diff options
author | Kostya Serebryany <kcc@google.com> | 2014-03-14 08:06:15 +0000 |
---|---|---|
committer | Kostya Serebryany <kcc@google.com> | 2014-03-14 08:06:15 +0000 |
commit | 30fd39fe12a619c9317d0dbd605b63cd044a0f43 (patch) | |
tree | 0cd41a70a56273f668c6d54384832c66a9025f36 /lib/sanitizer_common/sanitizer_bvgraph.h | |
parent | de54e50adca1ed8572a97ec8a923b9823d8850ae (diff) | |
download | compiler-rt-30fd39fe12a619c9317d0dbd605b63cd044a0f43.tar.gz |
[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_bvgraph.h')
-rw-r--r-- | lib/sanitizer_common/sanitizer_bvgraph.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/sanitizer_common/sanitizer_bvgraph.h b/lib/sanitizer_common/sanitizer_bvgraph.h index a55757b5d..9a547d3d4 100644 --- a/lib/sanitizer_common/sanitizer_bvgraph.h +++ b/lib/sanitizer_common/sanitizer_bvgraph.h @@ -60,6 +60,20 @@ class BVGraph { return res; } + // *EXPERIMENTAL* + // Returns true if all edges 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; + } + // Returns true if the edge from=>to was removed. bool removeEdge(uptr from, uptr to) { return v[from].clearBit(to); |