[9] RFR (M): 8069591: Customize LambdaForms which are invoked using MH.invoke/invokeExact

Vladimir Ivanov vladimir.x.ivanov at oracle.com
Wed Jan 21 16:25:18 UTC 2015


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

Overhead of non-inlined MH.invoke/invokeExact calls significantly 
increased with LambdaForm sharing. The cause is JIT compiler can't 
produce a single nmethod for the whole MethodHandle chain, so the 
execution is spread around numerous nmethods (1 per each MethodHandle in 
the chain). The longer the chain the larger overhead.

The fix is to customize LambdaForms (create a dedicated LambdaForm for a 
MethodHandle). Per-MethodHandle count is introduced, which is 
incremented every time a MethodHandle is invoked using 
MethodHandle.invoke/invokeExact. Once CUSTOMIZE_THRESHOLD is reached for 
a particular MethodHandle, it's LambdaForm is substituted with a 
customized one, which has it's MethodHandle embedded. It allows JIT to 
see actual MethodHandle during compilation and produce more efficient code.

This fix completely recovers Gbemu peak performance to pre-LambdaForm 
sharing level.

Testing: jck (api/java_lang/invoke), jdk/java/lang/invoke, nashorn 
tests, nashorn/octane

Thanks!

Best regards,
Vladimir Ivanov



More information about the core-libs-dev mailing list