[9] RFR (XS): 8078290: Customize adapted MethodHandle in MH.invoke() case

Vladimir Ivanov vladimir.x.ivanov at oracle.com
Tue Apr 21 17:37:04 UTC 2015


http://cr.openjdk.java.net/~vlivanov/8078290/webrev.00/
https://bugs.openjdk.java.net/browse/JDK-8078290

Customization logic introduced in [1] doesn't work as expected for 
MH.invoke() when asType() conversion happens and cached MH is used.

Generic invoker LambdaForm looks like:

invoke_002_MT=Lambda(a0:L,a1:L,a2:L)=>{
     t3:L=Invokers.checkGenericType(a0:L,a2:L);
     t4:V=Invokers.checkCustomized(a0:L);
     t5:L=MethodHandle.invokeBasic(t3:L,a1:L);t5:L}
}

Original MH(a0) is customized, but adapted MH (t3) is used for 
invocation. a0 != t3 when MH.asType() conversion happens in 
Invokers.checkGenericType().

Invoker LambdaForm should have the following structure:

invoke_002_MT=Lambda(a0:L,a1:L,a2:L)=>{
     t3:L=Invokers.checkGenericType(a0:L,a2:L);
     t4:V=Invokers.checkCustomized(t3:L);
     t5:L=MethodHandle.invokeBasic(t3:L,a1:L);t5:L}
}

Testing: manual (verified invoker LF), microbenchmark, 
jdk/test/java/lang/invoke, hotspot/test/compiler/jsr292, nashorn

Best regards,
Vladimir Ivanov


More information about the mlvm-dev mailing list