tsan: suport for Go finalizers

llvm-svn: 160723
This commit is contained in:
Dmitry Vyukov 2012-07-25 13:16:35 +00:00
parent d654f06644
commit dfc8e52400
5 changed files with 17 additions and 0 deletions

View File

@ -221,5 +221,10 @@ void __tsan_event(int typ, int tid, void *pc, void *addr, int info) {
}
}
void __tsan_finalizer_goroutine(int tid) {
ThreadState *thr = goroutines[tid];
ThreadFinalizerGoroutine(thr);
}
} // extern "C"
} // namespace __tsan

View File

@ -93,6 +93,11 @@ void ThreadClock::acq_rel(SyncClock *dst) {
release(dst);
}
void ThreadClock::Disable() {
for (uptr i = 0; i < kMaxTidInClock; i++)
clk_[i] = (u64)-1;
}
SyncClock::SyncClock()
: clk_(MBlockClock) {
}

View File

@ -61,6 +61,8 @@ struct ThreadClock {
nclk_ = tid + 1;
}
void Disable();
uptr size() const {
return nclk_;
}

View File

@ -437,6 +437,7 @@ int ThreadTid(ThreadState *thr, uptr pc, uptr uid);
void ThreadJoin(ThreadState *thr, uptr pc, int tid);
void ThreadDetach(ThreadState *thr, uptr pc, int tid);
void ThreadFinalize(ThreadState *thr);
void ThreadFinalizerGoroutine(ThreadState *thr);
void MutexCreate(ThreadState *thr, uptr pc, uptr addr, bool rw, bool recursive);
void MutexDestroy(ThreadState *thr, uptr pc, uptr addr);

View File

@ -298,6 +298,10 @@ void ThreadDetach(ThreadState *thr, uptr pc, int tid) {
}
}
void ThreadFinalizerGoroutine(ThreadState *thr) {
thr->clock.Disable();
}
void MemoryAccessRange(ThreadState *thr, uptr pc, uptr addr,
uptr size, bool is_write) {
if (size == 0)