[TSan] Revert r212531 and r212532.

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

llvm-svn: 212562
This commit is contained in:
Alexey Samsonov 2014-07-08 20:17:19 +00:00
parent 1ba38f8879
commit 047ea1717b
2 changed files with 3 additions and 16 deletions

View File

@ -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 *thr, uptr pc,
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 *thr, uptr pc,
}
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);

View File

@ -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