another question about megamorphic call sites in combination with MethodHandles

MacGregor, Duncan (GE Energy Management) duncan.macgregor at ge.com
Thu Mar 21 05:36:40 PDT 2013


Maybe I'm misunderstanding your question, but whether
mh.invokeWithArguments(args) internally generates a mono, poly, or
megamorphic call site internally in the JVM is going to depend on the
implementation and just how many subclasses of MethodHandle there are.

If you're concerned about the implementation details inside
invokeWithArguments the current Java 8 version either dispatches directly
to mh.invokeExact() if the method handle is a varargs collector or uses an
exact invoker cached on the MethodType passing it the method handle and
the argument array.

Using exactInvokers hasn't allowed inlining in the past, but maybe they
can now be with the incremental inlining changes in Java 8?

Regards, Duncan.

On 21/03/2013 08:23, "Jochen Theodorou" <blackdrag at gmx.org> wrote:
>Hi all,
>
>assuming I have in Java a method:
>
>public static Object invoke(MethodHandle mh, Object[] args) {
>   try {
>     return mv.invokeWithArguments(args);
>   } catch (Throwable th) {
>     ExceptionUtils.sneakyThrow(th);
>   }
>}
>
>(sneakyThrow is to work around checked exceptions and does basically
>just throw the throwable again without declaring it)
>
>I am wondering if the call site in this method can become megamorphic or
>not. And assuming it does not, I further assume the call to this method
>cannot become megamorphic as well... so my next question is if that can
>be always be potentially inlined then.
>
>bye blackdrag
>
>-- 
>Jochen "blackdrag" Theodorou - Groovy Project Tech Lead
>blog: http://blackdragsview.blogspot.com/
>german groovy discussion newsgroup: de.comp.lang.misc
>For Groovy programming sources visit http://groovy-lang.org
>
>_______________________________________________
>mlvm-dev mailing list
>mlvm-dev at openjdk.java.net
>http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev



More information about the mlvm-dev mailing list