< prev index next >

src/hotspot/os_cpu/linux_zero/atomic_linux_zero.hpp

Print this page




 105 template<typename T>
 106 inline T Atomic::PlatformCmpxchg<8>::operator()(T exchange_value,
 107                                                 T volatile* dest,
 108                                                 T compare_value,
 109                                                 atomic_memory_order order) const {
 110   STATIC_ASSERT(8 == sizeof(T));
 111   return __sync_val_compare_and_swap(dest, compare_value, exchange_value);
 112 }
 113 
 114 template<>
 115 template<typename T>
 116 inline T Atomic::PlatformLoad<8>::operator()(T const volatile* src) const {
 117   STATIC_ASSERT(8 == sizeof(T));
 118   volatile int64_t dest;
 119   os::atomic_copy64(reinterpret_cast<const volatile int64_t*>(src), reinterpret_cast<volatile int64_t*>(&dest));
 120   return PrimitiveConversions::cast<T>(dest);
 121 }
 122 
 123 template<>
 124 template<typename T>
 125 inline void Atomic::PlatformStore<8>::operator()(T store_value,
 126                                                  T volatile* dest) const {
 127   STATIC_ASSERT(8 == sizeof(T));
 128   os::atomic_copy64(reinterpret_cast<const volatile int64_t*>(&store_value), reinterpret_cast<volatile int64_t*>(dest));
 129 }
 130 
 131 #endif // OS_CPU_LINUX_ZERO_ATOMIC_LINUX_ZERO_HPP


 105 template<typename T>
 106 inline T Atomic::PlatformCmpxchg<8>::operator()(T exchange_value,
 107                                                 T volatile* dest,
 108                                                 T compare_value,
 109                                                 atomic_memory_order order) const {
 110   STATIC_ASSERT(8 == sizeof(T));
 111   return __sync_val_compare_and_swap(dest, compare_value, exchange_value);
 112 }
 113 
 114 template<>
 115 template<typename T>
 116 inline T Atomic::PlatformLoad<8>::operator()(T const volatile* src) const {
 117   STATIC_ASSERT(8 == sizeof(T));
 118   volatile int64_t dest;
 119   os::atomic_copy64(reinterpret_cast<const volatile int64_t*>(src), reinterpret_cast<volatile int64_t*>(&dest));
 120   return PrimitiveConversions::cast<T>(dest);
 121 }
 122 
 123 template<>
 124 template<typename T>
 125 inline void Atomic::PlatformStore<8>::operator()(T volatile* dest,
 126                                                  T store_value) const {
 127   STATIC_ASSERT(8 == sizeof(T));
 128   os::atomic_copy64(reinterpret_cast<const volatile int64_t*>(&store_value), reinterpret_cast<volatile int64_t*>(dest));
 129 }
 130 
 131 #endif // OS_CPU_LINUX_ZERO_ATOMIC_LINUX_ZERO_HPP
< prev index next >