< prev index next >

src/os_cpu/bsd_zero/vm/atomic_bsd_zero.inline.hpp

Print this page
@  rev 7104 : 8067331: Zero: Atomic::xchg and Atomic::xchg_ptr need full memory barrier
|

*** 236,246 **** #else // __sync_lock_test_and_set is a bizarrely named atomic exchange // operation. Note that some platforms only support this with the // limitation that the only valid value to store is the immediate // constant 1. There is a test for this in JNI_CreateJavaVM(). ! return __sync_lock_test_and_set (dest, exchange_value); #endif // M68K #endif // ARM } inline intptr_t Atomic::xchg_ptr(intptr_t exchange_value, --- 236,252 ---- #else // __sync_lock_test_and_set is a bizarrely named atomic exchange // operation. Note that some platforms only support this with the // limitation that the only valid value to store is the immediate // constant 1. There is a test for this in JNI_CreateJavaVM(). ! jint result = __sync_lock_test_and_set (dest, exchange_value); ! // All atomic operations are expected to be full memory barriers ! // (see atomic.hpp). However, __sync_lock_test_and_set is not ! // a full memory barrier, but an acquire barrier. Hence, this added ! // barrier. ! __sync_synchronize(); ! return result; #endif // M68K #endif // ARM } inline intptr_t Atomic::xchg_ptr(intptr_t exchange_value,
*** 249,259 **** return arm_lock_test_and_set(dest, exchange_value); #else #ifdef M68K return m68k_lock_test_and_set(dest, exchange_value); #else ! return __sync_lock_test_and_set (dest, exchange_value); #endif // M68K #endif // ARM } inline void* Atomic::xchg_ptr(void* exchange_value, volatile void* dest) { --- 255,267 ---- return arm_lock_test_and_set(dest, exchange_value); #else #ifdef M68K return m68k_lock_test_and_set(dest, exchange_value); #else ! intptr_t result = __sync_lock_test_and_set (dest, exchange_value); ! __sync_synchronize(); ! return result; #endif // M68K #endif // ARM } inline void* Atomic::xchg_ptr(void* exchange_value, volatile void* dest) {
< prev index next >