On Tue, 28 Jul 2026 12:26:05 GMT, Per Minborg <[email protected]> wrote:
> This PR proposes to add comments in `LazyConstants.Mutexes` so that it > becomes more evident where we have `volatile` access. > > --------- > - [x] I confirm that I make this contribution in accordance with the [OpenJDK > Interim AI Policy](https://openjdk.org/legal/ai). src/java.base/share/classes/java/util/LazyCollections.java line 623: > 621: UNSAFE.putReferenceVolatile(mutexes, offset, TOMB_STONE); > 622: // Volatile access on `counter` > 623: if (counter != null && counter.decrementAndGet() == 0) { Ideally we should do a single volatile read into a local variable than two volatile reads ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/32069#discussion_r3670502857
