[compiler-rt] r255997 - Revert r255996 ("[tsan] Add a DCHECK to verify __tsan_read* and __tsan_write function aren't called from ScopedInterceptor").

Kuba Brecka via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 18 05:52:08 PST 2015


Author: kuba.brecka
Date: Fri Dec 18 07:52:08 2015
New Revision: 255997

URL: http://llvm.org/viewvc/llvm-project?rev=255997&view=rev
Log:
Revert r255996 ("[tsan] Add a DCHECK to verify __tsan_read* and __tsan_write function aren't called from ScopedInterceptor").

There are some test failures on the Linux buildbots.


Modified:
    compiler-rt/trunk/lib/tsan/rtl/tsan_interceptors.cc
    compiler-rt/trunk/lib/tsan/rtl/tsan_interface_inl.h
    compiler-rt/trunk/lib/tsan/rtl/tsan_rtl.h

Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_interceptors.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_interceptors.cc?rev=255997&r1=255996&r2=255997&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/rtl/tsan_interceptors.cc (original)
+++ compiler-rt/trunk/lib/tsan/rtl/tsan_interceptors.cc Fri Dec 18 07:52:08 2015
@@ -281,15 +281,9 @@ ScopedInterceptor::ScopedInterceptor(Thr
     thr_->in_ignored_lib = true;
     ThreadIgnoreBegin(thr_, pc_);
   }
