--- old/src/hotspot/share/classfile/systemDictionaryShared.cpp 2018-11-07 14:26:56.807630077 -0800 +++ new/src/hotspot/share/classfile/systemDictionaryShared.cpp 2018-11-07 14:26:56.239608238 -0800 @@ -27,6 +27,7 @@ #include "classfile/classListParser.hpp" #include "classfile/classLoader.hpp" #include "classfile/classLoaderData.inline.hpp" +#include "classfile/classLoaderDataGraph.hpp" #include "classfile/classLoaderExt.hpp" #include "classfile/dictionary.hpp" #include "classfile/javaClasses.hpp" @@ -782,8 +783,16 @@ } } +void SystemDictionaryShared::finalize_verification_constraints_for(InstanceKlass* k) { + if (!k->is_unsafe_anonymous()) { + SharedDictionaryEntry* entry = ((SharedDictionary*)(k->class_loader_data()->dictionary()))->find_entry_for(k); + entry->finalize_verification_constraints(); + } +} + void SystemDictionaryShared::finalize_verification_constraints() { - boot_loader_dictionary()->finalize_verification_constraints(); + MutexLocker mcld(ClassLoaderDataGraph_lock); + ClassLoaderDataGraph::dictionary_classes_do(finalize_verification_constraints_for); } void SystemDictionaryShared::check_verification_constraints(InstanceKlass* klass, @@ -810,28 +819,6 @@ return NULL; } -void SharedDictionary::finalize_verification_constraints() { - int bytes = 0, count = 0; - for (int index = 0; index < table_size(); index++) { - for (SharedDictionaryEntry *probe = bucket(index); - probe != NULL; - probe = probe->next()) { - int n = probe->finalize_verification_constraints(); - if (n > 0) { - bytes += n; - count ++; - } - } - } - if (log_is_enabled(Info, cds, verification)) { - double avg = 0; - if (count > 0) { - avg = double(bytes) / double(count); - } - log_info(cds, verification)("Recorded verification constraints for %d classes = %d bytes (avg = %.2f bytes) ", count, bytes, avg); - } -} - void SharedDictionaryEntry::add_verification_constraint(Symbol* name, Symbol* from_name, bool from_field_is_protected, bool from_is_array, bool from_is_object) { if (_verifier_constraints == NULL) {