Bug 1153683 - mozjemalloc: FreeBSD can use its own alignment constants. draft
authorJan Beich <jbeich@FreeBSD.org>
Fri, 12 May 2017 20:16:07 +0000
changeset 577125 64aef5a9dc01c8cf479ce08164f48f6ad793771f
parent 577124 9bc7b498eb9b9a056a870abb9af1ffd5c3ca5413
child 577126 332fe0957388a55cd9c1bb9c9364c1e1bb02ea52
push id58619
push userbmo:jbeich@FreeBSD.org
push dateFri, 12 May 2017 21:48:08 +0000
bugs1153683
milestone55.0a1
Bug 1153683 - mozjemalloc: FreeBSD can use its own alignment constants. MozReview-Commit-ID: 8j4ECjvUAMB
memory/mozjemalloc/jemalloc.c
--- a/memory/mozjemalloc/jemalloc.c
+++ b/memory/mozjemalloc/jemalloc.c
@@ -469,25 +469,25 @@ static pthread_key_t tlsIndex;
 #endif
 
 #  define inline
 #endif
 
 /* Size of stack-allocated buffer passed to strerror_r(). */
 #define	STRERROR_BUF		64
 
+#ifndef __FreeBSD__
 /* Minimum alignment of non-tiny allocations is 2^QUANTUM_2POW_MIN bytes. */
 #  define QUANTUM_2POW_MIN      4
 #if defined(_WIN64) || defined(__LP64__)
 #  define SIZEOF_PTR_2POW       3
 #else
 #  define SIZEOF_PTR_2POW       2
 #endif
-#define PIC
-#if 0
+#else
 #ifdef __i386__
 #  define QUANTUM_2POW_MIN	4
 #  define SIZEOF_PTR_2POW	2
 #  define CPU_SPINWAIT		__asm__ volatile("pause")
 #endif
 #ifdef __ia64__
 #  define QUANTUM_2POW_MIN	4
 #  define SIZEOF_PTR_2POW	3
@@ -525,20 +525,22 @@ static pthread_key_t tlsIndex;
 
 #define	SIZEOF_PTR		(1U << SIZEOF_PTR_2POW)
 
 /* sizeof(int) == (1U << SIZEOF_INT_2POW). */
 #ifndef SIZEOF_INT_2POW
 #  define SIZEOF_INT_2POW	2
 #endif
 
+#ifndef MOZ_MEMORY
 /* We can't use TLS in non-PIC programs, since TLS relies on loader magic. */
 #if (!defined(PIC) && !defined(NO_TLS))
 #  define NO_TLS
 #endif
+#endif
 
 #ifdef NO_TLS
    /* MALLOC_BALANCE requires TLS. */
 #  ifdef MALLOC_BALANCE
 #    undef MALLOC_BALANCE
 #  endif
 #endif