RFR: 8338912: CDS: Segmented roots array [v4]

Aleksey Shipilev shade at openjdk.org
Mon Sep 9 11:31:12 UTC 2024


On Fri, 6 Sep 2024 18:17:21 GMT, Jiangli Zhou <jiangli at openjdk.org> wrote:

> @shipilev Glad to see this change. As mentioned in yesterday's premain meeting, we ran into the single roots array scalability issue trivially when experimenting with real world applications back in 2021. 

Good to know this is not only the problem with our tests, but also a real-world issue!

> At the time, I reworked it to use a 'linked-roots-array' solution to accommodate a large number of roots. If the required size was larger than the limit, multiple 'roots' arrays were allocated. The last element in the current 'roots' array contained the next 'roots' array. 

Right, I actually started with something like this: an array of slices, like `Object[][]`. But then I quickly realized that CDS is manipulating "objects" outside of the heap, so constructing any object graph is getting massive frowns from GC barriers code, and it comes with a headache for relocation. Notably, storing the reference to a segment into anywhere, like in 1-st level array is problematic.

What we arrived here is _basically_ `Object[][]`, but we don't have a 1-st level array, we just use the layout encoded by `HeapRootSegments` to identify where the segments are, instead.

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

PR Comment: https://git.openjdk.org/jdk/pull/20858#issuecomment-2337857815


More information about the hotspot-runtime-dev mailing list