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

Adapt AOTClassLinking test case for dynamic CDS archive

XMLWordPrintable

    • b21

      The handling of -XX:+AOTClassLinking with the dynamic CDS archive is different than the static CDS archive. In particular:
      - AOT resolution of method CP entries is not supported (JDK-XXXXXXX)
      - AOT resolution of indy CP entries is not supported (because this requires archived heap objects, which is not supported for dynamic archive

      We have some AOTClassLinking test cases that only test again the static CDS archive. As a sanity check, we should run them with the dynamic archive as well, to ensure that the JVM still functions properly.

      In particular, the following was a crash that was found in the Leyden repo related to AOT resolution of indy CP entries using "old" classes. Such a scenario is covered by the test case https://github.com/openjdk/jdk/blob/ed604038ffc4ca64113984324dde71c07f046b52/test/hotspot/jtreg/runtime/cds/appcds/resolvedConstants/ResolvedConstants.java . We should adapt this test case for dynamic CDS archive.



      =============== Original bug report from repo-leyden:
      In JDK mainline, linked old classes are excluded from the CDS archive (see JDK-8309074 for the reason)
      In leyden-premain, -XX:+ArchiveInvokeDynamic can create archived heap objects (MethodType) that reference linked old classes.

      As a result, we get an error like this when running 'java -Xshare:dump -XX:ArchiveInvokeDynamic"

      # Internal Error (/jdk3/le3/open/src/hotspot/share/cds/archiveBuilder.hpp:300), pid=3992961, tid=3993274
      # assert(is_in_buffer_space(obj)) failed: must be

      Stack: [0x00007fffd89d3000,0x00007fffd8ad3000], sp=0x00007fffd8ad1110, free space=1016k
      Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
      V [libjvm.so+0x5e7ec8] unsigned char* ArchiveBuilder::to_requested<unsigned char*>(unsigned char*) const+0x50 (archiveBuilder.hpp:300)
      V [libjvm.so+0x5f8447] ArchiveHeapWriter::compute_ptrmap(ArchiveHeapInfo*)+0x279 (archiveHeapWriter.cpp:692)
      V [libjvm.so+0x5f7ed2] ArchiveHeapWriter::relocate_embedded_oops(GrowableArrayCHeap<oopDesc*, (MEMFLAGS)13>*, ArchiveHeapInfo*, GrowableArray<unsigned long>*, int)+0x25e (archiveHeapWriter.cpp:592)
      V [libjvm.so+0x5f6476] ArchiveHeapWriter::write(GrowableArrayCHeap<oopDesc*, (MEMFLAGS)13>*, ArchiveHeapInfo*)+0xda (archiveHeapWriter.cpp:112)
      V [libjvm.so+0xd03eaa] HeapShared::archive_objects(ArchiveHeapInfo*)+0x168 (heapShared.cpp:680)

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

              Created:
              Updated:
              Resolved: