Am 19.02.2018 um 13:00 schrieb Vladimir Ivanov:
Geoffrey,
In both staticMethodHandle & lambdaMetafactory Dog::getName is inlined,
but using different mechanisms.
In staticMethodHandle target method is statically known [1], but in case
of lambdaMetafactory [2] compiler has to rely on profiling info to
devirtualize Function::apply(). The latter requires exact type check on
the receiver at runtime and that explains the difference you are seeing.
But comparing that with nonStaticMethodHandle is not fair: there's no
inlining happening there.
I actually never dared to ask, what kind of information is really
provided by the java compiler here to make the static version so fast?
Is it because the static final version becomes a member of the class
pool? Is the lambdafactory so fast, because here the handle will become
the member of the pool of the generated class? And is there a way for me
to bring nonStaticMethodHandle more near to staticMethodHandle, short of
making it static?
bye Jochen
_______________________________________________
mlvm-dev mailing list
mlvm-dev@openjdk.java.net
http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev