--- old/src/share/vm/classfile/dictionary.hpp 2017-06-23 19:15:15.783482561 -0400 +++ new/src/share/vm/classfile/dictionary.hpp 2017-06-23 19:15:15.526874825 -0400 @@ -39,18 +39,13 @@ // The data structure for the system dictionary (and the shared system // dictionary). -class Dictionary : public TwoOopHashtable { +class Dictionary : public Hashtable { friend class VMStructs; -private: - // current iteration index. - static int _current_class_index; - // pointer to the current hash table entry. - static DictionaryEntry* _current_class_entry; - ProtectionDomainCacheTable* _pd_cache_table; + ClassLoaderData* _loader_data; // backpointer to owning loader + ClassLoaderData* loader_data() const { return _loader_data; } - DictionaryEntry* get_entry(int index, unsigned int hash, - Symbol* name, ClassLoaderData* loader_data); + DictionaryEntry* get_entry(int index, unsigned int hash, Symbol* name); protected: DictionaryEntry* bucket(int i) const { @@ -66,61 +61,48 @@ Hashtable::add_entry(index, (HashtableEntry*)new_entry); } + void free_entry(DictionaryEntry* entry); + static size_t entry_size(); public: - Dictionary(int table_size); - Dictionary(int table_size, HashtableBucket* t, int number_of_entries); + Dictionary(ClassLoaderData* loader_data, int table_size); + Dictionary(ClassLoaderData* loader_data, int table_size, HashtableBucket* t, int number_of_entries); + ~Dictionary(); - DictionaryEntry* new_entry(unsigned int hash, InstanceKlass* klass, ClassLoaderData* loader_data); + DictionaryEntry* new_entry(unsigned int hash, InstanceKlass* klass); - void free_entry(DictionaryEntry* entry); - - void add_klass(Symbol* class_name, ClassLoaderData* loader_data, InstanceKlass* obj); + void add_klass(int index, unsigned int hash, Symbol* class_name, InstanceKlass* obj); - InstanceKlass* find_class(int index, unsigned int hash, - Symbol* name, ClassLoaderData* loader_data); + InstanceKlass* find_class(int index, unsigned int hash, Symbol* name); InstanceKlass* find_shared_class(int index, unsigned int hash, Symbol* name); - // Compiler support - InstanceKlass* try_get_next_class(); - // GC support void oops_do(OopClosure* f); void roots_oops_do(OopClosure* strong, OopClosure* weak); - void classes_do(void f(Klass*)); - void classes_do(void f(Klass*, TRAPS), TRAPS); - void classes_do(void f(Klass*, ClassLoaderData*)); + void classes_do(void f(InstanceKlass*)); + void classes_do(void f(InstanceKlass*, TRAPS), TRAPS); + void all_entries_do(void f(InstanceKlass*, ClassLoaderData*)); void unlink(BoolObjectClosure* is_alive); void remove_classes_in_error_state(); - // Classes loaded by the bootstrap loader are always strongly reachable. - // If we're not doing class unloading, all classes are strongly reachable. - static bool is_strongly_reachable(ClassLoaderData* loader_data, Klass* klass) { - assert (klass != NULL, "should have non-null klass"); - return (loader_data->is_the_null_class_loader_data() || !ClassUnloading); - } - - // Unload (that is, break root links to) all unmarked classes and loaders. + // Unload classes whose defining loaders are unloaded void do_unloading(); // Protection domains - InstanceKlass* find(int index, unsigned int hash, Symbol* name, - ClassLoaderData* loader_data, Handle protection_domain, TRAPS); + InstanceKlass* find(int index, unsigned int hash, Symbol* name, Handle protection_domain); bool is_valid_protection_domain(int index, unsigned int hash, - Symbol* name, ClassLoaderData* loader_data, + Symbol* name, Handle protection_domain); void add_protection_domain(int index, unsigned int hash, - InstanceKlass* klass, ClassLoaderData* loader_data, + InstanceKlass* klass, Handle protection_domain, TRAPS); // Sharing support void reorder_dictionary(); - ProtectionDomainCacheEntry* cache_get(Handle protection_domain); - void print(bool details = true); #ifdef ASSERT void printPerformanceInfoDetails(); @@ -155,7 +137,6 @@ // ClassLoader.checkPackageAccess(). // ProtectionDomainEntry* _pd_set; - ClassLoaderData* _loader_data; public: // Tells whether a protection is in the approved set. @@ -173,9 +154,6 @@ return (DictionaryEntry**)HashtableEntry::next_addr(); } - ClassLoaderData* loader_data() const { return _loader_data; } - void set_loader_data(ClassLoaderData* loader_data) { _loader_data = loader_data; } - ProtectionDomainEntry* pd_set() const { return _pd_set; } void set_pd_set(ProtectionDomainEntry* pd_set) { _pd_set = pd_set; } @@ -197,9 +175,9 @@ } } - bool equals(const Symbol* class_name, ClassLoaderData* loader_data) const { + bool equals(const Symbol* class_name) const { InstanceKlass* klass = (InstanceKlass*)literal(); - return (klass->name() == class_name && _loader_data == loader_data); + return (klass->name() == class_name); } void print_count(outputStream *st) {