lambda and MethodHandles in current prototype
Rémi Forax
forax at univ-mlv.fr
Sun Nov 27 07:10:09 PST 2011
On 11/27/2011 12:14 PM, Peter Levart wrote:
> On Sunday, November 27, 2011 11:31:27 AM Rémi Forax wrote:
>>>> *) optionally (if you use the -XDlambdaToMethod flag), the compiler will
>>>> use 292, by passing method handles on to a fake BSM lambda metafactory
>>>> that will spin the bytecode on the fly.
>>> I see.
>>>
>>> I experimented with modified implementation of ProxyHelper.metaFactory and observed that the 2nd argument to
>>>
>>> metaFactory(
>>> MethodHandles.Lookup caller,
>>> String invokedName,
>>> MethodType invokedType,
>>> Class<?> samClass,
>>> MethodHandle handle
>>> )
>>>
>>> is currently allways invoked with a constant String "lambda". Is this meant to be specified as the target method name or something similar that will facilitate serializability of SAM instances?
>> Hi Peter,
>> good question !
>>
>> The name of the handle (which is opaque for you but not for the VM)
>> is enough to make the lambda serializable.
> MethodHandleNatives provides such access, right?
yes, but this class is Hotspot specific.
>
>> The calling name has to be provided to be compliant with JSR 292,
>> but is not used at all currently.
> Ah, I see. This is the "method name" used in invokedynamic.
Rémi
More information about the lambda-dev
mailing list