2013-12-13 06:41:02 +08:00
|
|
|
#ifndef JEMALLOC_INTERNAL_DEFS_H_
|
|
|
|
#define JEMALLOC_INTERNAL_DEFS_H_
|
Refactor to support more varied testing.
Refactor the test harness to support three types of tests:
- unit: White box unit tests. These tests have full access to all
internal jemalloc library symbols. Though in actuality all symbols
are prefixed by jet_, macro-based name mangling abstracts this away
from test code.
- integration: Black box integration tests. These tests link with
the installable shared jemalloc library, and with the exception of
some utility code and configure-generated macro definitions, they have
no access to jemalloc internals.
- stress: Black box stress tests. These tests link with the installable
shared jemalloc library, as well as with an internal allocator with
symbols prefixed by jet_ (same as for unit tests) that can be used to
allocate data structures that are internal to the test code.
Move existing tests into test/{unit,integration}/ as appropriate.
Split out internal parts of jemalloc_defs.h.in and put them in
jemalloc_internal_defs.h.in. This reduces internals exposure to
applications that #include <jemalloc/jemalloc.h>.
Refactor jemalloc.h header generation so that a single header file
results, and the prototypes can be used to generate jet_ prototypes for
tests. Split jemalloc.h.in into multiple parts (jemalloc_defs.h.in,
jemalloc_macros.h.in, jemalloc_protos.h.in, jemalloc_mangle.h.in) and
use a shell script to generate a unified jemalloc.h at configure time.
Change the default private namespace prefix from "" to "je_".
Add missing private namespace mangling.
Remove hard-coded private_namespace.h. Instead generate it and
private_unnamespace.h from private_symbols.txt. Use similar logic for
public symbols, which aids in name mangling for jet_ symbols.
Add test_warn() and test_fail(). Replace existing exit(1) calls with
test_fail() calls.
2013-12-01 07:25:42 +08:00
|
|
|
/*
|
|
|
|
* If JEMALLOC_PREFIX is defined via --with-jemalloc-prefix, it will cause all
|
|
|
|
* public APIs to be prefixed. This makes it possible, with some care, to use
|
|
|
|
* multiple allocators simultaneously.
|
|
|
|
*/
|
|
|
|
#undef JEMALLOC_PREFIX
|
|
|
|
#undef JEMALLOC_CPREFIX
|
|
|
|
|
|
|
|
/*
|
|
|
|
* JEMALLOC_PRIVATE_NAMESPACE is used as a prefix for all library-private APIs.
|
|
|
|
* For shared libraries, symbol visibility mechanisms prevent these symbols
|
|
|
|
* from being exported, but for static libraries, naming collisions are a real
|
|
|
|
* possibility.
|
|
|
|
*/
|
|
|
|
#undef JEMALLOC_PRIVATE_NAMESPACE
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Hyper-threaded CPUs may need a special instruction inside spin loops in
|
|
|
|
* order to yield to another virtual CPU.
|
|
|
|
*/
|
|
|
|
#undef CPU_SPINWAIT
|
|
|
|
|
|
|
|
/* Defined if the equivalent of FreeBSD's atomic(9) functions are available. */
|
|
|
|
#undef JEMALLOC_ATOMIC9
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Defined if OSAtomic*() functions are available, as provided by Darwin, and
|
|
|
|
* documented in the atomic(3) manual page.
|
|
|
|
*/
|
|
|
|
#undef JEMALLOC_OSATOMIC
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Defined if __sync_add_and_fetch(uint32_t *, uint32_t) and
|
|
|
|
* __sync_sub_and_fetch(uint32_t *, uint32_t) are available, despite
|
|
|
|
* __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 not being defined (which means the
|
|
|
|
* functions are defined in libgcc instead of being inlines)
|
|
|
|
*/
|
|
|
|
#undef JE_FORCE_SYNC_COMPARE_AND_SWAP_4
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Defined if __sync_add_and_fetch(uint64_t *, uint64_t) and
|
|
|
|
* __sync_sub_and_fetch(uint64_t *, uint64_t) are available, despite
|
|
|
|
* __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 not being defined (which means the
|
|
|
|
* functions are defined in libgcc instead of being inlines)
|
|
|
|
*/
|
|
|
|
#undef JE_FORCE_SYNC_COMPARE_AND_SWAP_8
|
|
|
|
|
2014-05-29 07:11:55 +08:00
|
|
|
/*
|
|
|
|
* Defined if __builtin_clz() and __builtin_clzl() are available.
|
|
|
|
*/
|
|
|
|
#undef JEMALLOC_HAVE_BUILTIN_CLZ
|
|
|
|
|
Refactor to support more varied testing.
Refactor the test harness to support three types of tests:
- unit: White box unit tests. These tests have full access to all
internal jemalloc library symbols. Though in actuality all symbols
are prefixed by jet_, macro-based name mangling abstracts this away
from test code.
- integration: Black box integration tests. These tests link with
the installable shared jemalloc library, and with the exception of
some utility code and configure-generated macro definitions, they have
no access to jemalloc internals.
- stress: Black box stress tests. These tests link with the installable
shared jemalloc library, as well as with an internal allocator with
symbols prefixed by jet_ (same as for unit tests) that can be used to
allocate data structures that are internal to the test code.
Move existing tests into test/{unit,integration}/ as appropriate.
Split out internal parts of jemalloc_defs.h.in and put them in
jemalloc_internal_defs.h.in. This reduces internals exposure to
applications that #include <jemalloc/jemalloc.h>.
Refactor jemalloc.h header generation so that a single header file
results, and the prototypes can be used to generate jet_ prototypes for
tests. Split jemalloc.h.in into multiple parts (jemalloc_defs.h.in,
jemalloc_macros.h.in, jemalloc_protos.h.in, jemalloc_mangle.h.in) and
use a shell script to generate a unified jemalloc.h at configure time.
Change the default private namespace prefix from "" to "je_".
Add missing private namespace mangling.
Remove hard-coded private_namespace.h. Instead generate it and
private_unnamespace.h from private_symbols.txt. Use similar logic for
public symbols, which aids in name mangling for jet_ symbols.
Add test_warn() and test_fail(). Replace existing exit(1) calls with
test_fail() calls.
2013-12-01 07:25:42 +08:00
|
|
|
/*
|
|
|
|
* Defined if OSSpin*() functions are available, as provided by Darwin, and
|
|
|
|
* documented in the spinlock(3) manual page.
|
|
|
|
*/
|
|
|
|
#undef JEMALLOC_OSSPIN
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Defined if _malloc_thread_cleanup() exists. At least in the case of
|
|
|
|
* FreeBSD, pthread_key_create() allocates, which if used during malloc
|
|
|
|
* bootstrapping will cause recursion into the pthreads library. Therefore, if
|
|
|
|
* _malloc_thread_cleanup() exists, use it as the basis for thread cleanup in
|
|
|
|
* malloc_tsd.
|
|
|
|
*/
|
|
|
|
#undef JEMALLOC_MALLOC_THREAD_CLEANUP
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Defined if threaded initialization is known to be safe on this platform.
|
|
|
|
* Among other things, it must be possible to initialize a mutex without
|
|
|
|
* triggering allocation in order for threaded allocation to be safe.
|
|
|
|
*/
|
|
|
|
#undef JEMALLOC_THREADED_INIT
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Defined if the pthreads implementation defines
|
|
|
|
* _pthread_mutex_init_calloc_cb(), in which case the function is used in order
|
|
|
|
* to avoid recursive allocation during mutex initialization.
|
|
|
|
*/
|
|
|
|
#undef JEMALLOC_MUTEX_INIT_CB
|
|
|
|
|
|
|
|
/* Non-empty if the tls_model attribute is supported. */
|
|
|
|
#undef JEMALLOC_TLS_MODEL
|
|
|
|
|
|
|
|
/* JEMALLOC_CC_SILENCE enables code that silences unuseful compiler warnings. */
|
|
|
|
#undef JEMALLOC_CC_SILENCE
|
|
|
|
|
2013-12-07 10:27:33 +08:00
|
|
|
/* JEMALLOC_CODE_COVERAGE enables test code coverage analysis. */
|
|
|
|
#undef JEMALLOC_CODE_COVERAGE
|
|
|
|
|
Refactor to support more varied testing.
Refactor the test harness to support three types of tests:
- unit: White box unit tests. These tests have full access to all
internal jemalloc library symbols. Though in actuality all symbols
are prefixed by jet_, macro-based name mangling abstracts this away
from test code.
- integration: Black box integration tests. These tests link with
the installable shared jemalloc library, and with the exception of
some utility code and configure-generated macro definitions, they have
no access to jemalloc internals.
- stress: Black box stress tests. These tests link with the installable
shared jemalloc library, as well as with an internal allocator with
symbols prefixed by jet_ (same as for unit tests) that can be used to
allocate data structures that are internal to the test code.
Move existing tests into test/{unit,integration}/ as appropriate.
Split out internal parts of jemalloc_defs.h.in and put them in
jemalloc_internal_defs.h.in. This reduces internals exposure to
applications that #include <jemalloc/jemalloc.h>.
Refactor jemalloc.h header generation so that a single header file
results, and the prototypes can be used to generate jet_ prototypes for
tests. Split jemalloc.h.in into multiple parts (jemalloc_defs.h.in,
jemalloc_macros.h.in, jemalloc_protos.h.in, jemalloc_mangle.h.in) and
use a shell script to generate a unified jemalloc.h at configure time.
Change the default private namespace prefix from "" to "je_".
Add missing private namespace mangling.
Remove hard-coded private_namespace.h. Instead generate it and
private_unnamespace.h from private_symbols.txt. Use similar logic for
public symbols, which aids in name mangling for jet_ symbols.
Add test_warn() and test_fail(). Replace existing exit(1) calls with
test_fail() calls.
2013-12-01 07:25:42 +08:00
|
|
|
/*
|
|
|
|
* JEMALLOC_DEBUG enables assertions and other sanity checks, and disables
|
|
|
|
* inline functions.
|
|
|
|
*/
|
|
|
|
#undef JEMALLOC_DEBUG
|
|
|
|
|
|
|
|
/* JEMALLOC_STATS enables statistics calculation. */
|
|
|
|
#undef JEMALLOC_STATS
|
|
|
|
|
|
|
|
/* JEMALLOC_PROF enables allocation profiling. */
|
|
|
|
#undef JEMALLOC_PROF
|
|
|
|
|
|
|
|
/* Use libunwind for profile backtracing if defined. */
|
|
|
|
#undef JEMALLOC_PROF_LIBUNWIND
|
|
|
|
|
|
|
|
/* Use libgcc for profile backtracing if defined. */
|
|
|
|
#undef JEMALLOC_PROF_LIBGCC
|
|
|
|
|
|
|
|
/* Use gcc intrinsics for profile backtracing if defined. */
|
|
|
|
#undef JEMALLOC_PROF_GCC
|
|
|
|
|
|
|
|
/*
|
|
|
|
* JEMALLOC_TCACHE enables a thread-specific caching layer for small objects.
|
|
|
|
* This makes it possible to allocate/deallocate objects without any locking
|
|
|
|
* when the cache is in the steady state.
|
|
|
|
*/
|
|
|
|
#undef JEMALLOC_TCACHE
|
|
|
|
|
|
|
|
/*
|
|
|
|
* JEMALLOC_DSS enables use of sbrk(2) to allocate chunks from the data storage
|
|
|
|
* segment (DSS).
|
|
|
|
*/
|
|
|
|
#undef JEMALLOC_DSS
|
|
|
|
|
|
|
|
/* Support memory filling (junk/zero/quarantine/redzone). */
|
|
|
|
#undef JEMALLOC_FILL
|
|
|
|
|
|
|
|
/* Support utrace(2)-based tracing. */
|
|
|
|
#undef JEMALLOC_UTRACE
|
|
|
|
|
|
|
|
/* Support Valgrind. */
|
|
|
|
#undef JEMALLOC_VALGRIND
|
|
|
|
|
|
|
|
/* Support optional abort() on OOM. */
|
|
|
|
#undef JEMALLOC_XMALLOC
|
|
|
|
|
|
|
|
/* Support lazy locking (avoid locking unless a second thread is launched). */
|
|
|
|
#undef JEMALLOC_LAZY_LOCK
|
|
|
|
|
|
|
|
/* One page is 2^STATIC_PAGE_SHIFT bytes. */
|
|
|
|
#undef STATIC_PAGE_SHIFT
|
|
|
|
|
|
|
|
/*
|
|
|
|
* If defined, use munmap() to unmap freed chunks, rather than storing them for
|
|
|
|
* later reuse. This is disabled by default on Linux because common sequences
|
|
|
|
* of mmap()/munmap() calls will cause virtual memory map holes.
|
|
|
|
*/
|
|
|
|
#undef JEMALLOC_MUNMAP
|
|
|
|
|
|
|
|
/* TLS is used to map arenas and magazine caches to threads. */
|
|
|
|
#undef JEMALLOC_TLS
|
|
|
|
|
|
|
|
/*
|
|
|
|
* JEMALLOC_IVSALLOC enables ivsalloc(), which verifies that pointers reside
|
|
|
|
* within jemalloc-owned chunks before dereferencing them.
|
|
|
|
*/
|
|
|
|
#undef JEMALLOC_IVSALLOC
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Darwin (OS X) uses zones to work around Mach-O symbol override shortcomings.
|
|
|
|
*/
|
|
|
|
#undef JEMALLOC_ZONE
|
|
|
|
#undef JEMALLOC_ZONE_VERSION
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Methods for purging unused pages differ between operating systems.
|
|
|
|
*
|
|
|
|
* madvise(..., MADV_DONTNEED) : On Linux, this immediately discards pages,
|
|
|
|
* such that new pages will be demand-zeroed if
|
|
|
|
* the address region is later touched.
|
|
|
|
* madvise(..., MADV_FREE) : On FreeBSD and Darwin, this marks pages as being
|
|
|
|
* unused, such that they will be discarded rather
|
|
|
|
* than swapped out.
|
|
|
|
*/
|
|
|
|
#undef JEMALLOC_PURGE_MADVISE_DONTNEED
|
|
|
|
#undef JEMALLOC_PURGE_MADVISE_FREE
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Define if operating system has alloca.h header.
|
|
|
|
*/
|
|
|
|
#undef JEMALLOC_HAS_ALLOCA_H
|
|
|
|
|
2014-02-25 08:08:38 +08:00
|
|
|
/* C99 restrict keyword supported. */
|
|
|
|
#undef JEMALLOC_HAS_RESTRICT
|
|
|
|
|
2014-03-31 07:27:08 +08:00
|
|
|
/* For use by hash code. */
|
|
|
|
#undef JEMALLOC_BIG_ENDIAN
|
|
|
|
|
Refactor to support more varied testing.
Refactor the test harness to support three types of tests:
- unit: White box unit tests. These tests have full access to all
internal jemalloc library symbols. Though in actuality all symbols
are prefixed by jet_, macro-based name mangling abstracts this away
from test code.
- integration: Black box integration tests. These tests link with
the installable shared jemalloc library, and with the exception of
some utility code and configure-generated macro definitions, they have
no access to jemalloc internals.
- stress: Black box stress tests. These tests link with the installable
shared jemalloc library, as well as with an internal allocator with
symbols prefixed by jet_ (same as for unit tests) that can be used to
allocate data structures that are internal to the test code.
Move existing tests into test/{unit,integration}/ as appropriate.
Split out internal parts of jemalloc_defs.h.in and put them in
jemalloc_internal_defs.h.in. This reduces internals exposure to
applications that #include <jemalloc/jemalloc.h>.
Refactor jemalloc.h header generation so that a single header file
results, and the prototypes can be used to generate jet_ prototypes for
tests. Split jemalloc.h.in into multiple parts (jemalloc_defs.h.in,
jemalloc_macros.h.in, jemalloc_protos.h.in, jemalloc_mangle.h.in) and
use a shell script to generate a unified jemalloc.h at configure time.
Change the default private namespace prefix from "" to "je_".
Add missing private namespace mangling.
Remove hard-coded private_namespace.h. Instead generate it and
private_unnamespace.h from private_symbols.txt. Use similar logic for
public symbols, which aids in name mangling for jet_ symbols.
Add test_warn() and test_fail(). Replace existing exit(1) calls with
test_fail() calls.
2013-12-01 07:25:42 +08:00
|
|
|
/* sizeof(int) == 2^LG_SIZEOF_INT. */
|
|
|
|
#undef LG_SIZEOF_INT
|
|
|
|
|
|
|
|
/* sizeof(long) == 2^LG_SIZEOF_LONG. */
|
|
|
|
#undef LG_SIZEOF_LONG
|
|
|
|
|
|
|
|
/* sizeof(intmax_t) == 2^LG_SIZEOF_INTMAX_T. */
|
|
|
|
#undef LG_SIZEOF_INTMAX_T
|
2013-12-13 06:41:02 +08:00
|
|
|
|
|
|
|
#endif /* JEMALLOC_INTERNAL_DEFS_H_ */
|