src/hotspot/os_cpu/bsd_zero/atomic_bsd_zero.hpp
changeset 59251 4cbfa5077d68
parent 59249 29b0d0b61615
child 59252 623722a6aeb9
equal deleted inserted replaced
59250:a6deb69743d4 59251:4cbfa5077d68
   195   return __sync_add_and_fetch(dest, add_value);
   195   return __sync_add_and_fetch(dest, add_value);
   196 }
   196 }
   197 
   197 
   198 template<>
   198 template<>
   199 template<typename T>
   199 template<typename T>
   200 inline T Atomic::PlatformXchg<4>::operator()(T exchange_value,
   200 inline T Atomic::PlatformXchg<4>::operator()(T volatile* dest,
   201                                              T volatile* dest,
   201                                              T exchange_value,
   202                                              atomic_memory_order order) const {
   202                                              atomic_memory_order order) const {
   203   STATIC_ASSERT(4 == sizeof(T));
   203   STATIC_ASSERT(4 == sizeof(T));
   204 #ifdef ARM
   204 #ifdef ARM
   205   return xchg_using_helper<int>(arm_lock_test_and_set, exchange_value, dest);
   205   return xchg_using_helper<int>(arm_lock_test_and_set, dest, exchange_value);
   206 #else
   206 #else
   207 #ifdef M68K
   207 #ifdef M68K
   208   return xchg_using_helper<int>(m68k_lock_test_and_set, exchange_value, dest);
   208   return xchg_using_helper<int>(m68k_lock_test_and_set, dest, exchange_value);
   209 #else
   209 #else
   210   // __sync_lock_test_and_set is a bizarrely named atomic exchange
   210   // __sync_lock_test_and_set is a bizarrely named atomic exchange
   211   // operation.  Note that some platforms only support this with the
   211   // operation.  Note that some platforms only support this with the
   212   // limitation that the only valid value to store is the immediate
   212   // limitation that the only valid value to store is the immediate
   213   // constant 1.  There is a test for this in JNI_CreateJavaVM().
   213   // constant 1.  There is a test for this in JNI_CreateJavaVM().
   222 #endif // ARM
   222 #endif // ARM
   223 }
   223 }
   224 
   224 
   225 template<>
   225 template<>
   226 template<typename T>
   226 template<typename T>
   227 inline T Atomic::PlatformXchg<8>::operator()(T exchange_value,
   227 inline T Atomic::PlatformXchg<8>::operator()(T volatile* dest,
   228                                              T volatile* dest,
   228                                              T exchange_value,
   229                                              atomic_memory_order order) const {
   229                                              atomic_memory_order order) const {
   230   STATIC_ASSERT(8 == sizeof(T));
   230   STATIC_ASSERT(8 == sizeof(T));
   231   T result = __sync_lock_test_and_set (dest, exchange_value);
   231   T result = __sync_lock_test_and_set (dest, exchange_value);
   232   __sync_synchronize();
   232   __sync_synchronize();
   233   return result;
   233   return result;