[llvm-commits] [compiler-rt] r160282 - in /compiler-rt/trunk/lib/tsan/go: test.c tsan_go.cc

Dmitry Vyukov dvyukov at google.com
Mon Jul 16 09:01:08 PDT 2012


Author: dvyukov
Date: Mon Jul 16 11:01:08 2012
New Revision: 160282

URL: http://llvm.org/viewvc/llvm-project?rev=160282&view=rev
Log:
tsan: Go runtime: support goroutine end event

Modified:
    compiler-rt/trunk/lib/tsan/go/test.c
    compiler-rt/trunk/lib/tsan/go/tsan_go.cc

Modified: compiler-rt/trunk/lib/tsan/go/test.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/go/test.c?rev=160282&r1=160281&r2=160282&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/go/test.c (original)
+++ compiler-rt/trunk/lib/tsan/go/test.c Mon Jul 16 11:01:08 2012
@@ -2,6 +2,7 @@
 
 void __tsan_init();
 void __tsan_fini();
+void __tsan_event(int typ, int tid, void *pc, void *addr, int info);
 
 int goCallbackCommentPc(void *pc, char **img, char **rtn, char **file, int *l) {
   return 0;
@@ -9,6 +10,10 @@
 
 int main(void) {
   __tsan_init();
+  __tsan_event(1, 0, 0, &main, 0);  // READ
+  __tsan_event(11, 1, 0, 0, 0);  // THR_START
+  __tsan_event(11, 0, 0, &main, 0);  // READ
+  __tsan_event(13, 1, 0, 0, 0);  // THR_END
   printf("OK\n");
   __tsan_fini();
   return 0;

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=160282&r1=160281&r2=160282&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/go/tsan_go.cc (original)
+++ compiler-rt/trunk/lib/tsan/go/tsan_go.cc Mon Jul 16 11:01:08 2012
@@ -210,6 +210,12 @@
     thr->in_rtl--;
     break;
   }
+  case THR_END: {
+    thr->in_rtl++;
+    ThreadFinish(thr);
+    thr->in_rtl--;
+    break;
+  }
   default:
     Printf("Unknown event type %d\n", typ);
     Die();





More information about the llvm-commits mailing list