[LW2] Q-mirror, method handle, and reflection support for Q-type

Tobias Hartmann tobias.hartmann at oracle.com
Thu Nov 29 09:00:10 UTC 2018


Hi Mandy,

On 28.11.18 22:57, Mandy Chung wrote:
>> We now seem to have 3 types:
>> class compiler.valhalla.valuetypes.MyValue
>> class compiler.valhalla.valuetypes.MyValue/val
>> class compiler.valhalla.valuetypes.MyValue/box
> 
> How do you get the above names? 

I got this by doing:
System.out.println("" + MyValue.class + " " + MyValue.class.asValueType() + " " +
MyValue.class.asBoxType());

It does not reproduce with your latest webrev so probably the patch for the first one was missing
some parts.

> As TestNewAcmp.java is failing in lworld branch, I miss to update this.  TestNewAcmp now passes
> after changing from MyValue.class to MyValue.class.asValueType().

Yes, the test now passes.

> After pulling the recent lworld patches, TestLWorld.java fails instead (it passed before i pulled
> down the recent patches). 
> 
> # To suppress the following error report, specify this argument
> # after -XX: or in .hotspotrc:  SuppressErrorAt=/interpreterRuntime.cpp:336
> #
> # A fatal error has been detected by the Java Runtime Environment:
> #
> #  Internal Error
> (/scratch/mchung/ws/valhalla/q-mirror/src/hotspot/share/interpreter/interpreterRuntime.cpp:336),
> pid=94111, tid=6915
> #  assert(old_value != __null && oopDesc::is_oop(old_value) && old_value->is_value()) failed:
> Verifying receiver
> #
> # JRE version: OpenJDK Runtime Environment (12.0) (fastdebug build 12-internal+0-adhoc.mlchung.q-mirror)
> # Java VM: OpenJDK 64-Bit Server VM (fastdebug 12-internal+0-adhoc.mlchung.q-mirror, mixed mode,
> compressed oops, g1 gc, bsd-amd64)
> # No core dump will be written. Core dumps have been disabled. To enable core dumping, try "ulimit
> -c unlimited" before starting Java again
> #

Yes, I've seen that as well. I will have a look after you've pushed your fix.

> compiler/valhalla/valuetypes/TestNullableValueTypes.java:  class file generated by
> MethodHandleBuilder fails with VerifierError. 
This [1] doesn't look like a VerifierError to me. And the test passes if I change:

diff -r bfe436999cd6 test/hotspot/jtreg/compiler/valhalla/valuetypes/TestNullableValueTypes.java
--- a/test/hotspot/jtreg/compiler/valhalla/valuetypes/TestNullableValueTypes.java	Thu Nov 29
09:58:33 2018 +0100
+++ b/test/hotspot/jtreg/compiler/valhalla/valuetypes/TestNullableValueTypes.java	Thu Nov 29
09:58:37 2018 +0100
@@ -228,7 +228,7 @@

     private static final MethodHandle getNull = MethodHandleBuilder.loadCode(MethodHandles.lookup(),
         "getNull",
-        MethodType.methodType(MyValue1.class.asBoxType()),
+        MethodType.methodType(MyValue1.class.asValueType()),
         CODE -> {
             CODE.
             aconst_null().

But we should really use the BoxType because we are returning null.

Thanks,
Tobias

[1] Failures I'm seeing with TestNullableValueTypes:

java.lang.ExceptionInInitializerError
	at java.base/java.lang.Class.forName0(Native Method)
	at java.base/java.lang.Class.forName(Class.java:320)
	at compiler.valhalla.valuetypes.ValueTypeTest.main(ValueTypeTest.java:256)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at
java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at com.sun.javatest.regtest.agent.MainWrapper$MainThread.run(MainWrapper.java:115)
	at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.IllegalStateException: java.lang.IllegalStateException:
java.lang.NoSuchMethodException: no such method:
compiler.valhalla.valuetypes.getNull/0x00000008000cec40.getNull()MyValue1.box/invokeStatic
	at java.base/jdk.experimental.value.MethodHandleBuilder.loadCode(MethodHandleBuilder.java:110)
	at java.base/jdk.experimental.value.MethodHandleBuilder.loadCode(MethodHandleBuilder.java:77)
	at java.base/jdk.experimental.value.MethodHandleBuilder.loadCode(MethodHandleBuilder.java:72)
	at compiler.valhalla.valuetypes.TestNullableValueTypes.<clinit>(TestNullableValueTypes.java:229)
	... 9 more
Caused by: java.lang.IllegalStateException: java.lang.NoSuchMethodException: no such method:
compiler.valhalla.valuetypes.getNull/0x00000008000cec40.getNull()MyValue1.box/invokeStatic
	at java.base/jdk.experimental.value.MethodHandleBuilder.lambda$loadCode$0(MethodHandleBuilder.java:82)
	at java.base/jdk.experimental.value.MethodHandleBuilder.loadCode(MethodHandleBuilder.java:108)
	... 12 more
Caused by: java.lang.NoSuchMethodException: no such method:
compiler.valhalla.valuetypes.getNull/0x00000008000cec40.getNull()MyValue1.box/invokeStatic
	at java.base/java.lang.invoke.MemberName.makeAccessException(MemberName.java:983)
	at java.base/java.lang.invoke.MemberName$Factory.resolveOrFail(MemberName.java:1121)
	at java.base/java.lang.invoke.MethodHandles$Lookup.resolveOrFail(MethodHandles.java:2034)
	at java.base/java.lang.invoke.MethodHandles$Lookup.findStatic(MethodHandles.java:1106)
	at java.base/jdk.experimental.value.MethodHandleBuilder.lambda$loadCode$0(MethodHandleBuilder.java:80)
	... 13 more
Caused by: java.lang.NoSuchMethodError:
compiler.valhalla.valuetypes.getNull/0x00000008000cec40.getNull()Qcompiler/valhalla/valuetypes/MyValue1;
	at java.base/java.lang.invoke.MethodHandleNatives.resolve(Native Method)
	at java.base/java.lang.invoke.MemberName$Factory.resolve(MemberName.java:1090)
	at java.base/java.lang.invoke.MemberName$Factory.resolveOrFail(MemberName.java:1118)
	... 16 more




More information about the valhalla-dev mailing list