invoke* on a MethodHandle

Rémi Forax forax at univ-mlv.fr
Thu Feb 5 01:12:56 PST 2009


John Rose a écrit :
> On Feb 2, 2009, at 6:35 AM, Rémi Forax wrote:
>
>> Currently, the mth patch allow to call directly a MethoHandle
>> using invokevirtual but also invokeinterface, invokespecial or 
>> invokestatic.
>>
>> I wonder why invokeinterface, invokespecial and invokestatic are allowed
>> knowing that MethodHandle is a class ?
>
> That's not intentional.  MethodHandle.invoke is usable only with an 
> invokevirtual instruction.
Ok.
>
> The MHs.find* calls create handles which reify all kinds of callable 
> methods (virtual, static, interface, even special when legal).
By the way, the current prototype rely on getMethod (not 
getDeclaredMethod) to find callable methods,
so it's only possible to reify public methods.
Is it a known limitation of the current prototype or is the spec will 
only allow find* on public methods ?
>
> For convenient browsing and review, I have posted the javadoc 
> extracted from the current sources here:
>
> http://webrev.invokedynamic.info/jrose/6655638.meth.jdoc/
>
> This API is not yet official.  Comments would be welcome!
The doc of MethodHandle says it's possible to create a MethodHandle using a
LDC on Methodref/InterfaceMethodRef.

"Bytecode in an extended JVM can directly obtain a method handle for any 
accessible method from a |ldc| instruction which refers to a 
|CONSTANT_Methodref| or |CONSTANT_InterfaceMethodref| constant pool entry. "

What is the position of the JSR292 EG on this ?
>
> -- John
Rémi



More information about the mlvm-dev mailing list