• Icon: Sub-task Sub-task
    • Resolution: Fixed
    • Icon: P4 P4
    • 21
    • 20
    • hotspot
    • b06

      Currently the mirror objects (i.e., instances of java.lang.Class) are all archived inside a safepoint (VM_PopulateDumpSharedSpace). We we first make a copy of an existing mirror. Then we remove many states from the copy so that it would have the same state of a mirror object that has just been allocated.

      See
      https://github.com/openjdk/jdk/blob/56048f9718d1104227795a23c02fa144543c07d0/src/hotspot/share/classfile/javaClasses.cpp#L1154-L1245

      This is complicated, and the copy-and-modify inside the safepoint makes it difficult to implement JDK-8296344. It violates the requirements [1] and [2] as stated in JDK-8298600.

      ======================
      Proposal:

      During "java -Xshare:dump", for each class K that are loaded by the VM:

      - When K's mirror is allocated, we also allocate a new "scratch" mirror for K. The scratch mirror has the exact states that K needs when it's loaded from the archive at runtime. This allocation is when the current thread is in Java thread mode, so we can avoid allocation inside the safepoint.

      - When we are archiving inside the VM_PopulateDumpSharedSpace safepoint, instead of copying the old mirror and resetting its states, we just use the scratch mirror instead.

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

              Created:
              Updated:
              Resolved: