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

module_entry in CDS map file has stale value

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 23
    • None
    • hotspot
    • b15

      $ java -Xshare:dump -Xlog:cds+map=debug,cds+map+oops=trace:file=cds.map:none:filesize=0

      In cds.map:

      0x00000007ffd0bf20: @@ Object (0xfffa17e4) java.lang.Module
      0x00000007ffd0bf20: f0af3b01 0000001b 00020d38 00000001 00000000 00000000 fff9f8e3 fff958ab
      0x00000007ffd0bf40: fff9f75d fff9d2bf fffa17eb 00000000 fffa1801 00000000
       - klass: 'java/lang/Module' 0x0000000800020d38
       - fields (7 words):
       - private 'enableNativeAccess' 'Z' @12 true (0x01)
       - injected 'module_entry' 'J' @16 140166528907408 (0x00007f7b102a3890)
       - private final 'layer' 'Ljava/lang/ModuleLayer;' @24 0x00000007ffcfc718 (0xfff9f8e3) java.lang.ModuleLayer
      [....]

      The value of module_entry is wrong. When the object is stored in the archive, this field has been cleared to null:

      https://github.com/openjdk/jdk/blob/e8d1ba33b48dc8e6b937258c3765b91426c5b6f1/src/hotspot/share/cds/archiveHeapWriter.cpp#L403-L404

      size_t ArchiveHeapWriter::copy_one_source_obj_to_buffer(oop src_obj) {
        ...
          if (java_lang_Module::is_instance(src_obj)) {
          update_buffered_object_field<ModuleEntry*>(to, java_lang_Module::module_entry_offset(), nullptr);
        } else if ...

      ====================
      Correct output should look like this:

      0x00000007ffd0bf20: @@ Object (0xfffa17e4) java.lang.Module
      0x00000007ffd0bf20: f0af3b01 0000001b 00020d38 00000001 00000000 00000000 fff9f8e3 fff958ab
      0x00000007ffd0bf40: fff9f75d fff9d2bf fffa17eb 00000000 fffa1801 00000000
       - klass: 'java/lang/Module' 0x0000000800020d38
       - fields (7 words):
       - private 'enableNativeAccess' 'Z' @12 true (0x01)
       - injected 'module_entry' 'J' @16 0 (0x0000000000000000)

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

              Created:
              Updated:
              Resolved: