[llvm-commits] [compiler-rt] r168789 - in /compiler-rt/trunk/lib/tsan/rtl: tsan_defs.h tsan_flags.cc tsan_flags.h tsan_rtl.h

Dmitry Vyukov dvyukov at google.com
Wed Nov 28 05:01:32 PST 2012


Author: dvyukov
Date: Wed Nov 28 07:01:32 2012
New Revision: 168789

URL: http://llvm.org/viewvc/llvm-project?rev=168789&view=rev
Log:
tsan: address several review comments

Modified:
    compiler-rt/trunk/lib/tsan/rtl/tsan_defs.h
    compiler-rt/trunk/lib/tsan/rtl/tsan_flags.cc
    compiler-rt/trunk/lib/tsan/rtl/tsan_flags.h
    compiler-rt/trunk/lib/tsan/rtl/tsan_rtl.h

Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_defs.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_defs.h?rev=168789&r1=168788&r2=168789&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/rtl/tsan_defs.h (original)
+++ compiler-rt/trunk/lib/tsan/rtl/tsan_defs.h Wed Nov 28 07:01:32 2012
@@ -25,8 +25,12 @@
 namespace __tsan {
 
 #ifdef TSAN_GO
+const bool kGoMode = true;
+const bool kCppMode = false;
 const char *const kTsanOptionsEnv = "GORACE";
 #else
+const bool kGoMode = false;
+const bool kCppMode = true;
 const char *const kTsanOptionsEnv = "TSAN_OPTIONS";
 #endif
 

Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_flags.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_flags.cc?rev=168789&r1=168788&r2=168789&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/rtl/tsan_flags.cc (original)
+++ compiler-rt/trunk/lib/tsan/rtl/tsan_flags.cc Wed Nov 28 07:01:32 2012
@@ -56,11 +56,7 @@
   f->stop_on_start = false;
   f->running_on_valgrind = false;
   f->external_symbolizer_path = "";
-  f->history_size = 2;
-
-#ifdef TSAN_GO
-  f->history_size = 1;  // There are a lot of goroutines.
-#endif
+  f->history_size = kGoMode ? 1 : 2;  // There are a lot of goroutines in Go.
 
   // Let a frontend override.
   OverrideFlags(f);

Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_flags.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_flags.h?rev=168789&r1=168788&r2=168789&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/rtl/tsan_flags.h (original)
+++ compiler-rt/trunk/lib/tsan/rtl/tsan_flags.h Wed Nov 28 07:01:32 2012
@@ -69,7 +69,7 @@
   // Path to external symbolizer.
   const char *external_symbolizer_path;
   // Per-thread history size, controls how many previous memory accesses
-  // is remembered per thread.  Possible values are [0..7].
+  // are remembered per thread.  Possible values are [0..7].
   // history_size=0 amounts to 32K memory accesses.  Each next value doubles
   // the amount of memory accesses, up to history_size=7 that amounts to
   // 4M memory accesses.  The default value is 2 (128K memory accesses).

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=168789&r1=168788&r2=168789&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/rtl/tsan_rtl.h (original)
+++ compiler-rt/trunk/lib/tsan/rtl/tsan_rtl.h Wed Nov 28 07:01:32 2012
@@ -568,8 +568,8 @@
 void ALWAYS_INLINE INLINE TraceAddEvent(ThreadState *thr, FastState fs,
                                         EventType typ, uptr addr) {
   StatInc(thr, StatEvents);
-  u64 epoch = fs.GetTracePos();
-  if (UNLIKELY((epoch % kTracePartSize) == 0)) {
+  u64 pos = fs.GetTracePos();
+  if (UNLIKELY((pos % kTracePartSize) == 0)) {
 #ifndef TSAN_GO
     HACKY_CALL(__tsan_trace_switch);
 #else
@@ -577,7 +577,7 @@
 #endif
   }
   Event *trace = (Event*)GetThreadTrace(fs.tid());
-  Event *evp = &trace[epoch];
+  Event *evp = &trace[pos];
   Event ev = (u64)addr | ((u64)typ << 61);
   *evp = ev;
 }





More information about the llvm-commits mailing list