[lworld] RFR: 8376532: [lworld] Size of BUFFERED layout is sometimes smaller than size of NULLABLE_NON_ATOMIC_FLAT layout [v2]

Paul Hübner phubner at openjdk.org
Fri Jan 30 16:03:59 UTC 2026


On Fri, 30 Jan 2026 14:44:27 GMT, Frederic Parain <fparain at openjdk.org> wrote:

>> Fixes several bugs in the field layout builder, when the size and alignment constraint of the BUFFERED layout are adjusted to be compatible with all the other supported layouts.
>> The FieldLayoutAnalyzer framework has been updated to check this requirement each time a field layout log is processed.
>> 
>> Testing in progress.
>> 
>> Fred
>
> Frederic Parain has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Change from review

This looks good, thanks for the changes!

src/hotspot/share/classfile/fieldLayoutBuilder.cpp line 1272:

> 1270:     }
> 1271:     if (has_nullable_non_atomic_layout() && payload_layout_size_in_bytes() < nullable_non_atomic_layout_size_in_bytes()) {
> 1272:       _payload_size_in_bytes = nullable_non_atomic_layout_size_in_bytes();

Did we just forget this case before?

src/hotspot/share/classfile/fieldLayoutBuilder.cpp line 1276:

> 1274: 
> 1275:     // if the inline class has a null-free atomic layout, the the layout used in heap allocated standalone
> 1276:     // instances must have at least equal to the atomic layout to allow safe read/write atomic

This makes sense, thanks for the comment.

test/hotspot/jtreg/runtime/valhalla/inlinetypes/field_layout/FieldLayoutAnalyzer.java line 198:

> 196:     int nullFreeNonAtomicLayoutAlignment;    // -1 if no non-nullable layout
> 197:     int nullFreeAtomicLayoutSize;            // -1 if no atomic layout
> 198:     int nullFreeAtomicLayoutAlignment;       // -1 if no atomic layout

Nit: should the comment also say non-nullable since it's null-free as well?

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

Marked as reviewed by phubner (Committer).

PR Review: https://git.openjdk.org/valhalla/pull/1997#pullrequestreview-3729063645
PR Review Comment: https://git.openjdk.org/valhalla/pull/1997#discussion_r2746896125
PR Review Comment: https://git.openjdk.org/valhalla/pull/1997#discussion_r2746900267
PR Review Comment: https://git.openjdk.org/valhalla/pull/1997#discussion_r2746912883


More information about the valhalla-dev mailing list