RFR: 8329998: Remove double initialization for parts of small TypeArrays in ZObjArrayAllocator

Guoxiong Li gli at openjdk.org
Mon May 6 11:50:54 UTC 2024


On Mon, 6 May 2024 08:21:57 GMT, Stefan Karlsson <stefank at openjdk.org> wrote:

>> src/hotspot/share/gc/z/zObjArrayAllocator.cpp line 86:
>> 
>>> 84:     // fill the first 4 bytes here.
>>> 85:     assert(process_start_offset_in_bytes - base_offset_in_bytes == 4, "Must be 4-byte aligned");
>>> 86:     assert(!is_reference_type(element_type), "Only TypeArrays can be 4-byte aligned");
>> 
>> Actually, only the type arrays whose element type is not double word can be 4-byte aligned. So this assertion could be `!is_reference_type(element_type) && !is_double_word_type(element_type)`.
>
> I think the point is that when it is not a reference type, it is OK to initialize with a plain `0`.

May be better to treat the assertion as a more detailed guard or check. But I'm also OK with the current code.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/18721#discussion_r1590908388


More information about the hotspot-gc-dev mailing list