RFR: 8340171: CDS: Enhance bitmap truncation

Aleksey Shipilev shade at openjdk.org
Mon Sep 16 08:46:16 UTC 2024


Current CDS archive ships multiple bitmaps. Archival/loading code makes a useful optimization: it truncates the bitmaps at the beginning when it is known the prefix contains many zeroes. The object sorting code additionally sorts the pointer-rich objects at the end of the archive, increasing the zero-prefix length.

This optimization works less efficiently after [JDK-8338912](https://bugs.openjdk.org/browse/JDK-8338912), which moved the (pointer-rich) roots array at the beginning of the archive. We need to enhance current bitmap handling mechanism to truncate bitmaps better.

This PR does two things: a) enables bitmap truncation for both leading and trailing zeros; b) sorts the oop-rich objects at the beginning, where the oop-rich roots array is.

CDS archive sizes:


# Before JDK-8338912
$ ls -la build/linux-x86_64-server-release/images/jdk/lib/server/*.jsa
15450112 build/linux-x86_64-server-release/images/jdk/lib/server/classes.jsa
15851520 build/linux-x86_64-server-release/images/jdk/lib/server/classes_nocoops.jsa

# After JDK-8338912: +8..12K regression in size
$ ls -la build/linux-x86_64-server-release/images/jdk/lib/server/*.jsa
15462400 build/linux-x86_64-server-release/images/jdk/lib/server/classes.jsa
15859712 build/linux-x86_64-server-release/images/jdk/lib/server/classes_nocoops.jsa

# After this fix: recovered to pre-JDK-8338912 levels
$ ls -la build/linux-x86_64-server-release/images/jdk/lib/server/*.jsa
15450112 build/linux-x86_64-server-release/images/jdk/lib/server/classes.jsa
15851520 build/linux-x86_64-server-release/images/jdk/lib/server/classes_nocoops.jsa


Additional testing:
 - [x] Linux x86_64 server fastdebug, `runtime/cds`, `tier1`, `tier2`

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

Commit messages:
 - Fix

Changes: https://git.openjdk.org/jdk/pull/21010/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=21010&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8340171
  Stats: 42 lines in 3 files changed: 14 ins; 6 del; 22 mod
  Patch: https://git.openjdk.org/jdk/pull/21010.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/21010/head:pull/21010

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


More information about the hotspot-runtime-dev mailing list