jemalloc_macros.h revision 1.1.1.1 1 #include <stdlib.h>
2 #include <stdbool.h>
3 #include <stdint.h>
4 #include <limits.h>
5 #include <strings.h>
6
7 #define JEMALLOC_VERSION "5.1.0-0-g61efbda7098de6fe64c362d309824864308c36d4"
8 #define JEMALLOC_VERSION_MAJOR 5
9 #define JEMALLOC_VERSION_MINOR 1
10 #define JEMALLOC_VERSION_BUGFIX 0
11 #define JEMALLOC_VERSION_NREV 0
12 #define JEMALLOC_VERSION_GID "61efbda7098de6fe64c362d309824864308c36d4"
13
14 #define MALLOCX_LG_ALIGN(la) ((int)(la))
15 #if LG_SIZEOF_PTR == 2
16 # define MALLOCX_ALIGN(a) ((int)(ffs((int)(a))-1))
17 #else
18 # define MALLOCX_ALIGN(a) \
19 ((int)(((size_t)(a) < (size_t)INT_MAX) ? ffs((int)(a))-1 : \
20 ffs((int)(((size_t)(a))>>32))+31))
21 #endif
22 #define MALLOCX_ZERO ((int)0x40)
23 /*
24 * Bias tcache index bits so that 0 encodes "automatic tcache management", and 1
25 * encodes MALLOCX_TCACHE_NONE.
26 */
27 #define MALLOCX_TCACHE(tc) ((int)(((tc)+2) << 8))
28 #define MALLOCX_TCACHE_NONE MALLOCX_TCACHE(-1)
29 /*
30 * Bias arena index bits so that 0 encodes "use an automatically chosen arena".
31 */
32 #define MALLOCX_ARENA(a) ((((int)(a))+1) << 20)
33
34 /*
35 * Use as arena index in "arena.<i>.{purge,decay,dss}" and
36 * "stats.arenas.<i>.*" mallctl interfaces to select all arenas. This
37 * definition is intentionally specified in raw decimal format to support
38 * cpp-based string concatenation, e.g.
39 *
40 * #define STRINGIFY_HELPER(x) #x
41 * #define STRINGIFY(x) STRINGIFY_HELPER(x)
42 *
43 * mallctl("arena." STRINGIFY(MALLCTL_ARENAS_ALL) ".purge", NULL, NULL, NULL,
44 * 0);
45 */
46 #define MALLCTL_ARENAS_ALL 4096
47 /*
48 * Use as arena index in "stats.arenas.<i>.*" mallctl interfaces to select
49 * destroyed arenas.
50 */
51 #define MALLCTL_ARENAS_DESTROYED 4097
52
53 #if defined(__cplusplus) && defined(JEMALLOC_USE_CXX_THROW)
54 # define JEMALLOC_CXX_THROW throw()
55 #else
56 # define JEMALLOC_CXX_THROW
57 #endif
58
59 #if defined(_MSC_VER)
60 # define JEMALLOC_ATTR(s)
61 # define JEMALLOC_ALIGNED(s) __declspec(align(s))
62 # define JEMALLOC_ALLOC_SIZE(s)
63 # define JEMALLOC_ALLOC_SIZE2(s1, s2)
64 # ifndef JEMALLOC_EXPORT
65 # ifdef DLLEXPORT
66 # define JEMALLOC_EXPORT __declspec(dllexport)
67 # else
68 # define JEMALLOC_EXPORT __declspec(dllimport)
69 # endif
70 # endif
71 # define JEMALLOC_FORMAT_PRINTF(s, i)
72 # define JEMALLOC_NOINLINE __declspec(noinline)
73 # ifdef __cplusplus
74 # define JEMALLOC_NOTHROW __declspec(nothrow)
75 # else
76 # define JEMALLOC_NOTHROW
77 # endif
78 # define JEMALLOC_SECTION(s) __declspec(allocate(s))
79 # define JEMALLOC_RESTRICT_RETURN __declspec(restrict)
80 # if _MSC_VER >= 1900 && !defined(__EDG__)
81 # define JEMALLOC_ALLOCATOR __declspec(allocator)
82 # else
83 # define JEMALLOC_ALLOCATOR
84 # endif
85 #elif defined(JEMALLOC_HAVE_ATTR)
86 # define JEMALLOC_ATTR(s) __attribute__((s))
87 # define JEMALLOC_ALIGNED(s) JEMALLOC_ATTR(aligned(s))
88 # ifdef JEMALLOC_HAVE_ATTR_ALLOC_SIZE
89 # define JEMALLOC_ALLOC_SIZE(s) JEMALLOC_ATTR(alloc_size(s))
90 # define JEMALLOC_ALLOC_SIZE2(s1, s2) JEMALLOC_ATTR(alloc_size(s1, s2))
91 # else
92 # define JEMALLOC_ALLOC_SIZE(s)
93 # define JEMALLOC_ALLOC_SIZE2(s1, s2)
94 # endif
95 # ifndef JEMALLOC_EXPORT
96 # define JEMALLOC_EXPORT JEMALLOC_ATTR(visibility("default"))
97 # endif
98 # ifdef JEMALLOC_HAVE_ATTR_FORMAT_GNU_PRINTF
99 # define JEMALLOC_FORMAT_PRINTF(s, i) JEMALLOC_ATTR(format(gnu_printf, s, i))
100 # elif defined(JEMALLOC_HAVE_ATTR_FORMAT_PRINTF)
101 # define JEMALLOC_FORMAT_PRINTF(s, i) JEMALLOC_ATTR(format(printf, s, i))
102 # else
103 # define JEMALLOC_FORMAT_PRINTF(s, i)
104 # endif
105 # define JEMALLOC_NOINLINE JEMALLOC_ATTR(noinline)
106 # define JEMALLOC_NOTHROW JEMALLOC_ATTR(nothrow)
107 # define JEMALLOC_SECTION(s) JEMALLOC_ATTR(section(s))
108 # define JEMALLOC_RESTRICT_RETURN
109 # define JEMALLOC_ALLOCATOR
110 #else
111 # define JEMALLOC_ATTR(s)
112 # define JEMALLOC_ALIGNED(s)
113 # define JEMALLOC_ALLOC_SIZE(s)
114 # define JEMALLOC_ALLOC_SIZE2(s1, s2)
115 # define JEMALLOC_EXPORT
116 # define JEMALLOC_FORMAT_PRINTF(s, i)
117 # define JEMALLOC_NOINLINE
118 # define JEMALLOC_NOTHROW
119 # define JEMALLOC_SECTION(s)
120 # define JEMALLOC_RESTRICT_RETURN
121 # define JEMALLOC_ALLOCATOR
122 #endif
123