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

Ioi Lam iklam at openjdk.org
Thu Sep 19 20:29:34 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

LGTM.

Currently we have lots of pointers in the tables at the end of the  RO region. If we change those pointers to relative offsets, then `FileMapInfo::remove_bitmap_zeros` would be able to remove more zeros from there.

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

Marked as reviewed by iklam (Reviewer).

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


More information about the hotspot-runtime-dev mailing list