2 * Override settings that were generated in jemalloc_defs.h as necessary.
5 #undef JEMALLOC_OVERRIDE_VALLOC
7 #ifndef MALLOC_PRODUCTION
13 #undef JEMALLOC_BACKGROUND_THREAD
16 * The following are architecture-dependent, so conditionally define them for
17 * each supported architecture.
19 #undef JEMALLOC_TLS_MODEL
25 #undef LG_SIZEOF_INTMAX_T
29 # define LG_SIZEOF_PTR 2
30 # define JEMALLOC_TLS_MODEL __attribute__((tls_model("initial-exec")))
34 # define LG_SIZEOF_PTR 3
38 # define LG_SIZEOF_PTR 3
39 # define JEMALLOC_TLS_MODEL __attribute__((tls_model("initial-exec")))
43 # define LG_SIZEOF_PTR 3
44 # define JEMALLOC_TLS_MODEL __attribute__((tls_model("initial-exec")))
48 # define LG_SIZEOF_PTR 2
52 # define LG_SIZEOF_PTR 3
57 # define LG_SIZEOF_PTR 3
60 # define LG_SIZEOF_PTR 2
65 # define LG_SIZEOF_PTR 3
66 #elif defined(__powerpc__)
68 # define LG_SIZEOF_PTR 2
72 # define LG_SIZEOF_PTR 3
75 #ifndef JEMALLOC_TLS_MODEL
76 # define JEMALLOC_TLS_MODEL /* Default. */
79 #define LG_PAGE PAGE_SHIFT
80 #define LG_SIZEOF_INT 2
81 #define LG_SIZEOF_LONG LG_SIZEOF_PTR
82 #define LG_SIZEOF_INTMAX_T 3
85 #include <machine/cpu.h>
86 #include <machine/cpufunc.h>
87 #define CPU_SPINWAIT cpu_spinwait()
89 /* Disable lazy-lock machinery, mangle isthreaded, and adjust its type. */
90 #undef JEMALLOC_LAZY_LOCK
91 extern int __isthreaded;
92 #define isthreaded ((bool)__isthreaded)
97 #undef je_posix_memalign
98 #undef je_aligned_alloc
101 #undef je_malloc_usable_size
110 #undef je_mallctlnametomib
111 #undef je_mallctlbymib
112 #undef je_malloc_stats_print
118 #define je_malloc __malloc
119 #define je_calloc __calloc
120 #define je_posix_memalign __posix_memalign
121 #define je_aligned_alloc __aligned_alloc
122 #define je_realloc __realloc
123 #define je_free __free
124 #define je_malloc_usable_size __malloc_usable_size
125 #define je_mallocx __mallocx
126 #define je_rallocx __rallocx
127 #define je_xallocx __xallocx
128 #define je_sallocx __sallocx
129 #define je_dallocx __dallocx
130 #define je_sdallocx __sdallocx
131 #define je_nallocx __nallocx
132 #define je_mallctl __mallctl
133 #define je_mallctlnametomib __mallctlnametomib
134 #define je_mallctlbymib __mallctlbymib
135 #define je_malloc_stats_print __malloc_stats_print
136 #define je_allocm __allocm
137 #define je_rallocm __rallocm
138 #define je_sallocm __sallocm
139 #define je_dallocm __dallocm
140 #define je_nallocm __nallocm
145 #define pthread_join _pthread_join
146 #define pthread_once _pthread_once
147 #define pthread_self _pthread_self
148 #define pthread_equal _pthread_equal
149 #define pthread_mutex_lock _pthread_mutex_lock
150 #define pthread_mutex_trylock _pthread_mutex_trylock
151 #define pthread_mutex_unlock _pthread_mutex_unlock
152 #define pthread_cond_init _pthread_cond_init
153 #define pthread_cond_wait _pthread_cond_wait
154 #define pthread_cond_timedwait _pthread_cond_timedwait
155 #define pthread_cond_signal _pthread_cond_signal
159 * Define 'weak' symbols so that an application can have its own versions
160 * of malloc, calloc, realloc, free, et al.
162 __weak_reference(__malloc, malloc);
163 __weak_reference(__calloc, calloc);
164 __weak_reference(__posix_memalign, posix_memalign);
165 __weak_reference(__aligned_alloc, aligned_alloc);
166 __weak_reference(__realloc, realloc);
167 __weak_reference(__free, free);
168 __weak_reference(__malloc_usable_size, malloc_usable_size);
169 __weak_reference(__mallocx, mallocx);
170 __weak_reference(__rallocx, rallocx);
171 __weak_reference(__xallocx, xallocx);
172 __weak_reference(__sallocx, sallocx);
173 __weak_reference(__dallocx, dallocx);
174 __weak_reference(__sdallocx, sdallocx);
175 __weak_reference(__nallocx, nallocx);
176 __weak_reference(__mallctl, mallctl);
177 __weak_reference(__mallctlnametomib, mallctlnametomib);
178 __weak_reference(__mallctlbymib, mallctlbymib);
179 __weak_reference(__malloc_stats_print, malloc_stats_print);
180 __weak_reference(__allocm, allocm);
181 __weak_reference(__rallocm, rallocm);
182 __weak_reference(__sallocm, sallocm);
183 __weak_reference(__dallocm, dallocm);
184 __weak_reference(__nallocm, nallocm);