| Index: runtime/vm/atomic_macos.h
|
| diff --git a/runtime/vm/atomic_macos.h b/runtime/vm/atomic_macos.h
|
| index 288fe3cbcdf0afa637a98ef86ea9ec32d5014ebd..d9b89bc3924a8bed5fb7fed97f0995bdad4bcec1 100644
|
| --- a/runtime/vm/atomic_macos.h
|
| +++ b/runtime/vm/atomic_macos.h
|
| @@ -21,6 +21,11 @@ inline uintptr_t AtomicOperations::FetchAndIncrement(uintptr_t* p) {
|
| }
|
|
|
|
|
| +inline intptr_t AtomicOperations::FetchAndAdd(intptr_t* p, intptr_t delta) {
|
| + return __sync_fetch_and_add(p, delta);
|
| +}
|
| +
|
| +
|
| #if !defined(USING_SIMULATOR)
|
| inline uword AtomicOperations::CompareAndSwapWord(uword* ptr,
|
| uword old_value,
|
| @@ -29,6 +34,17 @@ inline uword AtomicOperations::CompareAndSwapWord(uword* ptr,
|
| }
|
| #endif // !defined(USING_SIMULATOR)
|
|
|
| +
|
| +inline uword AtomicOperations::LoadRelaxed(uword* ptr) {
|
| +#if defined(__ATOMIC_RELAXED)
|
| + return __atomic_load_n(ptr, __ATOMIC_RELAXED);
|
| +#else
|
| + // TODO(koda): Consider using C++11 <atomic> to avoid the barrier on more
|
| + // compilers/platforms.
|
| + return FetchAndAdd(reinterpret_cast<intptr_t*>(ptr), 0);
|
| +#endif
|
| +}
|
| +
|
| } // namespace dart
|
|
|
| #endif // VM_ATOMIC_MACOS_H_
|
|
|