-#if SANITIZER_DEBUG
-  thr_->in_interceptor_count++;
-#endif
 }
 
 ScopedInterceptor::~ScopedInterceptor() {
-#if SANITIZER_DEBUG
-  thr_->in_interceptor_count--;
-#endif
   if (in_ignored_lib_) {
     thr_->in_ignored_lib = false;
     ThreadIgnoreEnd(thr_, pc_);
@@ -302,9 +296,6 @@ ScopedInterceptor::~ScopedInterceptor()
 }
 
 void ScopedInterceptor::UserCallbackStart() {
-#if SANITIZER_DEBUG
-  thr_->in_interceptor_count--;
-#endif
   if (in_ignored_lib_) {
     thr_->in_ignored_lib = false;
     ThreadIgnoreEnd(thr_, pc_);
@@ -316,9 +307,6 @@ void ScopedInterceptor::UserCallbackEnd(
     thr_->in_ignored_lib = true;
     ThreadIgnoreBegin(thr_, pc_);
   }
-#if SANITIZER_DEBUG
-  thr_->in_interceptor_count++;
-#endif
 }
 
 #define TSAN_INTERCEPT(func) INTERCEPT_FUNCTION(func)
@@ -2120,9 +2108,7 @@ TSAN_INTERCEPTOR(sighandler_t, signal, i
 }
 
 TSAN_INTERCEPTOR(int, sigsuspend, const __sanitizer_sigset_t *mask) {
-  {
-    SCOPED_TSAN_INTERCEPTOR(sigsuspend, mask);
-  }
+  SCOPED_TSAN_INTERCEPTOR(sigsuspend, mask);
   return REAL(sigsuspend)(mask);
 }
 

Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_interface_inl.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_interface_inl.h?rev=255997&r1=255996&r2=255997&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/rtl/tsan_interface_inl.h (original)
+++ compiler-rt/trunk/lib/tsan/rtl/tsan_interface_inl.h Fri Dec 18 07:52:08 2015
@@ -18,36 +18,69 @@
 
 using namespace __tsan;  // NOLINT
 
-#define TSAN_MEM_ACCESS_FUNC(type, func, size) \
-  void __tsan_##type(void *addr) {             \
-    ThreadState *thr = cur_thread();           \
-    DCHECK_EQ(thr->in_interceptor_count, 0);   \
-    func(thr, CALLERPC, (uptr)addr, size);     \
-  }
-
-#define TSAN_MEM_ACCESS_FUNC_PC(type, func, size) \
-  void __tsan_##type(void *addr, void *pc) {      \
-    ThreadState *thr = cur_thread();              \
-    DCHECK_EQ(thr->in_interceptor_count, 0);      \
-    func(thr, (uptr)pc, (uptr)addr, size);        \
-  }
-
-TSAN_MEM_ACCESS_FUNC(read1, MemoryRead, kSizeLog1)
-TSAN_MEM_ACCESS_FUNC(read2, MemoryRead, kSizeLog2)
-TSAN_MEM_ACCESS_FUNC(read4, MemoryRead, kSizeLog4)
-TSAN_MEM_ACCESS_FUNC(read8, MemoryRead, kSizeLog8)
-TSAN_MEM_ACCESS_FUNC(write1, MemoryWrite, kSizeLog1)
-TSAN_MEM_ACCESS_FUNC(write2, MemoryWrite, kSizeLog2)
-TSAN_MEM_ACCESS_FUNC(write4, MemoryWrite, kSizeLog4)
-TSAN_MEM_ACCESS_FUNC(write8, MemoryWrite, kSizeLog8)
-TSAN_MEM_ACCESS_FUNC_PC(read1_pc, MemoryRead, kSizeLog1)
-TSAN_MEM_ACCESS_FUNC_PC(read2_pc, MemoryRead, kSizeLog2)
-TSAN_MEM_ACCESS_FUNC_PC(read4_pc, MemoryRead, kSizeLog4)
-TSAN_MEM_ACCESS_FUNC_PC(read8_pc, MemoryRead, kSizeLog8)
-TSAN_MEM_ACCESS_FUNC_PC(write1_pc, MemoryWrite, kSizeLog1)
-TSAN_MEM_ACCESS_FUNC_PC(write2_pc, MemoryWrite, kSizeLog2)
-TSAN_MEM_ACCESS_FUNC_PC(write4_pc, MemoryWrite, kSizeLog4)
-TSAN_MEM_ACCESS_FUNC_PC(write8_pc, MemoryWrite, kSizeLog8)
+void __tsan_read1(void *addr) {
+  MemoryRead(cur_thread(), CALLERPC, (uptr)addr, kSizeLog1);
+}
+
+void __tsan_read2(void *addr) {
+  MemoryRead(cur_thread(), CALLERPC, (uptr)addr, kSizeLog2);
+}
+
+void __tsan_read4(void *addr) {
+  MemoryRead(cur_thread(), CALLERPC, (uptr)addr, kSizeLog4);
+}
+
+void __tsan_read8(void *addr) {
+  MemoryRead(cur_thread(), CALLERPC, (uptr)addr, kSizeLog8);
+}
+
+void __tsan_write1(void *addr) {
+  MemoryWrite(cur_thread(), CALLERPC, (uptr)addr, kSizeLog1);
+}
+
+void __tsan_write2(void *addr) {
+  MemoryWrite(cur_thread(), CALLERPC, (uptr)addr, kSizeLog2);
+}
+
+void __tsan_write4(void *addr) {
+  MemoryWrite(cur_thread(), CALLERPC, (uptr)addr, kSizeLog4);
+}
+
+void __tsan_write8(void *addr) {
+  MemoryWrite(cur_thread(), CALLERPC, (uptr)addr, kSizeLog8);
+}
+
+void __tsan_read1_pc(void *addr, void *pc) {
+  MemoryRead(cur_thread(), (uptr)pc, (uptr)addr, kSizeLog1);
+}
+
+void __tsan_read2_pc(void *addr, void *pc) {
+  MemoryRead(cur_thread(), (uptr)pc, (uptr)addr, kSizeLog2);
+}
+
+void __tsan_read4_pc(void *addr, void *pc) {
+  MemoryRead(cur_thread(), (uptr)pc, (uptr)addr, kSizeLog4);
+}
+
+void __tsan_read8_pc(void *addr, void *pc) {
+  MemoryRead(cur_thread(), (uptr)pc, (uptr)addr, kSizeLog8);
+}
+
+void __tsan_write1_pc(void *addr, void *pc) {
+  MemoryWrite(cur_thread(), (uptr)pc, (uptr)addr, kSizeLog1);
+}
+
+void __tsan_write2_pc(void *addr, void *pc) {
+  MemoryWrite(cur_thread(), (uptr)pc, (uptr)addr, kSizeLog2);
+}
+
+void __tsan_write4_pc(void *addr, void *pc) {
+  MemoryWrite(cur_thread(), (uptr)pc, (uptr)addr, kSizeLog4);
+}
+
+void __tsan_write8_pc(void *addr, void *pc) {
+  MemoryWrite(cur_thread(), (uptr)pc, (uptr)addr, kSizeLog8);
+}
 
 void __tsan_vptr_update(void **vptr_p, void *new_val) {
   CHECK_EQ(sizeof(vptr_p), 8);

Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_rtl.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_rtl.h?rev=255997&r1=255996&r2=255997&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/rtl/tsan_rtl.h (original)
+++ compiler-rt/trunk/lib/tsan/rtl/tsan_rtl.h Fri Dec 18 07:52:08 2015
@@ -372,9 +372,6 @@ struct ThreadState {
   const int unique_id;
   bool in_symbolizer;
   bool in_ignored_lib;
-#if SANITIZER_DEBUG
-  int in_interceptor_count;
-#endif
   bool is_inited;
   bool is_dead;
   bool is_freeing;




More information about the llvm-commits mailing list