optional arguments for bootstrap methods

John Rose john.r.rose at oracle.com
Fri Oct 22 02:34:44 PDT 2010


On Oct 22, 2010, at 2:19 AM, Rémi Forax wrote:

> And also:
> 
>   CallSite myBSM(MethodHandles.Lookup look, String name, MethodType type);
>   CallSite myBSM(MethodHandles.Lookup look, String name, MethodType type, Object arg);
>   CallSite myBSM(MethodHandles.Lookup look, String name, MethodType type, Object... args);
> 
> 
> A bootstrap method can return a call site (CallSite) or a method handle 
> (MethodHandle).
> The idea is to return a CallSite if the target method can change and a 
> MethodHandle
> if the target of an invokedynamic never change.

Yes.

In fact, since the BSM is called by invokeGeneric, myBSM can also return Object, and dynamically choose whether to bind finally with a MH or mutably with a CS.

-- John



More information about the mlvm-dev mailing list