Single byte Atomic::cmpxchg implementation

Andrew Haley aph at
Thu Sep 11 11:24:49 UTC 2014

On 09/11/2014 12:18 PM, Erik Österlund wrote:
> On 11 Sep 2014, at 10:22, Andrew Haley <aph at> wrote:
>> From the AArch64 project's point of view, all we need is for the
>> single byte Atomic::cmpxchg implementation to be move into os_cpu/
>> and we can do the rest.
> I agree that it definitely needs to allow platform specific
> implementations. But I would also advocate not using
> __kernel_cmpxchg in MP AArch64 even for normal jint CAS for the
> simple reason that it only optimizes non-MP performance, and has an
> interface returning boolean instead of the old value needing a
> translation to the interface we expect, resulting in a less
> efficient implementation with two nested loops and a call (for
> normal jint CAS) instead of a single loop retrying only on spurious
> SC failure due to scheduling.

Sure; just to be clear, I wasn't thinking about __kernel_cmpxchg, bug a
GCC builtin.  AFAIK __kernel_cmpxchg isn't used for anything on
AArch64, and we certainly don't need it.


More information about the hotspot-dev mailing list