summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/sanitizer_common/sanitizer_allocator.h
diff options
context:
space:
mode:
authorSergey Matveev <earthdok@google.com>2013-05-31 11:13:45 +0000
committerSergey Matveev <earthdok@google.com>2013-05-31 11:13:45 +0000
commit69f11803ec63291c0d8b4697e75a2ec85d662ab7 (patch)
tree9cb755189d3095141b38e3e18cbce9a2ae60aa5d /compiler-rt/lib/sanitizer_common/sanitizer_allocator.h
parent1cf5ef5018794dcb17cbeb1b13a428f1715a54e8 (diff)
downloadbcm5719-llvm-69f11803ec63291c0d8b4697e75a2ec85d662ab7.tar.gz
bcm5719-llvm-69f11803ec63291c0d8b4697e75a2ec85d662ab7.zip
[lsan] Use the fast version of GetBlockBegin for leak checking in LSan and ASan.
llvm-svn: 182994
Diffstat (limited to 'compiler-rt/lib/sanitizer_common/sanitizer_allocator.h')
-rw-r--r--compiler-rt/lib/sanitizer_common/sanitizer_allocator.h15
1 files changed, 11 insertions, 4 deletions
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_allocator.h b/compiler-rt/lib/sanitizer_common/sanitizer_allocator.h
index 093f1fb9333..d24f42b3c04 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_allocator.h
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_allocator.h
@@ -1043,10 +1043,9 @@ class LargeMmapAllocator {
return GetUser(h);
}
- // This function does the same as GetBlockBegin, but much faster.
- // It may be called only in a single-threaded context, e.g. when all other
- // threads are suspended or joined.
- void *GetBlockBeginFastSingleThreaded(void *ptr) {
+ // This function does the same as GetBlockBegin, but is much faster.
+ // Must be called with the allocator locked.
+ void *GetBlockBeginFastLocked(void *ptr) {
uptr p = reinterpret_cast<uptr>(ptr);
uptr n = n_chunks_;
if (!n) return 0;
@@ -1238,6 +1237,14 @@ class CombinedAllocator {
return secondary_.GetBlockBegin(p);
}
+ // This function does the same as GetBlockBegin, but is much faster.
+ // Must be called with the allocator locked.
+ void *GetBlockBeginFastLocked(void *p) {
+ if (primary_.PointerIsMine(p))
+ return primary_.GetBlockBegin(p);
+ return secondary_.GetBlockBeginFastLocked(p);
+ }
+
uptr GetActuallyAllocatedSize(void *p) {
if (primary_.PointerIsMine(p))
return primary_.GetActuallyAllocatedSize(p);
OpenPOWER on IntegriCloud