Lock-free code in HotSpot uses an idiom of declaring variables `volatile` and using operations from the `Atomic` class to access and modify those variables. It would be better to package that idiom, preventing accidental misuse such as using non-atomic read-modify-write arithmetic operations on such variables.
The proposal is to add `Atomic<T>`, where `T` is a supported atomic type as before. Then incrementally replace (most) uses of that idiom with uses of this new type. "Most" because it is expected there will be some small residue where use of the `Atomic<T>` class isn't appropriate. One example is BitMap, which provides some atomic operations but where it would not be appropriate to change the underlying data to be an array of `Atomic<bm_word_t>`.
The proposal is to add `Atomic<T>`, where `T` is a supported atomic type as before. Then incrementally replace (most) uses of that idiom with uses of this new type. "Most" because it is expected there will be some small residue where use of the `Atomic<T>` class isn't appropriate. One example is BitMap, which provides some atomic operations but where it would not be appropriate to change the underlying data to be an array of `Atomic<bm_word_t>`.
- is blocked by
-
JDK-8367014 Rename class Atomic to AtomicAccess
-
- New
-
- relates to
-
JDK-8247213 G1: Reduce usage of volatile in favour of Atomic operations
-
- Open
-