RFR: 8374984: Convert workerUtils to use Atomic<T>
Stefan Karlsson
stefank at openjdk.org
Wed Jan 14 08:27:56 UTC 2026
On Wed, 14 Jan 2026 07:16:34 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:
>> Please review this change to make SubTasksDone and SequentialSubTasksDone use
>> Atomic<T> instead of AtomicAccess.
>>
>> Testing: mach5 tier1
>
> 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);
And maybe the same for `all_tasks_claimed_impl`?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/29201#discussion_r2689449288
More information about the hotspot-gc-dev
mailing list