[lworld] RFR: 8376813: [lworld] Add print for dummy field reused as null-marker

Chen Liang liach at openjdk.org
Fri Jan 30 22:04:23 UTC 2026


On Fri, 30 Jan 2026 15:29:17 GMT, Joel Sikström <jsikstro at openjdk.org> wrote:

> Hello,
> 
> Right now it's not clear that the dummy field that is injected into empty inline klasses can be/is reused for the null-marker when looking at the printed layout from -XX:+PrintInlineLayout. I suggest we enhance this print to indicate if the dummy field has been reused for the null-marker.
> 
> I've tested that the added comment in the print is there when nullability is turned on (default), and not there when turned off (`-XX:-UseNullableValueFlattening -XX:-UseNullableNonAtomicValueFlattening`).
> 
> 
> Before:
> Instance fields:
>  @0 RESERVED 12/-
>  @12 REGULAR 1/1 ".empty" B
> 
> After:
> Instance fields:
>  @0 RESERVED 12/-
>  @12 REGULAR 1/1 ".empty" B (reused as null-marker)
> 
> 
> Testing:
> * GHA
> * Oracle's tier1

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

> 1585:     _layout->print(&st, false, _super_klass, _inline_layout_info_array, dummy_field_is_reused_as_null_marker);
> 1586:     st.print_cr("Static fields:");
> 1587:     _static_layout->print(&st, true, nullptr, _inline_layout_info_array, dummy_field_is_reused_as_null_marker);

Does the static layout ever have a dummy field? I would have anticipated this to be simply `false`.

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

PR Review Comment: https://git.openjdk.org/valhalla/pull/2001#discussion_r2748145018


More information about the valhalla-dev mailing list