Skip to content

Commit 095abc9

Browse files
committed
fix TLS slot on macOS
1 parent e10d0d2 commit 095abc9

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

include/mimalloc/prim.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ void _mi_prim_thread_associate_default_heap(mi_heap_t* heap);
144144
|| (defined(__OpenBSD__) && (defined(__x86_64__) || defined(__i386__) || defined(__aarch64__))) \
145145
)
146146

147-
#define MI_HAS_TLS_SLOT
147+
#define MI_HAS_TLS_SLOT 1
148148

149149
static inline void* mi_prim_tls_slot(size_t slot) mi_attr_noexcept {
150150
void* res;
@@ -294,7 +294,7 @@ static inline mi_threadid_t _mi_prim_thread_id(void) mi_attr_noexcept {
294294
return (uintptr_t)__builtin_thread_pointer();
295295
}
296296

297-
#elif defined(MI_HAS_TLS_SLOT)
297+
#elif MI_HAS_TLS_SLOT
298298

299299
static inline mi_threadid_t _mi_prim_thread_id(void) mi_attr_noexcept {
300300
#if defined(__BIONIC__)
@@ -359,14 +359,14 @@ static inline mi_heap_t* mi_prim_get_default_heap(void);
359359
#endif
360360

361361

362-
#if defined(MI_TLS_SLOT)
362+
#if MI_TLS_SLOT
363363
# if !defined(MI_HAS_TLS_SLOT)
364364
# error "trying to use a TLS slot for the default heap, but the mi_prim_tls_slot primitives are not defined"
365365
# endif
366366

367367
static inline mi_heap_t* mi_prim_get_default_heap(void) {
368368
mi_heap_t* heap = (mi_heap_t*)mi_prim_tls_slot(MI_TLS_SLOT);
369-
#if MI_TLS_SLOT == 1 // check if the TLS slot is initialized
369+
#if MI_HAS_TLS_SLOT == 1 // check if the TLS slot is initialized
370370
if mi_unlikely(heap == NULL) {
371371
#ifdef __GNUC__
372372
__asm(""); // prevent conditional load of the address of _mi_heap_empty

0 commit comments

Comments
 (0)