Virtual extension methods -- second draft

Rémi Forax forax at univ-mlv.fr
Sat Jun 12 11:54:03 PDT 2010


Le 12/06/2010 20:00, Brian Goetz a écrit :
>> In section (3), method dispatch, it isn't clear if this is discussing
>> compile-time behavior or runtime behavior, nor is it clear is this is
>> describing the behavior when the qualifying type is a class or the
>> qualifying type is an interface.
>>      
> The first draft badly conflated compile-time and run-time behavior.  This
> draft attempts to do better by first describing the runtime semantics, and
> only then discussing possible implementation techniques, both compile-time and
> run-time.  After an initial bout of optimism where I thought most of this
> could be done at compile time and the runtime behavior would be a "safety
> net", I have come around to the conclusion that it is better to push as much
> of the behavior to runtime as implementation considerations allow (which is a
> good fit for invokedynamic.)  Anything the static compiler would do would be
> more of a "helping the runtime get there faster."
>
> The method dispatch section attempts to describe the semantics of a method
> invocation of a defender method.  There are a lot of things to work out,
> including which invoke instructions are generated by the compiler (virtual,
> interface, dynamic) at the call site, and whether the others actually have
> semantics.  Despite the improvements from V1 to V2, its still a draft, with
> the aim of discovering whether this is a practical means of achieving the real
> goal -- library evolution.
>
>    
>> The full matrix must be described.
>>      
> Agreed, just not down at the JVMS level yet.
>
>    
>> Taking the section more literally, it appears to be discussing runtime
>> dispatch of an invokeinterface invocation where the receiver type in
>> the constant pool is D.
>>      
> Or an invokedynamic.
>    

There is only one problem with invokedynamic.
Invokedynamic requires a bootstrap method and the current spec says
that there is only one bootstrap method for the whole class.
If defender methods are implemented using invokedynamic,
developers will not be able to specify their own a bootstrap method.

Rémi


More information about the lambda-dev mailing list