RFR: 8335922: Incorrect @Stable usage of LambdaForm$Name.index

Jorn Vernee jvernee at openjdk.org
Wed Jul 17 14:12:52 UTC 2024


On Wed, 17 Jul 2024 13:44:58 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:

> > @shipilev Would you re-review this patch, or are you no longer interested now that `@Stable` is removed?
> 
> I am not sure I understand the performance implications for this change. I can see the optimization for avoiding `Name` reallocation when we can rewrite the `index` is from original JSR 292 work that introduced LFs. Maybe that optimization is actually not worth it.

The old code made it possible to lazily initialize a `Name`'s index without creating a new `Name` instance. Another way to get there would be to explicitly specify the index when a `Name` is created.

When I started thinking about that yesterday, I thought maybe clients of `LambdaForm` shouldn't be in charge of creating `Name`s in the first place, and instead this should be handled by some `LambdaForm`-builder like utility, which can immediately fill in the right index. AFAICS, the only possible optimization that this would block is the sharing of `Name` instance with the same index in different `LambdaForms` (though, not sure if that's even done right now).

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

PR Comment: https://git.openjdk.org/jdk/pull/20178#issuecomment-2233426807


More information about the core-libs-dev mailing list