2 * Override settings that were generated in jemalloc_defs.h as necessary.
5 #undef JEMALLOC_OVERRIDE_VALLOC
7 #ifndef MALLOC_PRODUCTION
14 * The following are architecture-dependent, so conditionally define them for
15 * each supported architecture.
17 #undef JEMALLOC_TLS_MODEL
18 #undef STATIC_PAGE_SHIFT
22 #undef LG_SIZEOF_INTMAX_T
25 # define LG_SIZEOF_PTR 2
26 # define JEMALLOC_TLS_MODEL __attribute__((tls_model("initial-exec")))
29 # define LG_SIZEOF_PTR 3
32 # define LG_SIZEOF_PTR 3
33 # define JEMALLOC_TLS_MODEL __attribute__((tls_model("initial-exec")))
36 # define LG_SIZEOF_PTR 3
37 # define JEMALLOC_TLS_MODEL __attribute__((tls_model("initial-exec")))
40 # define LG_SIZEOF_PTR 2
43 # define LG_SIZEOF_PTR 3
47 # define LG_SIZEOF_PTR 3
49 # define LG_SIZEOF_PTR 2
53 # define LG_SIZEOF_PTR 3
54 #elif defined(__powerpc__)
55 # define LG_SIZEOF_PTR 2
58 # define LG_SIZEOF_PTR 3
61 #ifndef JEMALLOC_TLS_MODEL
62 # define JEMALLOC_TLS_MODEL /* Default. */
65 #define STATIC_PAGE_SHIFT PAGE_SHIFT
66 #define LG_SIZEOF_INT 2
67 #define LG_SIZEOF_LONG LG_SIZEOF_PTR
68 #define LG_SIZEOF_INTMAX_T 3
71 #include <machine/cpu.h>
72 #include <machine/cpufunc.h>
73 #define CPU_SPINWAIT cpu_spinwait()
75 /* Disable lazy-lock machinery, mangle isthreaded, and adjust its type. */
76 #undef JEMALLOC_LAZY_LOCK
77 extern int __isthreaded;
78 #define isthreaded ((bool)__isthreaded)
83 #undef je_posix_memalign
84 #undef je_aligned_alloc
87 #undef je_malloc_usable_size
96 #undef je_mallctlnametomib
97 #undef je_mallctlbymib
98 #undef je_malloc_stats_print
104 #define je_malloc __malloc
105 #define je_calloc __calloc
106 #define je_posix_memalign __posix_memalign
107 #define je_aligned_alloc __aligned_alloc
108 #define je_realloc __realloc
109 #define je_free __free
110 #define je_malloc_usable_size __malloc_usable_size
111 #define je_mallocx __mallocx
112 #define je_rallocx __rallocx
113 #define je_xallocx __xallocx
114 #define je_sallocx __sallocx
115 #define je_dallocx __dallocx
116 #define je_sdallocx __sdallocx
117 #define je_nallocx __nallocx
118 #define je_mallctl __mallctl
119 #define je_mallctlnametomib __mallctlnametomib
120 #define je_mallctlbymib __mallctlbymib
121 #define je_malloc_stats_print __malloc_stats_print
122 #define je_allocm __allocm
123 #define je_rallocm __rallocm
124 #define je_sallocm __sallocm
125 #define je_dallocm __dallocm
126 #define je_nallocm __nallocm
131 #define pthread_mutex_lock _pthread_mutex_lock
132 #define pthread_mutex_unlock _pthread_mutex_unlock
136 * Define 'weak' symbols so that an application can have its own versions
137 * of malloc, calloc, realloc, free, et al.
139 __weak_reference(__malloc, malloc);
140 __weak_reference(__calloc, calloc);
141 __weak_reference(__posix_memalign, posix_memalign);
142 __weak_reference(__aligned_alloc, aligned_alloc);
143 __weak_reference(__realloc, realloc);
144 __weak_reference(__free, free);
145 __weak_reference(__malloc_usable_size, malloc_usable_size);
146 __weak_reference(__mallocx, mallocx);
147 __weak_reference(__rallocx, rallocx);
148 __weak_reference(__xallocx, xallocx);
149 __weak_reference(__sallocx, sallocx);
150 __weak_reference(__dallocx, dallocx);
151 __weak_reference(__sdallocx, sdallocx);
152 __weak_reference(__nallocx, nallocx);
153 __weak_reference(__mallctl, mallctl);
154 __weak_reference(__mallctlnametomib, mallctlnametomib);
155 __weak_reference(__mallctlbymib, mallctlbymib);
156 __weak_reference(__malloc_stats_print, malloc_stats_print);
157 __weak_reference(__allocm, allocm);
158 __weak_reference(__rallocm, rallocm);
159 __weak_reference(__sallocm, sallocm);
160 __weak_reference(__dallocm, dallocm);
161 __weak_reference(__nallocm, nallocm);