RFR: 8340171: CDS: Enhance bitmap truncation [v2]

Matias Saavedra Silva matsaave at openjdk.org
Tue Sep 17 19:34:07 UTC 2024


On Mon, 16 Sep 2024 08:52:35 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:

>> 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`
>>  - [x]  Linux x86_64 server fastdebug, `all`
>
> Aleksey Shipilev has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Remove excessive debugging logging

Looks good! Just one question:
Since the pointer rich objects are now at the beginning, does that mean that the number of leading zeros is now very small? We might be losing the benefit of truncating if it's only a few bits.

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

Marked as reviewed by matsaave (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/21010#pullrequestreview-2310671338


More information about the hotspot-runtime-dev mailing list