src/hotspot/os_cpu/linux_zero/atomic_linux_zero.hpp
changeset 59251 4cbfa5077d68
parent 59249 29b0d0b61615
child 59252 623722a6aeb9
equal deleted inserted replaced
59250:a6deb69743d4 59251:4cbfa5077d68
    57   return __sync_add_and_fetch(dest, add_value);
    57   return __sync_add_and_fetch(dest, add_value);
    58 }
    58 }
    59 
    59 
    60 template<>
    60 template<>
    61 template<typename T>
    61 template<typename T>
    62 inline T Atomic::PlatformXchg<4>::operator()(T exchange_value,
    62 inline T Atomic::PlatformXchg<4>::operator()(T volatile* dest,
    63                                              T volatile* dest,
    63                                              T exchange_value,
    64                                              atomic_memory_order order) const {
    64                                              atomic_memory_order order) const {
    65   STATIC_ASSERT(4 == sizeof(T));
    65   STATIC_ASSERT(4 == sizeof(T));
    66   // __sync_lock_test_and_set is a bizarrely named atomic exchange
    66   // __sync_lock_test_and_set is a bizarrely named atomic exchange
    67   // operation.  Note that some platforms only support this with the
    67   // operation.  Note that some platforms only support this with the
    68   // limitation that the only valid value to store is the immediate
    68   // limitation that the only valid value to store is the immediate
    76   return result;
    76   return result;
    77 }
    77 }
    78 
    78 
    79 template<>
    79 template<>
    80 template<typename T>
    80 template<typename T>
    81 inline T Atomic::PlatformXchg<8>::operator()(T exchange_value,
    81 inline T Atomic::PlatformXchg<8>::operator()(T volatile* dest,
    82                                              T volatile* dest,
    82                                              T exchange_value,
    83                                              atomic_memory_order order) const {
    83                                              atomic_memory_order order) const {
    84   STATIC_ASSERT(8 == sizeof(T));
    84   STATIC_ASSERT(8 == sizeof(T));
    85   T result = __sync_lock_test_and_set (dest, exchange_value);
    85   T result = __sync_lock_test_and_set (dest, exchange_value);
    86   __sync_synchronize();
    86   __sync_synchronize();
    87   return result;
    87   return result;