On Wed, 17 Dec 2025 11:03:49 GMT, Paul Hübner <[email protected]> wrote:
>> Joel Sikström has updated the pull request incrementally with one additional
>> commit since the last revision:
>>
>> Offline review feedback
>
> src/hotspot/share/gc/z/zObjArrayAllocator.cpp line 64:
>
>> 62: }
>> 63:
>> 64: if (is_oop_containing_flat_array(_klass)) {
>
>> A value object containing an oop and the added null-marker will always
>> exceed 64 bits with ZGC, and therefore such objects will not be flattened in
>> practice due to the 64-bit atomicity constraint.
>
> Is this something we can guard against in the code as well? What happens if
> somebody creates a null-restricted non-atomic primitive-only flat array via
> the `ValueClass` API? Tearing from the user's POV is absolutely okay in such
> a case, but will any ZGC assumptions be violated?
In my initial sanity tests I just checked what classes were getting past the
new `is_oop_containing_flat_array`, without checking if the passed the size
check. It turns out that there are no tests in jdk_valhalla or hotspot_valhalla
where ZGC allocates a large enough primitive-only array to get into the segment
clearing code.
We can't add any asserts here as we have tests which uses null-restricted
and/or loosely-consistent properties.
-------------
PR Review Comment:
https://git.openjdk.org/valhalla/pull/1811#discussion_r2627706607