< prev index next >

src/hotspot/os_cpu/bsd_zero/atomic_bsd_zero.hpp

Print this page




 259 template<typename T>
 260 inline T Atomic::PlatformCmpxchg<8>::operator()(T exchange_value,
 261                                                 T volatile* dest,
 262                                                 T compare_value,
 263                                                 atomic_memory_order order) const {
 264   STATIC_ASSERT(8 == sizeof(T));
 265   return __sync_val_compare_and_swap(dest, compare_value, exchange_value);
 266 }
 267 
 268 template<>
 269 template<typename T>
 270 inline T Atomic::PlatformLoad<8>::operator()(T const volatile* src) const {
 271   STATIC_ASSERT(8 == sizeof(T));
 272   volatile int64_t dest;
 273   os::atomic_copy64(reinterpret_cast<const volatile int64_t*>(src), reinterpret_cast<volatile int64_t*>(&dest));
 274   return PrimitiveConversions::cast<T>(dest);
 275 }
 276 
 277 template<>
 278 template<typename T>
 279 inline void Atomic::PlatformStore<8>::operator()(T store_value,
 280                                                  T volatile* dest) const {
 281   STATIC_ASSERT(8 == sizeof(T));
 282   os::atomic_copy64(reinterpret_cast<const volatile int64_t*>(&store_value), reinterpret_cast<volatile int64_t*>(dest));
 283 }
 284 
 285 #endif // OS_CPU_BSD_ZERO_ATOMIC_BSD_ZERO_HPP


 259 template<typename T>
 260 inline T Atomic::PlatformCmpxchg<8>::operator()(T exchange_value,
 261                                                 T volatile* dest,
 262                                                 T compare_value,
 263                                                 atomic_memory_order order) const {
 264   STATIC_ASSERT(8 == sizeof(T));
 265   return __sync_val_compare_and_swap(dest, compare_value, exchange_value);
 266 }
 267 
 268 template<>
 269 template<typename T>
 270 inline T Atomic::PlatformLoad<8>::operator()(T const volatile* src) const {
 271   STATIC_ASSERT(8 == sizeof(T));
 272   volatile int64_t dest;
 273   os::atomic_copy64(reinterpret_cast<const volatile int64_t*>(src), reinterpret_cast<volatile int64_t*>(&dest));
 274   return PrimitiveConversions::cast<T>(dest);
 275 }
 276 
 277 template<>
 278 template<typename T>
 279 inline void Atomic::PlatformStore<8>::operator()(T volatile* dest,
 280                                                  T store_value) const {
 281   STATIC_ASSERT(8 == sizeof(T));
 282   os::atomic_copy64(reinterpret_cast<const volatile int64_t*>(&store_value), reinterpret_cast<volatile int64_t*>(dest));
 283 }
 284 
 285 #endif // OS_CPU_BSD_ZERO_ATOMIC_BSD_ZERO_HPP
< prev index next >