RFR: jsr166 jdk9 integration wave 9

Aleksey Shipilev aleksey.shipilev at gmail.com
Thu Aug 11 21:12:34 UTC 2016


On 08/11/2016 11:56 PM, Martin Buchholz wrote:
> I can imagine a machine that has a native cas instruction, but no native
> exchange instruction, but no one ever got fired for optimizing for x86.

...which would be less of an issue once we switch to proper-boolean
VarHandles, not the int-simulation. This way, implementations may choose
how to implement boolean getAndSet. Probably in Unsafe, but that would
still be lower and more reusable than in AtomicBoolean alone.

>     public final boolean getAndSet(boolean newValue) {
>         return (int)VALUE.getAndSet(this, (newValue ? 1 : 0)) != 0;
>     }

Yup.

Thanks,
-Aleksey



More information about the core-libs-dev mailing list