summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Hans Boehm <hboehm@google.com> 2017-06-08 00:54:44 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2017-06-08 00:54:44 +0000
commitbdb5c8335fcce3c20b568955b14b5899bf9ff9a2 (patch)
tree5a7b497f6f4eb90b536f8567f26f003ca7f78bb4
parent97acd8ad91dedaf59d32df7041d63f4c21229084 (diff)
parentf81e6566a4d8f6ee6160ab61e23404cf28eacb7c (diff)
Merge "Document and use AtomicStack concurrency properties"
-rw-r--r--runtime/gc/accounting/atomic_stack.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/runtime/gc/accounting/atomic_stack.h b/runtime/gc/accounting/atomic_stack.h
index 351798efd1..3d0e8172b6 100644
--- a/runtime/gc/accounting/atomic_stack.h
+++ b/runtime/gc/accounting/atomic_stack.h
@@ -29,6 +29,13 @@
#include "mem_map.h"
#include "stack_reference.h"
+// This implements a double-ended queue (deque) with various flavors of PushBack operations,
+// as well as PopBack and PopFront operations. We expect that all calls are performed
+// by a single thread (normally the GC). There is one exception, which accounts for the
+// name:
+// - Multiple calls to AtomicPushBack*() and AtomicBumpBack() may be made concurrently,
+// provided no other calls are made at the same time.
+
namespace art {
namespace gc {
namespace accounting {
@@ -150,7 +157,7 @@ class AtomicStack {
// Pop a number of elements.
void PopBackCount(int32_t n) {
DCHECK_GE(Size(), static_cast<size_t>(n));
- back_index_.FetchAndSubSequentiallyConsistent(n);
+ back_index_.StoreRelaxed(back_index_.LoadRelaxed() - n);
}
bool IsEmpty() const {