Invert NO_TLS to JEMALLOC_TLS.

This commit is contained in:
Jason Evans 2012-03-19 10:21:17 -07:00
parent f3e139a1ef
commit e24c7af35d
9 changed files with 28 additions and 28 deletions

View File

@ -210,7 +210,7 @@ case "${host}" in
*-*-darwin*) *-*-darwin*)
CFLAGS="$CFLAGS -fno-common -no-cpp-precomp" CFLAGS="$CFLAGS -fno-common -no-cpp-precomp"
abi="macho" abi="macho"
AC_DEFINE([JEMALLOC_PURGE_MADVISE_FREE]) AC_DEFINE([JEMALLOC_PURGE_MADVISE_FREE], [ ])
RPATH="" RPATH=""
LD_PRELOAD_VAR="DYLD_INSERT_LIBRARIES" LD_PRELOAD_VAR="DYLD_INSERT_LIBRARIES"
so="dylib" so="dylib"
@ -218,14 +218,14 @@ case "${host}" in
*-*-freebsd*) *-*-freebsd*)
CFLAGS="$CFLAGS" CFLAGS="$CFLAGS"
abi="elf" abi="elf"
AC_DEFINE([JEMALLOC_PURGE_MADVISE_FREE]) AC_DEFINE([JEMALLOC_PURGE_MADVISE_FREE], [ ])
RPATH="-Wl,-rpath," RPATH="-Wl,-rpath,"
;; ;;
*-*-linux*) *-*-linux*)
CFLAGS="$CFLAGS" CFLAGS="$CFLAGS"
CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE" CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
abi="elf" abi="elf"
AC_DEFINE([JEMALLOC_PURGE_MADVISE_DONTNEED]) AC_DEFINE([JEMALLOC_PURGE_MADVISE_DONTNEED], [ ])
RPATH="-Wl,-rpath," RPATH="-Wl,-rpath,"
;; ;;
*-*-netbsd*) *-*-netbsd*)
@ -240,7 +240,7 @@ case "${host}" in
[CFLAGS="$CFLAGS"; abi="elf"], [CFLAGS="$CFLAGS"; abi="elf"],
[abi="aout"]) [abi="aout"])
AC_MSG_RESULT([$abi]) AC_MSG_RESULT([$abi])
AC_DEFINE([JEMALLOC_PURGE_MADVISE_FREE]) AC_DEFINE([JEMALLOC_PURGE_MADVISE_FREE], [ ])
RPATH="-Wl,-rpath," RPATH="-Wl,-rpath,"
;; ;;
*-*-solaris2*) *-*-solaris2*)
@ -291,7 +291,7 @@ JE_COMPILABLE([mremap(...MREMAP_FIXED...)], [
void *p = mremap((void *)0, 0, 0, MREMAP_MAYMOVE|MREMAP_FIXED, (void *)0); void *p = mremap((void *)0, 0, 0, MREMAP_MAYMOVE|MREMAP_FIXED, (void *)0);
], [je_cv_mremap_fixed]) ], [je_cv_mremap_fixed])
if test "x${je_cv_mremap_fixed}" = "xyes" ; then if test "x${je_cv_mremap_fixed}" = "xyes" ; then
AC_DEFINE([JEMALLOC_MREMAP_FIXED]) AC_DEFINE([JEMALLOC_MREMAP_FIXED], [ ])
fi fi
dnl Support optional additions to rpath. 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. dnl Check for allocator-related functions that should be wrapped.
AC_CHECK_FUNC([memalign], AC_CHECK_FUNC([memalign],
[AC_DEFINE([JEMALLOC_OVERRIDE_MEMALIGN]) [AC_DEFINE([JEMALLOC_OVERRIDE_MEMALIGN], [ ])
public_syms="${public_syms} memalign"]) public_syms="${public_syms} memalign"])
AC_CHECK_FUNC([valloc], AC_CHECK_FUNC([valloc],
[AC_DEFINE([JEMALLOC_OVERRIDE_VALLOC]) [AC_DEFINE([JEMALLOC_OVERRIDE_VALLOC], [ ])
public_syms="${public_syms} valloc"]) public_syms="${public_syms} valloc"])
dnl Support the experimental API by default. dnl Support the experimental API by default.
@ -458,7 +458,7 @@ fi
[enable_cc_silence="0"] [enable_cc_silence="0"]
) )
if test "x$enable_cc_silence" = "x1" ; then if test "x$enable_cc_silence" = "x1" ; then
AC_DEFINE([JEMALLOC_CC_SILENCE]) AC_DEFINE([JEMALLOC_CC_SILENCE], [ ])
fi fi
dnl Do not compile with debugging by default. dnl Do not compile with debugging by default.
@ -808,8 +808,8 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
enable_tls="0") enable_tls="0")
fi fi
AC_SUBST([enable_tls]) AC_SUBST([enable_tls])
if test "x${enable_tls}" = "x0" ; then if test "x${enable_tls}" = "x1" ; then
AC_DEFINE_UNQUOTED([NO_TLS], [ ]) AC_DEFINE_UNQUOTED([JEMALLOC_TLS], [ ])
fi fi
dnl ============================================================================ dnl ============================================================================
@ -846,7 +846,7 @@ JE_COMPILABLE([Darwin OSAtomic*()], [
} }
], [je_cv_osatomic]) ], [je_cv_osatomic])
if test "x${je_cv_osatomic}" = "xyes" ; then if test "x${je_cv_osatomic}" = "xyes" ; then
AC_DEFINE([JEMALLOC_OSATOMIC]) AC_DEFINE([JEMALLOC_OSATOMIC], [ ])
fi fi
dnl ============================================================================ dnl ============================================================================
@ -861,15 +861,15 @@ JE_COMPILABLE([Darwin OSSpin*()], [
OSSpinLockUnlock(&lock); OSSpinLockUnlock(&lock);
], [je_cv_osspin]) ], [je_cv_osspin])
if test "x${je_cv_osspin}" = "xyes" ; then if test "x${je_cv_osspin}" = "xyes" ; then
AC_DEFINE([JEMALLOC_OSSPIN]) AC_DEFINE([JEMALLOC_OSSPIN], [ ])
fi fi
dnl ============================================================================ dnl ============================================================================
dnl Darwin-related configuration. dnl Darwin-related configuration.
if test "x${abi}" = "xmacho" ; then if test "x${abi}" = "xmacho" ; then
AC_DEFINE([JEMALLOC_IVSALLOC]) AC_DEFINE([JEMALLOC_IVSALLOC], [ ])
AC_DEFINE([JEMALLOC_ZONE]) AC_DEFINE([JEMALLOC_ZONE], [ ])
dnl The szone version jumped from 3 to 6 between the OS X 10.5.x and 10.6 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 dnl releases. malloc_zone_t and malloc_introspection_t have new fields in

