atomic add
Lukas Stadler
lukas.stadler at jku.at
Tue Sep 10 00:33:34 PDT 2013
Currently this is handled by the intrinsification of Unsafe.compareAndSwapInt, where it's too late to easily see that it's supposed to be an addition.
You could add a substitution class AtomicIntegerSubstitution (similar to UnsafeSubstitution) with a substitution for the add method and use an AtomicAddNode (just like the unsafe substitution uses a CompareAndSwapNode).
That node needs to be lowered to an LIR op that does the atomic add.
- Lukas
On Sep 9, 2013, at 23:29, "Deneau, Tom" <tom.deneau at amd.com> wrote:
> HSAIL has an atomic_add instruction. I would like this instruction to be emitted when we see something like
>
> AtomicInteger atomicInt = new AtomicInteger();
> xxx = atomicInt.getAndAdd(amount);
>
> What are the steps necessary to get this to happen?
>
> I would prefer not to go thru a cas for this.
> (I see on amd64 that the above code maps to a lock cmpxchg sequence)
>
> -- Tom
>
>
More information about the graal-dev
mailing list