RFR: 8369178: G1: Use NMethodMarkingScope and ThreadsClaimTokenScope in G1RootProcessor

Albert Mingkun Yang ayang at openjdk.org
Mon Oct 6 14:13:36 UTC 2025


On Mon, 6 Oct 2025 12:20:42 GMT, Francesco Andreuzzi <fandreuzzi at openjdk.org> wrote:

> Replace `StrongRootsScope` with `ThreadsClaimTokenScope` and `MarkingNMethodClosure` in `G1RootProcessor ` to be more precise with what is needed and why.
> 
> - `MarkingNMethodClosure` is used in `G1FullGCMarkTask`, so we also need `NMethodMarkingScope`.
> - `active_workers ` is guaranteed to be `> 0`
> 
> Passes tier1 and tier2 (fastdebug).

Marked as reviewed by ayang (Reviewer).

src/hotspot/share/gc/g1/g1RootProcessor.hpp line 54:

> 52:   NMethodMarkingScope _nmethod_marking_scope;
> 53:   ThreadsClaimTokenScope _threads_claim_token_scope;
> 54:   bool _is_parallel;

I would have used `uint _num_workers`, but I guess this also works.

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

PR Review: https://git.openjdk.org/jdk/pull/27644#pullrequestreview-3304938799
PR Review Comment: https://git.openjdk.org/jdk/pull/27644#discussion_r2406562709


More information about the hotspot-dev mailing list