< prev index next >

src/os_cpu/bsd_zero/vm/atomic_bsd_zero.hpp

Print this page
rev 13452 : imported patch Atomic_cmpxchg
rev 13453 : imported patch Atomic_add
rev 13454 : [mq]: Atomic_add_v2


 190 #ifdef ARM
 191   return add_using_helper<int>(arm_add_and_fetch, add_value, dest);
 192 #else
 193 #ifdef M68K
 194   return add_using_helper<int>(m68k_add_and_fetch, add_value, dest);
 195 #else
 196   return __sync_add_and_fetch(dest, add_value);
 197 #endif // M68K
 198 #endif // ARM
 199 }
 200 
 201 template<>
 202 template<typename I, typename D>
 203 inline D Atomic::PlatformAdd<8>::add_and_fetch(I add_value, D volatile* dest) const {
 204   STATIC_CAST(8 == sizeof(I));
 205   STATIC_CAST(8 == sizeof(D));
 206 
 207   return __sync_add_and_fetch(dest, add_value);
 208 }
 209 



 210 inline void Atomic::inc(volatile jint* dest) {
 211   add(1, dest);
 212 }
 213 
 214 inline void Atomic::inc_ptr(volatile intptr_t* dest) {
 215   add_ptr(1, dest);
 216 }
 217 
 218 inline void Atomic::inc_ptr(volatile void* dest) {
 219   add_ptr(1, dest);
 220 }
 221 
 222 inline void Atomic::dec(volatile jint* dest) {
 223   add(-1, dest);
 224 }
 225 
 226 inline void Atomic::dec_ptr(volatile intptr_t* dest) {
 227   add_ptr(-1, dest);
 228 }
 229 




 190 #ifdef ARM
 191   return add_using_helper<int>(arm_add_and_fetch, add_value, dest);
 192 #else
 193 #ifdef M68K
 194   return add_using_helper<int>(m68k_add_and_fetch, add_value, dest);
 195 #else
 196   return __sync_add_and_fetch(dest, add_value);
 197 #endif // M68K
 198 #endif // ARM
 199 }
 200 
 201 template<>
 202 template<typename I, typename D>
 203 inline D Atomic::PlatformAdd<8>::add_and_fetch(I add_value, D volatile* dest) const {
 204   STATIC_CAST(8 == sizeof(I));
 205   STATIC_CAST(8 == sizeof(D));
 206 
 207   return __sync_add_and_fetch(dest, add_value);
 208 }
 209 
 210 template<>
 211 struct Atomic::PlatformAdd<2>: Atomic::AddShortUsingInt {};
 212 
 213 inline void Atomic::inc(volatile jint* dest) {
 214   add(1, dest);
 215 }
 216 
 217 inline void Atomic::inc_ptr(volatile intptr_t* dest) {
 218   add_ptr(1, dest);
 219 }
 220 
 221 inline void Atomic::inc_ptr(volatile void* dest) {
 222   add_ptr(1, dest);
 223 }
 224 
 225 inline void Atomic::dec(volatile jint* dest) {
 226   add(-1, dest);
 227 }
 228 
 229 inline void Atomic::dec_ptr(volatile intptr_t* dest) {
 230   add_ptr(-1, dest);
 231 }
 232 


< prev index next >