RFR: 8341091: CDS: Segmented roots array misses roots
Andrew Dinn
adinn at openjdk.org
Wed Oct 2 15:57:39 UTC 2024
On Fri, 27 Sep 2024 15:37:25 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:
> There are a few bugs in [JDK-8338912](https://bugs.openjdk.org/browse/JDK-8338912) that we discovered in Leyden that uses multiple segments: a) root_index in ArchiveHeapWriter::copy_roots_to_buffer is initialized to zero for every segment, so all segments have the same set of roots; b) HeapShared::get_root and friends compute segment and internal indices modulo _byte_ size, while they should instead do it modulo _element_ size.
>
> This does not affect current mainline directly, since we run with a single segment the overwhelming majority of the time.
>
> Additional testing:
> - [x] Linux x86_64 server fastdebug, `runtime/cds`
> - [x] Linux x86_64 server fastdebug, `runtime/cds` + `-XX:-UseCompressedOops`
> - [x] Transplanted the patch to Leyden repo and verified it passes `runtime/cds`
> - [x] Linux x86_64 server fastdebug, `all`
Looks ok, apart from one minor tweak to a comment
src/hotspot/share/cds/archiveHeapLoader.cpp line 379:
> 377:
> 378: // The heap roots are stored in one or more segments that are laid out consecutively.
> 379: // The byte size of each segment (except for the last one) is max_size.
Comment here mentions `max_size` but that doesn't exist any more.
-------------
Marked as reviewed by adinn (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/21221#pullrequestreview-2343391590
PR Review Comment: https://git.openjdk.org/jdk/pull/21221#discussion_r1784820363
More information about the hotspot-runtime-dev
mailing list