< prev index next >

src/hotspot/os_cpu/bsd_zero/atomic_bsd_zero.hpp

Print this page

        

*** 161,213 **** template<size_t byte_size> struct Atomic::PlatformAdd : Atomic::AddAndFetch<Atomic::PlatformAdd<byte_size> > { ! template<typename I, typename D> ! D add_and_fetch(I add_value, D volatile* dest, atomic_memory_order order) const; }; template<> ! template<typename I, typename D> ! inline D Atomic::PlatformAdd<4>::add_and_fetch(I add_value, D volatile* dest, atomic_memory_order order) const { STATIC_ASSERT(4 == sizeof(I)); STATIC_ASSERT(4 == sizeof(D)); #ifdef ARM ! return add_using_helper<int>(arm_add_and_fetch, add_value, dest); #else #ifdef M68K ! return add_using_helper<int>(m68k_add_and_fetch, add_value, dest); #else return __sync_add_and_fetch(dest, add_value); #endif // M68K #endif // ARM } template<> ! template<typename I, typename D> ! inline D Atomic::PlatformAdd<8>::add_and_fetch(I add_value, D volatile* dest, atomic_memory_order order) const { STATIC_ASSERT(8 == sizeof(I)); STATIC_ASSERT(8 == sizeof(D)); return __sync_add_and_fetch(dest, add_value); } template<> template<typename T> ! inline T Atomic::PlatformXchg<4>::operator()(T exchange_value, ! T volatile* dest, atomic_memory_order order) const { STATIC_ASSERT(4 == sizeof(T)); #ifdef ARM ! return xchg_using_helper<int>(arm_lock_test_and_set, exchange_value, dest); #else #ifdef M68K ! return xchg_using_helper<int>(m68k_lock_test_and_set, exchange_value, dest); #else // __sync_lock_test_and_set is a bizarrely named atomic exchange // operation. Note that some platforms only support this with the // limitation that the only valid value to store is the immediate // constant 1. There is a test for this in JNI_CreateJavaVM(). --- 161,213 ---- template<size_t byte_size> struct Atomic::PlatformAdd : Atomic::AddAndFetch<Atomic::PlatformAdd<byte_size> > { ! template<typename D, typename I> ! D add_and_fetch(D volatile* dest, I add_value, atomic_memory_order order) const; }; template<> ! template<typename D, typename I> ! inline D Atomic::PlatformAdd<4>::add_and_fetch(D volatile* dest, I add_value, atomic_memory_order order) const { STATIC_ASSERT(4 == sizeof(I)); STATIC_ASSERT(4 == sizeof(D)); #ifdef ARM ! return add_using_helper<int>(arm_add_and_fetch, dest, add_value); #else #ifdef M68K ! return add_using_helper<int>(m68k_add_and_fetch, dest, add_value); #else return __sync_add_and_fetch(dest, add_value); #endif // M68K #endif // ARM } template<> ! template<typename D, typename !> ! inline D Atomic::PlatformAdd<8>::add_and_fetch(D volatile* dest, I add_value, atomic_memory_order order) const { STATIC_ASSERT(8 == sizeof(I)); STATIC_ASSERT(8 == sizeof(D)); return __sync_add_and_fetch(dest, add_value); } template<> template<typename T> ! inline T Atomic::PlatformXchg<4>::operator()(T volatile* dest, ! T exchange_value, atomic_memory_order order) const { STATIC_ASSERT(4 == sizeof(T)); #ifdef ARM ! return xchg_using_helper<int>(arm_lock_test_and_set, dest, exchange_value); #else #ifdef M68K ! return xchg_using_helper<int>(m68k_lock_test_and_set, dest, exchange_value); #else // __sync_lock_test_and_set is a bizarrely named atomic exchange // operation. Note that some platforms only support this with the // limitation that the only valid value to store is the immediate // constant 1. There is a test for this in JNI_CreateJavaVM().
*** 222,233 **** #endif // ARM } template<> template<typename T> ! inline T Atomic::PlatformXchg<8>::operator()(T exchange_value, ! T volatile* dest, atomic_memory_order order) const { STATIC_ASSERT(8 == sizeof(T)); T result = __sync_lock_test_and_set (dest, exchange_value); __sync_synchronize(); return result; --- 222,233 ---- #endif // ARM } template<> template<typename T> ! inline T Atomic::PlatformXchg<8>::operator()(T volatile* dest, ! T exchange_value, atomic_memory_order order) const { STATIC_ASSERT(8 == sizeof(T)); T result = __sync_lock_test_and_set (dest, exchange_value); __sync_synchronize(); return result;
*** 237,267 **** template<> struct Atomic::PlatformCmpxchg<1> : Atomic::CmpxchgByteUsingInt {}; template<> template<typename T> ! inline T Atomic::PlatformCmpxchg<4>::operator()(T exchange_value, ! T volatile* dest, T compare_value, atomic_memory_order order) const { STATIC_ASSERT(4 == sizeof(T)); #ifdef ARM ! return cmpxchg_using_helper<int>(arm_compare_and_swap, exchange_value, dest, compare_value); #else #ifdef M68K ! return cmpxchg_using_helper<int>(m68k_compare_and_swap, exchange_value, dest, compare_value); #else return __sync_val_compare_and_swap(dest, compare_value, exchange_value); #endif // M68K #endif // ARM } template<> template<typename T> ! inline T Atomic::PlatformCmpxchg<8>::operator()(T exchange_value, ! T volatile* dest, T compare_value, atomic_memory_order order) const { STATIC_ASSERT(8 == sizeof(T)); return __sync_val_compare_and_swap(dest, compare_value, exchange_value); } --- 237,267 ---- template<> struct Atomic::PlatformCmpxchg<1> : Atomic::CmpxchgByteUsingInt {}; template<> template<typename T> ! inline T Atomic::PlatformCmpxchg<4>::operator()(T volatile* dest, T compare_value, + T exchange_value, atomic_memory_order order) const { STATIC_ASSERT(4 == sizeof(T)); #ifdef ARM ! return cmpxchg_using_helper<int>(arm_compare_and_swap, dest, compare_value, exchange_value); #else #ifdef M68K ! return cmpxchg_using_helper<int>(m68k_compare_and_swap, dest, compare_value, exchange_value); #else return __sync_val_compare_and_swap(dest, compare_value, exchange_value); #endif // M68K #endif // ARM } template<> template<typename T> ! inline T Atomic::PlatformCmpxchg<8>::operator()(T volatile* dest, T compare_value, + T exchange_value, atomic_memory_order order) const { STATIC_ASSERT(8 == sizeof(T)); return __sync_val_compare_and_swap(dest, compare_value, exchange_value); }
*** 274,285 **** return PrimitiveConversions::cast<T>(dest); } template<> template<typename T> ! inline void Atomic::PlatformStore<8>::operator()(T store_value, ! T volatile* dest) const { STATIC_ASSERT(8 == sizeof(T)); os::atomic_copy64(reinterpret_cast<const volatile int64_t*>(&store_value), reinterpret_cast<volatile int64_t*>(dest)); } #endif // OS_CPU_BSD_ZERO_ATOMIC_BSD_ZERO_HPP --- 274,285 ---- return PrimitiveConversions::cast<T>(dest); } template<> template<typename T> ! inline void Atomic::PlatformStore<8>::operator()(T volatile* dest, ! T store_value) const { STATIC_ASSERT(8 == sizeof(T)); os::atomic_copy64(reinterpret_cast<const volatile int64_t*>(&store_value), reinterpret_cast<volatile int64_t*>(dest)); } #endif // OS_CPU_BSD_ZERO_ATOMIC_BSD_ZERO_HPP
< prev index next >