View File

@ -357,7 +357,7 @@ extern unsigned ncpus;
extern malloc_mutex_t arenas_lock; /* Protects arenas initialization. */ extern malloc_mutex_t arenas_lock; /* Protects arenas initialization. */
extern pthread_key_t arenas_tsd; extern pthread_key_t arenas_tsd;
#ifndef NO_TLS #ifdef JEMALLOC_TLS
/* /*
* Map of pthread_self() --> arenas[???], used for selecting an arena to use * Map of pthread_self() --> arenas[???], used for selecting an arena to use
* for allocations. * for allocations.
@ -382,7 +382,7 @@ extern __thread arena_t *arenas_tls JEMALLOC_ATTR(tls_model("initial-exec"));
extern arena_t **arenas; extern arena_t **arenas;
extern unsigned narenas; extern unsigned narenas;
#ifndef NO_TLS #ifdef JEMALLOC_TLS
extern __thread thread_allocated_t thread_allocated_tls; extern __thread thread_allocated_t thread_allocated_tls;
# define ALLOCATED_GET() (thread_allocated_tls.allocated) # define ALLOCATED_GET() (thread_allocated_tls.allocated)
# define ALLOCATEDP_GET() (&thread_allocated_tls.allocated) # define ALLOCATEDP_GET() (&thread_allocated_tls.allocated)

View File

@ -180,7 +180,7 @@ extern uint64_t prof_interval;
extern bool prof_promote; extern bool prof_promote;
/* Thread-specific backtrace cache, used to reduce bt2ctx contention. */ /* Thread-specific backtrace cache, used to reduce bt2ctx contention. */
#ifndef NO_TLS #ifdef JEMALLOC_TLS
extern __thread prof_tdata_t *prof_tdata_tls extern __thread prof_tdata_t *prof_tdata_tls
JEMALLOC_ATTR(tls_model("initial-exec")); JEMALLOC_ATTR(tls_model("initial-exec"));
# define PROF_TCACHE_GET() prof_tdata_tls # define PROF_TCACHE_GET() prof_tdata_tls

View File

@ -76,7 +76,7 @@ extern ssize_t opt_lg_tcache_max;
extern tcache_bin_info_t *tcache_bin_info; extern tcache_bin_info_t *tcache_bin_info;
/* Map of thread-specific caches. */ /* Map of thread-specific caches. */
#ifndef NO_TLS #ifdef JEMALLOC_TLS
extern __thread tcache_t *tcache_tls extern __thread tcache_t *tcache_tls
JEMALLOC_ATTR(tls_model("initial-exec")); JEMALLOC_ATTR(tls_model("initial-exec"));
# define TCACHE_GET() tcache_tls # define TCACHE_GET() tcache_tls

