diff --git a/src/hotspot/share/gc/z/zRootsIterator.cpp b/src/hotspot/share/gc/z/zRootsIterator.cpp index b8cb72057a8..cd77790afa4 100644 --- a/src/hotspot/share/gc/z/zRootsIterator.cpp +++ b/src/hotspot/share/gc/z/zRootsIterator.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -29,7 +29,6 @@ #include "gc/z/zStat.hpp" #include "memory/resourceArea.hpp" #include "prims/jvmtiTagMap.hpp" -#include "runtime/atomicAccess.hpp" #include "runtime/globals.hpp" #include "runtime/safepoint.hpp" #include "utilities/debug.hpp" @@ -91,10 +90,10 @@ public: template template void ZParallelApply::apply(ClosureType* cl) { - if (!AtomicAccess::load(&_completed)) { + if (!_completed.load_relaxed()) { _iter.apply(cl); - if (!AtomicAccess::load(&_completed)) { - AtomicAccess::store(&_completed, true); + if (!_completed.load_relaxed()) { + _completed.store_relaxed(true); } } } @@ -120,7 +119,7 @@ void ZCLDsIteratorAll::apply(CLDClosure* cl) { } uint ZJavaThreadsIterator::claim() { - return AtomicAccess::fetch_then_add(&_claimed, 1u); + return _claimed.fetch_then_add(1u); } void ZJavaThreadsIterator::apply(ThreadClosure* cl) { diff --git a/src/hotspot/share/gc/z/zRootsIterator.hpp b/src/hotspot/share/gc/z/zRootsIterator.hpp index 48d3f5c68a6..8208c947b0e 100644 --- a/src/hotspot/share/gc/z/zRootsIterator.hpp +++ b/src/hotspot/share/gc/z/zRootsIterator.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,13 +28,14 @@ #include "gc/z/zGenerationId.hpp" #include "logging/log.hpp" #include "memory/iterator.hpp" +#include "runtime/atomic.hpp" #include "runtime/threadSMR.hpp" template class ZParallelApply { private: Iterator _iter; - volatile bool _completed; + Atomic _completed; public: ZParallelApply(ZGenerationIdOptional generation) @@ -113,7 +114,7 @@ public: class ZJavaThreadsIterator { private: ThreadsListHandle _threads; - volatile uint _claimed; + Atomic _claimed; const ZGenerationIdOptional _generation; uint claim();