RFR: 8296155: Simplify CDS heap region address calculation [v5]

Ioi Lam iklam at openjdk.org
Thu Nov 17 00:40:23 UTC 2022


On Wed, 16 Nov 2022 19:36:27 GMT, Ioi Lam <iklam at openjdk.org> wrote:

>> Rewrite and simplify the convoluted logic used to calculate the runtime location of a CDS heap region. Now it's as simple as:
>> 
>> 
>> FileMapRegion::dumptime_base() + ArchiveHeapLoader::runtime_delta();
>> 
>> 
>> See `FileMapInfo::heap_region_runtime_start_address` for an example.
>> 
>> Also removed dead code:
>> 
>> - `FileMapInfo::is_in_shared_region`
>> - `MetaspaceShared::is_in_shared_region`
>> - `FileMapInfo::stop_sharing_and_unmap`
>
> Ioi Lam has updated the pull request incrementally with one additional commit since the last revision:
> 
>   fixed comments

After further consideration, this PR is not the right way to do it. If we remember the absolute address of the heap regions during dump time, it may cause unnecessary relocation at run time.

We should keep using CDSFileMapRegion::_mapping_offset to encode the requested address for the heap regions. However, the code should be cleaned up and documentation shoukld be corrected. 

I'll open a new RFE. Closing this RFE as will-not-fix.


  size_t  _mapping_offset;    // This encodes the requested address for this region to be mapped at runtime.
                              // However, the JVM may choose to map at an alternative location (e.g., for ASLR,
                              // or to adapt to the available ranges in the Java heap range).
                              // - For an RO/RW region, the requested address is:
                              //     FileMapHeader::requested_base_address() + _mapping_offset
                              // - For a heap region, the requested address is:
                              //     +UseCompressedOops: CompressedOops::decode_raw_not_null(_mapping_offset)
                              //     -UseCompressedOops: FileMapHeader::heap_begin() + _mapping_offset
                              // - For heap regions, the _mapping_offset is always zero. The runtime address
                              //   is picked by the OS.

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

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


More information about the hotspot-runtime-dev mailing list