RFR: 8361055: Serial: Inline SerialHeap::process_roots [v3]

Albert Mingkun Yang ayang at openjdk.org
Wed Jul 16 09:24:41 UTC 2025


On Wed, 16 Jul 2025 05:28:05 GMT, Kim Barrett <kbarrett at openjdk.org> wrote:

> Not only about what is there in each place, but also about what is not.

There are only three kinds of "real" roots -- CLDs, threads, and OopStorage -- and all need to be processed somehow for correctness. In various calling contexts (like young-GC, full-GC marking, or full-GC adjustment), we layer on some additional "pseudo" roots and apply specific closures tailored for those cases. The added comments calls out the additional "pseudo" roots explicitly in every calling context.

I believe this way of structuring the code -- where the handling of roots and pseudo-roots is explicit at each callsite -- results in a simpler and more comprehensible mental model. It avoids the complexity of having a generic method enumerate all possible roots and control the subset for each context via flags or options. Instead, readers can see directly what roots are processed right where it matters.

> But such a change needs to be an improvement...

FWIW, this reveals a redundancy in young-gc root processing: https://github.com/openjdk/jdk/pull/26038#issuecomment-3018419173

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

PR Comment: https://git.openjdk.org/jdk/pull/26038#issuecomment-3077716802


More information about the hotspot-gc-dev mailing list