diff options
author | jasone <jasone@FreeBSD.org> | 2012-04-17 07:22:14 +0000 |
---|---|---|
committer | jasone <jasone@FreeBSD.org> | 2012-04-17 07:22:14 +0000 |
commit | cbeacb7c46f3a3650e5dbefa9a1a18bc9943a8cc (patch) | |
tree | 24efdb5b31d087479e78f72f3b772bd5b02e470c /contrib/jemalloc/include/jemalloc/jemalloc_FreeBSD.h | |
parent | 1bc364bf7eebf6139e4f968987974484d35c5cb4 (diff) | |
download | FreeBSD-src-cbeacb7c46f3a3650e5dbefa9a1a18bc9943a8cc.zip FreeBSD-src-cbeacb7c46f3a3650e5dbefa9a1a18bc9943a8cc.tar.gz |
Import jemalloc 9ef7f5dc34ff02f50d401e41c8d9a4a928e7c2aa (dev branch,
prior to 3.0.0 release) as contrib/jemalloc, and integrate it into libc.
The code being imported by this commit diverged from
lib/libc/stdlib/malloc.c in March 2010, which means that a portion of
the jemalloc 1.0.0 ChangeLog entries are relevant, as are the entries
for all subsequent releases.
Diffstat (limited to 'contrib/jemalloc/include/jemalloc/jemalloc_FreeBSD.h')
-rw-r--r-- | contrib/jemalloc/include/jemalloc/jemalloc_FreeBSD.h | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/contrib/jemalloc/include/jemalloc/jemalloc_FreeBSD.h b/contrib/jemalloc/include/jemalloc/jemalloc_FreeBSD.h new file mode 100644 index 0000000..2c5797f --- /dev/null +++ b/contrib/jemalloc/include/jemalloc/jemalloc_FreeBSD.h @@ -0,0 +1,76 @@ +/* + * Override settings that were generated in jemalloc_defs.h as necessary. + */ + +#undef JEMALLOC_OVERRIDE_VALLOC + +#ifndef MALLOC_PRODUCTION +#define JEMALLOC_DEBUG +#endif + +/* + * The following are architecture-dependent, so conditionally define them for + * each supported architecture. + */ +#undef CPU_SPINWAIT +#undef JEMALLOC_TLS_MODEL +#undef STATIC_PAGE_SHIFT +#undef LG_SIZEOF_PTR +#undef LG_SIZEOF_INT +#undef LG_SIZEOF_LONG +#undef LG_SIZEOF_INTMAX_T + +#ifdef __i386__ +# define LG_SIZEOF_PTR 2 +# define CPU_SPINWAIT __asm__ volatile("pause") +# define JEMALLOC_TLS_MODEL __attribute__((tls_model("initial-exec"))) +#endif +#ifdef __ia64__ +# define LG_SIZEOF_PTR 3 +#endif +#ifdef __sparc64__ +# define LG_SIZEOF_PTR 3 +# define JEMALLOC_TLS_MODEL __attribute__((tls_model("initial-exec"))) +#endif +#ifdef __amd64__ +# define LG_SIZEOF_PTR 3 +# define CPU_SPINWAIT __asm__ volatile("pause") +# define JEMALLOC_TLS_MODEL __attribute__((tls_model("initial-exec"))) +#endif +#ifdef __arm__ +# define LG_SIZEOF_PTR 2 +#endif +#ifdef __mips__ +# define LG_SIZEOF_PTR 2 +#endif +#ifdef __powerpc64__ +# define LG_SIZEOF_PTR 3 +#elif defined(__powerpc__) +# define LG_SIZEOF_PTR 2 +#endif + +#ifndef JEMALLOC_TLS_MODEL +# define JEMALLOC_TLS_MODEL /* Default. */ +#endif +#ifdef __clang__ +# undef JEMALLOC_TLS_MODEL +# define JEMALLOC_TLS_MODEL /* clang does not support tls_model yet. */ +#endif + +#define STATIC_PAGE_SHIFT PAGE_SHIFT +#define LG_SIZEOF_INT 2 +#define LG_SIZEOF_LONG LG_SIZEOF_PTR +#define LG_SIZEOF_INTMAX_T 3 + +/* Disable lazy-lock machinery, mangle isthreaded, and adjust its type. */ +#undef JEMALLOC_LAZY_LOCK +extern int __isthreaded; +#define isthreaded ((bool)__isthreaded) + +/* Mangle. */ +#define open _open +#define read _read +#define write _write +#define close _close +#define pthread_mutex_lock _pthread_mutex_lock +#define pthread_mutex_unlock _pthread_mutex_unlock |