@@ -40,15 +40,14 @@ int setcontext(const ucontext_t *ucp);
4040
4141namespace __tsan {
4242
43- // The non-barrier versions of OSAtomic* functions are semantically
44- // morder::relaxed, but the two variants (e.g. OSAtomicAdd32 and
45- // OSAtomicAdd32Barrier) are actually aliases of each other, and we cannot have
46- // different interceptors for them, because they're actually the same function.
47- // Thus, we have to stay conservative and treat the non-barrier versions as
48- // morder::acq_rel.
49- static constexpr morder kMacOrderBarrier = morder::acq_rel;
50- static constexpr morder kMacOrderNonBarrier = morder::acq_rel;
51- static constexpr morder kMacFailureOrder = morder::relaxed;
43+ // The non-barrier versions of OSAtomic* functions are semantically mo_relaxed,
44+ // but the two variants (e.g. OSAtomicAdd32 and OSAtomicAdd32Barrier) are
45+ // actually aliases of each other, and we cannot have different interceptors for
46+ // them, because they're actually the same function. Thus, we have to stay
47+ // conservative and treat the non-barrier versions as mo_acq_rel.
48+ static constexpr morder kMacOrderBarrier = mo_acq_rel;
49+ static constexpr morder kMacOrderNonBarrier = mo_acq_rel;
50+ static constexpr morder kMacFailureOrder = mo_relaxed;
5251
5352# define OSATOMIC_INTERCEPTOR (return_t, t, tsan_t, f, tsan_atomic_f, mo ) \
5453 TSAN_INTERCEPTOR (return_t , f, t x, volatile t *ptr) { \
@@ -465,7 +464,7 @@ struct fake_shared_weak_count {
465464// Shared and weak pointers in C++ maintain reference counts via atomics in
466465// libc++.dylib, which are TSan-invisible, and this leads to false positives in
467466// destructor code. These interceptors re-implements the whole functions so that
468- // the morder::acq_rel semantics of the atomic decrement are visible.
467+ // the mo_acq_rel semantics of the atomic decrement are visible.
469468//
470469// Unfortunately, the interceptors cannot simply Acquire/Release some sync
471470// object and call the original function, because it would have a race between
@@ -480,11 +479,11 @@ STDCXX_INTERCEPTOR(void, _ZNSt3__119__shared_weak_count16__release_sharedEv,
480479
481480 SCOPED_TSAN_INTERCEPTOR (_ZNSt3__119__shared_weak_count16__release_sharedEv,
482481 o);
483- if (__tsan_atomic64_fetch_add (&o->shared_owners , -1 , morder::release ) == 0 ) {
482+ if (__tsan_atomic64_fetch_add (&o->shared_owners , -1 , mo_release ) == 0 ) {
484483 Acquire (thr, pc, (uptr)&o->shared_owners );
485484 o->on_zero_shared ();
486- if (__tsan_atomic64_fetch_add (&o->shared_weak_owners , -1 ,
487- morder::release) == 0 ) {
485+ if (__tsan_atomic64_fetch_add (&o->shared_weak_owners , -1 , mo_release) ==
486+ 0 ) {
488487 Acquire (thr, pc, (uptr)&o->shared_weak_owners );
489488 o->on_zero_shared_weak ();
490489 }
@@ -497,7 +496,7 @@ STDCXX_INTERCEPTOR(bool, _ZNSt3__114__shared_count16__release_sharedEv,
497496 return REAL (_ZNSt3__114__shared_count16__release_sharedEv)(o);
498497
499498 SCOPED_TSAN_INTERCEPTOR (_ZNSt3__114__shared_count16__release_sharedEv, o);
500- if (__tsan_atomic64_fetch_add (&o->shared_owners , -1 , morder::release ) == 0 ) {
499+ if (__tsan_atomic64_fetch_add (&o->shared_owners , -1 , mo_release ) == 0 ) {
501500 Acquire (thr, pc, (uptr)&o->shared_owners );
502501 o->on_zero_shared ();
503502 return true ;
0 commit comments