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