summaryrefslogtreecommitdiff
path: root/lib/tsan/rtl/tsan_clock.cc
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2012-07-28 15:27:41 +0000
committerDmitry Vyukov <dvyukov@google.com>2012-07-28 15:27:41 +0000
commit9d150bdb433ddd092073dabd87ba15aa176603a1 (patch)
tree44f5c26c038875d940351c3a88a8cbd85740e9b3 /lib/tsan/rtl/tsan_clock.cc
parent715c74611317d2e76f2b1dd854208eac238944ef (diff)
downloadcompiler-rt-9d150bdb433ddd092073dabd87ba15aa176603a1.tar.gz
compiler-rt-9d150bdb433ddd092073dabd87ba15aa176603a1.tar.bz2
compiler-rt-9d150bdb433ddd092073dabd87ba15aa176603a1.tar.xz
tsan: add ReleaseStore() function that merely copies vector clock rather than combines two clocks
fix clock setup for finalizer goroutine (Go runtime) git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@160918 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/tsan/rtl/tsan_clock.cc')
-rw-r--r--lib/tsan/rtl/tsan_clock.cc16
1 files changed, 15 insertions, 1 deletions
diff --git a/lib/tsan/rtl/tsan_clock.cc b/lib/tsan/rtl/tsan_clock.cc
index 1918f8df..08721921 100644
--- a/lib/tsan/rtl/tsan_clock.cc
+++ b/lib/tsan/rtl/tsan_clock.cc
@@ -88,14 +88,28 @@ void ThreadClock::release(SyncClock *dst) const {
}
}
+void ThreadClock::ReleaseStore(SyncClock *dst) const {
+ DCHECK(nclk_ <= kMaxTid);
+ DCHECK(dst->clk_.Size() <= kMaxTid);
+
+ if (dst->clk_.Size() < nclk_)
+ dst->clk_.Resize(nclk_);
+ for (uptr i = 0; i < nclk_; i++)
+ dst->clk_[i] = clk_[i];
+ for (uptr i = nclk_; i < dst->clk_.Size(); i++)
+ dst->clk_[i] = 0;
+}
+
void ThreadClock::acq_rel(SyncClock *dst) {
acquire(dst);
release(dst);
}
-void ThreadClock::Disable() {
+void ThreadClock::Disable(unsigned tid) {
+ u64 c0 = clk_[tid];
for (uptr i = 0; i < kMaxTidInClock; i++)
clk_[i] = (u64)-1;
+ clk_[tid] = c0;
}
SyncClock::SyncClock()