Add the --disable-experimental option.
This commit is contained in:
Родитель
7b398aca3b
Коммит
7e77eaffff
3
INSTALL
3
INSTALL
|
@ -116,6 +116,9 @@ any of the following arguments (not a definitive list) to 'configure':
|
|||
Disable support for junk/zero filling of memory. See the "opt.junk"/
|
||||
"opt.zero" option documentation for usage details.
|
||||
|
||||
--disable-experimental
|
||||
Disable support for the experimental API (*allocm()).
|
||||
|
||||
--enable-xmalloc
|
||||
Enable support for optional immediate termination due to out-of-memory
|
||||
errors, as is commonly implemented by "xmalloc" wrapper function for malloc.
|
||||
|
|
|
@ -63,10 +63,12 @@ DOCS_XML := @objroot@doc/jemalloc@install_suffix@.xml
|
|||
DOCS_HTML := $(DOCS_XML:@objroot@%.xml=@srcroot@%.html)
|
||||
DOCS_MAN3 := $(DOCS_XML:@objroot@%.xml=@srcroot@%.3)
|
||||
DOCS := $(DOCS_HTML) $(DOCS_MAN3)
|
||||
CTESTS := @srcroot@test/allocated.c @srcroot@test/allocm.c \
|
||||
@srcroot@test/bitmap.c @srcroot@test/mremap.c \
|
||||
@srcroot@test/posix_memalign.c @srcroot@test/rallocm.c \
|
||||
CTESTS := @srcroot@test/allocated.c @srcroot@test/bitmap.c \
|
||||
@srcroot@test/mremap.c @srcroot@test/posix_memalign.c \
|
||||
@srcroot@test/thread_arena.c
|
||||
ifeq (@enable_experimental@, 1)
|
||||
CTESTS += @srcroot@test/allocm.c @srcroot@test/rallocm.c
|
||||
endif
|
||||
|
||||
.PHONY: all dist doc_html doc_man doc
|
||||
.PHONY: install_bin install_include install_lib
|
||||
|
|
39
configure.ac
39
configure.ac
|
@ -303,6 +303,34 @@ AC_PATH_PROG([AR], [ar], , [$PATH])
|
|||
AC_PATH_PROG([LD], [ld], , [$PATH])
|
||||
AC_PATH_PROG([AUTOCONF], [autoconf], , [$PATH])
|
||||
|
||||
public_syms="malloc_conf malloc_message malloc calloc posix_memalign realloc free malloc_usable_size malloc_stats_print mallctl mallctlnametomib mallctlbymib"
|
||||
|
||||
dnl Check for allocator-related functions that should be wrapped.
|
||||
AC_CHECK_FUNC([memalign],
|
||||
[AC_DEFINE([JEMALLOC_OVERRIDE_MEMALIGN])
|
||||
public_syms="${public_syms} memalign"])
|
||||
AC_CHECK_FUNC([valloc],
|
||||
[AC_DEFINE([JEMALLOC_OVERRIDE_VALLOC])
|
||||
public_syms="${public_syms} valloc"])
|
||||
|
||||
dnl Support the experimental API by default.
|
||||
AC_ARG_ENABLE([experimental],
|
||||
[AS_HELP_STRING([--disable-experimental],
|
||||
[Disable support for the experimental API])],
|
||||
[if test "x$enable_experimental" = "xno" ; then
|
||||
enable_experimental="0"
|
||||
else
|
||||
enable_experimental="1"
|
||||
fi
|
||||
],
|
||||
[enable_experimental="1"]
|
||||
)
|
||||
if test "x$enable_experimental" = "x1" ; then
|
||||
AC_DEFINE([JEMALLOC_EXPERIMENTAL], [ ])
|
||||
public_syms="${public_syms} allocm dallocm nallocm rallocm sallocm"
|
||||
fi
|
||||
AC_SUBST([enable_experimental])
|
||||
|
||||
dnl Perform no name mangling by default.
|
||||
AC_ARG_WITH([mangling],
|
||||
[AS_HELP_STRING([--with-mangling=<map>], [Mangle symbols in <map>])],
|
||||
|
@ -331,7 +359,7 @@ fi
|
|||
dnl Generate macros to rename public symbols. All public symbols are prefixed
|
||||
dnl with je_ in the source code, so these macro definitions are needed even if
|
||||
dnl --with-jemalloc-prefix wasn't specified.
|
||||
for stem in malloc_conf malloc_message malloc calloc posix_memalign realloc free malloc_usable_size malloc_stats_print mallctl mallctlnametomib mallctlbymib memalign valloc allocm dallocm nallocm rallocm sallocm; do
|
||||
for stem in ${public_syms}; do
|
||||
n="je_${stem}"
|
||||
m="${JEMALLOC_PREFIX}${stem}"
|
||||
AC_DEFINE_UNQUOTED([${n}], [${m}])
|
||||
|
@ -795,14 +823,6 @@ if test "x${osspin}" = "xyes" ; then
|
|||
AC_DEFINE([JEMALLOC_OSSPIN])
|
||||
fi
|
||||
|
||||
dnl ============================================================================
|
||||
dnl Check for allocator-related functions that should be wrapped.
|
||||
|
||||
AC_CHECK_FUNC([memalign],
|
||||
[AC_DEFINE([JEMALLOC_OVERRIDE_MEMALIGN])])
|
||||
AC_CHECK_FUNC([valloc],
|
||||
[AC_DEFINE([JEMALLOC_OVERRIDE_VALLOC])])
|
||||
|
||||
dnl ============================================================================
|
||||
dnl Darwin-related configuration.
|
||||
|
||||
|
@ -903,6 +923,7 @@ AC_MSG_RESULT([JEMALLOC_PRIVATE_NAMESPACE])
|
|||
AC_MSG_RESULT([ : ${JEMALLOC_PRIVATE_NAMESPACE}])
|
||||
AC_MSG_RESULT([install_suffix : ${install_suffix}])
|
||||
AC_MSG_RESULT([autogen : ${enable_autogen}])
|
||||
AC_MSG_RESULT([experimental : ${enable_experimental}])
|
||||
AC_MSG_RESULT([cc-silence : ${enable_cc_silence}])
|
||||
AC_MSG_RESULT([debug : ${enable_debug}])
|
||||
AC_MSG_RESULT([stats : ${enable_stats}])
|
||||
|
|
|
@ -304,7 +304,9 @@ for (i = 0; i < nbins; i++) {
|
|||
<refsect2>
|
||||
<title>Experimental API</title>
|
||||
<para>The experimental API is subject to change or removal without regard
|
||||
for backward compatibility.</para>
|
||||
for backward compatibility. If <option>--disable-experimental</option>
|
||||
is specified during configuration, the experimental API is
|
||||
omitted.</para>
|
||||
|
||||
<para>The <function>allocm<parameter/></function>,
|
||||
<function>rallocm<parameter/></function>,
|
||||
|
|
|
@ -16,6 +16,7 @@ extern "C" {
|
|||
|
||||
#include "jemalloc_defs@install_suffix@.h"
|
||||
|
||||
#ifdef JEMALLOC_EXPERIMENTAL
|
||||
#define ALLOCM_LG_ALIGN(la) (la)
|
||||
#if LG_SIZEOF_PTR == 2
|
||||
#define ALLOCM_ALIGN(a) (ffs(a)-1)
|
||||
|
@ -28,6 +29,7 @@ extern "C" {
|
|||
#define ALLOCM_SUCCESS 0
|
||||
#define ALLOCM_ERR_OOM 1
|
||||
#define ALLOCM_ERR_NOT_MOVED 2
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The je_ prefix on the following public symbol declarations is an artifact of
|
||||
|
@ -53,6 +55,7 @@ int je_mallctlnametomib(const char *name, size_t *mibp, size_t *miblenp);
|
|||
int je_mallctlbymib(const size_t *mib, size_t miblen, void *oldp,
|
||||
size_t *oldlenp, void *newp, size_t newlen);
|
||||
|
||||
#ifdef JEMALLOC_EXPERIMENTAL
|
||||
int je_allocm(void **ptr, size_t *rsize, size_t size, int flags)
|
||||
JEMALLOC_ATTR(nonnull(1));
|
||||
int je_rallocm(void **ptr, size_t *rsize, size_t size, size_t extra,
|
||||
|
@ -61,6 +64,7 @@ int je_sallocm(const void *ptr, size_t *rsize, int flags)
|
|||
JEMALLOC_ATTR(nonnull(1));
|
||||
int je_dallocm(void *ptr, int flags) JEMALLOC_ATTR(nonnull(1));
|
||||
int je_nallocm(size_t *rsize, size_t size, int flags);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* By default application code must explicitly refer to mangled symbol names,
|
||||
|
@ -87,12 +91,14 @@ int je_nallocm(size_t *rsize, size_t size, int flags);
|
|||
#define mallctlbymib je_mallctlbymib
|
||||
#define memalign je_memalign
|
||||
#define valloc je_valloc
|
||||
#ifdef JEMALLOC_EXPERIMENTAL
|
||||
#define allocm je_allocm
|
||||
#define rallocm je_rallocm
|
||||
#define sallocm je_sallocm
|
||||
#define dallocm je_dallocm
|
||||
#define nallocm je_nallocm
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The je_* macros can be used as stable alternative names for the public
|
||||
|
@ -116,12 +122,14 @@ int je_nallocm(size_t *rsize, size_t size, int flags);
|
|||
#undef je_mallctlbymib
|
||||
#undef je_memalign
|
||||
#undef je_valloc
|
||||
#ifdef JEMALLOC_EXPERIMENTAL
|
||||
#undef je_allocm
|
||||
#undef je_rallocm
|
||||
#undef je_sallocm
|
||||
#undef je_dallocm
|
||||
#undef je_nallocm
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
|
|
|
@ -108,6 +108,9 @@
|
|||
/* Support memory filling (junk/zero). */
|
||||
#undef JEMALLOC_FILL
|
||||
|
||||
/* Support the experimental API. */
|
||||
#undef JEMALLOC_EXPERIMENTAL
|
||||
|
||||
/* Support optional abort() on OOM. */
|
||||
#undef JEMALLOC_XMALLOC
|
||||
|
||||
|
|
|
@ -1361,6 +1361,15 @@ je_mallctlbymib(const size_t *mib, size_t miblen, void *oldp, size_t *oldlenp,
|
|||
return (ctl_bymib(mib, miblen, oldp, oldlenp, newp, newlen));
|
||||
}
|
||||
|
||||
/*
|
||||
* End non-standard functions.
|
||||
*/
|
||||
/******************************************************************************/
|
||||
/*
|
||||
* Begin experimental functions.
|
||||
*/
|
||||
#ifdef JEMALLOC_EXPERIMENTAL
|
||||
|
||||
JEMALLOC_INLINE void *
|
||||
iallocm(size_t usize, size_t alignment, bool zero)
|
||||
{
|
||||
|
@ -1601,8 +1610,9 @@ je_nallocm(size_t *rsize, size_t size, int flags)
|
|||
return (ALLOCM_SUCCESS);
|
||||
}
|
||||
|
||||
#endif
|
||||
/*
|
||||
* End non-standard functions.
|
||||
* End experimental functions.
|
||||
*/
|
||||
/******************************************************************************/
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче