RFR: 8367013: Add Atomic<T> to package/replace idiom of volatile var plus AtomicAccess:: operations

Kim Barrett kbarrett at openjdk.org
Wed Sep 24 05:39:37 UTC 2025


Please review this change that adds the type `Atomic<T>`, to use as the type
of a variable that is accessed (including writes) concurrently by multiple
threads. This is intended to replace (most) uses of the current HotSpot idiom
of declaring a variable `volatile` and accessing that variable using functions
from the AtomicAccess class.
https://github.com/openjdk/jdk/blame/528f93f8cb9f1fb9c19f31ab80c8a546f47beed2/doc/hotspot-style.md#L138-L147

Testing: mach5 tier1-6, GHA sanity tests

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

Commit messages:
 - work around clang private access bug
 - update FreeListAllocator
 - update nonblockingQueue
 - update LockFreeStack
 - convert StringDedupTable
 - convert SingleWriterSynchronizer
 - test_atomic
 - Atomic<T>
 - add DependentAlwaysFalse

Changes: https://git.openjdk.org/jdk/pull/27462/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=27462&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8367013
  Stats: 1451 lines in 13 files changed: 1313 ins; 0 del; 138 mod
  Patch: https://git.openjdk.org/jdk/pull/27462.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/27462/head:pull/27462

PR: https://git.openjdk.org/jdk/pull/27462


More information about the hotspot-dev mailing list