On Wed, 5 Aug 2026 13:12:09 GMT, Viktor Klang <[email protected]> wrote:
>> Per Minborg has updated the pull request incrementally with one additional
>> commit since the last revision:
>>
>> Fix comment
>
> src/java.base/share/classes/java/util/LazyCollections.java line 597:
>
>> 595: private Mutexes(int length) {
>> 596: this.mutexes = new Object[length];
>> 597: UNSAFE.putIntRelease(this, COUNTER_OFFSET, length);
>
> @minborg You can avoid the putIntRelease if you write counter prior to
> writing mutexes (as the latter is a volatile write) both since you read
> mutexes before reading counter (and since your accesses to counter are all
> atomic / getAndAdd):
>
> Suggestion:
>
> this.counter = length; // plain write, will be published by the
> write to mutexes below
> this.mutexes = new Object[length];
Yes. But one of the objectives of this PR was to make them explicit, not
incidental.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/32070#discussion_r3966472915