summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/tsan/rtl/tsan_vector.h
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2014-05-29 13:50:54 +0000
committerDmitry Vyukov <dvyukov@google.com>2014-05-29 13:50:54 +0000
commitbde4c9c773eed5993d70dcc1f164ad033019ce83 (patch)
treef69ffcafcdf1a95d97d24271f12640b4fcf926e9 /compiler-rt/lib/tsan/rtl/tsan_vector.h
parent53ae251a1714858e9d268da7a74988b0d24032c0 (diff)
downloadbcm5719-llvm-bde4c9c773eed5993d70dcc1f164ad033019ce83.tar.gz
bcm5719-llvm-bde4c9c773eed5993d70dcc1f164ad033019ce83.zip
tsan: refactor storage of meta information for heap blocks and sync objects
The new storage (MetaMap) is based on direct shadow (instead of a hashmap + per-block lists). This solves a number of problems: - eliminates quadratic behaviour in SyncTab::GetAndLock (https://code.google.com/p/thread-sanitizer/issues/detail?id=26) - eliminates contention in SyncTab - eliminates contention in internal allocator during allocation of sync objects - removes a bunch of ad-hoc code in java interface - reduces java shadow from 2x to 1/2x - allows to memorize heap block meta info for Java and Go - allows to cleanup sync object meta info for Go - which in turn enabled deadlock detector for Go llvm-svn: 209810
Diffstat (limited to 'compiler-rt/lib/tsan/rtl/tsan_vector.h')
-rw-r--r--compiler-rt/lib/tsan/rtl/tsan_vector.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/compiler-rt/lib/tsan/rtl/tsan_vector.h b/compiler-rt/lib/tsan/rtl/tsan_vector.h
index ae84522a7dc..a7fb3fa58d5 100644
--- a/compiler-rt/lib/tsan/rtl/tsan_vector.h
+++ b/compiler-rt/lib/tsan/rtl/tsan_vector.h
@@ -78,6 +78,10 @@ class Vector {
}
void Resize(uptr size) {
+ if (size == 0) {
+ end_ = begin_;
+ return;
+ }
uptr old_size = Size();
EnsureSize(size);
if (old_size < size) {
@@ -100,7 +104,7 @@ class Vector {
return;
}
uptr cap0 = last_ - begin_;
- uptr cap = 2 * cap0;
+ uptr cap = cap0 * 5 / 4; // 25% growth
if (cap == 0)
cap = 16;
if (cap < size)
OpenPOWER on IntegriCloud