src/hotspot/os_cpu/bsd_zero/atomic_bsd_zero.hpp
changeset 59249 29b0d0b61615
parent 59248 e92153ed8bdc
child 59251 4cbfa5077d68
equal deleted inserted replaced
59248:e92153ed8bdc 59249:29b0d0b61615
   161 
   161 
   162 template<size_t byte_size>
   162 template<size_t byte_size>
   163 struct Atomic::PlatformAdd
   163 struct Atomic::PlatformAdd
   164   : Atomic::AddAndFetch<Atomic::PlatformAdd<byte_size> >
   164   : Atomic::AddAndFetch<Atomic::PlatformAdd<byte_size> >
   165 {
   165 {
   166   template<typename I, typename D>
   166   template<typename D, typename I>
   167   D add_and_fetch(I add_value, D volatile* dest, atomic_memory_order order) const;
   167   D add_and_fetch(D volatile* dest, I add_value, atomic_memory_order order) const;
   168 };
   168 };
   169 
   169 
   170 template<>
   170 template<>
   171 template<typename I, typename D>
   171 template<typename D, typename I>
   172 inline D Atomic::PlatformAdd<4>::add_and_fetch(I add_value, D volatile* dest,
   172 inline D Atomic::PlatformAdd<4>::add_and_fetch(D volatile* dest, I add_value,
   173                                                atomic_memory_order order) const {
   173                                                atomic_memory_order order) const {
   174   STATIC_ASSERT(4 == sizeof(I));
   174   STATIC_ASSERT(4 == sizeof(I));
   175   STATIC_ASSERT(4 == sizeof(D));
   175   STATIC_ASSERT(4 == sizeof(D));
   176 
   176 
   177 #ifdef ARM
   177 #ifdef ARM
   178   return add_using_helper<int>(arm_add_and_fetch, add_value, dest);
   178   return add_using_helper<int>(arm_add_and_fetch, dest, add_value);
   179 #else
   179 #else
   180 #ifdef M68K
   180 #ifdef M68K
   181   return add_using_helper<int>(m68k_add_and_fetch, add_value, dest);
   181   return add_using_helper<int>(m68k_add_and_fetch, dest, add_value);
   182 #else
   182 #else
   183   return __sync_add_and_fetch(dest, add_value);
   183   return __sync_add_and_fetch(dest, add_value);
   184 #endif // M68K
   184 #endif // M68K
   185 #endif // ARM
   185 #endif // ARM
   186 }
   186 }
   187 
   187 
   188 template<>
   188 template<>
   189 template<typename I, typename D>
   189 template<typename D, typename !>
   190 inline D Atomic::PlatformAdd<8>::add_and_fetch(I add_value, D volatile* dest,
   190 inline D Atomic::PlatformAdd<8>::add_and_fetch(D volatile* dest, I add_value,
   191                                                atomic_memory_order order) const {
   191                                                atomic_memory_order order) const {
   192   STATIC_ASSERT(8 == sizeof(I));
   192   STATIC_ASSERT(8 == sizeof(I));
   193   STATIC_ASSERT(8 == sizeof(D));
   193   STATIC_ASSERT(8 == sizeof(D));
   194 
   194 
   195   return __sync_add_and_fetch(dest, add_value);
   195   return __sync_add_and_fetch(dest, add_value);