2013-12-13 06:41:02 +08:00
|
|
|
#ifndef JEMALLOC_INTERNAL_DEFS_H_
|
2017-01-20 13:41:41 +08:00
|
|
|
#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
|
|
|
|
|
2017-02-07 05:17:12 +08:00
|
|
|
/*
|
|
|
|
* Number of significant bits in virtual addresses. This may be less than the
|
|
|
|
* total number of bits in a pointer, e.g. on x64, for which the uppermost 16
|
|
|
|
* bits are the same as bit 47.
|
|
|
|
*/
|
|
|
|
#undef LG_VADDR
|
|
|
|
|
2014-12-06 09:42:41 +08:00
|
|
|
/* Defined if C11 atomics are available. */
|
Introduce a backport of C11 atomics
This introduces a backport of C11 atomics. It has four implementations; ranked
in order of preference, they are:
- GCC/Clang __atomic builtins
- GCC/Clang __sync builtins
- MSVC _Interlocked builtins
- C11 atomics, from <stdatomic.h>
The primary advantages are:
- Close adherence to the standard API gives us a defined memory model.
- Type safety: atomic objects are now separate types from non-atomic ones, so
that it's impossible to mix up atomic and non-atomic updates (which is
undefined behavior that compilers are starting to take advantage of).
- Efficiency: we can specify ordering for operations, avoiding fences and
atomic operations on strongly ordered architectures (example:
`atomic_write_u32(ptr, val);` involves a CAS loop, whereas
`atomic_store(ptr, val, ATOMIC_RELEASE);` is a plain store.
This diff leaves in the current atomics API (implementing them in terms of the
backport). This lets us transition uses over piecemeal.
Testing:
This is by nature hard to test. I've manually tested the first three options on
Linux on gcc by futzing with the #defines manually, on freebsd with gcc and
clang, on MSVC, and on OS X with clang. All of these were x86 machines though,
and we don't have any test infrastructure set up for non-x86 platforms.
2017-01-26 01:54:27 +08:00
|
|
|
#undef JEMALLOC_C11_ATOMICS
|
2014-12-06 09:42:41 +08:00
|
|
|
|
Introduce a backport of C11 atomics
This introduces a backport of C11 atomics. It has four implementations; ranked
in order of preference, they are:
- GCC/Clang __atomic builtins
- GCC/Clang __sync builtins
- MSVC _Interlocked builtins
- C11 atomics, from <stdatomic.h>
The primary advantages are:
- Close adherence to the standard API gives us a defined memory model.
- Type safety: atomic objects are now separate types from non-atomic ones, so
that it's impossible to mix up atomic and non-atomic updates (which is
undefined behavior that compilers are starting to take advantage of).
- Efficiency: we can specify ordering for operations, avoiding fences and
atomic operations on strongly ordered architectures (example:
`atomic_write_u32(ptr, val);` involves a CAS loop, whereas
`atomic_store(ptr, val, ATOMIC_RELEASE);` is a plain store.
This diff leaves in the current atomics API (implementing them in terms of the
backport). This lets us transition uses over piecemeal.
Testing:
This is by nature hard to test. I've manually tested the first three options on
Linux on gcc by futzing with the #defines manually, on freebsd with gcc and
clang, on MSVC, and on OS X with clang. All of these were x86 machines though,
and we don't have any test infrastructure set up for non-x86 platforms.
2017-01-26 01:54:27 +08:00
|
|
|
/* Defined if GCC __atomic atomics are available. */
|
|
|
|
#undef JEMALLOC_GCC_ATOMIC_ATOMICS
|
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
|
|
|
|
Introduce a backport of C11 atomics
This introduces a backport of C11 atomics. It has four implementations; ranked
in order of preference, they are:
- GCC/Clang __atomic builtins
- GCC/Clang __sync builtins
- MSVC _Interlocked builtins
- C11 atomics, from <stdatomic.h>
The primary advantages are:
- Close adherence to the standard API gives us a defined memory model.
- Type safety: atomic objects are now separate types from non-atomic ones, so
that it's impossible to mix up atomic and non-atomic updates (which is
undefined behavior that compilers are starting to take advantage of).
- Efficiency: we can specify ordering for operations, avoiding fences and
atomic operations on strongly ordered architectures (example:
`atomic_write_u32(ptr, val);` involves a CAS loop, whereas
`atomic_store(ptr, val, ATOMIC_RELEASE);` is a plain store.
This diff leaves in the current atomics API (implementing them in terms of the
backport). This lets us transition uses over piecemeal.
Testing:
This is by nature hard to test. I've manually tested the first three options on
Linux on gcc by futzing with the #defines manually, on freebsd with gcc and
clang, on MSVC, and on OS X with clang. All of these were x86 machines though,
and we don't have any test infrastructure set up for non-x86 platforms.
2017-01-26 01:54:27 +08:00
|
|
|
/* Defined if GCC __sync atomics are available. */
|
|
|
|
#undef JEMALLOC_GCC_SYNC_ATOMICS
|
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 __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
|
2014-12-09 06:40:14 +08:00
|
|
|
* functions are defined in libgcc instead of being inlines).
|
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
|
|
|
*/
|
|
|
|
#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
|
2014-12-09 06:40:14 +08:00
|
|
|
* functions are defined in libgcc instead of being inlines).
|
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
|
|
|
*/
|
|
|
|
#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
|
|
|
|
|
2016-11-03 09:09:45 +08:00
|
|
|
/*
|
|
|
|
* Defined if os_unfair_lock_*() functions are available, as provided by Darwin.
|
|
|
|
*/
|
|
|
|
#undef JEMALLOC_OS_UNFAIR_LOCK
|
|
|
|
|
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
|
|
|
|
|
2016-12-04 08:47:36 +08:00
|
|
|
/* Defined if syscall(2) is usable. */
|
|
|
|
#undef JEMALLOC_USE_SYSCALL
|
2016-11-03 10:18:33 +08:00
|
|
|
|
2014-12-10 06:41:34 +08:00
|
|
|
/*
|
|
|
|
* Defined if secure_getenv(3) is available.
|
|
|
|
*/
|
|
|
|
#undef JEMALLOC_HAVE_SECURE_GETENV
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Defined if issetugid(2) is available.
|
|
|
|
*/
|
|
|
|
#undef JEMALLOC_HAVE_ISSETUGID
|
|
|
|
|
2016-11-18 07:14:57 +08:00
|
|
|
/* Defined if pthread_atfork(3) is available. */
|
|
|
|
#undef JEMALLOC_HAVE_PTHREAD_ATFORK
|
|
|
|
|
2016-10-07 23:47:16 +08:00
|
|
|
/*
|
2016-10-30 13:55:08 +08:00
|
|
|
* Defined if clock_gettime(CLOCK_MONOTONIC_COARSE, ...) is available.
|
2016-10-07 23:47:16 +08:00
|
|
|
*/
|
2016-10-30 13:55:08 +08:00
|
|
|
#undef JEMALLOC_HAVE_CLOCK_MONOTONIC_COARSE
|
2016-10-07 23:47:16 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Defined if clock_gettime(CLOCK_MONOTONIC, ...) is available.
|
|
|
|
*/
|
|
|
|
#undef JEMALLOC_HAVE_CLOCK_MONOTONIC
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Defined if mach_absolute_time() is available.
|
|
|
|
*/
|
|
|
|
#undef JEMALLOC_HAVE_MACH_ABSOLUTE_TIME
|
|
|
|
|
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 _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
|
|
|
|
|
|
|
|
/*
|
2016-06-02 04:53:56 +08:00
|
|
|
* JEMALLOC_DSS enables use of sbrk(2) to allocate extents from the data storage
|
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
|
|
|
* segment (DSS).
|
|
|
|
*/
|
|
|
|
#undef JEMALLOC_DSS
|
|
|
|
|
2016-04-06 09:18:15 +08:00
|
|
|
/* Support memory filling (junk/zero). */
|
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
|
|
|
#undef JEMALLOC_FILL
|
|
|
|
|
|
|
|
/* Support utrace(2)-based tracing. */
|
|
|
|
#undef JEMALLOC_UTRACE
|
|
|
|
|
|
|
|
/* Support optional abort() on OOM. */
|
|
|
|
#undef JEMALLOC_XMALLOC
|
|
|
|
|
|
|
|
/* Support lazy locking (avoid locking unless a second thread is launched). */
|
|
|
|
#undef JEMALLOC_LAZY_LOCK
|
|
|
|
|
2014-10-10 08:54:06 +08:00
|
|
|
/*
|
|
|
|
* Minimum allocation alignment is 2^LG_QUANTUM bytes (ignoring tiny size
|
|
|
|
* classes).
|
|
|
|
*/
|
|
|
|
#undef LG_QUANTUM
|
|
|
|
|
|
|
|
/* One page is 2^LG_PAGE bytes. */
|
|
|
|
#undef LG_PAGE
|
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
|
|
|
|
2016-11-18 05:36:17 +08:00
|
|
|
/*
|
|
|
|
* One huge page is 2^LG_HUGEPAGE bytes. Note that this is defined even if the
|
|
|
|
* system does not explicitly support huge pages; system calls that require
|
|
|
|
* explicit huge page support are separately configured.
|
|
|
|
*/
|
|
|
|
#undef LG_HUGEPAGE
|
|
|
|
|
2015-07-25 09:21:42 +08:00
|
|
|
/*
|
|
|
|
* If defined, adjacent virtual memory mappings with identical attributes
|
|
|
|
* automatically coalesce, and they fragment when changes are made to subranges.
|
|
|
|
* This is the normal order of things for mmap()/munmap(), but on Windows
|
|
|
|
* VirtualAlloc()/VirtualFree() operations must be precisely matched, i.e.
|
|
|
|
* mappings do *not* coalesce/fragment.
|
|
|
|
*/
|
|
|
|
#undef JEMALLOC_MAPS_COALESCE
|
|
|
|
|
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
|
|
|
/*
|
2016-06-02 04:53:56 +08:00
|
|
|
* If defined, use munmap() to unmap freed extents, rather than storing them for
|
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
|
|
|
* 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
|
|
|
|
|
2016-06-18 04:28:39 +08:00
|
|
|
/*
|
|
|
|
* Used to mark unreachable code to quiet "end of non-void" compiler warnings.
|
|
|
|
* Don't use this directly; instead use unreachable() from util.h
|
|
|
|
*/
|
|
|
|
#undef JEMALLOC_INTERNAL_UNREACHABLE
|
|
|
|
|
2014-05-29 10:37:02 +08:00
|
|
|
/*
|
2016-02-21 15:41:33 +08:00
|
|
|
* ffs*() functions to use for bitmapping. Don't use these directly; instead,
|
2016-02-25 02:32:45 +08:00
|
|
|
* use ffs_*() from util.h.
|
2014-05-29 10:37:02 +08:00
|
|
|
*/
|
2016-02-21 15:41:33 +08:00
|
|
|
#undef JEMALLOC_INTERNAL_FFSLL
|
2014-05-29 10:37:02 +08:00
|
|
|
#undef JEMALLOC_INTERNAL_FFSL
|
|
|
|
#undef JEMALLOC_INTERNAL_FFS
|
|
|
|
|
2015-05-05 00:58:36 +08:00
|
|
|
/*
|
|
|
|
* If defined, explicitly attempt to more uniformly distribute large allocation
|
|
|
|
* pointer alignments across all cache indices.
|
|
|
|
*/
|
|
|
|
#undef JEMALLOC_CACHE_OBLIVIOUS
|
|
|
|
|
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
|
|
|
/*
|
|
|
|
* Darwin (OS X) uses zones to work around Mach-O symbol override shortcomings.
|
|
|
|
*/
|
|
|
|
#undef JEMALLOC_ZONE
|
|
|
|
|
2016-05-06 08:45:02 +08:00
|
|
|
/*
|
|
|
|
* Methods for determining whether the OS overcommits.
|
|
|
|
* JEMALLOC_PROC_SYS_VM_OVERCOMMIT_MEMORY: Linux's
|
|
|
|
* /proc/sys/vm.overcommit_memory file.
|
|
|
|
* JEMALLOC_SYSCTL_VM_OVERCOMMIT: FreeBSD's vm.overcommit sysctl.
|
|
|
|
*/
|
|
|
|
#undef JEMALLOC_SYSCTL_VM_OVERCOMMIT
|
|
|
|
#undef JEMALLOC_PROC_SYS_VM_OVERCOMMIT_MEMORY
|
|
|
|
|
2016-11-18 02:24:51 +08:00
|
|
|
/* Defined if madvise(2) is available. */
|
|
|
|
#undef JEMALLOC_HAVE_MADVISE
|
|
|
|
|
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
|
|
|
/*
|
|
|
|
* Methods for purging unused pages differ between operating systems.
|
|
|
|
*
|
2016-11-18 02:24:51 +08:00
|
|
|
* madvise(..., MADV_FREE) : This marks pages as being unused, such that they
|
|
|
|
* will be discarded rather than swapped out.
|
2017-03-10 10:20:02 +08:00
|
|
|
* madvise(..., MADV_DONTNEED) : If JEMALLOC_PURGE_MADVISE_DONTNEED_ZEROS is
|
|
|
|
* defined, this immediately discards pages,
|
|
|
|
* such that new pages will be demand-zeroed if
|
|
|
|
* the address region is later touched;
|
|
|
|
* otherwise this behaves similarly to
|
|
|
|
* MADV_FREE, though typically with higher
|
|
|
|
* system overhead.
|
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
|
|
|
*/
|
|
|
|
#undef JEMALLOC_PURGE_MADVISE_FREE
|
2016-11-18 02:24:51 +08:00
|
|
|
#undef JEMALLOC_PURGE_MADVISE_DONTNEED
|
2017-03-10 10:20:02 +08:00
|
|
|
#undef JEMALLOC_PURGE_MADVISE_DONTNEED_ZEROS
|
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
|
|
|
|
2016-11-18 05:36:17 +08:00
|
|
|
/*
|
|
|
|
* Defined if transparent huge pages are supported via the MADV_[NO]HUGEPAGE
|
|
|
|
* arguments to madvise(2).
|
|
|
|
*/
|
|
|
|
#undef JEMALLOC_THP
|
|
|
|
|
2014-12-09 06:40:14 +08:00
|
|
|
/* Define if operating system has alloca.h header. */
|
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
|
|
|
#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
|
|
|
|
|
2016-02-21 15:41:33 +08:00
|
|
|
/* sizeof(long long) == 2^LG_SIZEOF_LONG_LONG. */
|
|
|
|
#undef LG_SIZEOF_LONG_LONG
|
|
|
|
|
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(intmax_t) == 2^LG_SIZEOF_INTMAX_T. */
|
|
|
|
#undef LG_SIZEOF_INTMAX_T
|
2013-12-13 06:41:02 +08:00
|
|
|
|
2014-12-09 06:40:14 +08:00
|
|
|
/* glibc malloc hooks (__malloc_hook, __realloc_hook, __free_hook). */
|
2014-08-19 04:06:39 +08:00
|
|
|
#undef JEMALLOC_GLIBC_MALLOC_HOOK
|
|
|
|
|
2014-12-09 06:40:14 +08:00
|
|
|
/* glibc memalign hook. */
|
2014-08-19 04:06:39 +08:00
|
|
|
#undef JEMALLOC_GLIBC_MEMALIGN_HOOK
|
|
|
|
|
2014-12-09 06:40:14 +08:00
|
|
|
/* Adaptive mutex support in pthreads. */
|
2014-08-31 11:57:06 +08:00
|
|
|
#undef JEMALLOC_HAVE_PTHREAD_MUTEX_ADAPTIVE_NP
|
|
|
|
|
Implement per-CPU arena.
The new feature, opt.percpu_arena, determines thread-arena association
dynamically based CPU id. Three modes are supported: "percpu", "phycpu"
and disabled.
"percpu" uses the current core id (with help from sched_getcpu())
directly as the arena index, while "phycpu" will assign threads on the
same physical CPU to the same arena. In other words, "percpu" means # of
arenas == # of CPUs, while "phycpu" has # of arenas == 1/2 * (# of
CPUs). Note that no runtime check on whether hyper threading is enabled
is added yet.
When enabled, threads will be migrated between arenas when a CPU change
is detected. In the current design, to reduce overhead from reading CPU
id, each arena tracks the thread accessed most recently. When a new
thread comes in, we will read CPU id and update arena if necessary.
2017-02-03 09:02:05 +08:00
|
|
|
/* GNU specific sched_getcpu support */
|
|
|
|
#undef JEMALLOC_HAVE_SCHED_GETCPU
|
|
|
|
|
2015-03-04 20:48:01 +08:00
|
|
|
/*
|
|
|
|
* If defined, jemalloc symbols are not exported (doesn't work when
|
|
|
|
* JEMALLOC_PREFIX is not defined).
|
|
|
|
*/
|
|
|
|
#undef JEMALLOC_EXPORT
|
|
|
|
|
2016-02-08 06:23:22 +08:00
|
|
|
/* config.malloc_conf options string. */
|
|
|
|
#undef JEMALLOC_CONFIG_MALLOC_CONF
|
|
|
|
|
2017-04-22 04:47:49 +08:00
|
|
|
/* If defined, jemalloc takes the malloc/free/etc. symbol names. */
|
|
|
|
#undef JEMALLOC_IS_MALLOC
|
|
|
|
|
2013-12-13 06:41:02 +08:00
|
|
|
#endif /* JEMALLOC_INTERNAL_DEFS_H_ */
|