1#ifndef JEMALLOC_PREAMBLE_H
2#define JEMALLOC_PREAMBLE_H
3
4#include "jemalloc_internal_defs.h"
5#include "jemalloc/internal/jemalloc_internal_decls.h"
6
7#ifdef JEMALLOC_UTRACE
8#include <sys/ktrace.h>
9#endif
10
11#define JEMALLOC_NO_DEMANGLE
12#ifdef JEMALLOC_JET
13# undef JEMALLOC_IS_MALLOC
14# define JEMALLOC_N(n) jet_##n
15# include "jemalloc/internal/public_namespace.h"
16# define JEMALLOC_NO_RENAME
17# include "jemalloc/jemalloc.h"
18# undef JEMALLOC_NO_RENAME
19#else
20# define JEMALLOC_N(n) je_##n
21# include "jemalloc/jemalloc.h"
22#endif
23
24#if (defined(JEMALLOC_OSATOMIC) || defined(JEMALLOC_OSSPIN))
25#include <libkern/OSAtomic.h>
26#endif
27
28#ifdef JEMALLOC_ZONE
29#include <mach/mach_error.h>
30#include <mach/mach_init.h>
31#include <mach/vm_map.h>
32#endif
33
34#include "jemalloc/internal/jemalloc_internal_macros.h"
35
36/*
37 * Note that the ordering matters here; the hook itself is name-mangled. We
38 * want the inclusion of hooks to happen early, so that we hook as much as
39 * possible.
40 */
41#ifndef JEMALLOC_NO_PRIVATE_NAMESPACE
42# ifndef JEMALLOC_JET
43# include "jemalloc/internal/private_namespace.h"
44# else
45# include "jemalloc/internal/private_namespace_jet.h"
46# endif
47#endif
48#include "jemalloc/internal/test_hooks.h"
49
50#ifdef JEMALLOC_DEFINE_MADVISE_FREE
51# define JEMALLOC_MADV_FREE 8
52#endif
53
54static const bool config_debug =
55#ifdef JEMALLOC_DEBUG
56 true
57#else
58 false
59#endif
60 ;
61static const bool have_dss =
62#ifdef JEMALLOC_DSS
63 true
64#else
65 false
66#endif
67 ;
68static const bool have_madvise_huge =
69#ifdef JEMALLOC_HAVE_MADVISE_HUGE
70 true
71#else
72 false
73#endif
74 ;
75static const bool config_fill =
76#ifdef JEMALLOC_FILL
77 true
78#else
79 false
80#endif
81 ;
82static const bool config_lazy_lock =
83#ifdef JEMALLOC_LAZY_LOCK
84 true
85#else
86 false
87#endif
88 ;
89static const char * const config_malloc_conf = JEMALLOC_CONFIG_MALLOC_CONF;
90static const bool config_prof =
91#ifdef JEMALLOC_PROF
92 true
93#else
94 false
95#endif
96 ;
97static const bool config_prof_libgcc =
98#ifdef JEMALLOC_PROF_LIBGCC
99 true
100#else
101 false
102#endif
103 ;
104static const bool config_prof_libunwind =
105#ifdef JEMALLOC_PROF_LIBUNWIND
106 true
107#else
108 false
109#endif
110 ;
111static const bool maps_coalesce =
112#ifdef JEMALLOC_MAPS_COALESCE
113 true
114#else
115 false
116#endif
117 ;
118static const bool config_stats =
119#ifdef JEMALLOC_STATS
120 true
121#else
122 false
123#endif
124 ;
125static const bool config_tls =
126#ifdef JEMALLOC_TLS
127 true
128#else
129 false
130#endif
131 ;
132static const bool config_utrace =
133#ifdef JEMALLOC_UTRACE
134 true
135#else
136 false
137#endif
138 ;
139static const bool config_xmalloc =
140#ifdef JEMALLOC_XMALLOC
141 true
142#else
143 false
144#endif
145 ;
146static const bool config_cache_oblivious =
147#ifdef JEMALLOC_CACHE_OBLIVIOUS
148 true
149#else
150 false
151#endif
152 ;
153/*
154 * Undocumented, for jemalloc development use only at the moment. See the note
155 * in jemalloc/internal/log.h.
156 */
157static const bool config_log =
158#ifdef JEMALLOC_LOG
159 true
160#else
161 false
162#endif
163 ;
164#ifdef JEMALLOC_HAVE_SCHED_GETCPU
165/* Currently percpu_arena depends on sched_getcpu. */
166#define JEMALLOC_PERCPU_ARENA
167#endif
168static const bool have_percpu_arena =
169#ifdef JEMALLOC_PERCPU_ARENA
170 true
171#else
172 false
173#endif
174 ;
175/*
176 * Undocumented, and not recommended; the application should take full
177 * responsibility for tracking provenance.
178 */
179static const bool force_ivsalloc =
180#ifdef JEMALLOC_FORCE_IVSALLOC
181 true
182#else
183 false
184#endif
185 ;
186static const bool have_background_thread =
187#ifdef JEMALLOC_BACKGROUND_THREAD
188 true
189#else
190 false
191#endif
192 ;
193
194#endif /* JEMALLOC_PREAMBLE_H */
195