RFR(S) 8208658: Make CDS archived heap regions usable even if compressed oop encoding has changed

Ioi Lam ioi.lam at oracle.com
Thu Aug 2 06:04:37 UTC 2018


https://bugs.openjdk.java.net/browse/JDK-8208658
http://cr.openjdk.java.net/~iklam/jdk12/8208658-relocate-archived-heap-regions.v00/

PROBLEM:

     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 time, because the archived heap
     regions enable many aggressive optimizations, such as JDK-8202035,
     archiving the system module info.

     This degradation is undesirable for JDK-8204247 (include default
     CDS archive in JDK binary) -- what we want is to ship a CDS archive
     that's optimal regardless of the max heap settings.

FIX:

     If the compressed oop encoding scheme is different:
         - relocate the archived heap regions so it
           fits within the runtime heap bounds.
         - patch all reference fields in the archived objects to
           use the runtime compressed oop encoding scheme.

RESULTS:

     # 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

     Note: the archive is dumped with UnscaledNarrowOop encoding.
     At run time, if -Xmx2090m is specified, ZeroBasedNarrowOop is
     used instead.

========================================================================
     OLD same encoding      34.45 ms +- 0.51%
     OLD diff encoding      47.76 ms +- 0.94%  <<<<< 13.3 ms degradation!

     NEW same encoding      34.58 ms +- 0.61%
     NEW diff encoding      35.09 ms +- 0.24% <<<<<  0.5 ms degradation
========================================================================


     The cost of relocating/patching the archived heap regions is only
     0.5 ms. This is much better than the 13.3 ms degradation caused by the
     failure to map the archived heap regions.

TESTING:

     All 150+ CDS tests passed locally. I am starting tiers 1/2/3 runs.

Thanks
- Ioi



More information about the hotspot-gc-dev mailing list