tsan_update_shadow_word_inl.h [plain text]
do {
StatInc(thr, StatShadowProcessed);
const unsigned kAccessSize = 1 << kAccessSizeLog;
unsigned off = cur.ComputeSearchOffset();
u64 *sp = &shadow_mem[(idx + off) % kShadowCnt];
old = LoadShadow(sp);
if (old.IsZero()) {
StatInc(thr, StatShadowZero);
if (store_word)
StoreIfNotYetStored(sp, &store_word);
break;
}
if (Shadow::Addr0AndSizeAreEqual(cur, old)) {
StatInc(thr, StatShadowSameSize);
if (Shadow::TidsAreEqual(old, cur)) {
StatInc(thr, StatShadowSameThread);
if (OldIsInSameSynchEpoch(old, thr)) {
if (OldIsRWNotWeaker(old, kAccessIsWrite)) {
StatInc(thr, StatMopSame);
return;
}
StoreIfNotYetStored(sp, &store_word);
break;
}
if (OldIsRWWeakerOrEqual(old, kAccessIsWrite))
StoreIfNotYetStored(sp, &store_word);
break;
}
StatInc(thr, StatShadowAnotherThread);
if (HappensBefore(old, thr)) {
StoreIfNotYetStored(sp, &store_word);
break;
}
if (BothReads(old, kAccessIsWrite))
break;
goto RACE;
}
if (Shadow::TwoRangesIntersect(old, cur, kAccessSize)) {
StatInc(thr, StatShadowIntersect);
if (Shadow::TidsAreEqual(old, cur)) {
StatInc(thr, StatShadowSameThread);
break;
}
StatInc(thr, StatShadowAnotherThread);
if (HappensBefore(old, thr))
break;
if (BothReads(old, kAccessIsWrite))
break;
goto RACE;
}
StatInc(thr, StatShadowNotIntersect);
break;
} while (0);