Invert NO_TLS to JEMALLOC_TLS.
This commit is contained in:
parent
f3e139a1ef
commit
e24c7af35d
28
configure.ac
28
configure.ac
@ -210,7 +210,7 @@ case "${host}" in
|
||||
*-*-darwin*)
|
||||
CFLAGS="$CFLAGS -fno-common -no-cpp-precomp"
|
||||
abi="macho"
|
||||
AC_DEFINE([JEMALLOC_PURGE_MADVISE_FREE])
|
||||
AC_DEFINE([JEMALLOC_PURGE_MADVISE_FREE], [ ])
|
||||
RPATH=""
|
||||
LD_PRELOAD_VAR="DYLD_INSERT_LIBRARIES"
|
||||
so="dylib"
|
||||
@ -218,14 +218,14 @@ case "${host}" in
|
||||
*-*-freebsd*)
|
||||
CFLAGS="$CFLAGS"
|
||||
abi="elf"
|
||||
AC_DEFINE([JEMALLOC_PURGE_MADVISE_FREE])
|
||||
AC_DEFINE([JEMALLOC_PURGE_MADVISE_FREE], [ ])
|
||||
RPATH="-Wl,-rpath,"
|
||||
;;
|
||||
*-*-linux*)
|
||||
CFLAGS="$CFLAGS"
|
||||
CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
|
||||
abi="elf"
|
||||
AC_DEFINE([JEMALLOC_PURGE_MADVISE_DONTNEED])
|
||||
AC_DEFINE([JEMALLOC_PURGE_MADVISE_DONTNEED], [ ])
|
||||
RPATH="-Wl,-rpath,"
|
||||
;;
|
||||
*-*-netbsd*)
|
||||
@ -240,7 +240,7 @@ case "${host}" in
|
||||
[CFLAGS="$CFLAGS"; abi="elf"],
|
||||
[abi="aout"])
|
||||
AC_MSG_RESULT([$abi])
|
||||
AC_DEFINE([JEMALLOC_PURGE_MADVISE_FREE])
|
||||
AC_DEFINE([JEMALLOC_PURGE_MADVISE_FREE], [ ])
|
||||
RPATH="-Wl,-rpath,"
|
||||
;;
|
||||
*-*-solaris2*)
|
||||
@ -291,7 +291,7 @@ JE_COMPILABLE([mremap(...MREMAP_FIXED...)], [
|
||||
void *p = mremap((void *)0, 0, 0, MREMAP_MAYMOVE|MREMAP_FIXED, (void *)0);
|
||||
], [je_cv_mremap_fixed])
|
||||
if test "x${je_cv_mremap_fixed}" = "xyes" ; then
|
||||
AC_DEFINE([JEMALLOC_MREMAP_FIXED])
|
||||
AC_DEFINE([JEMALLOC_MREMAP_FIXED], [ ])
|
||||
fi
|
||||
|
||||
dnl Support optional additions to rpath.
|
||||
@ -329,10 +329,10 @@ public_syms="malloc_conf malloc_message malloc calloc posix_memalign aligned_all
|
||||
|
||||
dnl Check for allocator-related functions that should be wrapped.
|
||||
AC_CHECK_FUNC([memalign],
|
||||
[AC_DEFINE([JEMALLOC_OVERRIDE_MEMALIGN])
|
||||
[AC_DEFINE([JEMALLOC_OVERRIDE_MEMALIGN], [ ])
|
||||
public_syms="${public_syms} memalign"])
|
||||
AC_CHECK_FUNC([valloc],
|
||||
[AC_DEFINE([JEMALLOC_OVERRIDE_VALLOC])
|
||||
[AC_DEFINE([JEMALLOC_OVERRIDE_VALLOC], [ ])
|
||||
public_syms="${public_syms} valloc"])
|
||||
|
||||
dnl Support the experimental API by default.
|
||||
@ -458,7 +458,7 @@ fi
|
||||
[enable_cc_silence="0"]
|
||||
)
|
||||
if test "x$enable_cc_silence" = "x1" ; then
|
||||
AC_DEFINE([JEMALLOC_CC_SILENCE])
|
||||
AC_DEFINE([JEMALLOC_CC_SILENCE], [ ])
|
||||
fi
|
||||
|
||||
dnl Do not compile with debugging by default.
|
||||
@ -808,8 +808,8 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
|
||||
enable_tls="0")
|
||||
fi
|
||||
AC_SUBST([enable_tls])
|
||||
if test "x${enable_tls}" = "x0" ; then
|
||||
AC_DEFINE_UNQUOTED([NO_TLS], [ ])
|
||||
if test "x${enable_tls}" = "x1" ; then
|
||||
AC_DEFINE_UNQUOTED([JEMALLOC_TLS], [ ])
|
||||
fi
|
||||
|
||||
dnl ============================================================================
|
||||
@ -846,7 +846,7 @@ JE_COMPILABLE([Darwin OSAtomic*()], [
|
||||
}
|
||||
], [je_cv_osatomic])
|
||||
if test "x${je_cv_osatomic}" = "xyes" ; then
|
||||
AC_DEFINE([JEMALLOC_OSATOMIC])
|
||||
AC_DEFINE([JEMALLOC_OSATOMIC], [ ])
|
||||
fi
|
||||
|
||||
dnl ============================================================================
|
||||
@ -861,15 +861,15 @@ JE_COMPILABLE([Darwin OSSpin*()], [
|
||||
OSSpinLockUnlock(&lock);
|
||||
], [je_cv_osspin])
|
||||
if test "x${je_cv_osspin}" = "xyes" ; then
|
||||
AC_DEFINE([JEMALLOC_OSSPIN])
|
||||
AC_DEFINE([JEMALLOC_OSSPIN], [ ])
|
||||
fi
|
||||
|
||||
dnl ============================================================================
|
||||
dnl Darwin-related configuration.
|
||||
|
||||
if test "x${abi}" = "xmacho" ; then
|
||||
AC_DEFINE([JEMALLOC_IVSALLOC])
|
||||
AC_DEFINE([JEMALLOC_ZONE])
|
||||
AC_DEFINE([JEMALLOC_IVSALLOC], [ ])
|
||||
AC_DEFINE([JEMALLOC_ZONE], [ ])
|
||||
|
||||
dnl The szone version jumped from 3 to 6 between the OS X 10.5.x and 10.6
|
||||
dnl releases. malloc_zone_t and malloc_introspection_t have new fields in
|
||||
|
@ -357,7 +357,7 @@ extern unsigned ncpus;
|
||||
|
||||
extern malloc_mutex_t arenas_lock; /* Protects arenas initialization. */
|
||||
extern pthread_key_t arenas_tsd;
|
||||
#ifndef NO_TLS
|
||||
#ifdef JEMALLOC_TLS
|
||||
/*
|
||||
* Map of pthread_self() --> arenas[???], used for selecting an arena to use
|
||||
* for allocations.
|
||||
@ -382,7 +382,7 @@ extern __thread arena_t *arenas_tls JEMALLOC_ATTR(tls_model("initial-exec"));
|
||||
extern arena_t **arenas;
|
||||
extern unsigned narenas;
|
||||
|
||||
#ifndef NO_TLS
|
||||
#ifdef JEMALLOC_TLS
|
||||
extern __thread thread_allocated_t thread_allocated_tls;
|
||||
# define ALLOCATED_GET() (thread_allocated_tls.allocated)
|
||||
# define ALLOCATEDP_GET() (&thread_allocated_tls.allocated)
|
||||
|
@ -180,7 +180,7 @@ extern uint64_t prof_interval;
|
||||
extern bool prof_promote;
|
||||
|
||||
/* Thread-specific backtrace cache, used to reduce bt2ctx contention. */
|
||||
#ifndef NO_TLS
|
||||
#ifdef JEMALLOC_TLS
|
||||
extern __thread prof_tdata_t *prof_tdata_tls
|
||||
JEMALLOC_ATTR(tls_model("initial-exec"));
|
||||
# define PROF_TCACHE_GET() prof_tdata_tls
|
||||
|
@ -76,7 +76,7 @@ extern ssize_t opt_lg_tcache_max;
|
||||
extern tcache_bin_info_t *tcache_bin_info;
|
||||
|
||||
/* Map of thread-specific caches. */
|
||||
#ifndef NO_TLS
|
||||
#ifdef JEMALLOC_TLS
|
||||
extern __thread tcache_t *tcache_tls
|
||||
JEMALLOC_ATTR(tls_model("initial-exec"));
|
||||
# define TCACHE_GET() tcache_tls
|
||||
|
@ -122,7 +122,7 @@
|
||||
#undef STATIC_PAGE_SHIFT
|
||||
|
||||
/* TLS is used to map arenas and magazine caches to threads. */
|
||||
#undef NO_TLS
|
||||
#undef JEMALLOC_TLS
|
||||
|
||||
/*
|
||||
* JEMALLOC_IVSALLOC enables ivsalloc(), which verifies that pointers reside
|
||||
|
@ -8,7 +8,7 @@
|
||||
* Used by chunk_alloc_mmap() to decide whether to attempt the fast path and
|
||||
* potentially avoid some system calls.
|
||||
*/
|
||||
#ifndef NO_TLS
|
||||
#ifdef JEMALLOC_TLS
|
||||
static __thread bool mmap_unaligned_tls
|
||||
JEMALLOC_ATTR(tls_model("initial-exec"));
|
||||
#define MMAP_UNALIGNED_GET() mmap_unaligned_tls
|
||||
@ -225,7 +225,7 @@ bool
|
||||
chunk_mmap_boot(void)
|
||||
{
|
||||
|
||||
#ifdef NO_TLS
|
||||
#ifndef JEMALLOC_TLS
|
||||
if (pthread_key_create(&mmap_unaligned_tsd, NULL) != 0) {
|
||||
malloc_write("<jemalloc>: Error in pthread_key_create()\n");
|
||||
return (true);
|
||||
|
@ -9,11 +9,11 @@ arena_t **arenas;
|
||||
unsigned narenas;
|
||||
|
||||
pthread_key_t arenas_tsd;
|
||||
#ifndef NO_TLS
|
||||
#ifdef JEMALLOC_TLS
|
||||
__thread arena_t *arenas_tls JEMALLOC_ATTR(tls_model("initial-exec"));
|
||||
#endif
|
||||
|
||||
#ifndef NO_TLS
|
||||
#ifdef JEMALLOC_TLS
|
||||
__thread thread_allocated_t thread_allocated_tls;
|
||||
#endif
|
||||
pthread_key_t thread_allocated_tsd;
|
||||
@ -58,7 +58,7 @@ size_t opt_narenas = 0;
|
||||
static void stats_print_atexit(void);
|
||||
static unsigned malloc_ncpus(void);
|
||||
static void arenas_cleanup(void *arg);
|
||||
#ifdef NO_TLS
|
||||
#ifndef JEMALLOC_TLS
|
||||
static void thread_allocated_cleanup(void *arg);
|
||||
#endif
|
||||
static bool malloc_conf_next(char const **opts_p, char const **k_p,
|
||||
@ -251,7 +251,7 @@ arenas_cleanup(void *arg)
|
||||
malloc_mutex_unlock(&arenas_lock);
|
||||
}
|
||||
|
||||
#ifdef NO_TLS
|
||||
#ifndef JEMALLOC_TLS
|
||||
static void
|
||||
thread_allocated_cleanup(void *arg)
|
||||
{
|
||||
@ -656,7 +656,7 @@ malloc_init_hard(void)
|
||||
return (true);
|
||||
}
|
||||
|
||||
#ifdef NO_TLS
|
||||
#ifndef JEMALLOC_TLS
|
||||
/* Initialize allocation counters before any allocations can occur. */
|
||||
if (config_stats && pthread_key_create(&thread_allocated_tsd,
|
||||
thread_allocated_cleanup) != 0) {
|
||||
|
@ -26,7 +26,7 @@ char opt_prof_prefix[PATH_MAX + 1];
|
||||
uint64_t prof_interval;
|
||||
bool prof_promote;
|
||||
|
||||
#ifndef NO_TLS
|
||||
#ifdef JEMALLOC_TLS
|
||||
__thread prof_tdata_t *prof_tdata_tls
|
||||
JEMALLOC_ATTR(tls_model("initial-exec"));
|
||||
#endif
|
||||
|
@ -11,7 +11,7 @@ tcache_bin_info_t *tcache_bin_info;
|
||||
static unsigned stack_nelms; /* Total stack elms per tcache. */
|
||||
|
||||
/* Map of thread-specific caches. */
|
||||
#ifndef NO_TLS
|
||||
#ifdef JEMALLOC_TLS
|
||||
__thread tcache_t *tcache_tls JEMALLOC_ATTR(tls_model("initial-exec"));
|
||||
#endif
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user