Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(734)

Unified Diff: runtime/vm/atomic_android.h

Issue 1277473004: Safe and efficient stack-limit based interrupt checking in C++. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Explicitly signal task ready. Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/atomic.h ('k') | runtime/vm/atomic_linux.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/atomic_android.h
diff --git a/runtime/vm/atomic_android.h b/runtime/vm/atomic_android.h
index 06208f2293d95f02f0e1d807082a8ed9d75f8738..1f148a070557e3fb7da30f46d852afc593d4be94 100644
--- a/runtime/vm/atomic_android.h
+++ b/runtime/vm/atomic_android.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_ANDROID_H_
« no previous file with comments | « runtime/vm/atomic.h ('k') | runtime/vm/atomic_linux.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698