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 596: > 594: private Mutexes(int length) { > 595: this.mutexes = new Object[length]; // Volatile access > 596: this.counter = new AtomicInteger(length); // Volatile access Does it really matter that this is volatile access in the constructor w/o leaked "this"? src/java.base/share/classes/java/util/LazyCollections.java line 620: > 618: > 619: private void releaseMutex(long offset) { > 620: // Replace the old mutex with a tomb stone since now the old > mutex can be collected. "UNSAFE.putReferenceVolatile" below is also "Volatile read access" of the "mutexes" field. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/32069#discussion_r3670385455 PR Review Comment: https://git.openjdk.org/jdk/pull/32069#discussion_r3670397485
