diff options
author | Daan Leijen <daan@microsoft.com> | 2021-06-17 19:15:09 -0700 |
---|---|---|
committer | Daan Leijen <daan@microsoft.com> | 2021-06-17 19:15:09 -0700 |
commit | a83bca72b3f98b55c564713176c40e44698e2c43 (patch) | |
tree | 44088df6c2007b98420da50109b09d1c5ea3f9be /include/mimalloc-internal.h | |
parent | c8b5b745006a833189381eaab119df06bd1c8f44 (diff) |
fixes for M1; disable interpose use zones; fix pedantic warnings
Diffstat (limited to 'include/mimalloc-internal.h')
-rw-r--r-- | include/mimalloc-internal.h | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/include/mimalloc-internal.h b/include/mimalloc-internal.h index 449893b..4a803ff 100644 --- a/include/mimalloc-internal.h +++ b/include/mimalloc-internal.h @@ -713,6 +713,7 @@ static inline void* mi_tls_slot(size_t slot) mi_attr_noexcept { void** tcb; UNUSED(ofs); #if defined(__APPLE__) // M1, issue #343 __asm__ volatile ("mrs %0, tpidrro_el0" : "=r" (tcb)); + tcb = (void**)((uintptr_t)tcb & ~0x07UL); // clear lower 3 bits #else __asm__ volatile ("mrs %0, tpidr_el0" : "=r" (tcb)); #endif @@ -740,6 +741,7 @@ static inline void mi_tls_slot_set(size_t slot, void* value) mi_attr_noexcept { void** tcb; UNUSED(ofs); #if defined(__APPLE__) // M1, issue #343 __asm__ volatile ("mrs %0, tpidrro_el0" : "=r" (tcb)); + tcb = (void**)((uintptr_t)tcb & ~0x07UL); // clear lower 3 bits #else __asm__ volatile ("mrs %0, tpidr_el0" : "=r" (tcb)); #endif @@ -748,10 +750,7 @@ static inline void mi_tls_slot_set(size_t slot, void* value) mi_attr_noexcept { } static inline uintptr_t _mi_thread_id(void) mi_attr_noexcept { -#if defined(__aarch64__) && defined(__APPLE__) // M1 - // on macOS on the M1, slot 0 does not seem to work, so we fall back to portable C for now. See issue #354 - return (uintptr_t)&_mi_heap_default; -#elif defined(__BIONIC__) && (defined(__arm__) || defined(__aarch64__)) +#if defined(__BIONIC__) && (defined(__arm__) || defined(__aarch64__)) // on Android, slot 1 is the thread ID (pointer to pthread internal struct) return (uintptr_t)mi_tls_slot(1); #else |