< prev index next >

src/hotspot/share/classfile/systemDictionaryShared.cpp

Print this page

@@ -780,12 +780,17 @@
     // because at dump time we don't know how to resolve classes for such loaders.
     return true;
   }
 }
 
-void SystemDictionaryShared::finalize_verification_constraints() {
-  boot_loader_dictionary()->finalize_verification_constraints();
+void SystemDictionaryShared::finalize_verification_constraints(InstanceKlass* k) {
+  assert(DumpSharedSpaces, "called at dump time only");
+  if (k->class_loader_data()->is_unsafe_anonymous()) {
+    return; // unsafe anonymous classes are not archived, skip
+  }
+  SharedDictionaryEntry* entry = ((SharedDictionary*)(k->class_loader_data()->dictionary()))->find_entry_for(k);
+  entry->finalize_verification_constraints();
 }
 
 void SystemDictionaryShared::check_verification_constraints(InstanceKlass* klass,
                                                              TRAPS) {
   assert(!DumpSharedSpaces && UseSharedSpaces, "called at run time with CDS enabled only");

@@ -808,31 +813,10 @@
   }
 
   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) {
     _verifier_constraints = new(ResourceObj::C_HEAP, mtClass) GrowableArray<Symbol*>(8, true, mtClass);

@@ -905,10 +889,12 @@
       size += out->size() * BytesPerWord;
       delete vcflags_array;
     }
 
     return size;
+  } else {
+    assert(vcflags_array == NULL, "must both be NULL");
   }
   return 0;
 }
 
 void SharedDictionaryEntry::check_verification_constraints(InstanceKlass* klass, TRAPS) {
< prev index next >