RFR (S): 8033666: Make sure @ForceInline is everywhere it needs to be in sun.misc and java.lang.invoke

Vladimir Ivanov vladimir.x.ivanov at oracle.com
Tue Feb 25 16:16:04 PST 2014


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

ValueConversions::castReference was introduced to workaround a problem 
with unreliable inlining of Class::cast method. Unfortunately, since 
ValueConversions class is located in sun.invoke.util, 
@java.lang.invoke.ForceInline annotation isn't visible to it.

A proper fix would be to teach Hotspot to treat Class::cast specifically 
and always inline it, but it requires extensive exploration of 
performance implications. Filed 8035809 [1] to track that.

As an interim fix, I moved castReference method into 
java.lang.invoke.MethodHandleImpl class and added new entry point 
ValueConversions::cast which accepts a method handle to a method which 
should be used for casting.

Testing: manual (looked through -XX:+PrintInlining output to ensure 
MHI::castReference is inlined), jdk/java/lang/invoke, octane.

Thanks!

Best regards,
Vladimir Ivanov

[1] 8035809: Improve inlining of Class::cast method
     https://bugs.openjdk.java.net/browse/JDK-8035809



More information about the mlvm-dev mailing list