Bug 1153683 - mozjemalloc: unbreak NO_TLS for other POSIX platforms. draft
authorJan Beich <jbeich@FreeBSD.org>
Fri, 12 May 2017 20:10:05 +0000
changeset 577123 9e248353d69612c6d861b0e87959e87de1154137
parent 577122 239b2330c70bf153a33d35999e574814018f2ecf
child 577124 9bc7b498eb9b9a056a870abb9af1ffd5c3ca5413
push id58619
push userbmo:jbeich@FreeBSD.org
push dateFri, 12 May 2017 21:48:08 +0000
bugs1153683
milestone55.0a1
Bug 1153683 - mozjemalloc: unbreak NO_TLS for other POSIX platforms. MozReview-Commit-ID: K2Ng49LDypC
memory/mozjemalloc/jemalloc.c
--- a/memory/mozjemalloc/jemalloc.c
+++ b/memory/mozjemalloc/jemalloc.c
@@ -97,17 +97,16 @@
  *   Huge : Each allocation is backed by a dedicated contiguous set of chunks.
  *          Metadata are stored in a separate red-black tree.
  *
  *******************************************************************************
  */
 
 #ifdef MOZ_MEMORY_ANDROID
 #define NO_TLS
-#define _pthread_self() pthread_self()
 #endif
 
 /*
  * On Linux, we use madvise(MADV_DONTNEED) to release memory back to the
  * operating system.  If we release 1MB of live pages with MADV_DONTNEED, our
  * RSS will decrease by 1MB (almost) immediately.
  *
  * On Mac, we use madvise(MADV_FREE).  Unlike MADV_DONTNEED on Linux, MADV_FREE
@@ -1303,16 +1302,20 @@ static pthread_mutex_t arenas_lock; /* P
 #ifndef NO_TLS
 /*
  * Map of pthread_self() --> arenas[???], used for selecting an arena to use
  * for allocations.
  */
 #ifndef MOZ_MEMORY_WINDOWS
 static __thread arena_t	*arenas_map;
 #endif
+#else
+#ifndef _pthread_self
+#define _pthread_self() pthread_self()
+#endif
 #endif
 
 /*******************************/
 /*
  * Runtime configuration options.
  */
 MOZ_JEMALLOC_API
 const char	*_malloc_options = MOZ_MALLOC_OPTIONS;