JDK-8297313 : Refactor APIs for calculating address of CDS archive heap regions
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 20
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2022-11-21
  • Updated: 2022-12-05
  • Resolved: 2022-12-01
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 20
20 masterFixed
Related Reports
Relates :  
Relates :  
Relates :  
Description
In anticipation of the following RFEs:

- JDK-8296263: Uniform APIs for using archived heap regions
- 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:

  address FileMapInfo::start_address_as_decoded_from_archive()
  address 
start_address_as_decoded_with_current_oop_encoding_mode()

and the implementation is convoluted. See 

https://github.com/openjdk/jdk/blob/544e31722528d12fae0eb19271f85886680801a6/src/hotspot/share/cds/filemap.cpp#L2070-L2116

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 CDSFileMapRegion  structure is changed slightly to simplify the implementation of the above 3 functions.

With the above change, FileMapInfo::map_heap_regions_impl() can also be simplified significantly.


Comments
Changeset: 391599bc Author: Ioi Lam <iklam@openjdk.org> Date: 2022-12-01 19:59:14 +0000 URL: https://git.openjdk.org/jdk/commit/391599bc9d6b28a88e86d37464bb76e1e5314ce3
01-12-2022

A pull request was submitted for review. URL: https://git.openjdk.org/jdk/pull/11257 Date: 2022-11-21 06:22:49 +0000
21-11-2022

Note: this RFE is a redo of the withdrawn RFE JDK-8296155 (Simplify CDS heap region address calculation). While reviewing JDK-8296263 (Uniform APIs for using archived heap regions) and discussing with its author, [~asmehra], I realized that the the APIs for calculating the addresses of CDS archive heap regions are problematic and will hinder further development. I also realized that JDK-8296155 was not fixing it in the right direction. Therefore, I withdrew JDK-8296155 and I am trying again with this RFE. Thanks to [~asmehra] for his insights and contributions to the proposed design.
21-11-2022