< prev index next >

src/hotspot/share/cds/cdsHeapVerifier.cpp

Print this page
@@ -121,10 +121,28 @@
  
    // Integer for 0 and 1 are in java/lang/Integer$IntegerCache and are archived
    ADD_EXCL("sun/invoke/util/ValueConversions",           "ONE_INT",                // E
                                                           "ZERO_INT");              // E
  
+ // Leyden-specific-begin
+   ADD_EXCL("java/lang/invoke/DirectMethodHandle",        "LONG_OBJ_TYPE",  // TEMP archive MethodTypes
+                                                          "OBJ_OBJ_TYPE");  // TEMP archive MethodTypes
+ 
+   ADD_EXCL("sun/invoke/util/Wrapper",                    "FLOAT_ZERO",     // ? there is a cache??
+                                                          "DOUBLE_ZERO");   // ? there is a cache??
+ 
+   ADD_EXCL("java/lang/invoke/BoundMethodHandle$Specializer",   "BMH_TRANSFORMS",
+                                                                "SPECIES_DATA_ACCESSOR");
+   ADD_EXCL("java/lang/invoke/BoundMethodHandle",               "SPECIALIZER");
+   ADD_EXCL("java/lang/invoke/DelegatingMethodHandle",          "NF_getTarget");
+   ADD_EXCL("java/lang/invoke/MethodHandleImpl$ArrayAccessor",  "OBJECT_ARRAY_GETTER",
+                                                                "OBJECT_ARRAY_SETTER");
+   ADD_EXCL("java/lang/invoke/SimpleMethodHandle",              "BMH_SPECIES");
+ 
+   ADD_EXCL("java/lang/invoke/StringConcatFactory",             "NEW_ARRAY");
+ // Leyden-specific-end
+ 
  # undef ADD_EXCL
  
    ClassLoaderDataGraph::classes_do(this);
  }
  

@@ -198,16 +216,28 @@
        // in heapShared.cpp. We assume such classes are programmed to
        // update their static fields correctly at runtime.
        return;
      }
  
+     if (HeapShared::is_lambda_form_klass(ik)) {
+       // Archived lambda forms have preinitialized mirrors, so <clinit> won't run.
+       return;
+     }
+ 
      CheckStaticFields csf(this, ik);
      ik->do_local_static_fields(&csf);
    }
  }
  
  void CDSHeapVerifier::add_static_obj_field(InstanceKlass* ik, oop field, Symbol* name) {
+   if (field->klass() == vmClasses::MethodType_klass() ||
+       field->klass() == vmClasses::LambdaForm_klass()) {
+     // LambdaForm and MethodType are non-modifiable and are not tested for object equality, so
+     // it's OK if the static fields are reinitialized at runtime with alternative instances.
+     // (TODO: double check is this is correct)
+     return;
+   }
    StaticFieldInfo info = {ik, name};
    _table.put(field, info);
  }
  
  inline bool CDSHeapVerifier::do_entry(oop& orig_obj, HeapShared::CachedOopInfo& value) {

@@ -220,13 +250,21 @@
        // only because it's in the interned string table. So we are not in a condition that
        // should be flagged by CDSHeapVerifier.
        return true; /* keep on iterating */
      }
      ResourceMark rm;
+ 
+     char* class_name = info->_holder->name()->as_C_string();
+     char* field_name = info->_name->as_C_string();
+     if (strstr(class_name, "java/lang/invoke/BoundMethodHandle$Species_") == class_name &&
+         strcmp(field_name, "BMH_SPECIES") == 0) {
+       // FIXME: is this really OK??
+       return true;
+     }
      LogStream ls(Log(cds, heap)::warning());
      ls.print_cr("Archive heap points to a static field that may be reinitialized at runtime:");
-     ls.print_cr("Field: %s::%s", info->_holder->name()->as_C_string(), info->_name->as_C_string());
+     ls.print_cr("Field: %s::%s", class_name, field_name);
      ls.print("Value: ");
      orig_obj->print_on(&ls);
      ls.print_cr("--- trace begin ---");
      trace_to_root(&ls, orig_obj, nullptr, &value);
      ls.print_cr("--- trace end ---");
< prev index next >