RFR: 8297313: Refactor APIs for calculating address of CDS archive heap regions [v2]

Ioi Lam iklam at openjdk.org
Thu Dec 1 03:05:11 UTC 2022


> In anticipation of the following RFEs:
> 
> - [JDK-8296263](https://bugs.openjdk.org/browse/JDK-8296263): Uniform APIs for using archived heap regions
> - [JDK-8296344](https://bugs.openjdk.org/browse/JDK-8296344): Remove dependency on G1 for writing the CDS archive heap
> 
> We need to clean up the APIs for calculating the addresses of CDS archive heap regions.  The current APIs have confusing names and the implementation is convoluted.
> 
> The proposal is to change the above to three APIs with easy-to-understand semantics:
> 
> // The actual address of this region during dump time.
> address heap_region_dumptime_address(FileMapRegion* r)
> 
> // The address where this region can be mapped into the runtime heap without
> // patching any of the pointers that are embedded in this region.
> address heap_region_requested_address(FileMapRegion* r)
> 
> // The address where this shared heap region is actually mapped at runtime.
> address heap_region_mapped_address(FileMapRegion* r)
> 
> 
> The meaning of the `CDSFileMapRegion::_mapping_offset` field is changed slightly to simplify the implementation of the above 3 functions. Comments are improved explain what's going on.
> 
> With the above changes, `FileMapInfo::map_heap_regions_impl()` can also be simplified significantly.
> 
> ****
> Testing: tiers 1-4
> ****
> Misc changes:
> - added more assertions about exactly which combinations of collector and oop encoding mode are supported
>   - Specifically, uncompressed oops for non-G1 collectors are currently not supported;
>   - Change error message accordingly when the user selects an unsupported combination.

Ioi Lam has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains three additional commits since the last revision:

 - @calvinccheung comments
 - Merge branch 'master' into 8297313-refactor-cds-heap-region-address-apis
 - 8297313: Refactor APIs for calculating address of CDS archive heap regions

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/11257/files
  - new: https://git.openjdk.org/jdk/pull/11257/files/07891986..fa7dd4dd

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=11257&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=11257&range=00-01

  Stats: 62913 lines in 1194 files changed: 27711 ins; 20929 del; 14273 mod
  Patch: https://git.openjdk.org/jdk/pull/11257.diff
  Fetch: git fetch https://git.openjdk.org/jdk pull/11257/head:pull/11257

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


More information about the hotspot-runtime-dev mailing list