RFR: 8342967: Lambda deduplication fails with non-metafactory BSMs and mismatched local variables names [v5]

Aggelos Biboudis abimpoudis at openjdk.org
Thu Oct 31 16:54:34 UTC 2024


On Wed, 30 Oct 2024 13:52:52 GMT, Aggelos Biboudis <abimpoudis at openjdk.org> wrote:

>> After experimentation and under certain conditions, a few equivalent lambdas (up to variable renaming) fail to deduplicate.
>> 
>> `TreeHasher` and `TreeDiffer` are now aware that other bootstraps may appear in lambda bodies (e.g. `SwitchBootstraps.typeSwitch`) and that variable names do not matter (when they appear in method/lambda definitions). In the first case equivalence is checked based on `bsmKey` and not the `Dynamic{Var, Method}Symbol` itself.
>> 
>> The test was also adjusted since it was assuming BSM with certain structure only (that `.get(1)` was unprotected).
>
> Aggelos Biboudis has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Refactor deduplication test
>   
>   - introduce two kinds of groups
>   - extract assertNotEqualsWithinGroup
>   - extract isMethodWithName
>   - extract addToGroup

Addressed the reviews with https://github.com/openjdk/jdk/pull/21687/commits/1c80a7c45e950cd49f98f22f1ec055be10e5f22e 
(which would be great if someone could have a final quick look).

I guess the only thing now is to decide (based on the experiments' results) whether we merge this and remove later, or close this and remove dedup now or remove later 😄

Sooner or later, this test will start to fail when lambda bodies start containing other kinds of bootstrap invocations.

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

PR Comment: https://git.openjdk.org/jdk/pull/21687#issuecomment-2450362290


More information about the compiler-dev mailing list