method handle cracking API

John Rose john.r.rose at oracle.com
Wed May 15 14:37:32 PDT 2013


On May 15, 2013, at 10:27 AM, Mark Roos <mroos at roos.com> wrote:

> Just for my learning,  what is the use model for this form of method handle inspection? 

What Remi said...

> Is there some cool technique that this facilitates? 

Yes.  A bootstrap method receives 3 required arguments, a Lookup, String, and MethodType.  If you pass it additional optional arguments, they can be CONSTANT_MethodHandles.  All such constants are fully local to the Lookup object, and can therefore be cracked down to their symbolic reference components.

Basically, it means you can use direct method handles (in the context of a matching Lookup) for double duty:  As access paths to method invocation (and other member usage) and also as well-formed symbolic descriptors.  JSR 335 implementations use the latter.  The calls look like BSM(lookup, name, mtype, [methodhandle]*).

An alternative would be to pass symbolic reference components as 4-tuples of BSM arguments:  BSM(lookup, name, mtype, [refkind, refclass, name, type, ]*).  This has a larger class file footprint, and also does not verify the linkability of the symbolic reference.

— John
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/mlvm-dev/attachments/20130515/2d6e0f07/attachment.html 


More information about the mlvm-dev mailing list