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

Use int indices to reference CDS archived primitive mirrors

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 20
    • 20
    • hotspot
    • b26

      In CDS, when archived class metadata reference an object in the archive heap, it's usually done using an integer index, which can be passed to HeapShared::get_root(int) to retrieve the object. This way, we don't need to worry if the archive heap has been relocated.

      E.g.,

      oop Klass::archived_java_mirror() {
        assert(has_archived_mirror_index(), "must have archived mirror");
        return HeapShared::get_root(_archived_mirror_index);
      }

      However, for the primitive mirror objects (in Universe::_mirrors[], which point to the java.lang.Class instances of the Java primitive types such as int, float, etc), we are still using a direct oop reference.

      See:
      https://github.com/openjdk/jdk/blob/0ec575a2030c0c633c0a57179efa55d7dbc416fa/src/hotspot/share/memory/universe.cpp#L240-L263

      For consistency, we should change this code to use the same int indices as the rest of the system. This will also make it simpler to optimize the layout of the CDS archive heap (e.g., in JDK-8234679).

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

              Created:
              Updated:
              Resolved: