2012-03-02 09:19:20 +08:00
|
|
|
/*
|
|
|
|
* Name mangling for public symbols is controlled by --with-mangling and
|
|
|
|
* --with-jemalloc-prefix. With default settings the je_ prefix is stripped by
|
|
|
|
* these macro definitions.
|
|
|
|
*/
|
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
|
|
|
#ifndef JEMALLOC_NO_RENAME
|
|
|
|
# undef je_malloc_conf
|
|
|
|
# undef je_malloc_message
|
|
|
|
# undef je_malloc
|
|
|
|
# undef je_calloc
|
|
|
|
# undef je_posix_memalign
|
|
|
|
# undef je_aligned_alloc
|
|
|
|
# undef je_realloc
|
|
|
|
# undef je_free
|
|
|
|
# undef je_malloc_usable_size
|
|
|
|
# undef je_malloc_stats_print
|
|
|
|
# undef je_mallctl
|
|
|
|
# undef je_mallctlnametomib
|
|
|
|
# undef je_mallctlbymib
|
|
|
|
# undef je_memalign
|
|
|
|
# undef je_valloc
|
|
|
|
# undef je_allocm
|
|
|
|
# undef je_rallocm
|
|
|
|
# undef je_sallocm
|
|
|
|
# undef je_dallocm
|
|
|
|
# undef je_nallocm
|
|
|
|
#endif
|
2012-02-03 14:04:57 +08:00
|
|
|
|
2010-01-04 03:59:20 +08:00
|
|
|
/* Defined if __attribute__((...)) syntax is supported. */
|
|
|
|
#undef JEMALLOC_HAVE_ATTR
|
|
|
|
#ifdef JEMALLOC_HAVE_ATTR
|
2012-04-30 18:38:29 +08:00
|
|
|
# define JEMALLOC_ATTR(s) __attribute__((s))
|
|
|
|
# define JEMALLOC_EXPORT JEMALLOC_ATTR(visibility("default"))
|
|
|
|
# define JEMALLOC_ALIGNED(s) JEMALLOC_ATTR(aligned(s))
|
|
|
|
# define JEMALLOC_SECTION(s) JEMALLOC_ATTR(section(s))
|
|
|
|
# define JEMALLOC_NOINLINE JEMALLOC_ATTR(noinline)
|
2012-04-30 18:38:31 +08:00
|
|
|
#elif _MSC_VER
|
|
|
|
# define JEMALLOC_ATTR(s)
|
2012-05-02 18:02:53 +08:00
|
|
|
# ifdef DLLEXPORT
|
|
|
|
# define JEMALLOC_EXPORT __declspec(dllexport)
|
|
|
|
# else
|
|
|
|
# define JEMALLOC_EXPORT __declspec(dllimport)
|
|
|
|
# endif
|
2012-04-30 18:38:31 +08:00
|
|
|
# define JEMALLOC_ALIGNED(s) __declspec(align(s))
|
|
|
|
# define JEMALLOC_SECTION(s) __declspec(allocate(s))
|
|
|
|
# define JEMALLOC_NOINLINE __declspec(noinline)
|
2010-01-04 03:59:20 +08:00
|
|
|
#else
|
2012-04-30 18:38:29 +08:00
|
|
|
# define JEMALLOC_ATTR(s)
|
|
|
|
# define JEMALLOC_EXPORT
|
|
|
|
# define JEMALLOC_ALIGNED(s)
|
|
|
|
# define JEMALLOC_SECTION(s)
|
|
|
|
# define JEMALLOC_NOINLINE
|
2010-01-04 03:59:20 +08:00
|
|
|
#endif
|
2009-07-01 07:17:05 +08:00
|
|
|
|
2012-03-03 09:47:37 +08:00
|
|
|
/* Support the experimental API. */
|
|
|
|
#undef JEMALLOC_EXPERIMENTAL
|
|
|
|
|
2012-10-10 07:20:10 +08:00
|
|
|
/*
|
|
|
|
* At least Linux omits the "const" in:
|
|
|
|
*
|
|
|
|
* size_t malloc_usable_size(const void *ptr);
|
|
|
|
*
|
|
|
|
* Match the operating system's prototype.
|
|
|
|
*/
|
|
|
|
#undef JEMALLOC_USABLE_SIZE_CONST
|