RFR: 8329998: Remove double initialization for parts of small TypeArrays in ZObjArrayAllocator
Guoxiong Li
gli at openjdk.org
Sun May 5 05:11:56 UTC 2024
On Wed, 10 Apr 2024 13:06:47 GMT, Axel Boldt-Christmas <aboldtch at openjdk.org> wrote:
> [JDK-8139457](https://bugs.openjdk.org/browse/JDK-8139457) introduced non-word aligned payloads for TypeArrays. This required adaptation in `ZObjArrayAllocator` segmented array allocator. But the implementation does this adaptation even when the size is small enough and dispatches the allocation to `ObjArrayAllocator`, which already handles clearing this memory.
>
> Instead move the initialization of any unaligned payload start to after the segmented allocation decision.
Looks good. One suggestion.
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)`.
-------------
Marked as reviewed by gli (Committer).
PR Review: https://git.openjdk.org/jdk/pull/18721#pullrequestreview-2039582650
PR Review Comment: https://git.openjdk.org/jdk/pull/18721#discussion_r1590209609
More information about the hotspot-gc-dev
mailing list