summaryrefslogtreecommitdiff
path: root/lib/sanitizer_common/sanitizer_deadlock_detector.h
diff options
context:
space:
mode:
authorKostya Serebryany <kcc@google.com>2014-03-14 08:06:15 +0000
committerKostya Serebryany <kcc@google.com>2014-03-14 08:06:15 +0000
commit30fd39fe12a619c9317d0dbd605b63cd044a0f43 (patch)
tree0cd41a70a56273f668c6d54384832c66a9025f36 /lib/sanitizer_common/sanitizer_deadlock_detector.h
parentde54e50adca1ed8572a97ec8a923b9823d8850ae (diff)
[sanitizer] partially implement racy fast path in bitset-based deadlock detector
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@203904 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/sanitizer_common/sanitizer_deadlock_detector.h')
-rw-r--r--lib/sanitizer_common/sanitizer_deadlock_detector.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/sanitizer_common/sanitizer_deadlock_detector.h b/lib/sanitizer_common/sanitizer_deadlock_detector.h
index 33913137f..6d4cec86c 100644
--- a/lib/sanitizer_common/sanitizer_deadlock_detector.h
+++ b/lib/sanitizer_common/sanitizer_deadlock_detector.h
@@ -172,6 +172,16 @@ class DeadlockDetector {
dtls->addLock(cur_idx, current_epoch_);
}
+ // Experimental *racy* fast path function.
+ // Returns true if all edges from the currently held locks to cur_node exist.
+ bool hasAllEdges(DeadlockDetectorTLS<BV> *dtls, uptr cur_node) {
+ if (dtls->getEpoch() == nodeToEpoch(cur_node)) {
+ uptr cur_idx = nodeToIndexUnchecked(cur_node);
+ return g_.hasAllEdges(dtls->getLocks(current_epoch_), cur_idx);
+ }
+ return false;
+ }
+
// Adds edges from currently held locks to cur_node,
// returns the number of added edges, and puts the sources of added edges
// into added_edges[].