On Mon, 15 Jul 2024 15:57:30 GMT, Chen Liang <li...@openjdk.org> wrote:

>> The `@Stable` on the `index` field is incorrect, as stable only avoids 
>> inlining `0`. Solution is to use bit flip on the actual index (and rename 
>> the field to `flippedIndex`), so we use -1 to -256 (mapping to 0 to 255) and 
>> 0 the default value is used as an unset indicator.
>
> Chen Liang has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   Encapsulate offsetIndex, share computation result

Hmm, I don't think index is that closely tied to LF interpretation; it's only 
used to find the output values from a `Name`.

After another more general look, I think we might just turn the `index` field 
final: all its other fields are already final, and the lazy setting of `index` 
is just a trivial attempt to avoid reallocation if the index is not 
initialized, and such an approach will actually be harmful once we have value 
objects from valhalla.

Should I make it `final` instead, so we can prepare `Name` for the Valhalla 
value class migration?

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

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

Reply via email to