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

Ashutosh Mehra duke at openjdk.org
Mon Jun 19 20:06:26 UTC 2023


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

>> src/hotspot/share/cds/filemap.cpp line 2097:
>> 
>>> 2095:     assert(heap_range.contains(_mapped_heap_memregion), "must be");
>>> 2096: 
>>> 2097:     if (UseG1GC) {
>> 
>> This condition is odd. We only call FileMapInfo::map_heap_region() for G1, right? Maybe just assert at the start of the function for `ArchiveHeapLoader::can_map()` instead?
>
> I mixed up my thoughts about the future changes where `FileMapInfo::map_heap_region()` could be called for any collector, not just G1. In that scenario the assert that mapped heap region is at the top of the heap would be true only for G1 (among current set of collectors that support archive heap).
> Your point is valid. I can just add an assert `ArchiveHeapLoader::can_map()` at the start.

On second thought I think there is no need for `ArchiveHeapLoader::can_map()` either. `map_heap_region()` gets called from `FileMapInfo::map_or_load_heap_region` only if `ArchiveHeapLoader::can_map()` is true.

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

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


More information about the hotspot-dev mailing list