jemalloc_internal_defs.h.in revision 2aa7fed9c983d8dcde7c0cacf1b024c966758b88
1#ifndef JEMALLOC_INTERNAL_DEFS_H_
2#define	JEMALLOC_INTERNAL_DEFS_H_
3/*
4 * If JEMALLOC_PREFIX is defined via --with-jemalloc-prefix, it will cause all
5 * public APIs to be prefixed.  This makes it possible, with some care, to use
6 * multiple allocators simultaneously.
7 */
8#undef JEMALLOC_PREFIX
9#undef JEMALLOC_CPREFIX
10
11/*
12 * JEMALLOC_PRIVATE_NAMESPACE is used as a prefix for all library-private APIs.
13 * For shared libraries, symbol visibility mechanisms prevent these symbols
14 * from being exported, but for static libraries, naming collisions are a real
15 * possibility.
16 */
17#undef JEMALLOC_PRIVATE_NAMESPACE
18
19/*
20 * Hyper-threaded CPUs may need a special instruction inside spin loops in
21 * order to yield to another virtual CPU.
22 */
23#undef CPU_SPINWAIT
24
25/* Defined if the equivalent of FreeBSD's atomic(9) functions are available. */
26#undef JEMALLOC_ATOMIC9
27
28/*
29 * Defined if OSAtomic*() functions are available, as provided by Darwin, and
30 * documented in the atomic(3) manual page.
31 */
32#undef JEMALLOC_OSATOMIC
33
34/*
35 * Defined if __sync_add_and_fetch(uint32_t *, uint32_t) and
36 * __sync_sub_and_fetch(uint32_t *, uint32_t) are available, despite
37 * __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 not being defined (which means the
38 * functions are defined in libgcc instead of being inlines)
39 */
40#undef JE_FORCE_SYNC_COMPARE_AND_SWAP_4
41
42/*
43 * Defined if __sync_add_and_fetch(uint64_t *, uint64_t) and
44 * __sync_sub_and_fetch(uint64_t *, uint64_t) are available, despite
45 * __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 not being defined (which means the
46 * functions are defined in libgcc instead of being inlines)
47 */
48#undef JE_FORCE_SYNC_COMPARE_AND_SWAP_8
49
50/*
51 * Defined if __builtin_clz() and __builtin_clzl() are available.
52 */
53#undef JEMALLOC_HAVE_BUILTIN_CLZ
54
55/*
56 * Defined if OSSpin*() functions are available, as provided by Darwin, and
57 * documented in the spinlock(3) manual page.
58 */
59#undef JEMALLOC_OSSPIN
60
61/*
62 * Defined if _malloc_thread_cleanup() exists.  At least in the case of
63 * FreeBSD, pthread_key_create() allocates, which if used during malloc
64 * bootstrapping will cause recursion into the pthreads library.  Therefore, if
65 * _malloc_thread_cleanup() exists, use it as the basis for thread cleanup in
66 * malloc_tsd.
67 */
68#undef JEMALLOC_MALLOC_THREAD_CLEANUP
69
70/*
71 * Defined if threaded initialization is known to be safe on this platform.
72 * Among other things, it must be possible to initialize a mutex without
73 * triggering allocation in order for threaded allocation to be safe.
74 */
75#undef JEMALLOC_THREADED_INIT
76
77/*
78 * Defined if the pthreads implementation defines
79 * _pthread_mutex_init_calloc_cb(), in which case the function is used in order
80 * to avoid recursive allocation during mutex initialization.
81 */
82#undef JEMALLOC_MUTEX_INIT_CB
83
84/* Non-empty if the tls_model attribute is supported. */
85#undef JEMALLOC_TLS_MODEL
86
87/* JEMALLOC_CC_SILENCE enables code that silences unuseful compiler warnings. */
88#undef JEMALLOC_CC_SILENCE
89
90/* JEMALLOC_CODE_COVERAGE enables test code coverage analysis. */
91#undef JEMALLOC_CODE_COVERAGE
92
93/*
94 * JEMALLOC_DEBUG enables assertions and other sanity checks, and disables
95 * inline functions.
96 */
97#undef JEMALLOC_DEBUG
98
99/* JEMALLOC_STATS enables statistics calculation. */
100#undef JEMALLOC_STATS
101
102/* JEMALLOC_PROF enables allocation profiling. */
103#undef JEMALLOC_PROF
104
105/* Use libunwind for profile backtracing if defined. */
106#undef JEMALLOC_PROF_LIBUNWIND
107
108/* Use libgcc for profile backtracing if defined. */
109#undef JEMALLOC_PROF_LIBGCC
110
111/* Use gcc intrinsics for profile backtracing if defined. */
112#undef JEMALLOC_PROF_GCC
113
114/*
115 * JEMALLOC_TCACHE enables a thread-specific caching layer for small objects.
116 * This makes it possible to allocate/deallocate objects without any locking
117 * when the cache is in the steady state.
118 */
119#undef JEMALLOC_TCACHE
120
121/*
122 * JEMALLOC_DSS enables use of sbrk(2) to allocate chunks from the data storage
123 * segment (DSS).
124 */
125#undef JEMALLOC_DSS
126
127/* Support memory filling (junk/zero/quarantine/redzone). */
128#undef JEMALLOC_FILL
129
130/* Support utrace(2)-based tracing. */
131#undef JEMALLOC_UTRACE
132
133/* Support Valgrind. */
134#undef JEMALLOC_VALGRIND
135
136/* Support optional abort() on OOM. */
137#undef JEMALLOC_XMALLOC
138
139/* Support lazy locking (avoid locking unless a second thread is launched). */
140#undef JEMALLOC_LAZY_LOCK
141
142/* One page is 2^STATIC_PAGE_SHIFT bytes. */
143#undef STATIC_PAGE_SHIFT
144
145/*
146 * If defined, use munmap() to unmap freed chunks, rather than storing them for
147 * later reuse.  This is disabled by default on Linux because common sequences
148 * of mmap()/munmap() calls will cause virtual memory map holes.
149 */
150#undef JEMALLOC_MUNMAP
151
152/* TLS is used to map arenas and magazine caches to threads. */
153#undef JEMALLOC_TLS
154
155/*
156 * ffs()/ffsl() functions to use for bitmapping.  Don't use these directly;
157 * instead, use jemalloc_ffs() or jemalloc_ffsl() from util.h.
158 */
159#undef JEMALLOC_INTERNAL_FFSL
160#undef JEMALLOC_INTERNAL_FFS
161
162/*
163 * JEMALLOC_IVSALLOC enables ivsalloc(), which verifies that pointers reside
164 * within jemalloc-owned chunks before dereferencing them.
165 */
166#undef JEMALLOC_IVSALLOC
167
168/*
169 * Darwin (OS X) uses zones to work around Mach-O symbol override shortcomings.
170 */
171#undef JEMALLOC_ZONE
172#undef JEMALLOC_ZONE_VERSION
173
174/*
175 * Methods for purging unused pages differ between operating systems.
176 *
177 *   madvise(..., MADV_DONTNEED) : On Linux, this immediately discards pages,
178 *                                 such that new pages will be demand-zeroed if
179 *                                 the address region is later touched.
180 *   madvise(..., MADV_FREE) : On FreeBSD and Darwin, this marks pages as being
181 *                             unused, such that they will be discarded rather
182 *                             than swapped out.
183 */
184#undef JEMALLOC_PURGE_MADVISE_DONTNEED
185#undef JEMALLOC_PURGE_MADVISE_FREE
186
187/*
188 * Define if operating system has alloca.h header.
189 */
190#undef JEMALLOC_HAS_ALLOCA_H
191
192/* C99 restrict keyword supported. */
193#undef JEMALLOC_HAS_RESTRICT
194
195/* For use by hash code. */
196#undef JEMALLOC_BIG_ENDIAN
197
198/* sizeof(int) == 2^LG_SIZEOF_INT. */
199#undef LG_SIZEOF_INT
200
201/* sizeof(long) == 2^LG_SIZEOF_LONG. */
202#undef LG_SIZEOF_LONG
203
204/* sizeof(intmax_t) == 2^LG_SIZEOF_INTMAX_T. */
205#undef LG_SIZEOF_INTMAX_T
206
207#endif /* JEMALLOC_INTERNAL_DEFS_H_ */
208