RFR: 8371923: Update LockFreeStack for Atomic<T>

Kim Barrett kbarrett at openjdk.org
Fri Nov 14 18:42:02 UTC 2025


Please review this change to the `LockFreeStack` utility to allow clients to
use `Atomic<T>` as the type of the "next" member used in the linked-list
representation of the stack. It also continues to allow clients to use the old
(pre-`Atomic<T>`) form where the "next" member is volatile. This allows
clients to be updated incrementally after this change, rather than requiring
all clients to be updated in conjunction with the update of this class. Once
all clients have been updated, support for the old form can be removed.

The associated gtests have been updated to use `Atomic<T>`, with testing of
the old form is no longer being done. The non-updated uses provide some
testing, and that's all expected to go away soon. So parameterizing the gtests
for both forms seems like a bunch of work that will just be deleted soon, with
very little benefit.

Testing: mach5 tier1

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

Commit messages:
 - LockFreeStack supports Atomic<T>

Changes: https://git.openjdk.org/jdk/pull/28329/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=28329&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8371923
  Stats: 53 lines in 2 files changed: 21 ins; 0 del; 32 mod
  Patch: https://git.openjdk.org/jdk/pull/28329.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/28329/head:pull/28329

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


More information about the hotspot-dev mailing list