]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - contrib/jemalloc/include/jemalloc/jemalloc_FreeBSD.h
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.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 #define MALLOC_PRODUCTION
8
9 #ifndef MALLOC_PRODUCTION
10 #define JEMALLOC_DEBUG
11 #endif
12
13 /*
14  * The following are architecture-dependent, so conditionally define them for
15  * each supported architecture.
16  */
17 #undef CPU_SPINWAIT
18 #undef JEMALLOC_TLS_MODEL
19 #undef STATIC_PAGE_SHIFT
20 #undef LG_SIZEOF_PTR
21 #undef LG_SIZEOF_INT
22 #undef LG_SIZEOF_LONG
23 #undef LG_SIZEOF_INTMAX_T
24
25 #ifdef __i386__
26 #  define LG_SIZEOF_PTR         2
27 #  define CPU_SPINWAIT          __asm__ volatile("pause")
28 #  define JEMALLOC_TLS_MODEL    __attribute__((tls_model("initial-exec")))
29 #endif
30 #ifdef __ia64__
31 #  define LG_SIZEOF_PTR         3
32 #endif
33 #ifdef __sparc64__
34 #  define LG_SIZEOF_PTR         3
35 #  define JEMALLOC_TLS_MODEL    __attribute__((tls_model("initial-exec")))
36 #endif
37 #ifdef __amd64__
38 #  define LG_SIZEOF_PTR         3
39 #  define CPU_SPINWAIT          __asm__ volatile("pause")
40 #  define JEMALLOC_TLS_MODEL    __attribute__((tls_model("initial-exec")))
41 #endif
42 #ifdef __arm__
43 #  define LG_SIZEOF_PTR         2
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
58 #ifndef JEMALLOC_TLS_MODEL
59 #  define JEMALLOC_TLS_MODEL    /* Default. */
60 #endif
61
62 #define STATIC_PAGE_SHIFT       PAGE_SHIFT
63 #define LG_SIZEOF_INT           2
64 #define LG_SIZEOF_LONG          LG_SIZEOF_PTR
65 #define LG_SIZEOF_INTMAX_T      3
66
67 /* Disable lazy-lock machinery, mangle isthreaded, and adjust its type. */
68 #undef JEMALLOC_LAZY_LOCK
69 extern int __isthreaded;
70 #define isthreaded              ((bool)__isthreaded)
71
72 /* Mangle. */
73 #undef je_malloc
74 #undef je_calloc
75 #undef je_realloc
76 #undef je_free
77 #undef je_posix_memalign
78 #undef je_malloc_usable_size
79 #undef je_allocm
80 #undef je_rallocm
81 #undef je_sallocm
82 #undef je_dallocm
83 #undef je_nallocm
84 #define je_malloc               __malloc
85 #define je_calloc               __calloc
86 #define je_realloc              __realloc
87 #define je_free                 __free
88 #define je_posix_memalign       __posix_memalign
89 #define je_malloc_usable_size   __malloc_usable_size
90 #define je_allocm               __allocm
91 #define je_rallocm              __rallocm
92 #define je_sallocm              __sallocm
93 #define je_dallocm              __dallocm
94 #define je_nallocm              __nallocm
95 #define open                    _open
96 #define read                    _read
97 #define write                   _write
98 #define close                   _close
99 #define pthread_mutex_lock      _pthread_mutex_lock
100 #define pthread_mutex_unlock    _pthread_mutex_unlock
101
102 #ifdef JEMALLOC_C_
103 /*
104  * Define 'weak' symbols so that an application can have its own versions
105  * of malloc, calloc, realloc, free, et al.
106  */
107 __weak_reference(__malloc, malloc);
108 __weak_reference(__calloc, calloc);
109 __weak_reference(__realloc, realloc);
110 __weak_reference(__free, free);
111 __weak_reference(__posix_memalign, posix_memalign);
112 __weak_reference(__malloc_usable_size, malloc_usable_size);
113 __weak_reference(__allocm, allocm);
114 __weak_reference(__rallocm, rallocm);
115 __weak_reference(__sallocm, sallocm);
116 __weak_reference(__dallocm, dallocm);
117 __weak_reference(__nallocm, nallocm);
118 #endif
119