Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8316994

Avoid modifying ClassLoader and Module objects during -Xshare:dump

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 22
    • None
    • hotspot
    • b18

      When dumping the module graph, we set some native pointers in ClassLoader and Module to null:

      https://github.com/openjdk/jdk/blob/2f311d59dcbbf7605e52fac0b8ebd35d7d51a48b/src/hotspot/share/cds/heapShared.cpp#L298-L314

      java_lang_Module::set_module_entry(obj, nullptr);
      ...
      java_lang_ClassLoader::release_set_loader_data(obj, nullptr);

      This is problematic for Leyden, as we want to run the AOT compiler in the same VM process after the CDS archive has been created.

      The fix is simple: instead of modifying the "source" versions of these objects, which affects the current JVM, we can modify the "buffered" versions of these objects in ArchiveHeapWriter::copy_one_source_obj_to_buffer()

      https://github.com/openjdk/jdk/blob/2f311d59dcbbf7605e52fac0b8ebd35d7d51a48b/src/hotspot/share/cds/archiveHeapWriter.cpp#L320

            iklam Ioi Lam
            iklam Ioi Lam
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: