--- old/src/share/vm/classfile/loaderConstraints.cpp 2017-07-17 11:17:04.024615928 -0400 +++ new/src/share/vm/classfile/loaderConstraints.cpp 2017-07-17 11:17:03.786657861 -0400 @@ -23,6 +23,7 @@ */ #include "precompiled.hpp" +#include "classfile/dictionary.hpp" #include "classfile/classLoaderData.inline.hpp" #include "classfile/loaderConstraints.hpp" #include "memory/resourceArea.hpp" @@ -35,8 +36,8 @@ set_loader_data(i, ClassLoaderData::class_loader_data(p)); } -LoaderConstraintTable::LoaderConstraintTable(int nof_buckets) - : Hashtable(nof_buckets, sizeof(LoaderConstraintEntry)) {}; +LoaderConstraintTable::LoaderConstraintTable(int table_size) + : Hashtable(table_size, sizeof(LoaderConstraintEntry)) {}; LoaderConstraintEntry* LoaderConstraintTable::new_entry( @@ -429,10 +430,9 @@ } -void LoaderConstraintTable::verify(Dictionary* dictionary, - PlaceholderTable* placeholders) { +void LoaderConstraintTable::verify(PlaceholderTable* placeholders) { Thread *thread = Thread::current(); - for (int cindex = 0; cindex < _loader_constraint_size; cindex++) { + for (int cindex = 0; cindex < table_size(); cindex++) { for (LoaderConstraintEntry* probe = bucket(cindex); probe != NULL; probe = probe->next()) { @@ -441,9 +441,11 @@ guarantee(ik->name() == probe->name(), "name should match"); Symbol* name = ik->name(); ClassLoaderData* loader_data = ik->class_loader_data(); - unsigned int d_hash = dictionary->compute_hash(name, loader_data); + Dictionary* dictionary = loader_data->dictionary_or_null(); + assert(dictionary != NULL, "no dictionary for this loader constraint entry?"); + unsigned int d_hash = dictionary->compute_hash(name); int d_index = dictionary->hash_to_index(d_hash); - InstanceKlass* k = dictionary->find_class(d_index, d_hash, name, loader_data); + InstanceKlass* k = dictionary->find_class(d_index, d_hash, name); if (k != NULL) { // We found the class in the system dictionary, so we should // make sure that the Klass* matches what we already have. @@ -451,7 +453,7 @@ } else { // If we don't find the class in the system dictionary, it // has to be in the placeholders table. - unsigned int p_hash = placeholders->compute_hash(name, loader_data); + unsigned int p_hash = placeholders->compute_hash(name); int p_index = placeholders->hash_to_index(p_hash); PlaceholderEntry* entry = placeholders->get_entry(p_index, p_hash, name, loader_data); @@ -475,8 +477,9 @@ void LoaderConstraintTable::print() { ResourceMark rm; assert_locked_or_safepoint(SystemDictionary_lock); - tty->print_cr("Java loader constraints (entries=%d)", _loader_constraint_size); - for (int cindex = 0; cindex < _loader_constraint_size; cindex++) { + tty->print_cr("Java loader constraints (entries=%d, constraints=%d)", + table_size(), number_of_entries()); + for (int cindex = 0; cindex < table_size(); cindex++) { for (LoaderConstraintEntry* probe = bucket(cindex); probe != NULL; probe = probe->next()) {