[compiler-rt] r177261 - tsan: use StackDepot for thread creation stacks

Dmitry Vyukov dvyukov at google.com
Mon Mar 18 02:02:27 PDT 2013


Author: dvyukov
Date: Mon Mar 18 04:02:27 2013
New Revision: 177261

URL: http://llvm.org/viewvc/llvm-project?rev=177261&view=rev
Log:
tsan: use StackDepot for thread creation stacks

Modified:
    compiler-rt/trunk/lib/tsan/rtl/tsan_rtl.h
    compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_report.cc
    compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_thread.cc

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=177261&r1=177260&r2=177261&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/rtl/tsan_rtl.h (original)
+++ compiler-rt/trunk/lib/tsan/rtl/tsan_rtl.h Mon Mar 18 04:02:27 2013
@@ -420,7 +420,11 @@ class ThreadContext : public ThreadConte
  public:
   explicit ThreadContext(int tid);
   ThreadState *thr;
+#ifdef TSAN_GO
   StackTrace creation_stack;
+#else
+  u32 creation_stack_id;
+#endif
   SyncClock sync;
   // Epoch at which the thread had started.
   // If we see an event from the thread stamped by an older epoch,

Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_report.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_report.cc?rev=177261&r1=177260&r2=177261&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_report.cc (original)
+++ compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_report.cc Mon Mar 18 04:02:27 2013
@@ -188,7 +188,18 @@ void ScopedReport::AddThread(const Threa
   rt->running = (tctx->status == ThreadStatusRunning);
   rt->name = tctx->name ? internal_strdup(tctx->name) : 0;
   rt->parent_tid = tctx->parent_tid;
+  rt->stack = 0;
+#ifdef TSAN_GO
   rt->stack = SymbolizeStack(tctx->creation_stack);
+#else
+  uptr ssz = 0;
+  const uptr *stack = StackDepotGet(tctx->creation_stack_id, &ssz);
+  if (stack) {
+    StackTrace trace;
+    trace.Init(stack, ssz);
+    rt->stack = SymbolizeStack(trace);
+  }
+#endif
 }
 
 #ifndef TSAN_GO

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=177261&r1=177260&r2=177261&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_thread.cc (original)
+++ compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_thread.cc Mon Mar 18 04:02:27 2013
@@ -58,7 +58,11 @@ void ThreadContext::OnCreated(void *arg)
   args->thr->fast_synch_epoch = args->thr->fast_state.epoch();
   args->thr->clock.release(&sync);
   StatInc(args->thr, StatSyncRelease);
+#ifdef TSAN_GO
   creation_stack.ObtainCurrent(args->thr, args->pc);
+#else
+  creation_stack_id = CurrentStackId(args->thr, args->pc);
+#endif
   if (reuse_count == 0)
     StatInc(args->thr, StatThreadMaxTid);
 }





More information about the llvm-commits mailing list