]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/jemalloc/include/jemalloc/jemalloc_FreeBSD.h
Merge llvm, clang, lld, lldb, compiler-rt and libc++ r305575, and update
[FreeBSD/FreeBSD.git] / contrib / jemalloc / include / jemalloc / jemalloc_FreeBSD.h
1 /*
2  * Override settings that were generated in jemalloc_defs.h as necessary.
3  */
4
5 #undef JEMALLOC_OVERRIDE_VALLOC
6
7 #ifndef MALLOC_PRODUCTION
8 #define JEMALLOC_DEBUG
9 #endif
10
11 #undef JEMALLOC_DSS
12
13 /*
14  * The following are architecture-dependent, so conditionally define them for
15  * each supported architecture.
16  */
17 #undef JEMALLOC_TLS_MODEL
18 #undef STATIC_PAGE_SHIFT
19 #undef LG_SIZEOF_PTR
20 #undef LG_SIZEOF_INT
21 #undef LG_SIZEOF_LONG
22 #undef LG_SIZEOF_INTMAX_T
23
24 #ifdef __i386__
25 #  define LG_SIZEOF_PTR         2
26 #  define JEMALLOC_TLS_MODEL    __attribute__((tls_model("initial-exec")))
27 #endif
28 #ifdef __ia64__
29 #  define LG_SIZEOF_PTR         3
30 #endif
31 #ifdef __sparc64__
32 #  define LG_SIZEOF_PTR         3
33 #  define JEMALLOC_TLS_MODEL    __attribute__((tls_model("initial-exec")))
34 #endif
35 #ifdef __amd64__
36 #  define LG_SIZEOF_PTR         3
37 #  define JEMALLOC_TLS_MODEL    __attribute__((tls_model("initial-exec")))
38 #endif
39 #ifdef __arm__
40 #  define LG_SIZEOF_PTR         2
41 #endif
42 #ifdef __aarch64__
43 #  define LG_SIZEOF_PTR         3
44 #endif
45 #ifdef __mips__
46 #ifdef __mips_n64
47 #  define LG_SIZEOF_PTR         3
48 #else
49 #  define LG_SIZEOF_PTR         2
50 #endif
51 #endif
52 #ifdef __powerpc64__
53 #  define LG_SIZEOF_PTR         3
54 #elif defined(__powerpc__)
55 #  define LG_SIZEOF_PTR         2
56 #endif
57 #ifdef __riscv__
58 #  define LG_SIZEOF_PTR         3
59 #endif
60
61 #ifndef JEMALLOC_TLS_MODEL
62 #  define JEMALLOC_TLS_MODEL    /* Default. */
63 #endif
64
65 #define STATIC_PAGE_SHIFT       PAGE_SHIFT
66 #define LG_SIZEOF_INT           2
67 #define LG_SIZEOF_LONG          LG_SIZEOF_PTR
68 #define LG_SIZEOF_INTMAX_T      3
69
70 #undef CPU_SPINWAIT
71 #include <machine/cpu.h>
72 #include <machine/cpufunc.h>
73 #define CPU_SPINWAIT            cpu_spinwait()
74
75 /* Disable lazy-lock machinery, mangle isthreaded, and adjust its type. */
76 #undef JEMALLOC_LAZY_LOCK
77 extern int __isthreaded;
78 #define isthreaded              ((bool)__isthreaded)
79
80 /* Mangle. */
81 #undef je_malloc
82 #undef je_calloc
83 #undef je_posix_memalign
84 #undef je_aligned_alloc
85 #undef je_realloc
86 #undef je_free
87 #undef je_malloc_usable_size
88 #undef je_mallocx
89 #undef je_rallocx
90 #undef je_xallocx
91 #undef je_sallocx
92 #undef je_dallocx
93 #undef je_sdallocx
94 #undef je_nallocx
95 #undef je_mallctl
96 #undef je_mallctlnametomib
97 #undef je_mallctlbymib
98 #undef je_malloc_stats_print
99 #undef je_allocm
100 #undef je_rallocm
101 #undef je_sallocm
102 #undef je_dallocm
103 #undef je_nallocm
104 #define je_malloc               __malloc
105 #define je_calloc               __calloc
106 #define je_posix_memalign       __posix_memalign
107 #define je_aligned_alloc        __aligned_alloc
108 #define je_realloc              __realloc
109 #define je_free                 __free
110 #define je_malloc_usable_size   __malloc_usable_size
111 #define je_mallocx              __mallocx
112 #define je_rallocx              __rallocx
113 #define je_xallocx              __xallocx
114 #define je_sallocx              __sallocx
115 #define je_dallocx              __dallocx
116 #define je_sdallocx             __sdallocx
117 #define je_nallocx              __nallocx
118 #define je_mallctl              __mallctl
119 #define je_mallctlnametomib     __mallctlnametomib
120 #define je_mallctlbymib         __mallctlbymib
121 #define je_malloc_stats_print   __malloc_stats_print
122 #define je_allocm               __allocm
123 #define je_rallocm              __rallocm
124 #define je_sallocm              __sallocm
125 #define je_dallocm              __dallocm
126 #define je_nallocm              __nallocm
127 #define open                    _open
128 #define read                    _read
129 #define write                   _write
130 #define close                   _close
131 #define pthread_mutex_lock      _pthread_mutex_lock
132 #define pthread_mutex_unlock    _pthread_mutex_unlock
133
134 #ifdef JEMALLOC_C_
135 /*
136  * Define 'weak' symbols so that an application can have its own versions
137  * of malloc, calloc, realloc, free, et al.
138  */
139 __weak_reference(__malloc, malloc);
140 __weak_reference(__calloc, calloc);
141 __weak_reference(__posix_memalign, posix_memalign);
142 __weak_reference(__aligned_alloc, aligned_alloc);
143 __weak_reference(__realloc, realloc);
144 __weak_reference(__free, free);
145 __weak_reference(__malloc_usable_size, malloc_usable_size);
146 __weak_reference(__mallocx, mallocx);
147 __weak_reference(__rallocx, rallocx);
148 __weak_reference(__xallocx, xallocx);
149 __weak_reference(__sallocx, sallocx);
150 __weak_reference(__dallocx, dallocx);
151 __weak_reference(__sdallocx, sdallocx);
152 __weak_reference(__nallocx, nallocx);
153 __weak_reference(__mallctl, mallctl);
154 __weak_reference(__mallctlnametomib, mallctlnametomib);
155 __weak_reference(__mallctlbymib, mallctlbymib);
156 __weak_reference(__malloc_stats_print, malloc_stats_print);
157 __weak_reference(__allocm, allocm);
158 __weak_reference(__rallocm, rallocm);
159 __weak_reference(__sallocm, sallocm);
160 __weak_reference(__dallocm, dallocm);
161 __weak_reference(__nallocm, nallocm);
162 #endif