hotspot/src/share/vm/classfile/dictionary.cpp
changeset 34257 4be3504cc03b
parent 33611 9abd65805e19
child 35498 392b50de06c6
equal deleted inserted replaced
34132:aa73af640c61 34257:4be3504cc03b
    21  * questions.
    21  * questions.
    22  *
    22  *
    23  */
    23  */
    24 
    24 
    25 #include "precompiled.hpp"
    25 #include "precompiled.hpp"
       
    26 #include "classfile/sharedClassUtil.hpp"
    26 #include "classfile/dictionary.hpp"
    27 #include "classfile/dictionary.hpp"
    27 #include "classfile/systemDictionary.hpp"
    28 #include "classfile/systemDictionary.hpp"
       
    29 #include "classfile/systemDictionaryShared.hpp"
    28 #include "memory/iterator.hpp"
    30 #include "memory/iterator.hpp"
    29 #include "oops/oop.inline.hpp"
    31 #include "oops/oop.inline.hpp"
    30 #include "prims/jvmtiRedefineClassesTrace.hpp"
    32 #include "prims/jvmtiRedefineClassesTrace.hpp"
    31 #include "runtime/orderAccess.inline.hpp"
    33 #include "runtime/orderAccess.inline.hpp"
    32 #include "utilities/hashtable.inline.hpp"
    34 #include "utilities/hashtable.inline.hpp"
    33 
    35 
    34 DictionaryEntry*  Dictionary::_current_class_entry = NULL;
    36 DictionaryEntry*  Dictionary::_current_class_entry = NULL;
    35 int               Dictionary::_current_class_index =    0;
    37 int               Dictionary::_current_class_index =    0;
    36 
    38 
       
    39 size_t Dictionary::entry_size() {
       
    40   if (DumpSharedSpaces) {
       
    41     return SystemDictionaryShared::dictionary_entry_size();
       
    42   } else {
       
    43     return sizeof(DictionaryEntry);
       
    44   }
       
    45 }
    37 
    46 
    38 Dictionary::Dictionary(int table_size)
    47 Dictionary::Dictionary(int table_size)
    39   : TwoOopHashtable<Klass*, mtClass>(table_size, sizeof(DictionaryEntry)) {
    48   : TwoOopHashtable<Klass*, mtClass>(table_size, (int)entry_size()) {
    40   _current_class_index = 0;
    49   _current_class_index = 0;
    41   _current_class_entry = NULL;
    50   _current_class_entry = NULL;
    42   _pd_cache_table = new ProtectionDomainCacheTable(defaultProtectionDomainCacheSize);
    51   _pd_cache_table = new ProtectionDomainCacheTable(defaultProtectionDomainCacheSize);
    43 };
    52 };
    44 
    53 
    45 
    54 
    46 Dictionary::Dictionary(int table_size, HashtableBucket<mtClass>* t,
    55 Dictionary::Dictionary(int table_size, HashtableBucket<mtClass>* t,
    47                        int number_of_entries)
    56                        int number_of_entries)
    48   : TwoOopHashtable<Klass*, mtClass>(table_size, sizeof(DictionaryEntry), t, number_of_entries) {
    57   : TwoOopHashtable<Klass*, mtClass>(table_size, (int)entry_size(), t, number_of_entries) {
    49   _current_class_index = 0;
    58   _current_class_index = 0;
    50   _current_class_entry = NULL;
    59   _current_class_entry = NULL;
    51   _pd_cache_table = new ProtectionDomainCacheTable(defaultProtectionDomainCacheSize);
    60   _pd_cache_table = new ProtectionDomainCacheTable(defaultProtectionDomainCacheSize);
    52 };
    61 };
    53 
    62 
    59                                        ClassLoaderData* loader_data) {
    68                                        ClassLoaderData* loader_data) {
    60   DictionaryEntry* entry = (DictionaryEntry*)Hashtable<Klass*, mtClass>::new_entry(hash, klass);
    69   DictionaryEntry* entry = (DictionaryEntry*)Hashtable<Klass*, mtClass>::new_entry(hash, klass);
    61   entry->set_loader_data(loader_data);
    70   entry->set_loader_data(loader_data);
    62   entry->set_pd_set(NULL);
    71   entry->set_pd_set(NULL);
    63   assert(klass->is_instance_klass(), "Must be");
    72   assert(klass->is_instance_klass(), "Must be");
       
    73   if (DumpSharedSpaces) {
       
    74     SystemDictionaryShared::init_shared_dictionary_entry(klass, entry);
       
    75   }
    64   return entry;
    76   return entry;
    65 }
    77 }
    66 
    78 
    67 
    79 
    68 void Dictionary::free_entry(DictionaryEntry* entry) {
    80 void Dictionary::free_entry(DictionaryEntry* entry) {