[jmm-dev] jdk9 APIs

Doug Lea dl at cs.oswego.edu
Wed Aug 12 10:43:07 UTC 2015


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).

-Doug




More information about the jmm-dev mailing list