Lambdas and serialization

Rémi Forax forax at univ-mlv.fr
Wed Oct 20 11:36:35 PDT 2010


Le 20/10/2010 19:21, Fredrik Öhrström a écrit :
> 2010/10/20w Rémi Forax <forax at univ-mlv.fr <mailto:forax at univ-mlv.fr>>
>
>     Method handle can not be easily serializable because they don't hold
>     information like the declaring class,
>     the method name. They are typically represented by a pointer or a base
>     pointer and a vtable slot.
>     They are more close to the VM and less close to the language.
>
>
> Hmm, it must be possible to deduce that a certain methodhandle keeps
> a certain target class alive. If not, bad things can happen after GC.
>
> For example, the target class that owns an immediate target address
> can be found using the meta data; a virtual method handle has the
> target class as the first argument in the MethodType; a bound method
> handle  has a pointer to an instance of the target class.

You're right, getting the declaring class seems possible for 'nice' method
handles (as Brian called them). And you can perform a reverse lookup
using the list of all methods of a class (the VM must have that list if it
implement reflection) to find the method name, but it will be slow.

>
> //Fredrik

Rémi


More information about the lambda-dev mailing list