RFR: 8358586: ZGC: Combine ZAllocator and ZObjectAllocator [v7]
Axel Boldt-Christmas
aboldtch at openjdk.org
Mon Jun 16 10:03:30 UTC 2025
On Mon, 16 Jun 2025 09:55:12 GMT, Joel Sikström <jsikstro at openjdk.org> wrote:
>> Hello,
>>
>> The main purpose of this RFE is to merge the ZAllocator class into ZObjectAllocator. After [JDK-8353184](https://bugs.openjdk.org/browse/JDK-8353184), ZAllocator has essentially become a mirror of ZObjectAllocator, with a few tweaks for different behavior for eden or relocation allocations. The goal is to make the code a bit easier to follow and generalise the different paths for eden and relocation allocations to a shared path.
>>
>> The storage of the static allocators for each ZPageAge has been moved from ZHeap into ZObjectAllocator, and initilization is done via ZInitialize (calling into `ZObjectAllocator::initialize()`) instead of in the ZHeap constructor.
>>
>> Instead of storing eden and relocation allocators separately, they are now in a single array, which makes iterating over the allocators more straightforward (when retiring pages for example). I have opted to keep the getter for the eden allocator (`ZObjectAllocator::eden()`), but it can be swapped to `ZObjectAllocator::allocator(ZPageAge::eden)` if we prefer that instead.
>>
>> `ZObjectAllocator::{alloc_object, alloc_object_for_relocation}` have been merged into a single `ZObjectAllocator::alloc_object()`, with a check to add a non-blocking flag or not. The null-check for eden allocation has been moved to its single caller in zCollectedHeap.cpp. This makes the API in ZObjectAllocator more general and we don't have to track methods for both eden and relocation allocations.
>>
>> `_relocation_allocators` has been moved from ZAllocator to ZObjectAllocator and renamed to `NumRelocationAllocators` to be more consistent with the naming style in ZGC.
>>
>> Testing:
>> * Oracle's tier 1-5
>
> Joel Sikström has updated the pull request incrementally with one additional commit since the last revision:
>
> Private member variables in ZObjectAlloactorImpl
lgtm.
-------------
Marked as reviewed by aboldtch (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/25693#pullrequestreview-2931439144
More information about the hotspot-gc-dev
mailing list