summaryrefslogtreecommitdiff
path: root/include/mimalloc-internal.h
diff options
context:
space:
mode:
authorJim Huang <jserv@biilabs.io>2021-04-19 01:02:13 +0800
committerJim Huang <jserv@biilabs.io>2021-04-21 15:24:02 +0800
commit3402c6cc3f439e8be04ff99afea2c810f27af035 (patch)
treec5dec5f056f9d21e8e7e54b90d8b7415341f47f3 /include/mimalloc-internal.h
parentb19da8e362acae8944c60a40cf5c40c8f5ebeb44 (diff)
Revise the use of macOS predefined macro
Quoted from "Porting UNIX/Linux Applications to OS X,"[1] * macro __MACH__ is defined if Mach system calls are supported; * macro __APPLE__ is defined in any Apple computer. __MACH__ is not specific to macOS since GNU/Hurd runs on a Mach-based microkernel (gnumach) [2]. __MACH__ is defined by the compiler, leading to potential confusions. The solution is just changing the checked identifier (i.e. __APPLE__), so it is really used only on macOS. [1] https://developer.apple.com/library/archive/documentation/Porting/Conceptual/PortingUnix/compiling/compiling.html [2] https://www.gnu.org/software/hurd/microkernel/mach/gnumach.html
Diffstat (limited to 'include/mimalloc-internal.h')
-rw-r--r--include/mimalloc-internal.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/include/mimalloc-internal.h b/include/mimalloc-internal.h
index 7160bc4..5655cd4 100644
--- a/include/mimalloc-internal.h
+++ b/include/mimalloc-internal.h
@@ -293,7 +293,7 @@ extern bool _mi_process_is_initialized;
mi_heap_t* _mi_heap_main_get(void); // statically allocated main backing heap
#if defined(MI_MALLOC_OVERRIDE)
-#if defined(__MACH__) // OSX
+#if defined(__APPLE__) // macOS
#define MI_TLS_SLOT 89 // seems unused?
// other possible unused ones are 9, 29, __PTK_FRAMEWORK_JAVASCRIPTCORE_KEY4 (94), __PTK_FRAMEWORK_GC_KEY9 (112) and __PTK_FRAMEWORK_OLDGC_KEY9 (89)
// see <https://github.com/rweichler/substrate/blob/master/include/pthread_machdep.h>
@@ -699,7 +699,7 @@ static inline void* mi_tls_slot(size_t slot) mi_attr_noexcept {
const size_t ofs = (slot*sizeof(void*));
#if defined(__i386__)
__asm__("movl %%gs:%1, %0" : "=r" (res) : "m" (*((void**)ofs)) : ); // 32-bit always uses GS
-#elif defined(__MACH__) && defined(__x86_64__)
+#elif defined(__APPLE__) && defined(__x86_64__)
__asm__("movq %%gs:%1, %0" : "=r" (res) : "m" (*((void**)ofs)) : ); // x86_64 macOSX uses GS
#elif defined(__x86_64__) && (MI_INTPTR_SIZE==4)
__asm__("movl %%fs:%1, %0" : "=r" (res) : "m" (*((void**)ofs)) : ); // x32 ABI
@@ -726,7 +726,7 @@ static inline void mi_tls_slot_set(size_t slot, void* value) mi_attr_noexcept {
const size_t ofs = (slot*sizeof(void*));
#if defined(__i386__)
__asm__("movl %1,%%gs:%0" : "=m" (*((void**)ofs)) : "rn" (value) : ); // 32-bit always uses GS
-#elif defined(__MACH__) && defined(__x86_64__)
+#elif defined(__APPLE__) && defined(__x86_64__)
__asm__("movq %1,%%gs:%0" : "=m" (*((void**)ofs)) : "rn" (value) : ); // x86_64 macOSX uses GS
#elif defined(__x86_64__) && (MI_INTPTR_SIZE==4)
__asm__("movl %1,%%fs:%1" : "=m" (*((void**)ofs)) : "rn" (value) : ); // x32 ABI