JDK-8208658 : Make CDS archived heap regions usable even if compressed oop encoding has changed
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 11
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2018-08-02
  • Updated: 2020-08-08
  • Resolved: 2018-08-22
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 11 JDK 12
11.0.7Fixed 12 b09Fixed
Related Reports
Blocks :  
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Description
At runtime, if you use a maximum heap size (-Xmx) setting that's different than the one used at CDS archive creation time, the archived heap regions may fail to map. The reason is the archived heap regions are hard-coded to a specific compressed oop encoding scheme

This causes degradation in start-up.

For the related code, see:

http://hg.openjdk.java.net/jdk/jdk/file/5cc6acb1d6b6/src/hotspot/share/memory/filemap.cpp#l877

To fix this, we should patch/relocate the archived heap regions to make it compatible with the runtime compressed oop encoding. Preliminary result is encouraging.

Test case:

# dump archive
java -Xshare:dump -Xmx2000m

# same compressed oop encoding
java -Xshare:on -Xmx2000m -Xlog:cds -version

# different compressed oop encoding
java -Xshare:on -Xmx2090m -Xlog:cds -version

(The archive is dumped with UnscaledNarrowOop mode. At run time, if -Xmx2090m is specified, ZeroBasedNarrowOop is used instead).

OLD same 34.45 ms +- 0.51%
OLD diff 47.76 ms +- 0.61%      <<<<< 13.3 ms degradation!
NEW same 34.58 ms +- 0.94%
NEW diff 35.09 ms +- 0.24%

Patch: http://cr.openjdk.java.net/~iklam/jdk12/8208658-relocate-archived-heap-regions.v00/

Note that without this fix, start-up time degrades 13.3ms when compressed oop encoding has changed. With this fix, the degradation is only 0.5ms, which is the cost of relocating/patching the archived heap regions.


Comments
Requested backport for jdk11u-dev: https://mail.openjdk.java.net/pipermail/jdk-updates-dev/2020-January/002412.html
22-01-2020