d904612
diff --git a/src/os_cpu/linux_zero/vm/atomic_linux_zero.inline.hpp b/src/os_cpu/linux_zero/vm/atomic_linux_zero.inline.hpp
d904612
--- jdk8/hotspot/src/os_cpu/linux_zero/vm/atomic_linux_zero.inline.hpp
d904612
+++ jdk8/hotspot/src/os_cpu/linux_zero/vm/atomic_linux_zero.inline.hpp
d904612
@@ -222,31 +222,35 @@
d904612
 
d904612
 inline jint Atomic::xchg(jint exchange_value, volatile jint* dest) {
d904612
 #ifdef ARM
d904612
-  return arm_lock_test_and_set(dest, exchange_value);
d904612
+  jint result = arm_lock_test_and_set(dest, exchange_value);
d904612
 #else
d904612
 #ifdef M68K
d904612
-  return m68k_lock_test_and_set(dest, exchange_value);
d904612
+  jint result = m68k_lock_test_and_set(dest, exchange_value);
d904612
 #else
d904612
   // __sync_lock_test_and_set is a bizarrely named atomic exchange
d904612
   // operation.  Note that some platforms only support this with the
d904612
   // limitation that the only valid value to store is the immediate
d904612
   // constant 1.  There is a test for this in JNI_CreateJavaVM().
d904612
-  return __sync_lock_test_and_set (dest, exchange_value);
d904612
+  jint result = __sync_lock_test_and_set (dest, exchange_value);
d904612
+  __sync_synchronize();
d904612
 #endif // M68K
d904612
 #endif // ARM
d904612
+  return result;
d904612
 }
d904612
 
d904612
 inline intptr_t Atomic::xchg_ptr(intptr_t exchange_value,
d904612
                                  volatile intptr_t* dest) {
d904612
 #ifdef ARM
d904612
-  return arm_lock_test_and_set(dest, exchange_value);
d904612
+  intptr_t result = arm_lock_test_and_set(dest, exchange_value);
d904612
 #else
d904612
 #ifdef M68K
d904612
-  return m68k_lock_test_and_set(dest, exchange_value);
d904612
+  intptr_t result = m68k_lock_test_and_set(dest, exchange_value);
d904612
 #else
d904612
-  return __sync_lock_test_and_set (dest, exchange_value);
d904612
+  intptr_t result = __sync_lock_test_and_set (dest, exchange_value);
d904612
+  __sync_synchronize();
d904612
 #endif // M68K
d904612
 #endif // ARM
d904612
+  return result;
d904612
 }
d904612
 
d904612
 inline void* Atomic::xchg_ptr(void* exchange_value, volatile void* dest) {