RFR: 8358586: ZGC: Combine ZAllocator and ZObjectAllocator [v2]

Joel Sikström jsikstro at openjdk.org
Mon Jun 16 09:00:14 UTC 2025


On Thu, 12 Jun 2025 09:23:35 GMT, Axel Boldt-Christmas <aboldtch at openjdk.org> wrote:

>> Joel Sikström has updated the pull request incrementally with two additional commits since the last revision:
>> 
>>  - -Wconversion fixes
>>  - Intermediate alloc_object in ZHeap
>
> The change looks good. But I have a few thoughts if we want to take this a step further.
> 
> This change starts adding a static interface on `ZObjectAllocator` which is used for `retire_pages`. I wonder if we can take this all the way and make `ZObjectAllocator` a static only interface. And keep the Allocator implementation opaque / private. 
> 
> So instead of first pulling out the allocator and calling the corresponding function, we go through the static interface. So we get something like
> ```c++
>   static void initialize();
>   static void retire_pages(ZPageAgeRange range);
>   static zaddress alloc_object(size_t size, ZPageAge age);
>   static void undo_alloc_object(zaddress addr, size_t size, ZPageAge age);
>   static size_t remaining_in_eden();

With some more feedback from @xmas92 I have moved the implementation of ZObjectAllocator to the .cpp file, now named ZObjectAllocatorImpl. I have also moved the storage of the static allocators to the .cpp file and the .hpp file only contains the static interface, now called ZObjectAllocator.

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

PR Comment: https://git.openjdk.org/jdk/pull/25693#issuecomment-2975667892


More information about the hotspot-gc-dev mailing list