[aarch64-port-dev ] RFR(XS): 8211320: Aarch64: unsafe.compareAndSetByte() and unsafe.compareAndSetShort() c2 intrinsics broken with negative expected value

Andrew Dinn adinn at redhat.com
Mon Oct 1 10:50:08 UTC 2018

On 01/10/18 11:43, Andrew Haley wrote:
> On 10/01/2018 11:09 AM, Roland Westrelin wrote:
>> http://cr.openjdk.java.net/~roland/8211320/webrev.00/
>> Intrinsics for unsafe.compareAndSetByte() and
>> unsafe.compareAndSetShort() don't properly deal with sign extension:
>> load exclusive doesn't sign extend loaded value but comparison is done
>> with sign extended value.
> Ooh, that's tricky. I wonder if we should do this inside cmpxchg().
> Mind you, that would cause cmpxchg() to have a side effect on an input
> operand.
You seem to have answered that question (correctly?) in the negative :-)

If you moved the sign extend into the cmpxchg method the C2 code would
still have to copy the input to a temporary register and pass the temp
into cmpxchg. Since this is the only place where a cmpxchgb actually
occurs that doesn't seem like a better solution.


Andrew Dinn
Senior Principal Software Engineer
Red Hat UK Ltd
Registered in England and Wales under Company Registration No. 03798903
Directors: Michael Cunningham, Michael ("Mike") O'Neill, Eric Shander

More information about the hotspot-compiler-dev mailing list