RFR: 8296344: Remove dependency on G1 for writing the CDS archive heap [v4]

Ashutosh Mehra duke at openjdk.org
Tue Feb 7 16:17:05 UTC 2023


On Fri, 3 Feb 2023 05:23:26 GMT, Ioi Lam <iklam at openjdk.org> wrote:

>> Goals
>> 
>> - Simplify the writing of the CDS archive heap
>>     - We no longer need to allocate special "archive regions" during CDS dump time. See all the removed G1 code. 
>> - Make it possible to (in a future RFE) write the CDS archive heap using any garbage collector
>> 
>> Implementation - the following runs inside a safepoint so heap objects aren't moving
>> 
>> - Find all the objects that should be archived
>> - Allocate buffer using a GrowableArray
>>     - Copy all "open" objects into the buffer
>>     - Copy all "closed" objects into the buffer
>> - Make sure the heap image can be mapped with all possible G1 region sizes: 
>>     - While copying, add fillers to make sure no object spans across 1MB boundary (minimal G1 region size)
>>     - Align the bottom of the "open" and "closed" objects at 1MB boundary
>> - Write the buffer to disk as the image for the archive heap
>> 
>> Testing: tiers 1 ~ 5
>
> Ioi Lam has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Simplified relocation by using buffered address instead of requested address

src/hotspot/share/cds/archiveHeapWriter.cpp line 388:

> 386:   assert(is_aligned(_open_bottom, HeapRegion::GrainBytes), "sanity");
> 387: 
> 388:   _requested_closed_region_bottom = align_down(heap_end - closed_region_byte_size, HeapRegion::GrainBytes);

Instead of aligning to `HeapRegion::GrainBytes`, shouldn't it be aligned to `MIN_GC_REGION_ALIGNMENT`?
With `HeapRegion::GrainBytes`, if the cds archive is created with large region size (say 32M) and later mapped with smaller region size (say 1M), then the archive heap would need to be relocated. Using `MIN_GC_REGION_ALIGNMENT` would avoid the relocation in this case.

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

PR: https://git.openjdk.org/jdk/pull/12304


More information about the hotspot-dev mailing list