Clean up and augment Atomic class. Replace QuasiAtomic MemBars.
Add a number of missing C++11 operations to Atomic class.
Invoke the 64 bit routines in QuasiAtomic when necessary.
Replace QuasiAtomic membars with fences that correspond to C++11 fences.
QuasiAtomic was moved to the top of the file. Only fence implementations
actually changed.
This replaces some buggy uses of MembarStoreStore, as reported
in b/14685856 .
Avoid some redundant fences for long volatile operations.
Incompletely converts low-level memory access operations to Atomic.
Change-Id: Iea828431a0cea46540eb74fcaa02071cab6fdcda
diff --git a/runtime/mirror/object.h b/runtime/mirror/object.h
index 442909d..e5f923d 100644
--- a/runtime/mirror/object.h
+++ b/runtime/mirror/object.h
@@ -103,6 +103,13 @@
// avoids the barriers.
LockWord GetLockWord(bool as_volatile) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
void SetLockWord(LockWord new_val, bool as_volatile) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
+ // All Cas operations defined here have C++11 memory_order_seq_cst ordering
+ // semantics: Preceding memory operations become visible to other threads
+ // before the CAS, and subsequent operations become visible after the CAS.
+ // The Cas operations defined here do not fail spuriously, i.e. they
+ // have C++11 "strong" semantics.
+ // TODO: In most, possibly all, cases, these assumptions are too strong.
+ // Confirm and weaken the implementation.
bool CasLockWord(LockWord old_val, LockWord new_val) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
uint32_t GetLockOwnerThreadId();