JDK-8219607 : Add support in Graal and AOT for hidden class
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 14
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2019-02-22
  • Updated: 2020-07-01
  • Resolved: 2020-04-27
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 15
15 b21Fixed
Related Reports
Relates :  
Relates :  
Description
Hidden classes are replacement for VM anonymous classes.   Hidden classes can optionally be created
as a weak class, i.e. weakly referenced by its defining class loader so that it may be reclaimed while the class loader is still alive.   In addition, it can optionally join in a nest as a new nest member.

Graal currently special cases VM anonymous classes.   This issue is to investigate and add support in Graal for hidden classes JEP.
Comments
URL: https://hg.openjdk.java.net/jdk/jdk/rev/aa0217568f78 User: dlong Date: 2020-04-27 21:24:37 +0000
27-04-2020

I filed a separate bug for the LambdaStableNameTest failure: JDK-8243381.
22-04-2020

The following tests are problem listed [1]. They should be removed when this issue is resolved. org.graalvm.compiler.hotspot.test.CheckGraalIntrinsics 8219607 generic-all org.graalvm.compiler.hotspot.test.LambdaStableNameTest 8219607 generic-all [1] https://hg.openjdk.java.net/jdk/jdk/rev/30ec85283758
21-04-2020

There's a newer version of this test in the graal master that removes some of these assumptions which should resolve this problem I think.
18-03-2020

I'm seeing another failure in compiler/graalunit/HotspotTest.java: There was 1 failure: 1) org.graalvm.compiler.hotspot.test.LambdaStableNameTest#checkStableLamdaNameForRunnableAndAutoCloseable java.lang.NumberFormatException: For input string: "6f55x00" under radix 16 at java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:68) at java.base/java.lang.Integer.parseInt(Integer.java:652) at java.base/java.math.BigInteger.<init>(BigInteger.java:545) at org.graalvm.compiler.hotspot.test.LambdaStableNameTest.assertLambdaName(LambdaStableNameTest.java:83) at org.graalvm.compiler.hotspot.test.LambdaStableNameTest.checkStableLamdaNameForRunnableAndAutoCloseable(LambdaStableNameTest.java:61) The test is probably making assumptions about lambda implementation details.
07-03-2020

Hidden classes are just normal classes from JVM's perspective. Hidden classes can't be found from any class loader. Hidden weak class may be GC'ed while its defining loader is still alive. Hidden class conforms to the standard access control rules w.r.t nestmates. VM-anonymous class has special access to members of the host class and members inherited from its supertypes but that does not apply to hidden classes. I suspect JVMCI getHostClass is about.
27-02-2020

Graal uses the JVMCI getHostClass to check if a class is unsafe-anonymous, but since hidden classes are non-discoverable, I wonder if they also need to be treated as anonymous.
25-02-2020

We can white-list the intrinsic in the CheckGraalIntrinsics test and add it to Graal later.
25-02-2020

jaotc/AOT may need to treat hidden classes the same as unsafe_anonymous classes.
25-02-2020

Class::isHiddenClass intrinsic in C2: http://cr.openjdk.java.net/~mchung/valhalla/webrevs/8171335/webrev-misc2/
24-09-2019

The test fails before we intrinsified Class::isHiddenClass. There may be other failures besides: java.lang.AssertionError: missing Graal intrinsics for: java/lang/Class.isHiddenClass()Z at org.graalvm.compiler.hotspot.test.CheckGraalIntrinsics.test(CheckGraalIntrinsics.java:663) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:61) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:564) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.junit.runners.Suite.runChild(Suite.java:128) at org.junit.runners.Suite.runChild(Suite.java:27) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.junit.runner.JUnitCore.run(JUnitCore.java:137) at org.junit.runner.JUnitCore.run(JUnitCore.java:115) at com.oracle.mxtool.junit.MxJUnitWrapper.runRequest(MxJUnitWrapper.java:280) at com.oracle.mxtool.junit.MxJUnitWrapper.main(MxJUnitWrapper.java:196)
12-09-2019

test/hotspot/jtreg/compiler/graalunit/HotspotTest.java is currently problem listed in the valhalla repo nestmates branch.
12-09-2019

ILW = Same as parent = P3
25-02-2019