On Wed, 24 Jun 2026 11:08:37 GMT, Viktor Klang <[email protected]> wrote:

>> src/java.base/share/classes/jdk/internal/misc/Unsafe.java line 1881:
>> 
>>> 1879:             return compareAndSetReference(o, offset, valueType, 
>>> expected, x);
>>> 1880:         } else {
>>> 1881:             return weakCompareAndSetReferencePlain(o, offset, 
>>> expected, x);
>> 
>> Looks like this is delegating to the wrong method
>> 
>> Suggestion:
>> 
>>             return weakCompareAndSetReferenceAcquire(o, offset, expected, x);
>
> Yeah, this can definitely not be a weaker access than requested.

Please continue the discussions at https://github.com/openjdk/valhalla/pull/2576

>> src/java.base/share/classes/jdk/internal/misc/Unsafe.java line 1908:
>> 
>>> 1906:             return compareAndSetReference(o, offset, valueType, 
>>> expected, x);
>>> 1907:         } else {
>>> 1908:             return weakCompareAndSetReferencePlain(o, offset, 
>>> expected, x);
>> 
>> Same here
>> 
>> Suggestion:
>> 
>>             return weakCompareAndSetReferenceRelease(o, offset, expected, x);
>
> Yeah, this can definitely not be a weaker access than requested.

Please continue the discussions at https://github.com/openjdk/valhalla/pull/2576

>> src/java.base/share/classes/jdk/internal/misc/Unsafe.java line 1935:
>> 
>>> 1933:             return compareAndSetReference(o, offset, valueType, 
>>> expected, x);
>>> 1934:         } else {
>>> 1935:             return weakCompareAndSetReferencePlain(o, offset, 
>>> expected, x);
>> 
>> Suggestion:
>> 
>>             return weakCompareAndSetReference(o, offset, expected, x);
>
> Yeah, this can definitely not be a weaker access than requested.

Please continue the discussions at https://github.com/openjdk/valhalla/pull/2576

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

PR Review Comment: https://git.openjdk.org/jdk/pull/31123#discussion_r3467161486
PR Review Comment: https://git.openjdk.org/jdk/pull/31123#discussion_r3467162655
PR Review Comment: https://git.openjdk.org/jdk/pull/31123#discussion_r3467163028

Reply via email to