From e24c7af35d1e9d24d02166ac98cfca7cf807ff13 Mon Sep 17 00:00:00 2001 From: Jason Evans Date: Mon, 19 Mar 2012 10:21:17 -0700 Subject: [PATCH] Invert NO_TLS to JEMALLOC_TLS. --- configure.ac | 28 +++++++++---------- .../jemalloc/internal/jemalloc_internal.h.in | 4 +-- include/jemalloc/internal/prof.h | 2 +- include/jemalloc/internal/tcache.h | 2 +- include/jemalloc/jemalloc_defs.h.in | 2 +- src/chunk_mmap.c | 4 +-- src/jemalloc.c | 10 +++---- src/prof.c | 2 +- src/tcache.c | 2 +- 9 files changed, 28 insertions(+), 28 deletions(-) diff --git a/configure.ac b/configure.ac index c7110240..b92a7491 100644 --- a/configure.ac +++ b/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 diff --git a/include/jemalloc/internal/jemalloc_internal.h.in b/include/jemalloc/internal/jemalloc_internal.h.in index 2c213120..dbfd3fc8 100644 --- a/include/jemalloc/internal/jemalloc_internal.h.in +++ b/include/jemalloc/internal/jemalloc_internal.h.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) diff --git a/include/jemalloc/internal/prof.h b/include/jemalloc/internal/prof.h index f647f637..48231928 100644 --- a/include/jemalloc/internal/prof.h +++ b/include/jemalloc/internal/prof.h @@ -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 diff --git a/include/jemalloc/internal/tcache.h b/include/jemalloc/internal/tcache.h index e5f9518e..ed037cf9 100644 --- a/include/jemalloc/internal/tcache.h +++ b/include/jemalloc/internal/tcache.h @@ -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 diff --git a/include/jemalloc/jemalloc_defs.h.in b/include/jemalloc/jemalloc_defs.h.in index f8f80e62..434dd368 100644 --- a/include/jemalloc/jemalloc_defs.h.in +++ b/include/jemalloc/jemalloc_defs.h.in @@ -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 diff --git a/src/chunk_mmap.c b/src/chunk_mmap.c index c7409284..6ea21180 100644 --- a/src/chunk_mmap.c +++ b/src/chunk_mmap.c @@ -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(": Error in pthread_key_create()\n"); return (true); diff --git a/src/jemalloc.c b/src/jemalloc.c index 385eb03a..e2b61343 100644 --- a/src/jemalloc.c +++ b/src/jemalloc.c @@ -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) { diff --git a/src/prof.c b/src/prof.c index 2ca66c73..9c327379 100644 --- a/src/prof.c +++ b/src/prof.c @@ -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 diff --git a/src/tcache.c b/src/tcache.c index 478b7f5f..f90308cd 100644 --- a/src/tcache.c +++ b/src/tcache.c @@ -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