mirror of
https://github.com/microsoft/mimalloc.git
synced 2025-05-05 23:19:31 +03:00
make cas weak use release memory order; improve free assembly
This commit is contained in:
parent
5c7c106d62
commit
7ce9c02fd4
2 changed files with 2 additions and 2 deletions
|
@ -179,7 +179,7 @@ static inline intptr_t mi_atomic_add(volatile _Atomic(intptr_t)* p, intptr_t add
|
||||||
}
|
}
|
||||||
static inline bool mi_atomic_cas_weak(volatile _Atomic(uintptr_t)* p, uintptr_t desired, uintptr_t expected) {
|
static inline bool mi_atomic_cas_weak(volatile _Atomic(uintptr_t)* p, uintptr_t desired, uintptr_t expected) {
|
||||||
MI_USING_STD
|
MI_USING_STD
|
||||||
return atomic_compare_exchange_weak_explicit(p, &expected, desired, memory_order_acq_rel, memory_order_relaxed);
|
return atomic_compare_exchange_weak_explicit(p, &expected, desired, memory_order_release, memory_order_relaxed);
|
||||||
}
|
}
|
||||||
static inline bool mi_atomic_cas_strong(volatile _Atomic(uintptr_t)* p, uintptr_t desired, uintptr_t expected) {
|
static inline bool mi_atomic_cas_strong(volatile _Atomic(uintptr_t)* p, uintptr_t desired, uintptr_t expected) {
|
||||||
MI_USING_STD
|
MI_USING_STD
|
||||||
|
|
|
@ -226,7 +226,7 @@ void mi_free(void* p) mi_attr_noexcept
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const mi_segment_t* const segment = _mi_ptr_segment(p);
|
const mi_segment_t* const segment = _mi_ptr_segment(p);
|
||||||
if (segment == NULL) return; // checks for (p==NULL)
|
if (mi_unlikely(segment == NULL)) return; // checks for (p==NULL)
|
||||||
|
|
||||||
#if (MI_DEBUG>0)
|
#if (MI_DEBUG>0)
|
||||||
if (mi_unlikely(!mi_is_in_heap_region(p))) {
|
if (mi_unlikely(!mi_is_in_heap_region(p))) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue