RFR 8158039 VarHandle float/double field/array access should support CAS/set/add atomics
Paul Sandoz
paul.sandoz at oracle.com
Wed Jul 6 12:27:20 UTC 2016
> On 6 Jul 2016, at 13:01, Andrew Haley <aph at redhat.com> wrote:
>
> I'm baffled by
>
> @ForceInline
> public final float compareAndExchangeFloatAcquire(Object o, long offset,
> float expected,
> float x) {
> int w = compareAndExchangeIntVolatile(o, offset,
> Float.floatToRawIntBits(expected),
> Float.floatToRawIntBits(x));
> return Float.intBitsToFloat(w);
> }
>
> Why does it use compareAndExchangeIntVolatile? It's a minor
> inefficiency, but it does generate an unnecessary write fence on a
> machine with relaxed memory consistency.
>
Opps, that’s an oversight (probably a copy/paste one, since the other methods are as expected). Thanks for noticing that.
I’ll fix once the changes get integrated into jdk9/dev (which i hope should occur soon).
https://bugs.openjdk.java.net/browse/JDK-8160885 <https://bugs.openjdk.java.net/browse/JDK-8160885>
Paul.
More information about the jdk9-dev
mailing list