From eb3d36e6490315066f0c6267586d7523424be465 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Wed, 28 Nov 2012 13:01:32 +0000 Subject: [PATCH] tsan: address several review comments llvm-svn: 168789 --- compiler-rt/lib/tsan/rtl/tsan_defs.h | 4 ++++ compiler-rt/lib/tsan/rtl/tsan_flags.cc | 6 +----- compiler-rt/lib/tsan/rtl/tsan_flags.h | 2 +- compiler-rt/lib/tsan/rtl/tsan_rtl.h | 6 +++--- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/compiler-rt/lib/tsan/rtl/tsan_defs.h b/compiler-rt/lib/tsan/rtl/tsan_defs.h index 2ffe2ef..6d8e9cf 100644 --- a/compiler-rt/lib/tsan/rtl/tsan_defs.h +++ b/compiler-rt/lib/tsan/rtl/tsan_defs.h @@ -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 diff --git a/compiler-rt/lib/tsan/rtl/tsan_flags.cc b/compiler-rt/lib/tsan/rtl/tsan_flags.cc index 942d392..e3a18da 100644 --- a/compiler-rt/lib/tsan/rtl/tsan_flags.cc +++ b/compiler-rt/lib/tsan/rtl/tsan_flags.cc @@ -56,11 +56,7 @@ void InitializeFlags(Flags *f, const char *env) { 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); diff --git a/compiler-rt/lib/tsan/rtl/tsan_flags.h b/compiler-rt/lib/tsan/rtl/tsan_flags.h index 41a8a78..86c2af5 100644 --- a/compiler-rt/lib/tsan/rtl/tsan_flags.h +++ b/compiler-rt/lib/tsan/rtl/tsan_flags.h @@ -69,7 +69,7 @@ struct Flags { // 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). diff --git a/compiler-rt/lib/tsan/rtl/tsan_rtl.h b/compiler-rt/lib/tsan/rtl/tsan_rtl.h index 79075f0..eab2af5 100644 --- a/compiler-rt/lib/tsan/rtl/tsan_rtl.h +++ b/compiler-rt/lib/tsan/rtl/tsan_rtl.h @@ -568,8 +568,8 @@ extern "C" void __tsan_trace_switch(); 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 @@ void ALWAYS_INLINE INLINE TraceAddEvent(ThreadState *thr, FastState fs, #endif } Event *trace = (Event*)GetThreadTrace(fs.tid()); - Event *evp = &trace[epoch]; + Event *evp = &trace[pos]; Event ev = (u64)addr | ((u64)typ << 61); *evp = ev; } -- 2.7.4