< prev index next >

src/hotspot/share/cds/heapShared.cpp

Print this page
*** 1304,11 ***
  
  void HeapShared::resolve_or_init(Klass* k, bool do_init, TRAPS) {
    if (!do_init) {
      if (k->class_loader_data() == nullptr) {
        Klass* resolved_k = SystemDictionary::resolve_or_null(k->name(), CHECK);
!       assert(resolved_k == k, "classes used by archived heap must not be replaced by JVMTI ClassFileLoadHook");
      }
    } else {
      assert(k->class_loader_data() != nullptr, "must have been resolved by HeapShared::resolve_classes");
      if (k->is_instance_klass()) {
        InstanceKlass* ik = InstanceKlass::cast(k);
--- 1304,15 ---
  
  void HeapShared::resolve_or_init(Klass* k, bool do_init, TRAPS) {
    if (!do_init) {
      if (k->class_loader_data() == nullptr) {
        Klass* resolved_k = SystemDictionary::resolve_or_null(k->name(), CHECK);
!       if (resolved_k->is_array_klass()) {
+         assert(resolved_k == k || resolved_k == k->super(), "classes used by archived heap must not be replaced by JVMTI ClassFileLoadHook");
+       } else {
+         assert(resolved_k == k, "classes used by archived heap must not be replaced by JVMTI ClassFileLoadHook");
+       }
      }
    } else {
      assert(k->class_loader_data() != nullptr, "must have been resolved by HeapShared::resolve_classes");
      if (k->is_instance_klass()) {
        InstanceKlass* ik = InstanceKlass::cast(k);

*** 2046,10 ***
--- 2050,17 ---
    //     At runtime, these classes are initialized before X's archived fields
    //     are restored by HeapShared::initialize_from_archived_subgraph().
    for (int i = 0; fields[i].valid(); ) {
      ArchivableStaticFieldInfo* info = &fields[i];
      const char* klass_name = info->klass_name;
+ 
+     if (CDSConfig::is_valhalla_preview() && strcmp(klass_name, "jdk/internal/module/ArchivedModuleGraph") == 0) {
+       // FIXME -- ArchivedModuleGraph doesn't work when java.base is patched with valhalla classes.
+       i++;
+       continue;
+     }
+ 
      start_recording_subgraph(info->klass, klass_name, is_full_module_graph);
  
      // If you have specified consecutive fields of the same klass in
      // fields[], these will be archived in the same
      // {start_recording_subgraph ... done_recording_subgraph} pass to
< prev index next >