RFR: 8310160: Make GC APIs for handling archive heap objects agnostic of GC policy
Ashutosh Mehra
duke at openjdk.org
Fri Jun 16 14:34:11 UTC 2023
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.
-------------
Commit messages:
- 8310160: Make GC APIs for handling archive heap objects agnostic of GC policy
Changes: https://git.openjdk.org/jdk/pull/14520/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=14520&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8310160
Stats: 69 lines in 5 files changed: 22 ins; 14 del; 33 mod
Patch: https://git.openjdk.org/jdk/pull/14520.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/14520/head:pull/14520
PR: https://git.openjdk.org/jdk/pull/14520
More information about the hotspot-dev
mailing list