[llvm-commits] [compiler-rt] r157566 - /compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_thread.cc
Dmitry Vyukov
dvyukov at google.com
Mon May 28 00:44:34 PDT 2012
Author: dvyukov
Date: Mon May 28 02:44:34 2012
New Revision: 157566
URL: http://llvm.org/viewvc/llvm-project?rev=157566&view=rev
Log:
tsan: do not clean stack/tls for main thread
Modified:
compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_thread.cc
Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_thread.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_thread.cc?rev=157566&r1=157565&r2=157566&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_thread.cc (original)
+++ compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_thread.cc Mon May 28 02:44:34 2012
@@ -140,18 +140,20 @@
uptr tls_size = 0;
GetThreadStackAndTls(tid == 0, &stk_addr, &stk_size, &tls_addr, &tls_size);
- MemoryResetRange(thr, /*pc=*/ 1, stk_addr, stk_size);
+ if (tid) {
+ MemoryResetRange(thr, /*pc=*/ 1, stk_addr, stk_size);
- // Check that the thr object is in tls;
- const uptr thr_beg = (uptr)thr;
- const uptr thr_end = (uptr)thr + sizeof(*thr);
- CHECK_GE(thr_beg, tls_addr);
- CHECK_LE(thr_beg, tls_addr + tls_size);
- CHECK_GE(thr_end, tls_addr);
- CHECK_LE(thr_end, tls_addr + tls_size);
- // Since the thr object is huge, skip it.
- MemoryResetRange(thr, /*pc=*/ 2, tls_addr, thr_beg - tls_addr);
- MemoryResetRange(thr, /*pc=*/ 2, thr_end, tls_addr + tls_size - thr_end);
+ // Check that the thr object is in tls;
+ const uptr thr_beg = (uptr)thr;
+ const uptr thr_end = (uptr)thr + sizeof(*thr);
+ CHECK_GE(thr_beg, tls_addr);
+ CHECK_LE(thr_beg, tls_addr + tls_size);
+ CHECK_GE(thr_end, tls_addr);
+ CHECK_LE(thr_end, tls_addr + tls_size);
+ // Since the thr object is huge, skip it.
+ MemoryResetRange(thr, /*pc=*/ 2, tls_addr, thr_beg - tls_addr);
+ MemoryResetRange(thr, /*pc=*/ 2, thr_end, tls_addr + tls_size - thr_end);
+ }
Lock l(&CTX()->thread_mtx);
ThreadContext *tctx = CTX()->threads[tid];
More information about the llvm-commits
mailing list