< prev index next >

src/os_cpu/linux_sparc/vm/atomic_linux_sparc.hpp

Print this page
rev 13452 : [mq]: coleen_review1


 114     : "=r" (rv)
 115     : "r" (exchange_value), "r" (dest)
 116     : "memory", "o2", "o3");
 117   return rv;
 118 }
 119 
 120 inline void*    Atomic::xchg_ptr(void*    exchange_value, volatile void*     dest) {
 121   return (void*)xchg_ptr((intptr_t)exchange_value, (volatile intptr_t*)dest);
 122 }
 123 
 124 // No direct support for cmpxchg of bytes; emulate using int.
 125 template<>
 126 struct Atomic::PlatformCmpxchg<1> : Atomic::CmpxchgByteUsingInt {};
 127 
 128 template<>
 129 template<typename T>
 130 inline T Atomic::PlatformCmpxchg<4>::operator()(T exchange_value,
 131                                                 T volatile* dest,
 132                                                 T compare_value,
 133                                                 cmpxchg_memory_order order) {

 134   T rv;
 135   __asm__ volatile(
 136     " cas    [%2], %3, %0"
 137     : "=r" (rv)
 138     : "0" (exchange_value), "r" (dest), "r" (compare_value)
 139     : "memory");
 140   return rv;
 141 }
 142 
 143 template<>
 144 template<typename T>
 145 inline T Atomic::PlatformCmpxchg<8>::operator()(T exchange_value,
 146                                                 T volatile* dest,
 147                                                 T compare_value,
 148                                                 cmpxchg_memory_order order) {

 149   T rv;
 150   __asm__ volatile(
 151     " casx   [%2], %3, %0"
 152     : "=r" (rv)
 153     : "0" (exchange_value), "r" (dest), "r" (compare_value)
 154     : "memory");
 155   return rv;
 156 }
 157 
 158 #endif // OS_CPU_LINUX_SPARC_VM_ATOMIC_LINUX_SPARC_INLINE_HPP


 114     : "=r" (rv)
 115     : "r" (exchange_value), "r" (dest)
 116     : "memory", "o2", "o3");
 117   return rv;
 118 }
 119 
 120 inline void*    Atomic::xchg_ptr(void*    exchange_value, volatile void*     dest) {
 121   return (void*)xchg_ptr((intptr_t)exchange_value, (volatile intptr_t*)dest);
 122 }
 123 
 124 // No direct support for cmpxchg of bytes; emulate using int.
 125 template<>
 126 struct Atomic::PlatformCmpxchg<1> : Atomic::CmpxchgByteUsingInt {};
 127 
 128 template<>
 129 template<typename T>
 130 inline T Atomic::PlatformCmpxchg<4>::operator()(T exchange_value,
 131                                                 T volatile* dest,
 132                                                 T compare_value,
 133                                                 cmpxchg_memory_order order) {
 134   STATIC_ASSERT(4 == sizeof(T));
 135   T rv;
 136   __asm__ volatile(
 137     " cas    [%2], %3, %0"
 138     : "=r" (rv)
 139     : "0" (exchange_value), "r" (dest), "r" (compare_value)
 140     : "memory");
 141   return rv;
 142 }
 143 
 144 template<>
 145 template<typename T>
 146 inline T Atomic::PlatformCmpxchg<8>::operator()(T exchange_value,
 147                                                 T volatile* dest,
 148                                                 T compare_value,
 149                                                 cmpxchg_memory_order order) {
 150   STATIC_ASSERT(8 == sizeof(T));
 151   T rv;
 152   __asm__ volatile(
 153     " casx   [%2], %3, %0"
 154     : "=r" (rv)
 155     : "0" (exchange_value), "r" (dest), "r" (compare_value)
 156     : "memory");
 157   return rv;
 158 }
 159 
 160 #endif // OS_CPU_LINUX_SPARC_VM_ATOMIC_LINUX_SPARC_INLINE_HPP
< prev index next >