< prev index next >

src/os_cpu/bsd_zero/vm/atomic_bsd_zero.hpp

Print this page
rev 13460 : [mq]: zero_fix


 259   __sync_synchronize();
 260   return result;
 261 #endif // M68K
 262 #endif // ARM
 263 }
 264 
 265 inline void* Atomic::xchg_ptr(void* exchange_value, volatile void* dest) {
 266   return (void *) xchg_ptr((intptr_t) exchange_value,
 267                            (volatile intptr_t*) dest);
 268 }
 269 
 270 // No direct support for cmpxchg of bytes; emulate using int.
 271 template<>
 272 struct Atomic::PlatformCmpxchg<1> : Atomic::CmpxchgByteUsingInt {};
 273 
 274 template<>
 275 template<typename T>
 276 inline T Atomic::PlatformCmpxchg<4>::operator()(T exchange_value,
 277                                                 T volatile* dest,
 278                                                 T compare_value,
 279                                                 cmpxchg_memory_order order) {
 280   STATIC_CAST(4 == sizeof(T));
 281 #ifdef ARM
 282   return cmpxchg_using_helper<int>(arm_compare_and_swap, exchange_value, dest, compare_value);
 283 #else
 284 #ifdef M68K
 285   return cmpxchg_using_helper<int>(m68k_compare_and_swap, exchange_value, dest, compare_value);
 286 #else
 287   return __sync_val_compare_and_swap(dest, compare_value, exchange_value);
 288 #endif // M68K
 289 #endif // ARM
 290 }
 291 
 292 template<>
 293 template<typename T>
 294 inline T Atomic::PlatformCmpxchg<8>::operator()(T exchange_value,
 295                                                 T volatile* dest,
 296                                                 T compare_value,
 297                                                 cmpxchg_memory_order order) {
 298   STATIC_CAST(8 == sizeof(T));
 299   return __sync_val_compare_and_swap(dest, compare_value, exchange_value);
 300 }
 301 
 302 inline jlong Atomic::load(const volatile jlong* src) {
 303   volatile jlong dest;
 304   os::atomic_copy64(src, &dest);
 305   return dest;
 306 }
 307 
 308 inline void Atomic::store(jlong store_value, jlong* dest) {
 309   os::atomic_copy64((volatile jlong*)&store_value, (volatile jlong*)dest);
 310 }
 311 
 312 inline void Atomic::store(jlong store_value, volatile jlong* dest) {
 313   os::atomic_copy64((volatile jlong*)&store_value, dest);
 314 }
 315 
 316 #endif // OS_CPU_BSD_ZERO_VM_ATOMIC_BSD_ZERO_HPP


 259   __sync_synchronize();
 260   return result;
 261 #endif // M68K
 262 #endif // ARM
 263 }
 264 
 265 inline void* Atomic::xchg_ptr(void* exchange_value, volatile void* dest) {
 266   return (void *) xchg_ptr((intptr_t) exchange_value,
 267                            (volatile intptr_t*) dest);
 268 }
 269 
 270 // No direct support for cmpxchg of bytes; emulate using int.
 271 template<>
 272 struct Atomic::PlatformCmpxchg<1> : Atomic::CmpxchgByteUsingInt {};
 273 
 274 template<>
 275 template<typename T>
 276 inline T Atomic::PlatformCmpxchg<4>::operator()(T exchange_value,
 277                                                 T volatile* dest,
 278                                                 T compare_value,
 279                                                 cmpxchg_memory_order order) const {
 280   STATIC_CAST(4 == sizeof(T));
 281 #ifdef ARM
 282   return cmpxchg_using_helper<int>(arm_compare_and_swap, exchange_value, dest, compare_value);
 283 #else
 284 #ifdef M68K
 285   return cmpxchg_using_helper<int>(m68k_compare_and_swap, exchange_value, dest, compare_value);
 286 #else
 287   return __sync_val_compare_and_swap(dest, compare_value, exchange_value);
 288 #endif // M68K
 289 #endif // ARM
 290 }
 291 
 292 template<>
 293 template<typename T>
 294 inline T Atomic::PlatformCmpxchg<8>::operator()(T exchange_value,
 295                                                 T volatile* dest,
 296                                                 T compare_value,
 297                                                 cmpxchg_memory_order order) const {
 298   STATIC_CAST(8 == sizeof(T));
 299   return __sync_val_compare_and_swap(dest, compare_value, exchange_value);
 300 }
 301 
 302 inline jlong Atomic::load(const volatile jlong* src) {
 303   volatile jlong dest;
 304   os::atomic_copy64(src, &dest);
 305   return dest;
 306 }
 307 
 308 inline void Atomic::store(jlong store_value, jlong* dest) {
 309   os::atomic_copy64((volatile jlong*)&store_value, (volatile jlong*)dest);
 310 }
 311 
 312 inline void Atomic::store(jlong store_value, volatile jlong* dest) {
 313   os::atomic_copy64((volatile jlong*)&store_value, dest);
 314 }
 315 
 316 #endif // OS_CPU_BSD_ZERO_VM_ATOMIC_BSD_ZERO_HPP
< prev index next >