Unsafe compareAnd*

Trevor Watson trevor.d.watson at oracle.com
Thu Nov 17 17:29:14 UTC 2016


I'm working on an implementation of the C2 code for 
compareAndExchangeShort on SPARC.

I've only implemented this function so far, and no compareAndSwapShort 
equivalent.

When I run the test in 
hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestShort.java 
it fails because Unsafe.compareAndSwapShort() returns an incorrect 
value. This test passes without my implementation of 
compareAndExchangeShort.

If I comment out the Unsafe.compareAndSwapShort() tests, the 
Unsafe.compareAndExchangeShort tests run successfully but the 
Unsafe.weakCompareAndSwapShort() tests subsequently fail.

Can anyone tell me why it might be that an implementation for 
CompareAndExchangeS would trigger a failure in Unsafe.compareAndSwapShort()?

Thanks,
Trevor


More information about the hotspot-dev mailing list