src/hotspot/share/classfile/systemDictionaryShared.cpp
changeset 52468 e0fd97beab7e
parent 51823 2a51125b2794
child 52514 f4e3900c8d08
--- a/src/hotspot/share/classfile/systemDictionaryShared.cpp	Fri Nov 09 12:08:53 2018 +0800
+++ b/src/hotspot/share/classfile/systemDictionaryShared.cpp	Thu Nov 01 10:59:05 2018 -0700
@@ -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) {