RFR: 8374984: Convert workerUtils to use Atomic<T>

Aleksey Shipilev shade at openjdk.org
Wed Jan 14 07:21:33 UTC 2026


On Tue, 13 Jan 2026 17:50:39 GMT, Kim Barrett <kbarrett at openjdk.org> wrote:

> Please review this change to make SubTasksDone and SequentialSubTasksDone use
> Atomic<T> instead of AtomicAccess.
> 
> Testing: mach5 tier1

Marked as reviewed by shade (Reviewer).

src/hotspot/share/gc/shared/workerUtils.cpp line 120:

> 118: bool SubTasksDone::try_claim_task(uint t) {
> 119:   assert(t < _n_tasks, "bad task id.");
> 120:   return !_tasks[t].load_relaxed() && !_tasks[t].compare_exchange(false, true);

This is one of those cases where `compare_set` is somewhat cleaner:


  return !_tasks[t].load_relaxed() && _tasks[t].compare_set(false, true);

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

PR Review: https://git.openjdk.org/jdk/pull/29201#pullrequestreview-3659208016
PR Review Comment: https://git.openjdk.org/jdk/pull/29201#discussion_r2689245483


More information about the hotspot-gc-dev mailing list