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 

When I run the test in 
it fails because Unsafe.compareAndSwapShort() returns an incorrect 
value. This test passes without my implementation of 

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()?


More information about the hotspot-dev mailing list