Fix name mangling issues.

Move je_* definitions from jemalloc_macros.h.in to jemalloc_defs.h.in,
because only the latter is an autoconf header (#undef substitution
occurs).

Fix unit tests to use automatic mangling, so that e.g. mallocx is
macro-substituted to becom jet_mallocx.
This commit is contained in:
Jason Evans 2013-12-13 15:07:43 -08:00
parent d82a5e6a34
commit 3477991440
4 changed files with 37 additions and 36 deletions

View File

@ -22,3 +22,37 @@
/* sizeof(void *) == 2^LG_SIZEOF_PTR. */ /* sizeof(void *) == 2^LG_SIZEOF_PTR. */
#undef LG_SIZEOF_PTR #undef LG_SIZEOF_PTR
/*
* 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.
*/
#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_mallocx
# undef je_rallocx
# undef je_xallocx
# undef je_sallocx
# undef je_dallocx
# undef je_nallocx
# undef je_mallctl
# undef je_mallctlnametomib
# undef je_mallctlbymib
# undef je_malloc_stats_print
# undef je_malloc_usable_size
# undef je_memalign
# undef je_valloc
# undef je_allocm
# undef je_rallocm
# undef je_sallocm
# undef je_dallocm
# undef je_nallocm
#endif

View File

@ -36,40 +36,6 @@
# define ALLOCM_ERR_NOT_MOVED 2 # define ALLOCM_ERR_NOT_MOVED 2
#endif #endif
/*
* 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.
*/
#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_mallocx
# undef je_rallocx
# undef je_xallocx
# undef je_sallocx
# undef je_dallocx
# undef je_nallocx
# undef je_mallctl
# undef je_mallctlnametomib
# undef je_mallctlbymib
# undef je_malloc_stats_print
# undef je_malloc_usable_size
# undef je_memalign
# undef je_valloc
# undef je_allocm
# undef je_rallocm
# undef je_sallocm
# undef je_dallocm
# undef je_nallocm
#endif
#ifdef JEMALLOC_HAVE_ATTR #ifdef JEMALLOC_HAVE_ATTR
# define JEMALLOC_ATTR(s) __attribute__((s)) # define JEMALLOC_ATTR(s) __attribute__((s))
# define JEMALLOC_EXPORT JEMALLOC_ATTR(visibility("default")) # define JEMALLOC_EXPORT JEMALLOC_ATTR(visibility("default"))

View File

@ -64,6 +64,7 @@
*/ */
#ifdef JEMALLOC_UNIT_TEST #ifdef JEMALLOC_UNIT_TEST
# define JEMALLOC_JET # define JEMALLOC_JET
# define JEMALLOC_MANGLE
# include "jemalloc/internal/jemalloc_internal.h" # include "jemalloc/internal/jemalloc_internal.h"
/******************************************************************************/ /******************************************************************************/

View File

@ -39,7 +39,7 @@ thd_receiver_start(void *arg)
for (i = 0; i < (NSENDERS * NMSGS); i++) { for (i = 0; i < (NSENDERS * NMSGS); i++) {
mq_msg_t *msg = mq_get(mq); mq_msg_t *msg = mq_get(mq);
assert_ptr_not_null(msg, "mq_get() should never return NULL"); assert_ptr_not_null(msg, "mq_get() should never return NULL");
jet_dallocx(msg, 0); dallocx(msg, 0);
} }
return (NULL); return (NULL);
} }
@ -53,7 +53,7 @@ thd_sender_start(void *arg)
for (i = 0; i < NMSGS; i++) { for (i = 0; i < NMSGS; i++) {
mq_msg_t *msg; mq_msg_t *msg;
void *p; void *p;
p = jet_mallocx(sizeof(mq_msg_t), 0); p = mallocx(sizeof(mq_msg_t), 0);
assert_ptr_not_null(p, "Unexpected allocm() failure"); assert_ptr_not_null(p, "Unexpected allocm() failure");
msg = (mq_msg_t *)p; msg = (mq_msg_t *)p;
mq_put(mq, msg); mq_put(mq, msg);