@@ -40,15 +40,14 @@ int setcontext(const ucontext_t *ucp);
40
40
41
41
namespace __tsan {
42
42
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;
52
51
53
52
# define OSATOMIC_INTERCEPTOR (return_t, t, tsan_t, f, tsan_atomic_f, mo ) \
54
53
TSAN_INTERCEPTOR (return_t , f, t x, volatile t *ptr) { \
@@ -465,7 +464,7 @@ struct fake_shared_weak_count {
465
464
// Shared and weak pointers in C++ maintain reference counts via atomics in
466
465
// libc++.dylib, which are TSan-invisible, and this leads to false positives in
467
466
// 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.
469
468
//
470
469
// Unfortunately, the interceptors cannot simply Acquire/Release some sync
471
470
// 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,
480
479
481
480
SCOPED_TSAN_INTERCEPTOR (_ZNSt3__119__shared_weak_count16__release_sharedEv,
482
481
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 ) {
484
483
Acquire (thr, pc, (uptr)&o->shared_owners );
485
484
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 ) {
488
487
Acquire (thr, pc, (uptr)&o->shared_weak_owners );
489
488
o->on_zero_shared_weak ();
490
489
}
@@ -497,7 +496,7 @@ STDCXX_INTERCEPTOR(bool, _ZNSt3__114__shared_count16__release_sharedEv,
497
496
return REAL (_ZNSt3__114__shared_count16__release_sharedEv)(o);
498
497
499
498
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 ) {
501
500
Acquire (thr, pc, (uptr)&o->shared_owners );
502
501
o->on_zero_shared ();
503
502
return true ;
0 commit comments