[llvm-commits] [compiler-rt] r160723 - in /compiler-rt/trunk/lib/tsan: go/tsan_go.cc rtl/tsan_clock.cc rtl/tsan_clock.h rtl/tsan_rtl.h rtl/tsan_rtl_thread.cc

Dmitry Vyukov dvyukov at google.com
Wed Jul 25 06:16:35 PDT 2012


Author: dvyukov
Date: Wed Jul 25 08:16:35 2012
New Revision: 160723

URL: http://llvm.org/viewvc/llvm-project?rev=160723&view=rev
Log:
tsan: suport for Go finalizers

Modified:
    compiler-rt/trunk/lib/tsan/go/tsan_go.cc
    compiler-rt/trunk/lib/tsan/rtl/tsan_clock.cc
    compiler-rt/trunk/lib/tsan/rtl/tsan_clock.h
    compiler-rt/trunk/lib/tsan/rtl/tsan_rtl.h
    compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_thread.cc

Modified: compiler-rt/trunk/lib/tsan/go/tsan_go.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/go/tsan_go.cc?rev=160723&r1=160722&r2=160723&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/go/tsan_go.cc (original)
+++ compiler-rt/trunk/lib/tsan/go/tsan_go.cc Wed Jul 25 08:16:35 2012
@@ -221,5 +221,10 @@
   }
 }
 
+void __tsan_finalizer_goroutine(int tid) {
+  ThreadState *thr = goroutines[tid];
+  ThreadFinalizerGoroutine(thr);
+}
+
 }  // extern "C"
 }  // namespace __tsan

Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_clock.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_clock.cc?rev=160723&r1=160722&r2=160723&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/rtl/tsan_clock.cc (original)
+++ compiler-rt/trunk/lib/tsan/rtl/tsan_clock.cc Wed Jul 25 08:16:35 2012
@@ -93,6 +93,11 @@
   release(dst);
 }
 
+void ThreadClock::Disable() {
+  for (uptr i = 0; i < kMaxTidInClock; i++)
+    clk_[i] = (u64)-1;
+}
+
 SyncClock::SyncClock()
   : clk_(MBlockClock) {
 }

Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_clock.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_clock.h?rev=160723&r1=160722&r2=160723&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/rtl/tsan_clock.h (original)
+++ compiler-rt/trunk/lib/tsan/rtl/tsan_clock.h Wed Jul 25 08:16:35 2012
@@ -61,6 +61,8 @@
       nclk_ = tid + 1;
   }
 
+  void Disable();
+
   uptr size() const {
     return nclk_;
   }

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=160723&r1=160722&r2=160723&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/rtl/tsan_rtl.h (original)
+++ compiler-rt/trunk/lib/tsan/rtl/tsan_rtl.h Wed Jul 25 08:16:35 2012
@@ -437,6 +437,7 @@
 void ThreadJoin(ThreadState *thr, uptr pc, int tid);
 void ThreadDetach(ThreadState *thr, uptr pc, int tid);
 void ThreadFinalize(ThreadState *thr);
+void ThreadFinalizerGoroutine(ThreadState *thr);
 
 void MutexCreate(ThreadState *thr, uptr pc, uptr addr, bool rw, bool recursive);
 void MutexDestroy(ThreadState *thr, uptr pc, uptr addr);

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=160723&r1=160722&r2=160723&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_thread.cc (original)
+++ compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_thread.cc Wed Jul 25 08:16:35 2012
@@ -298,6 +298,10 @@
   }
 }
 
+void ThreadFinalizerGoroutine(ThreadState *thr) {
+  thr->clock.Disable();
+}
+
 void MemoryAccessRange(ThreadState *thr, uptr pc, uptr addr,
                        uptr size, bool is_write) {
   if (size == 0)





More information about the llvm-commits mailing list