summaryrefslogtreecommitdiff
path: root/lib/sanitizer_common/sanitizer_bvgraph.h
diff options
context:
space:
mode:
authorKostya Serebryany <kcc@google.com>2014-03-31 07:23:50 +0000
committerKostya Serebryany <kcc@google.com>2014-03-31 07:23:50 +0000
commit6239ca0fb2741276c55e3eac783e24108cc4f71e (patch)
treee636cd53fd80e19591338c9eeb6e3643a06f06e8 /lib/sanitizer_common/sanitizer_bvgraph.h
parent128891cfae56bed0c169b3e9c98c824c574ea414 (diff)
downloadcompiler-rt-6239ca0fb2741276c55e3eac783e24108cc4f71e.tar.gz
[sanitizer] speed up the bitvector-based deadlock detector by ~15% (iterate over the currently held locks using the array, not the bitvector. Bitvector is not the best data structure to iterate over)
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@205168 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/sanitizer_common/sanitizer_bvgraph.h')
-rw-r--r--lib/sanitizer_common/sanitizer_bvgraph.h10
1 files changed, 2 insertions, 8 deletions
diff --git a/lib/sanitizer_common/sanitizer_bvgraph.h b/lib/sanitizer_common/sanitizer_bvgraph.h
index 9a547d3d4..df72f1c2d 100644
--- a/lib/sanitizer_common/sanitizer_bvgraph.h
+++ b/lib/sanitizer_common/sanitizer_bvgraph.h
@@ -61,18 +61,12 @@ class BVGraph {
}
// *EXPERIMENTAL*
- // Returns true if all edges from=>to exist.
+ // Returns true if an edge from=>to exist.
// This function does not use any global state except for 'this' itself,
// and thus can be called from different threads w/o locking.
// This would be racy.
// FIXME: investigate how much we can prove about this race being "benign".
- bool hasAllEdges(const BV &from, uptr to) {
- for (typename BV::Iterator it(from); it.hasNext(); ) {
- uptr idx = it.next();
- if (!v[idx].getBit(to)) return false;
- }
- return true;
- }
+ bool hasEdge(uptr from, uptr to) { return v[from].getBit(to); }
// Returns true if the edge from=>to was removed.
bool removeEdge(uptr from, uptr to) {