1261071Sjasone/* include/jemalloc/internal/jemalloc_internal_defs.h.  Generated from jemalloc_internal_defs.h.in by configure.  */
2261071Sjasone#ifndef JEMALLOC_INTERNAL_DEFS_H_
3261071Sjasone#define	JEMALLOC_INTERNAL_DEFS_H_
4261071Sjasone/*
5261071Sjasone * If JEMALLOC_PREFIX is defined via --with-jemalloc-prefix, it will cause all
6261071Sjasone * public APIs to be prefixed.  This makes it possible, with some care, to use
7261071Sjasone * multiple allocators simultaneously.
8261071Sjasone */
9261071Sjasone/* #undef JEMALLOC_PREFIX */
10261071Sjasone/* #undef JEMALLOC_CPREFIX */
11261071Sjasone
12261071Sjasone/*
13261071Sjasone * JEMALLOC_PRIVATE_NAMESPACE is used as a prefix for all library-private APIs.
14261071Sjasone * For shared libraries, symbol visibility mechanisms prevent these symbols
15261071Sjasone * from being exported, but for static libraries, naming collisions are a real
16261071Sjasone * possibility.
17261071Sjasone */
18261071Sjasone#define JEMALLOC_PRIVATE_NAMESPACE __je_
19261071Sjasone
20261071Sjasone/*
21261071Sjasone * Hyper-threaded CPUs may need a special instruction inside spin loops in
22261071Sjasone * order to yield to another virtual CPU.
23261071Sjasone */
24261071Sjasone#define CPU_SPINWAIT __asm__ volatile("pause")
25261071Sjasone
26286866Sjasone/* Defined if C11 atomics are available. */
27286866Sjasone/* #undef JEMALLOC_C11ATOMICS */
28286866Sjasone
29261071Sjasone/* Defined if the equivalent of FreeBSD's atomic(9) functions are available. */
30261071Sjasone#define JEMALLOC_ATOMIC9 1
31261071Sjasone
32261071Sjasone/*
33261071Sjasone * Defined if OSAtomic*() functions are available, as provided by Darwin, and
34261071Sjasone * documented in the atomic(3) manual page.
35261071Sjasone */
36261071Sjasone/* #undef JEMALLOC_OSATOMIC */
37261071Sjasone
38261071Sjasone/*
39261071Sjasone * Defined if __sync_add_and_fetch(uint32_t *, uint32_t) and
40261071Sjasone * __sync_sub_and_fetch(uint32_t *, uint32_t) are available, despite
41261071Sjasone * __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 not being defined (which means the
42286866Sjasone * functions are defined in libgcc instead of being inlines).
43261071Sjasone */
44261071Sjasone/* #undef JE_FORCE_SYNC_COMPARE_AND_SWAP_4 */
45261071Sjasone
46261071Sjasone/*
47261071Sjasone * Defined if __sync_add_and_fetch(uint64_t *, uint64_t) and
48261071Sjasone * __sync_sub_and_fetch(uint64_t *, uint64_t) are available, despite
49261071Sjasone * __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 not being defined (which means the
50286866Sjasone * functions are defined in libgcc instead of being inlines).
51261071Sjasone */
52261071Sjasone/* #undef JE_FORCE_SYNC_COMPARE_AND_SWAP_8 */
53261071Sjasone
54261071Sjasone/*
55286866Sjasone * Defined if __builtin_clz() and __builtin_clzl() are available.
56286866Sjasone */
57286866Sjasone#define JEMALLOC_HAVE_BUILTIN_CLZ
58286866Sjasone
59286866Sjasone/*
60286866Sjasone * Defined if madvise(2) is available.
61286866Sjasone */
62286866Sjasone#define JEMALLOC_HAVE_MADVISE
63286866Sjasone
64286866Sjasone/*
65261071Sjasone * Defined if OSSpin*() functions are available, as provided by Darwin, and
66261071Sjasone * documented in the spinlock(3) manual page.
67261071Sjasone */
68261071Sjasone/* #undef JEMALLOC_OSSPIN */
69261071Sjasone
70261071Sjasone/*
71286866Sjasone * Defined if secure_getenv(3) is available.
72286866Sjasone */
73286866Sjasone/* #undef JEMALLOC_HAVE_SECURE_GETENV */
74286866Sjasone
75286866Sjasone/*
76286866Sjasone * Defined if issetugid(2) is available.
77286866Sjasone */
78286866Sjasone#define JEMALLOC_HAVE_ISSETUGID
79286866Sjasone
80286866Sjasone/*
81261071Sjasone * Defined if _malloc_thread_cleanup() exists.  At least in the case of
82261071Sjasone * FreeBSD, pthread_key_create() allocates, which if used during malloc
83261071Sjasone * bootstrapping will cause recursion into the pthreads library.  Therefore, if
84261071Sjasone * _malloc_thread_cleanup() exists, use it as the basis for thread cleanup in
85261071Sjasone * malloc_tsd.
86261071Sjasone */
87261071Sjasone#define JEMALLOC_MALLOC_THREAD_CLEANUP
88261071Sjasone
89261071Sjasone/*
90261071Sjasone * Defined if threaded initialization is known to be safe on this platform.
91261071Sjasone * Among other things, it must be possible to initialize a mutex without
92261071Sjasone * triggering allocation in order for threaded allocation to be safe.
93261071Sjasone */
94261071Sjasone/* #undef JEMALLOC_THREADED_INIT */
95261071Sjasone
96261071Sjasone/*
97261071Sjasone * Defined if the pthreads implementation defines
98261071Sjasone * _pthread_mutex_init_calloc_cb(), in which case the function is used in order
99261071Sjasone * to avoid recursive allocation during mutex initialization.
100261071Sjasone */
101261071Sjasone#define JEMALLOC_MUTEX_INIT_CB 1
102261071Sjasone
103261071Sjasone/* Non-empty if the tls_model attribute is supported. */
104261071Sjasone#define JEMALLOC_TLS_MODEL __attribute__((tls_model("initial-exec")))
105261071Sjasone
106261071Sjasone/* JEMALLOC_CC_SILENCE enables code that silences unuseful compiler warnings. */
107261071Sjasone#define JEMALLOC_CC_SILENCE
108261071Sjasone
109261071Sjasone/* JEMALLOC_CODE_COVERAGE enables test code coverage analysis. */
110261071Sjasone/* #undef JEMALLOC_CODE_COVERAGE */
111261071Sjasone
112261071Sjasone/*
113261071Sjasone * JEMALLOC_DEBUG enables assertions and other sanity checks, and disables
114261071Sjasone * inline functions.
115261071Sjasone */
116261071Sjasone/* #undef JEMALLOC_DEBUG */
117261071Sjasone
118261071Sjasone/* JEMALLOC_STATS enables statistics calculation. */
119261071Sjasone#define JEMALLOC_STATS
120261071Sjasone
121261071Sjasone/* JEMALLOC_PROF enables allocation profiling. */
122261071Sjasone/* #undef JEMALLOC_PROF */
123261071Sjasone
124261071Sjasone/* Use libunwind for profile backtracing if defined. */
125261071Sjasone/* #undef JEMALLOC_PROF_LIBUNWIND */
126261071Sjasone
127261071Sjasone/* Use libgcc for profile backtracing if defined. */
128261071Sjasone/* #undef JEMALLOC_PROF_LIBGCC */
129261071Sjasone
130261071Sjasone/* Use gcc intrinsics for profile backtracing if defined. */
131261071Sjasone/* #undef JEMALLOC_PROF_GCC */
132261071Sjasone
133261071Sjasone/*
134261071Sjasone * JEMALLOC_TCACHE enables a thread-specific caching layer for small objects.
135261071Sjasone * This makes it possible to allocate/deallocate objects without any locking
136261071Sjasone * when the cache is in the steady state.
137261071Sjasone */
138261071Sjasone#define JEMALLOC_TCACHE
139261071Sjasone
140261071Sjasone/*
141261071Sjasone * JEMALLOC_DSS enables use of sbrk(2) to allocate chunks from the data storage
142261071Sjasone * segment (DSS).
143261071Sjasone */
144261071Sjasone#define JEMALLOC_DSS
145261071Sjasone
146261071Sjasone/* Support memory filling (junk/zero/quarantine/redzone). */
147261071Sjasone#define JEMALLOC_FILL
148261071Sjasone
149261071Sjasone/* Support utrace(2)-based tracing. */
150261071Sjasone#define JEMALLOC_UTRACE
151261071Sjasone
152261071Sjasone/* Support Valgrind. */
153261071Sjasone/* #undef JEMALLOC_VALGRIND */
154261071Sjasone
155261071Sjasone/* Support optional abort() on OOM. */
156261071Sjasone#define JEMALLOC_XMALLOC
157261071Sjasone
158261071Sjasone/* Support lazy locking (avoid locking unless a second thread is launched). */
159261071Sjasone#define JEMALLOC_LAZY_LOCK
160261071Sjasone
161286866Sjasone/* Minimum size class to support is 2^LG_TINY_MIN bytes. */
162286866Sjasone#define LG_TINY_MIN 3
163261071Sjasone
164261071Sjasone/*
165286866Sjasone * Minimum allocation alignment is 2^LG_QUANTUM bytes (ignoring tiny size
166286866Sjasone * classes).
167286866Sjasone */
168286866Sjasone/* #undef LG_QUANTUM */
169286866Sjasone
170286866Sjasone/* One page is 2^LG_PAGE bytes. */
171286866Sjasone#define LG_PAGE 12
172286866Sjasone
173286866Sjasone/*
174286866Sjasone * If defined, adjacent virtual memory mappings with identical attributes
175286866Sjasone * automatically coalesce, and they fragment when changes are made to subranges.
176286866Sjasone * This is the normal order of things for mmap()/munmap(), but on Windows
177286866Sjasone * VirtualAlloc()/VirtualFree() operations must be precisely matched, i.e.
178286866Sjasone * mappings do *not* coalesce/fragment.
179286866Sjasone */
180286866Sjasone#define JEMALLOC_MAPS_COALESCE
181286866Sjasone
182286866Sjasone/*
183261071Sjasone * If defined, use munmap() to unmap freed chunks, rather than storing them for
184261071Sjasone * later reuse.  This is disabled by default on Linux because common sequences
185261071Sjasone * of mmap()/munmap() calls will cause virtual memory map holes.
186261071Sjasone */
187261071Sjasone#define JEMALLOC_MUNMAP
188261071Sjasone
189261071Sjasone/* TLS is used to map arenas and magazine caches to threads. */
190261071Sjasone#define JEMALLOC_TLS
191261071Sjasone
192261071Sjasone/*
193296221Sjasone * ffs*() functions to use for bitmapping.  Don't use these directly; instead,
194296221Sjasone * use ffs_*() from util.h.
195286866Sjasone */
196296221Sjasone#define JEMALLOC_INTERNAL_FFSLL __builtin_ffsll
197286866Sjasone#define JEMALLOC_INTERNAL_FFSL __builtin_ffsl
198286866Sjasone#define JEMALLOC_INTERNAL_FFS __builtin_ffs
199286866Sjasone
200286866Sjasone/*
201261071Sjasone * JEMALLOC_IVSALLOC enables ivsalloc(), which verifies that pointers reside
202261071Sjasone * within jemalloc-owned chunks before dereferencing them.
203261071Sjasone */
204261071Sjasone/* #undef JEMALLOC_IVSALLOC */
205261071Sjasone
206261071Sjasone/*
207286866Sjasone * If defined, explicitly attempt to more uniformly distribute large allocation
208286866Sjasone * pointer alignments across all cache indices.
209286866Sjasone */
210286866Sjasone#define JEMALLOC_CACHE_OBLIVIOUS
211286866Sjasone
212286866Sjasone/*
213261071Sjasone * Darwin (OS X) uses zones to work around Mach-O symbol override shortcomings.
214261071Sjasone */
215261071Sjasone/* #undef JEMALLOC_ZONE */
216261071Sjasone/* #undef JEMALLOC_ZONE_VERSION */
217261071Sjasone
218261071Sjasone/*
219299587Sjasone * Methods for determining whether the OS overcommits.
220299587Sjasone * JEMALLOC_PROC_SYS_VM_OVERCOMMIT_MEMORY: Linux's
221299587Sjasone *                                         /proc/sys/vm.overcommit_memory file.
222299587Sjasone * JEMALLOC_SYSCTL_VM_OVERCOMMIT: FreeBSD's vm.overcommit sysctl.
223299587Sjasone */
224299587Sjasone#define JEMALLOC_SYSCTL_VM_OVERCOMMIT
225299587Sjasone/* #undef JEMALLOC_PROC_SYS_VM_OVERCOMMIT_MEMORY */
226299587Sjasone
227299587Sjasone/*
228261071Sjasone * Methods for purging unused pages differ between operating systems.
229261071Sjasone *
230261071Sjasone *   madvise(..., MADV_DONTNEED) : On Linux, this immediately discards pages,
231261071Sjasone *                                 such that new pages will be demand-zeroed if
232261071Sjasone *                                 the address region is later touched.
233261071Sjasone *   madvise(..., MADV_FREE) : On FreeBSD and Darwin, this marks pages as being
234261071Sjasone *                             unused, such that they will be discarded rather
235261071Sjasone *                             than swapped out.
236261071Sjasone */
237261071Sjasone/* #undef JEMALLOC_PURGE_MADVISE_DONTNEED */
238261071Sjasone#define JEMALLOC_PURGE_MADVISE_FREE
239261071Sjasone
240286866Sjasone/* Define if operating system has alloca.h header. */
241261071Sjasone/* #undef JEMALLOC_HAS_ALLOCA_H */
242261071Sjasone
243262521Sjasone/* C99 restrict keyword supported. */
244262521Sjasone#define JEMALLOC_HAS_RESTRICT 1
245262521Sjasone
246263974Sjasone/* For use by hash code. */
247263974Sjasone/* #undef JEMALLOC_BIG_ENDIAN */
248263974Sjasone
249261071Sjasone/* sizeof(int) == 2^LG_SIZEOF_INT. */
250261071Sjasone#define LG_SIZEOF_INT 2
251261071Sjasone
252261071Sjasone/* sizeof(long) == 2^LG_SIZEOF_LONG. */
253261071Sjasone#define LG_SIZEOF_LONG 3
254261071Sjasone
255296221Sjasone/* sizeof(long long) == 2^LG_SIZEOF_LONG_LONG. */
256296221Sjasone#define LG_SIZEOF_LONG_LONG 3
257296221Sjasone
258261071Sjasone/* sizeof(intmax_t) == 2^LG_SIZEOF_INTMAX_T. */
259261071Sjasone#define LG_SIZEOF_INTMAX_T 3
260261071Sjasone
261286866Sjasone/* glibc malloc hooks (__malloc_hook, __realloc_hook, __free_hook). */
262286866Sjasone/* #undef JEMALLOC_GLIBC_MALLOC_HOOK */
263286866Sjasone
264286866Sjasone/* glibc memalign hook. */
265286866Sjasone/* #undef JEMALLOC_GLIBC_MEMALIGN_HOOK */
266286866Sjasone
267286866Sjasone/* Adaptive mutex support in pthreads. */
268286866Sjasone#define JEMALLOC_HAVE_PTHREAD_MUTEX_ADAPTIVE_NP
269286866Sjasone
270286866Sjasone/*
271286866Sjasone * If defined, jemalloc symbols are not exported (doesn't work when
272286866Sjasone * JEMALLOC_PREFIX is not defined).
273286866Sjasone */
274286866Sjasone/* #undef JEMALLOC_EXPORT */
275286866Sjasone
276296221Sjasone/* config.malloc_conf options string. */
277296221Sjasone#define JEMALLOC_CONFIG_MALLOC_CONF ""
278296221Sjasone
279261071Sjasone#endif /* JEMALLOC_INTERNAL_DEFS_H_ */
280