speed of invokeExact

Jochen Theodorou blackdrag at gmx.org
Wed May 8 02:59:43 PDT 2013


Am 07.05.2013 17:42, schrieb MacGregor, Duncan (GE Energy Management):
> Which version of the jvm are you seeing this problem on, and are you
> adapting the method handle every time as well as exact invoking it?

the version is a 1.8.0-ea. Since this is a generic way of method 
invocation I have to adapt it a tiny bit (the arguments come in an Object[])

> We avoided invoke and invokeExact calls from Java (because they were
> sometimes painful to get correct in the case of varargs methods) by having
> the fallbacks return the adapted method handle to an exact invoker, like
> this
>
> MethodHandle invoker = MethodHandles.exactInvoker(type());
> setTarget(MethodHandles.foldArguments(invoker, fallback));

my handles originate from reflection. I don't get them new every time, 
still I have to adapt the handle for actual invocation... like this:

>         MethodHandle mh = call.target.asSpreader(Object[].class, call.args.length);
>         mh = MethodHandles.insertArguments(mh, 0, call.receiver);
>         mh = mh.asType(VC);

mh is then used for the invocation using invokeExact

  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



More information about the mlvm-dev mailing list