src/hotspot/os_cpu/bsd_x86/atomic_bsd_x86.hpp
changeset 59248 e92153ed8bdc
parent 59247 56bf71d64d51
child 59249 29b0d0b61615
equal deleted inserted replaced
59247:56bf71d64d51 59248:e92153ed8bdc
   159   return PrimitiveConversions::cast<T>(dest);
   159   return PrimitiveConversions::cast<T>(dest);
   160 }
   160 }
   161 
   161 
   162 template<>
   162 template<>
   163 template<typename T>
   163 template<typename T>
   164 inline void Atomic::PlatformStore<8>::operator()(T store_value,
   164 inline void Atomic::PlatformStore<8>::operator()(T volatile* dest,
   165                                                  T volatile* dest) const {
   165                                                  T store_value) const {
   166   STATIC_ASSERT(8 == sizeof(T));
   166   STATIC_ASSERT(8 == sizeof(T));
   167   _Atomic_move_long(reinterpret_cast<const volatile int64_t*>(&store_value), reinterpret_cast<volatile int64_t*>(dest));
   167   _Atomic_move_long(reinterpret_cast<const volatile int64_t*>(&store_value), reinterpret_cast<volatile int64_t*>(dest));
   168 }
   168 }
   169 
   169 
   170 #endif // AMD64
   170 #endif // AMD64
   171 
   171 
   172 template<>
   172 template<>
   173 struct Atomic::PlatformOrderedStore<1, RELEASE_X_FENCE>
   173 struct Atomic::PlatformOrderedStore<1, RELEASE_X_FENCE>
   174 {
   174 {
   175   template <typename T>
   175   template <typename T>
   176   void operator()(T v, volatile T* p) const {
   176   void operator()(volatile T* p, T v) const {
   177     __asm__ volatile (  "xchgb (%2),%0"
   177     __asm__ volatile (  "xchgb (%2),%0"
   178                       : "=q" (v)
   178                       : "=q" (v)
   179                       : "0" (v), "r" (p)
   179                       : "0" (v), "r" (p)
   180                       : "memory");
   180                       : "memory");
   181   }
   181   }
   183 
   183 
   184 template<>
   184 template<>
   185 struct Atomic::PlatformOrderedStore<2, RELEASE_X_FENCE>
   185 struct Atomic::PlatformOrderedStore<2, RELEASE_X_FENCE>
   186 {
   186 {
   187   template <typename T>
   187   template <typename T>
   188   void operator()(T v, volatile T* p) const {
   188   void operator()(volatile T* p, T v) const {
   189     __asm__ volatile (  "xchgw (%2),%0"
   189     __asm__ volatile (  "xchgw (%2),%0"
   190                       : "=r" (v)
   190                       : "=r" (v)
   191                       : "0" (v), "r" (p)
   191                       : "0" (v), "r" (p)
   192                       : "memory");
   192                       : "memory");
   193   }
   193   }
   195 
   195 
   196 template<>
   196 template<>
   197 struct Atomic::PlatformOrderedStore<4, RELEASE_X_FENCE>
   197 struct Atomic::PlatformOrderedStore<4, RELEASE_X_FENCE>
   198 {
   198 {
   199   template <typename T>
   199   template <typename T>
   200   void operator()(T v, volatile T* p) const {
   200   void operator()(volatile T* p, T v) const {
   201     __asm__ volatile (  "xchgl (%2),%0"
   201     __asm__ volatile (  "xchgl (%2),%0"
   202                       : "=r" (v)
   202                       : "=r" (v)
   203                       : "0" (v), "r" (p)
   203                       : "0" (v), "r" (p)
   204                       : "memory");
   204                       : "memory");
   205   }
   205   }
   208 #ifdef AMD64
   208 #ifdef AMD64
   209 template<>
   209 template<>
   210 struct Atomic::PlatformOrderedStore<8, RELEASE_X_FENCE>
   210 struct Atomic::PlatformOrderedStore<8, RELEASE_X_FENCE>
   211 {
   211 {
   212   template <typename T>
   212   template <typename T>
   213   void operator()(T v, volatile T* p) const {
   213   void operator()(volatile T* p, T v) const {
   214     __asm__ volatile (  "xchgq (%2), %0"
   214     __asm__ volatile (  "xchgq (%2), %0"
   215                       : "=r" (v)
   215                       : "=r" (v)
   216                       : "0" (v), "r" (p)
   216                       : "0" (v), "r" (p)
   217                       : "memory");
   217                       : "memory");
   218   }
   218   }