Few questions about invokeDynamic
assembling.signals at yandex.ru
Sat Nov 6 03:31:02 PDT 2010
I couldn't find information about several issues, so I'll ask here for help:
I'm using JDK7 b116.
When using MethodHandle.invokeExact(...), I can only invoke a method,
which signature is "Object (Object)", anything else fails with:
WrongMethodTypeException: ()V cannot be called as ([Ljava/lang/Object;)Ljava/lang/Object;
Doing it with invokeVarargs(...) works, but a benchmark showed that it is nearly as slow
as good old Java reflection (Method.invoke(...)), which is around 50 times slower than normal method invocation.
In contrast, using the language feature "InvokeDynamic.<void>anything();" is just 2.5 times slower
than usual method invocation. So my assumption is just that invokeVarargs is slow because of varargs,
and invokeExact should be as fast as InvokeDynamic.<...>(...) syntax, but since it fails, I can't know.
So my questions are:
1) is that just a bug that invokeExact fails with anything but Object (Object)?
2) is my assumption correct that normally invokeExact should be as fast as InvokeDynamic.<...>(...)?
3) Is there a tentative timeline about the progress of MLVM in JDK7, or at least when could
one expect invokeExact to "work"?
Note: I can't use InvokeDynamic.<...>(...) for method-signatures known only at runtime,
that's why I need invokeExact.
Thank you very much in advance!
Ivan G S
More information about the mlvm-dev