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

Mandy Chung mandy.chung at oracle.com
Wed Nov 28 21:57:35 UTC 2018

Updated webrev:

Reflection and dynamic proxies use the legacy bytecode generators that 
does not support stack map and so they stay at old class file version 
until they are upgraded.  So we have to disable the class file version 
check on Q-Type until JDK-8207814 is resolved.

On 11/28/18 4:28 AM, Tobias Hartmann wrote:
> Hi Mandy,
>> 2. Class::forName, Object::getClass, Member::getDeclaringClass
>>     returns L-mirror in this version as Point.class
> But with your patch, it seems that MyValue.class != MyValue.class.asValueType() and also
> MyValue.class != MyValue.class.asBoxType().
> 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 added test cases in test/jdk/valhalla/valuetypes/Reflection.java to 
verify Point.class == p.getClass() == c.asBoxType().

> This breaks TestNewAcmp.java which gets the parameter types of a method via getParameterTypes() and
> then compares them to MyValue.class. This now returns false for a method with signature (MyValue v).

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

> On 27.11.18 19:57, Mandy Chung wrote:
>> It also fixes hotspot/jtreg/compiler/valhalla/valuetypes
>> and hotspot/jtreg/runtime/valhalla/valuetypes tests to use
>> Q-mirror in the method type correctly.
> The changes to the compiler tests look good to me but I think TestNewAcmp.java and
> TestNullableValueTypes.java need to be fixed as well:
> http://cr.openjdk.java.net/~thartmann/valhalla/lworld/qmirror_fixes/webrev.00/

Thanks for the patch.
> But even with these fixes, I still see:
> Caused by: java.lang.IllegalStateException: java.lang.IllegalStateException:
> java.lang.NoSuchMethodException: no such method:
> compiler.valhalla.valuetypes.getNull/0x00000008000cec40.getNull()MyValue1/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
> Am I missing something?

With my TestNullableValueTypes fails with VerifierError.

     Type null (current frame, stack[1]) is not assignable to 'Qcompiler/valhalla/valuetypes/MyValue1;'

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 
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 
# 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

> I've also noticed that the webrev patch does not contain all the changes:
> http://cr.openjdk.java.net/~mchung/valhalla/webrevs/q-mirror.01/q-mirror.changeset

webrev does not work well when I have mq patches and uncommitted files.

webrev.02/q-mirror.changeset should contain all changes.

> For example, it misses the changes to the compiler tests. Maybe it also misses other parts and that's why I'm still seeing these failures.

TestNewCmp.java and TestNativeClone.java pass with this patch. These are 
still 5 hotspot_valhalla test failures to be investigated.

compiler/valhalla/valuetypes/TestLWorld.java:  VM crashes
compiler/valhalla/valuetypes/TestNullableValueTypes.java:  class file 
generated by MethodHandleBuilder fails with VerifierError.
runtime/valhalla/valuetypes/ValueOops.java: compilation error due to the 
bytecode API that needs fixes
runtime/valhalla/valuetypes/ValueTypeArray.java:  VerifierError that may 
be a test bug or something related to reflection
runtime/valhalla/valuetypes/ValueTypesTest.java: compilation error due 
to the bytecode API that needs fixes


More information about the valhalla-dev mailing list