deduplicating lambda methods

B. Blaser bsrbnd at gmail.com
Sun Mar 4 16:25:18 UTC 2018


On 4 March 2018 at 14:11, Remi Forax <forax at univ-mlv.fr> wrote:
> Hi Vincente,
>
> ----- Mail original -----
>> De: "Vicente Romero" <vicente.romero at oracle.com>
>> À: "Liam Miller-Cushon" <cushon at google.com>, "amber-dev" <amber-dev at openjdk.java.net>, "Brian Goetz"
>> <brian.goetz at oracle.com>
>> Envoyé: Samedi 3 Mars 2018 05:01:47
>> Objet: Re: deduplicating lambda methods
>
> [...]
>
>>>
>>> 2) Debug info: the optimization is safe if line numbers are not being
>>> emitted. If they are, is there a way to deduplicate the methods
>>> without breaking debug info?
>>
>> I haven't tried to debug a method with more than one LNT, the spec
>> allows it but not sure how IDEs will operate on that
>
> from JVMS 4.7.13,
> "The LocalVariableTable attribute is an optional variable-length attribute in the attributes table of a Code attribute (§4.7.3). It may be used by debuggers to determine the value of a given local variable during the execution of a method.
> If multiple LocalVariableTable attributes are present in the attributes table of a Code attribute, then they may appear in any order.
> There may be no more than one LocalVariableTable attribute per local variable in the attributes table of a Code attribute. "
>
> You can not have several LNTs that map different parts of a compilation unit to the same bytecode because if you have several attributes it's like you can merge them into one attribute,
> so deduplication if there are debug info is not possible as far as i know.

The LVT is simply mapping local variable symbols ('name_index') to
their memory offsets ('index'). It should be possible to merge them as
the bytecode (modulo my previous comments to retrieve the right LNT)
for identical lambdas, I think.

Bernard

>> Vicente
>
> Rémi


More information about the amber-dev mailing list