RFR: 8367848: Parallel: Use NMethodToOopClosure during Young GC

Stefan Karlsson stefank at openjdk.org
Wed Sep 17 14:44:42 UTC 2025


On Wed, 17 Sep 2025 09:00:22 GMT, Albert Mingkun Yang <ayang at openjdk.org> wrote:

> Replace `MarkingNMethodClosure` with `NMethodToOopClosure` during young-gc. After that, a new local `ThreadsClaimTokenScope` is introduced instead of `StrongRootsScope` to make the thread-claim-token logic visible in the current context.
>  
> Test: tier1-3

src/hotspot/share/gc/parallel/psScavenge.cpp line 244:

> 242:       Threads::assert_all_threads_claimed();
> 243:     }
> 244:   };

Could this class be placed in Threads together with these functions:

  static uintx thread_claim_token()
  static void change_thread_claim_token();
  static void assert_all_threads_claimed() NOT_DEBUG_RETURN;
  static void possibly_parallel_oops_do(bool is_par, OopClosure* f, NMethodClosure* cf);


There's other GC code that could benefit from using this helper.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/27336#discussion_r2355768943


More information about the hotspot-gc-dev mailing list