[compiler-rt] r212562 - [TSan] Revert r212531 and r212532.

Alexey Samsonov vonosmas at gmail.com
Tue Jul 8 13:17:19 PDT 2014


Author: samsonov
Date: Tue Jul  8 15:17:19 2014
New Revision: 212562

URL: http://llvm.org/viewvc/llvm-project?rev=212562&view=rev
Log:
[TSan] Revert r212531 and r212532.

They cause "check-tsan" command to hang. Details in r212532 review thread.

Modified:
    compiler-rt/trunk/lib/tsan/rtl/tsan_sync.cc
    compiler-rt/trunk/lib/tsan/tests/unit/tsan_sync_test.cc

Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_sync.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_sync.cc?rev=212562&r1=212561&r2=212562&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/rtl/tsan_sync.cc (original)
+++ compiler-rt/trunk/lib/tsan/rtl/tsan_sync.cc Tue Jul  8 15:17:19 2014
@@ -46,6 +46,7 @@ void SyncVar::Reset() {
   is_recursive = 0;
   is_broken = 0;
   is_linker_init = 0;
+  next = 0;
 
   clock.Zero();
   read_clock.Reset();
@@ -133,7 +134,7 @@ SyncVar* MetaMap::GetAndLock(ThreadState
   u32 myidx = 0;
   SyncVar *mys = 0;
   for (;;) {
-    u32 idx = idx0;
+    u32 idx = *meta;
     for (;;) {
       if (idx == 0)
         break;
@@ -156,10 +157,8 @@ SyncVar* MetaMap::GetAndLock(ThreadState
     }
     if (!create)
       return 0;
-    if (*meta != idx0) {
-      idx0 = *meta;
+    if (*meta != idx0)
       continue;
-    }
 
     if (myidx == 0) {
       const u64 uid = atomic_fetch_add(&uid_gen_, 1, memory_order_relaxed);

Modified: compiler-rt/trunk/lib/tsan/tests/unit/tsan_sync_test.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/tests/unit/tsan_sync_test.cc?rev=212562&r1=212561&r2=212562&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/tests/unit/tsan_sync_test.cc (original)
+++ compiler-rt/trunk/lib/tsan/tests/unit/tsan_sync_test.cc Tue Jul  8 15:17:19 2014
@@ -108,16 +108,4 @@ TEST(MetaMap, MoveMemory) {
   m->FreeRange(thr, 0, (uptr)&block2[0], 4 * sizeof(u64));
 }
 
-TEST(MetaMap, ResetSync) {
-  ThreadState *thr = cur_thread();
-  MetaMap *m = &ctx->metamap;
-  u64 block[1] = {};  // fake malloc block
-  m->AllocBlock(thr, 0, (uptr)&block[0], 1 * sizeof(u64));
-  SyncVar *s = m->GetOrCreateAndLock(thr, 0, (uptr)&block[0], true);
-  s->Reset();
-  s->mtx.Unlock();
-  uptr sz = m->FreeBlock(thr, 0, (uptr)&block[0]);
-  EXPECT_EQ(sz, 1 * sizeof(u64));
-}
-
 }  // namespace __tsan





More information about the llvm-commits mailing list