diff options
author | Dmitry Vyukov <dvyukov@google.com> | 2016-02-26 18:26:48 +0000 |
---|---|---|
committer | Dmitry Vyukov <dvyukov@google.com> | 2016-02-26 18:26:48 +0000 |
commit | 7f022ae4c26f6bee2477868c99c73fb5bda1711d (patch) | |
tree | 84b7e2246750f343659e8d438373a80c6e227909 /compiler-rt/lib/tsan/rtl/tsan_rtl_thread.cc | |
parent | 1762ad3e7332f9dc3db942851df3249fb539eed9 (diff) | |
download | bcm5719-llvm-7f022ae4c26f6bee2477868c99c73fb5bda1711d.tar.gz bcm5719-llvm-7f022ae4c26f6bee2477868c99c73fb5bda1711d.zip |
tsan: revert r262037
Broke aarch64 and darwin bots.
llvm-svn: 262046
Diffstat (limited to 'compiler-rt/lib/tsan/rtl/tsan_rtl_thread.cc')
-rw-r--r-- | compiler-rt/lib/tsan/rtl/tsan_rtl_thread.cc | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/compiler-rt/lib/tsan/rtl/tsan_rtl_thread.cc b/compiler-rt/lib/tsan/rtl/tsan_rtl_thread.cc index 353e086c77d..dcae255f764 100644 --- a/compiler-rt/lib/tsan/rtl/tsan_rtl_thread.cc +++ b/compiler-rt/lib/tsan/rtl/tsan_rtl_thread.cc @@ -42,7 +42,7 @@ void ThreadContext::OnDead() { void ThreadContext::OnJoined(void *arg) { ThreadState *caller_thr = static_cast<ThreadState *>(arg); AcquireImpl(caller_thr, 0, &sync); - sync.Reset(&caller_thr->proc->clock_cache); + sync.Reset(&caller_thr->clock_cache); } struct OnCreatedArgs { @@ -74,7 +74,7 @@ void ThreadContext::OnReset() { void ThreadContext::OnDetached(void *arg) { ThreadState *thr1 = static_cast<ThreadState*>(arg); - sync.Reset(&thr1->proc->clock_cache); + sync.Reset(&thr1->clock_cache); } struct OnStartedArgs { @@ -106,8 +106,13 @@ void ThreadContext::OnStarted(void *arg) { thr->shadow_stack_pos = thr->shadow_stack; thr->shadow_stack_end = thr->shadow_stack + kInitStackSize; #endif - if (common_flags()->detect_deadlocks) +#ifndef SANITIZER_GO + AllocatorThreadStart(thr); +#endif + if (common_flags()->detect_deadlocks) { + thr->dd_pt = ctx->dd->CreatePhysicalThread(); thr->dd_lt = ctx->dd->CreateLogicalThread(unique_id); + } thr->fast_state.SetHistorySize(flags()->history_size); // Commit switch to the new part of the trace. // TraceAddEvent will reset stack0/mset0 in the new part for us. @@ -116,7 +121,7 @@ void ThreadContext::OnStarted(void *arg) { thr->fast_synch_epoch = epoch0; AcquireImpl(thr, 0, &sync); StatInc(thr, StatSyncAcquire); - sync.Reset(&thr->proc->clock_cache); + sync.Reset(&thr->clock_cache); thr->is_inited = true; DPrintf("#%d: ThreadStart epoch=%zu stk_addr=%zx stk_size=%zx " "tls_addr=%zx tls_size=%zx\n", @@ -133,8 +138,15 @@ void ThreadContext::OnFinished() { } epoch1 = thr->fast_state.epoch(); - if (common_flags()->detect_deadlocks) + if (common_flags()->detect_deadlocks) { + ctx->dd->DestroyPhysicalThread(thr->dd_pt); ctx->dd->DestroyLogicalThread(thr->dd_lt); + } + ctx->clock_alloc.FlushCache(&thr->clock_cache); + ctx->metamap.OnThreadIdle(thr); +#ifndef SANITIZER_GO + AllocatorThreadFinish(thr); +#endif thr->~ThreadState(); #if TSAN_COLLECT_STATS StatAggregate(ctx->stat, thr->stat); |