[lworld] RFR: 8374800: [lworld] Add a NULLABLE_NON_ATOMIC_FLAT layout

Quan Anh Mai qamai at openjdk.org
Fri Jan 9 16:39:50 UTC 2026


On Mon, 24 Mar 2025 20:49:25 GMT, Frederic Parain <fparain at openjdk.org> wrote:

> Strict final instance fields are not subject to concurrent writes during a read access, so they can be flattened even if they are nullable and bigger than 64 bits. The NULLABLE_NON_ATOMIC_FLAT layout is added for this particular case.
> This new layout can also be used in the special case of nullable empty value classes, because their payload contains a single entry, the null-marker, which is naturally atomic.

This would forbid the class which contains the `NULLABLE_NON_ATOMIC_FLAT` from being flattened into a class which contains it. I think we should only do so if the holder of the flattened strict final field should not be flattened if it is not itself a strict final field:

- The holder is an identity class.
- The holder is a large value class without `@LooselyConsistentValue`.

This is equally valid to null-restricted field of non-`@LooselyConsistentValue`, too.

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

PR Comment: https://git.openjdk.org/valhalla/pull/1407#issuecomment-2876555236


More information about the valhalla-dev mailing list