diff options
author | Kostya Serebryany <kcc@google.com> | 2014-02-17 11:21:52 +0000 |
---|---|---|
committer | Kostya Serebryany <kcc@google.com> | 2014-02-17 11:21:52 +0000 |
commit | c42e54f332984165b297fe4918df286c6ae8754e (patch) | |
tree | c6dedb008a20992e88a9ab0f6be4d53c17fea82d /lib/sanitizer_common/sanitizer_deadlock_detector.h | |
parent | 41bf92d3368b803bf1c96eb1e75bdfbde8d98d57 (diff) |
[sanitizer] implement node removal in Deadlock graph
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@201509 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/sanitizer_common/sanitizer_deadlock_detector.h')
-rw-r--r-- | lib/sanitizer_common/sanitizer_deadlock_detector.h | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/sanitizer_common/sanitizer_deadlock_detector.h b/lib/sanitizer_common/sanitizer_deadlock_detector.h index aa2644fd7..d0ff29de4 100644 --- a/lib/sanitizer_common/sanitizer_deadlock_detector.h +++ b/lib/sanitizer_common/sanitizer_deadlock_detector.h @@ -40,7 +40,7 @@ class DeadlockDetectorTLS { bv_.clear(); epoch_ = current_epoch; } - bv_.setBit(lock_id); + CHECK(bv_.setBit(lock_id)); } void removeLock(uptr lock_id, uptr current_epoch) { @@ -48,7 +48,7 @@ class DeadlockDetectorTLS { bv_.clear(); epoch_ = current_epoch; } - bv_.clearBit(lock_id); + CHECK(bv_.clearBit(lock_id)); } const BV &getLocks() const { return bv_; } @@ -88,9 +88,10 @@ class DeadlockDetector { return getAvailableNode(data); if (!recycled_nodes_.empty()) { CHECK(available_nodes_.empty()); + // removeEdgesFrom was called in removeNode. + g_.removeEdgesTo(recycled_nodes_); available_nodes_.setUnion(recycled_nodes_); recycled_nodes_.clear(); - // FIXME: actually recycle nodes in the graph. return getAvailableNode(data); } // We are out of vacant nodes. Flush and increment the current_epoch_. @@ -108,7 +109,7 @@ class DeadlockDetector { uptr idx = nodeToIndex(node); CHECK(!available_nodes_.getBit(idx)); CHECK(recycled_nodes_.setBit(idx)); - // FIXME: also remove from the graph. + g_.removeEdgesFrom(idx); } // Handle the lock event, return true if there is a cycle. @@ -126,6 +127,8 @@ class DeadlockDetector { dtls->removeLock(nodeToIndex(node), current_epoch_); } + uptr testOnlyGetEpoch() const { return current_epoch_; } + private: void check_idx(uptr idx) const { CHECK_LT(idx, size()); } |