View File

@ -122,7 +122,7 @@
#undef STATIC_PAGE_SHIFT #undef STATIC_PAGE_SHIFT
/* TLS is used to map arenas and magazine caches to threads. */ /* 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 * JEMALLOC_IVSALLOC enables ivsalloc(), which verifies that pointers reside

View File

@ -8,7 +8,7 @@
* Used by chunk_alloc_mmap() to decide whether to attempt the fast path and * Used by chunk_alloc_mmap() to decide whether to attempt the fast path and
* potentially avoid some system calls. * potentially avoid some system calls.
*/ */
#ifndef NO_TLS #ifdef JEMALLOC_TLS
static __thread bool mmap_unaligned_tls static __thread bool mmap_unaligned_tls
JEMALLOC_ATTR(tls_model("initial-exec")); JEMALLOC_ATTR(tls_model("initial-exec"));
#define MMAP_UNALIGNED_GET() mmap_unaligned_tls #define MMAP_UNALIGNED_GET() mmap_unaligned_tls
@ -225,7 +225,7 @@ bool
chunk_mmap_boot(void) chunk_mmap_boot(void)
{ {
#ifdef NO_TLS #ifndef JEMALLOC_TLS
if (pthread_key_create(&mmap_unaligned_tsd, NULL) != 0) { if (pthread_key_create(&mmap_unaligned_tsd, NULL) != 0) {
malloc_write("<jemalloc>: Error in pthread_key_create()\n"); malloc_write("<jemalloc>: Error in pthread_key_create()\n");
return (true); return (true);

View File

@ -9,11 +9,11 @@ arena_t **arenas;
unsigned narenas; unsigned narenas;
pthread_key_t arenas_tsd; pthread_key_t arenas_tsd;
#ifndef NO_TLS #ifdef JEMALLOC_TLS
__thread arena_t *arenas_tls JEMALLOC_ATTR(tls_model("initial-exec")); __thread arena_t *arenas_tls JEMALLOC_ATTR(tls_model("initial-exec"));
#endif #endif
#ifndef NO_TLS #ifdef JEMALLOC_TLS
__thread thread_allocated_t thread_allocated_tls; __thread thread_allocated_t thread_allocated_tls;
#endif #endif
pthread_key_t thread_allocated_tsd; pthread_key_t thread_allocated_tsd;
@ -58,7 +58,7 @@ size_t opt_narenas = 0;
static void stats_print_atexit(void); static void stats_print_atexit(void);
static unsigned malloc_ncpus(void); static unsigned malloc_ncpus(void);
static void arenas_cleanup(void *arg); static void arenas_cleanup(void *arg);
#ifdef NO_TLS #ifndef JEMALLOC_TLS
static void thread_allocated_cleanup(void *arg); static void thread_allocated_cleanup(void *arg);
#endif #endif
static bool malloc_conf_next(char const **opts_p, char const **k_p, 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); malloc_mutex_unlock(&arenas_lock);
} }
#ifdef NO_TLS #ifndef JEMALLOC_TLS
static void static void
thread_allocated_cleanup(void *arg) thread_allocated_cleanup(void *arg)
{ {
@ -656,7 +656,7 @@ malloc_init_hard(void)
return (true); return (true);
} }
#ifdef NO_TLS #ifndef JEMALLOC_TLS
/* Initialize allocation counters before any allocations can occur. */ /* Initialize allocation counters before any allocations can occur. */
if (config_stats && pthread_key_create(&thread_allocated_tsd, if (config_stats && pthread_key_create(&thread_allocated_tsd,
thread_allocated_cleanup) != 0) { thread_allocated_cleanup) != 0) {

View File

@ -26,7 +26,7 @@ char opt_prof_prefix[PATH_MAX + 1];
uint64_t prof_interval; uint64_t prof_interval;
bool prof_promote; bool prof_promote;
#ifndef NO_TLS #ifdef JEMALLOC_TLS
__thread prof_tdata_t *prof_tdata_tls __thread prof_tdata_t *prof_tdata_tls
JEMALLOC_ATTR(tls_model("initial-exec")); JEMALLOC_ATTR(tls_model("initial-exec"));
#endif #endif

View File

@ -11,7 +11,7 @@ tcache_bin_info_t *tcache_bin_info;
static unsigned stack_nelms; /* Total stack elms per tcache. */ static unsigned stack_nelms; /* Total stack elms per tcache. */
/* Map of thread-specific caches. */ /* Map of thread-specific caches. */
#ifndef NO_TLS #ifdef JEMALLOC_TLS
__thread tcache_t *tcache_tls JEMALLOC_ATTR(tls_model("initial-exec")); __thread tcache_t *tcache_tls JEMALLOC_ATTR(tls_model("initial-exec"));
#endif #endif