RFR: 8310160: Make GC APIs for handling archive heap objects agnostic of GC policy [v2]

Albert Mingkun Yang ayang at openjdk.org
Tue Jun 20 09:26:06 UTC 2023


On Mon, 19 Jun 2023 20:06:23 GMT, Ashutosh Mehra <duke at openjdk.org> wrote:

>> This PR adds GC APIs to be implemented by all collectors for proper handling of archive heap space. Currently only G1 is updated to use these APIs which just involves renaming the existing G1 APIs.
>> In addition to that filemap.cpp is updated to replace calls to `G1CollectedHeap::heap()` with `Universe::heap()` to avoid G1 specific code as much as possible.
>> 
>> At many places in filemap.cpp heap range is requested from GC. All collectors except ZGC have contiguous heap and set `CollectedHeap::_reserved` to the heap range, so it can be easily exposed to the CDS code. This is done in this patch through `CollectedHeap::reserved` API. But for ZGC the heap can be discontiguous which makes it tricky to expose the heap range.
>> Another point to note is that most of the usage for heap range is for logging purpose, but there is one place where it is used for setting the `mapping_offset` in `FileMapInfo::write_region()` based on the heap start. So purely based on the functional requirement, we only need the heap start address, not the range.
>> 
>> To keep things simple and considering ZGC does not currently support archive heap, i refrained from tackling the issue of discontiguous heap range in this PR.
>
> Ashutosh Mehra has updated the pull request incrementally with three additional commits since the last revision:
> 
>  - Remove unnecessary assert and condition for UseG1GC
>    
>    Signed-off-by: Ashutosh Mehra <asmehra at redhat.com>
>  - Rename CollectedHeap::reserved() to CollectedHeap::reserved_range()
>    
>    Signed-off-by: Ashutosh Mehra <asmehra at redhat.com>
>  - Rename alloc_archive_space to allocate_archive_space
>    
>    Signed-off-by: Ashutosh Mehra <asmehra at redhat.com>

src/hotspot/share/gc/shared/collectedHeap.hpp line 212:

> 210:   MemRegion reserved_region() const {
> 211:     return _reserved;
> 212:   }

Could you extract out this (a new CollectedHeap API) to its own ticket/PR? (It seems important enough to not be hidden inside a CDS PR.)

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

PR Review Comment: https://git.openjdk.org/jdk/pull/14520#discussion_r1234991165


More information about the hotspot-dev mailing list