[code-reflection] RFR: Lambda model uniqueness [v4]

Maurizio Cimadamore mcimadamore at openjdk.org
Tue May 6 11:09:30 UTC 2025


On Sun, 4 May 2025 13:49:46 GMT, Mourad Abbay <mabbay at openjdk.org> wrote:

>> Lambdas that share the same proxy class, have the same implementation and therefore have the same code model generated by the compiler. In this PR, we share the code model across instances of the same proxy class. 
>> This also means we reduce execution time as we only need to invoke `opMethod` once for given proxy class.
>> With these changes we can compare lambda code model based on identity.
>
> Mourad Abbay has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Create Quoted object lazily

It seems to me this patch is doing several things at once. While sharing the model instance in a new static field, I'm less sure about the fact that the lazy initialization of the `Quoted` object is worth the extra code complexity (e.g. double checked locking) -- after all, computing the `Quoted` instance in the constructor of the generated class should not mess up with uniqueness (as there will still be a new instance of `Quoted` per new instance of the generated class?)

-------------

PR Review: https://git.openjdk.org/babylon/pull/420#pullrequestreview-2817857995


More information about the babylon-dev mailing list