File tree Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -92,8 +92,11 @@ __inline static void lock(Lock *l) { OSSpinLockLock(l); }
9292static Lock locks [SPINLOCK_COUNT ]; // initialized to OS_SPINLOCK_INIT which is 0
9393
9494#else
95+ #ifndef __CHERI_PURE_CAPABILITY__
96+ // FIXME: needs https://github.com/CTSRD-CHERI/llvm-project/pull/721
9597_Static_assert (__atomic_always_lock_free (sizeof (uintptr_t ), 0 ),
9698 "Implementation assumes lock-free pointer-size cmpxchg" );
99+ #endif
97100typedef _Atomic (uintptr_t ) Lock ;
98101/// Unlock a lock. This is a release operation.
99102__inline static void unlock (Lock * l ) {
Original file line number Diff line number Diff line change @@ -1408,6 +1408,13 @@ _Tp __cxx_atomic_fetch_xor(__cxx_atomic_lock_impl<_Tp>* __a,
14081408
14091409template <typename _Tp> struct __cxx_is_always_lock_free {
14101410 enum { __value = __atomic_always_lock_free (sizeof (_Tp), 0 ) }; };
1411+ #ifdef __CHERI_PURE_CAPABILITY__
1412+ // FIXME: can be removed after https://github.com/CTSRD-CHERI/llvm-project/pull/721 lands
1413+ template <typename _Tp> struct __cxx_is_always_lock_free <_Tp*> { enum { __value = 2 == ATOMIC_POINTER_LOCK_FREE }; };
1414+ template <> struct __cxx_is_always_lock_free <intptr_t > { enum { __value = 2 == ATOMIC_POINTER_LOCK_FREE }; };
1415+ template <> struct __cxx_is_always_lock_free <uintptr_t > { enum { __value = 2 == ATOMIC_POINTER_LOCK_FREE }; };
1416+ template <> struct __cxx_is_always_lock_free <std::nullptr_t > { enum { __value = 2 == ATOMIC_POINTER_LOCK_FREE }; };
1417+ #endif
14111418
14121419#else
14131420
You can’t perform that action at this time.
0 commit comments