summaryrefslogtreecommitdiffstats
path: root/compiler-rt/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
commit61a0f1c5646dad62af289f5f7a5541b2b2b35377 (patch)
treea783e6b3a2179f055f5be885bfbc8cf9369d5ce7 /compiler-rt/lib/sanitizer_common/sanitizer_deadlock_detector.h
parent39aa6af23fbbcdefb2875f80e7ee5c6f5a1fa34d (diff)
downloadbcm5719-llvm-61a0f1c5646dad62af289f5f7a5541b2b2b35377.tar.gz
bcm5719-llvm-61a0f1c5646dad62af289f5f7a5541b2b2b35377.zip
[sanitizer] partially implement racy fast path in bitset-based deadlock detector
llvm-svn: 203904
Diffstat (limited to 'compiler-rt/lib/sanitizer_common/sanitizer_deadlock_detector.h')
-rw-r--r--compiler-rt/lib/sanitizer_common/sanitizer_deadlock_detector.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_deadlock_detector.h b/compiler-rt/lib/sanitizer_common/sanitizer_deadlock_detector.h
index 33913137f28..6d4cec86c4e 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_deadlock_detector.h
+++ b/compiler-rt/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[].
OpenPOWER on IntegriCloud