[jmm-dev] jdk9 APIs

Aleksey Shipilev aleksey.shipilev at oracle.com
Wed Aug 12 16:20:44 UTC 2015


On 08/12/2015 01:43 PM, Doug Lea wrote:
> On 08/12/2015 04:35 AM, Andrew Haley wrote:
>> On 12/08/15 09:33, Aleksey Shipilev wrote:
>>> Or is it the other way around: weakCAS is relaxed by default, and
>>> acq/rel weakCAS version are actually *stronger* than default weakCAS?
>>
>> That's how I read it.
>>
>> weakCompareAndSet        is   ldxr; cmp; stxr
>> weakCompareAndSetAcquire is   ldaxr; cmp; stxr
>> weakCompareAndSetRelease is   ldxr; cmp; stlxr
>>
> 
> Yes. Exactly so. I'll make a pass on the specs to clarify.
> 
> We defined weakCAS back in the original JDK5 atomics, but
> just linked the Java code to plain Unsafe CAS, with the
> expectation that someday someone would add intrinsics
> allowing a these kinds of implementations. More than a
> decade later, the intrinsics still don't exist. So it is
> nice to see you and Aleksey contemplating this (also for
> the acq/rel versions).

Yes, we are drilling more holes in Unsafe/VarHandles to support these
usages:
 https://bugs.openjdk.java.net/browse/JDK-8133451

Andrew, I sent a separate note with a patch to review.

Thanks,
-Aleksey



More information about the jmm-dev mailing list