Invert NO_TLS to JEMALLOC_TLS.
diff --git a/configure.ac b/configure.ac
index c711024..b92a749 100644
--- a/configure.ac
+++ b/configure.ac
@@ -210,7 +210,7 @@
*-*-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 @@
*-*-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 @@
[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 @@
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 @@
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 @@
[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 @@
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_cv_osatomic])
if test "x${je_cv_osatomic}" = "xyes" ; then
- AC_DEFINE([JEMALLOC_OSATOMIC])
+ AC_DEFINE([JEMALLOC_OSATOMIC], [ ])
fi
dnl ============================================================================
@@ -861,15 +861,15 @@
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 2c21312..dbfd3fc 100644
--- a/include/jemalloc/internal/jemalloc_internal.h.in
+++ b/include/jemalloc/internal/jemalloc_internal.h.in
@@ -357,7 +357,7 @@
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 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 f647f63..4823192 100644
--- a/include/jemalloc/internal/prof.h
+++ b/include/jemalloc/internal/prof.h
@@ -180,7 +180,7 @@
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 e5f9518..ed037cf 100644
--- a/include/jemalloc/internal/tcache.h
+++ b/include/jemalloc/internal/tcache.h
@@ -76,7 +76,7 @@
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 f8f80e6..434dd36 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 c740928..6ea2118 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 @@
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);
diff --git a/src/jemalloc.c b/src/jemalloc.c
index 385eb03..e2b6134 100644
--- a/src/jemalloc.c
+++ b/src/jemalloc.c
@@ -9,11 +9,11 @@
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 @@
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 @@
malloc_mutex_unlock(&arenas_lock);
}
-#ifdef NO_TLS
+#ifndef JEMALLOC_TLS
static void
thread_allocated_cleanup(void *arg)
{
@@ -656,7 +656,7 @@
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 2ca66c7..9c32737 100644
--- a/src/prof.c
+++ b/src/prof.c
@@ -26,7 +26,7 @@
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 478b7f5..f90308c 100644
--- a/src/tcache.c
+++ b/src/tcache.c
@@ -11,7 +11,7 @@
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