]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/jemalloc/include/jemalloc/jemalloc_FreeBSD.h
Upgrade our copy of llvm/clang to trunk r162107. With thanks to
[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 /*
12  * The following are architecture-dependent, so conditionally define them for
13  * each supported architecture.
14  */
15 #undef CPU_SPINWAIT
16 #undef JEMALLOC_TLS_MODEL
17 #undef STATIC_PAGE_SHIFT
18 #undef LG_SIZEOF_PTR
19 #undef LG_SIZEOF_INT
20 #undef LG_SIZEOF_LONG
21 #undef LG_SIZEOF_INTMAX_T
22
23 #ifdef __i386__
24 #  define LG_SIZEOF_PTR         2
25 #  define CPU_SPINWAIT          __asm__ volatile("pause")
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 CPU_SPINWAIT          __asm__ volatile("pause")
38 #  define JEMALLOC_TLS_MODEL    __attribute__((tls_model("initial-exec")))
39 #endif
40 #ifdef __arm__
41 #  define LG_SIZEOF_PTR         2
42 #endif
43 #ifdef __mips__
44 #ifdef __mips_n64
45 #  define LG_SIZEOF_PTR         3
46 #else
47 #  define LG_SIZEOF_PTR         2
48 #endif
49 #endif
50 #ifdef __powerpc64__
51 #  define LG_SIZEOF_PTR         3
52 #elif defined(__powerpc__)
53 #  define LG_SIZEOF_PTR         2
54 #endif
55
56 #ifndef JEMALLOC_TLS_MODEL
57 #  define JEMALLOC_TLS_MODEL    /* Default. */
58 #endif
59 #ifdef __clang__
60 #  undef JEMALLOC_TLS_MODEL
61 #  define JEMALLOC_TLS_MODEL    /* clang does not support tls_model yet. */
62 #endif
63
64 #define STATIC_PAGE_SHIFT       PAGE_SHIFT
65 #define LG_SIZEOF_INT           2
66 #define LG_SIZEOF_LONG          LG_SIZEOF_PTR
67 #define LG_SIZEOF_INTMAX_T      3
68
69 /* Disable lazy-lock machinery, mangle isthreaded, and adjust its type. */
70 #undef JEMALLOC_LAZY_LOCK
71 extern int __isthreaded;
72 #define isthreaded              ((bool)__isthreaded)
73
74 /* Mangle. */
75 #define open                    _open
76 #define read                    _read
77 #define write                   _write
78 #define close                   _close
79 #define pthread_mutex_lock      _pthread_mutex_lock
80 #define pthread_mutex_unlock    _pthread_mutex_unlock