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

[premain] AOTConstantPoolResolver::preresolve_class_cp_entries is too pessimistic when AOTClassLinking is false

XMLWordPrintable

      In JDK mainline, AOTConstantPoolResolver::preresolve_class_cp_entries() always tries to resolve the entries specified in preresolve_list(). We rely on AOTConstantPoolResolver::is_resolution_deterministic() to decide whether some of those preresolved entries need to be reverted back to the unresolved state.

      However, in the premain branch, this check is added for some unspecified reasons:

      https://github.com/openjdk/leyden/blob/478f86f9cd6df6b92c037c83d0540b9c5fe97e5c/src/hotspot/share/cds/aotConstantPoolResolver.cpp#L239-L246

        if (!CDSConfig::is_dumping_aot_linked_classes()) {
          // TODO: Why is this check needed in Leyden?
          // The following 3 tests fails when this "if" check is removed (when -XX:-AOTClassLinking is NOT enabled)
          // - runtime/cds/appcds/methodHandles/MethodHandlesAsCollectorTest.java
          // - runtime/cds/appcds/methodHandles/MethodHandlesGeneralTest.java
          // - runtime/cds/appcds/methodHandles/MethodHandlesSpreadArgumentsTest.java
          return;
        }


      This causes fewer CP entries to be resolved in CDS archive when AOTClassLinking is false.

      =========

      The reason for the failure is probably because AOTConstantPoolResolver::is_resolution_deterministic is incorrect when AOTClassLinking is false.

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

              Created:
              Updated: