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

Francesco Andreuzzi fandreuzzi at openjdk.org
Mon Oct 6 14:33:42 UTC 2025


On Mon, 6 Oct 2025 14:10:31 GMT, Albert Mingkun Yang <ayang 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).
>
> 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.

We don't need to know how many workers there are, just if we are parallel or not. I think this goes in the same direction as the idea of the PR, being clear about what we actually need

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

PR Review Comment: https://git.openjdk.org/jdk/pull/27644#discussion_r2406680110


More information about the hotspot-gc-dev mailing list