JDK-8248410 : Correct Fix for 8236647: java/lang/invoke/CallSiteTest.java failed with InvocationTargetException in Graal mode
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 11,15
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2020-06-26
  • Updated: 2022-02-15
  • Resolved: 2020-06-29
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 11 JDK 15 JDK 16
11.0.9-oracleFixed 15 b30Fixed 16Fixed
Related Reports
Relates :  
Description
The fix in 8236647: java/lang/invoke/CallSiteTest.java failed with InvocationTargetException in Graal mode added an inner class which causes problems when GraalVM native-image is generating libjvmcicompiler.

at com.oracle.svm.core.code.IsolateEnterStub.TruffleToLibGraalEntryPoints_installTruffleCallBoundaryMethods_3aa85e7f55c4718d4b6345496ed0a7b255c6f867(generated:0)
Error: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: HotSpotResolvedJavaFieldImpl<java.lang.invoke.ConstantCallSite.isFrozen boolean:20>
Trace:
    at parsing jdk.vm.ci.hotspot.HotSpotObjectConstantImpl.isFullyInitializedConstantCallSite(HotSpotObjectConstantImpl.java:79)
Call path from entry point to jdk.vm.ci.hotspot.HotSpotObjectConstantImpl.isFullyInitializedConstantCallSite():
    at jdk.vm.ci.hotspot.HotSpotObjectConstantImpl.isFullyInitializedConstantCallSite(HotSpotObjectConstantImpl.java:75)
    at jdk.vm.ci.hotspot.HotSpotObjectConstantImpl.getCallSiteTarget(HotSpotObjectConstantImpl.java:94)
    at org.graalvm.compiler.hotspot.replacements.CallSiteTargetNode.tryFold(CallSiteTargetNode.java:60)
    at org.graalvm.compiler.hotspot.replacements.CallSiteTargetNode.canonical(CallSiteTargetNode.java:70)
    at org.graalvm.compiler.phases.common.CanonicalizerPhase$Instance.tryCanonicalize(CanonicalizerPhase.java:389)
    at org.graalvm.compiler.phases.common.CanonicalizerPhase$Instance.processNode(CanonicalizerPhase.java:341)
    at org.graalvm.compiler.phases.common.CanonicalizerPhase$Instance.processWorkSet(CanonicalizerPhase.java:300)
    at org.graalvm.compiler.phases.common.CanonicalizerPhase$Instance.run(CanonicalizerPhase.java:262)
    at org.graalvm.compiler.phases.Phase.run(Phase.java:49)
    at org.graalvm.compiler.phases.BasePhase.apply(BasePhase.java:214)
    at org.graalvm.compiler.phases.Phase.apply(Phase.java:42)
    at org.graalvm.compiler.phases.Phase.apply(Phase.java:38)
Comments
Changeset: ba711f63 Author: Bob Vandette <bobv@openjdk.org> Date: 2020-06-29 17:25:44 +0000 URL: https://git.openjdk.java.net/mobile/commit/ba711f63
02-07-2020

The fix was pushed into JDK15 with wrong bug id JDK-8236647 that is why this bug report was not updated automatically: https://hg.openjdk.java.net/jdk/jdk15/rev/c7159850c3e9 Note, both backports to JDK 11u and 16 have correct id: 8248410.
29-06-2020

diff --git a/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotObjectConstantImpl.java b/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotObjectConstantImpl.java --- a/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotObjectConstantImpl.java +++ b/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotObjectConstantImpl.java @@ -65,25 +65,21 @@ @Override public abstract int getIdentityHashCode(); - static class Fields { - // Initializing these too early causes a hang, so do it here in a subclass - static final HotSpotResolvedJavaField callSiteTargetField = HotSpotMethodHandleAccessProvider.Internals.instance().callSiteTargetField; - static final HotSpotResolvedJavaField constantCallSiteFrozenField = HotSpotMethodHandleAccessProvider.Internals.instance().constantCallSiteFrozenField; - } - private boolean isFullyInitializedConstantCallSite() { if (!runtime().getConstantCallSite().isInstance(this)) { return false; } // read ConstantCallSite.isFrozen as a volatile field - boolean isFrozen = readFieldValue(Fields.constantCallSiteFrozenField, true /* volatile */).asBoolean(); + HotSpotResolvedJavaField field = HotSpotMethodHandleAccessProvider.Internals.instance().constantCallSiteFrozenField; + boolean isFrozen = readFieldValue(field, true /* volatile */).asBoolean(); // isFrozen true implies fully-initialized return isFrozen; } private HotSpotObjectConstantImpl readTarget() { // read CallSite.target as a volatile field - return (HotSpotObjectConstantImpl) readFieldValue(Fields.callSiteTargetField, true /* volatile */); + HotSpotResolvedJavaField field = HotSpotMethodHandleAccessProvider.Internals.instance().callSiteTargetField; + return (HotSpotObjectConstantImpl) readFieldValue(field, true /* volatile */); } @Override
29-06-2020

RFR - http://mail.openjdk.java.net/pipermail/hotspot-compiler-dev/2020-June/038734.html
29-06-2020