--- a/memory/mozjemalloc/jemalloc.c
+++ b/memory/mozjemalloc/jemalloc.c
@@ -161,21 +161,16 @@
#ifndef MALLOC_PRODUCTION
/*
* MALLOC_DEBUG enables assertions and other sanity checks, and disables
* inline functions.
*/
# define MALLOC_DEBUG
- /* Allocation tracing. */
-# ifndef MOZ_MEMORY_WINDOWS
-# define MALLOC_UTRACE
-# endif
-
/* Support optional abort() on OOM. */
# define MALLOC_XMALLOC
/* Support SYSV semantics. */
# define MALLOC_SYSV
#endif
#if defined(MOZ_MEMORY_LINUX) && !defined(MOZ_MEMORY_ANDROID)
@@ -1130,45 +1125,23 @@ static bool opt_print_stats = false;
#define opt_quantum_2pow QUANTUM_2POW_MIN
#define opt_small_max_2pow SMALL_MAX_2POW_DEFAULT
#define opt_chunk_2pow CHUNK_2POW_DEFAULT
#else
static size_t opt_quantum_2pow = QUANTUM_2POW_MIN;
static size_t opt_small_max_2pow = SMALL_MAX_2POW_DEFAULT;
static size_t opt_chunk_2pow = CHUNK_2POW_DEFAULT;
#endif
-#ifdef MALLOC_UTRACE
-static bool opt_utrace = false;
-#endif
#ifdef MALLOC_SYSV
static bool opt_sysv = false;
#endif
#ifdef MALLOC_XMALLOC
static bool opt_xmalloc = false;
#endif
-#ifdef MALLOC_UTRACE
-typedef struct {
- void *p;
- size_t s;
- void *r;
-} malloc_utrace_t;
-
-#define UTRACE(a, b, c) \
- if (opt_utrace) { \
- malloc_utrace_t ut; \
- ut.p = (a); \
- ut.s = (b); \
- ut.r = (c); \
- utrace(&ut, sizeof(ut)); \
- }
-#else
-#define UTRACE(a, b, c)
-#endif
-
/******************************************************************************/
/*
* Begin function prototypes for non-inline static functions.
*/
static char *umax2s(uintmax_t x, unsigned base, char *s);
static bool malloc_mutex_init(malloc_mutex_t *mutex);
static bool malloc_spin_init(malloc_spinlock_t *lock);
@@ -1536,62 +1509,16 @@ pow2_ceil(size_t x)
x |= x >> 16;
#if (SIZEOF_PTR == 8)
x |= x >> 32;
#endif
x++;
return (x);
}
-#ifdef MALLOC_UTRACE
-static int
-utrace(const void *addr, size_t len)
-{
- malloc_utrace_t *ut = (malloc_utrace_t *)addr;
- char buf_a[UMAX2S_BUFSIZE];
- char buf_b[UMAX2S_BUFSIZE];
-
- assert(len == sizeof(malloc_utrace_t));
-
- if (ut->p == NULL && ut->s == 0 && ut->r == NULL) {
- _malloc_message(
- umax2s(getpid(), 10, buf_a),
- " x USER malloc_init()\n", "", "");
- } else if (ut->p == NULL && ut->r != NULL) {
- _malloc_message(
- umax2s(getpid(), 10, buf_a),
- " x USER 0x",
- umax2s((uintptr_t)ut->r, 16, buf_b),
- " = malloc(");
- _malloc_message(
- umax2s(ut->s, 10, buf_a),
- ")\n", "", "");
- } else if (ut->p != NULL && ut->r != NULL) {
- _malloc_message(
- umax2s(getpid(), 10, buf_a),
- " x USER 0x",
- umax2s((uintptr_t)ut->r, 16, buf_b),
- " = realloc(0x");
- _malloc_message(
- umax2s((uintptr_t)ut->p, 16, buf_a),
- ", ",
- umax2s(ut->s, 10, buf_b),
- ")\n");
- } else {
- _malloc_message(
- umax2s(getpid(), 10, buf_a),
- " x USER free(0x",
- umax2s((uintptr_t)ut->p, 16, buf_b),
- ")\n");
- }
-
- return (0);
-}
-#endif
-
static inline const char *
_getprogname(void)
{
return ("<jemalloc>");
}
#ifdef MALLOC_STATS
@@ -4797,19 +4724,16 @@ malloc_print_stats(void)
"\n", "");
_malloc_message("Boolean MALLOC_OPTIONS: ",
opt_abort ? "A" : "a", "", "");
#ifdef MALLOC_FILL
_malloc_message(opt_poison ? "C" : "c", "", "", "");
_malloc_message(opt_junk ? "J" : "j", "", "", "");
#endif
_malloc_message("P", "", "", "");
-#ifdef MALLOC_UTRACE
- _malloc_message(opt_utrace ? "U" : "u", "", "", "");
-#endif
#ifdef MALLOC_SYSV
_malloc_message(opt_sysv ? "V" : "v", "", "", "");
#endif
#ifdef MALLOC_XMALLOC
_malloc_message(opt_xmalloc ? "X" : "x", "", "", "");
#endif
#ifdef MALLOC_FILL
_malloc_message(opt_zero ? "Z" : "z", "", "", "");
@@ -5142,24 +5066,16 @@ MALLOC_OUT:
opt_small_max_2pow--;
break;
case 'S':
if (opt_small_max_2pow < pagesize_2pow
- 1)
opt_small_max_2pow++;
break;
#endif
-#ifdef MALLOC_UTRACE
- case 'u':
- opt_utrace = false;
- break;
- case 'U':
- opt_utrace = true;
- break;
-#endif
#ifdef MALLOC_SYSV
case 'v':
opt_sysv = false;
break;
case 'V':
opt_sysv = true;
break;
#endif
@@ -5244,18 +5160,16 @@ MALLOC_OUT:
/*
* When using MAP_ALIGN, the alignment parameter must be a power of two
* multiple of the system pagesize, or mmap will fail.
*/
assert((chunksize % pagesize) == 0);
assert((1 << (ffs(chunksize / pagesize) - 1)) == (chunksize/pagesize));
#endif
- UTRACE(0, 0, 0);
-
/* Various sanity checks that regard configuration. */
assert(quantum >= sizeof(void *));
assert(quantum <= pagesize);
assert(chunksize >= pagesize);
assert(quantum * 4 <= chunksize);
/* Initialize chunks data. */
malloc_mutex_init(&chunks_mtx);
@@ -5385,17 +5299,16 @@ RETURN:
": (malloc) Error in malloc(): out of memory\n", "",
"");
abort();
}
#endif
errno = ENOMEM;
}
- UTRACE(0, size, ret);
return (ret);
}
/*
* In ELF systems the default visibility allows symbols to be preempted at
* runtime. This in turn prevents the uses of memalign in this file from being
* optimized. What we do in here is define two aliasing symbols (they point to
* the same code): memalign and memalign_internal. The internal version has
@@ -5465,17 +5378,16 @@ MEMALIGN(size_t alignment, size_t size)
RETURN:
#ifdef MALLOC_XMALLOC
if (opt_xmalloc && ret == NULL) {
_malloc_message(_getprogname(),
": (malloc) Error in memalign(): out of memory\n", "", "");
abort();
}
#endif
- UTRACE(0, size, ret);
return (ret);
}
#ifdef MOZ_MEMORY_ELF
extern void *
memalign_impl(size_t alignment, size_t size) __attribute__((alias ("memalign_internal"), visibility ("default")));
#endif
@@ -5577,17 +5489,16 @@ RETURN:
": (malloc) Error in calloc(): out of memory\n", "",
"");
abort();
}
#endif
errno = ENOMEM;
}
- UTRACE(0, num_size, ret);
return (ret);
}
MOZ_MEMORY_API void *
realloc_impl(void *ptr, size_t size)
{
void *ret;
@@ -5639,27 +5550,24 @@ realloc_impl(void *ptr, size_t size)
#endif
errno = ENOMEM;
}
}
#ifdef MALLOC_SYSV
RETURN:
#endif
- UTRACE(ptr, size, ret);
return (ret);
}
MOZ_MEMORY_API void
free_impl(void *ptr)
{
size_t offset;
- UTRACE(ptr, 0, 0);
-
/*
* A version of idalloc that checks for NULL pointer but only for
* huge allocations assuming that CHUNK_ADDR2OFFSET(NULL) == 0.
*/
assert(CHUNK_ADDR2OFFSET(NULL) == 0);
offset = CHUNK_ADDR2OFFSET(ptr);
if (offset != 0)
arena_dalloc(ptr, offset);
@@ -5737,21 +5645,16 @@ jemalloc_stats_impl(jemalloc_stats_t *st
opt_junk ? true :
#endif
false;
stats->opt_poison =
#ifdef MALLOC_FILL
opt_poison ? true :
#endif
false;
- stats->opt_utrace =
-#ifdef MALLOC_UTRACE
- opt_utrace ? true :
-#endif
- false;
stats->opt_sysv =
#ifdef MALLOC_SYSV
opt_sysv ? true :
#endif
false;
stats->opt_xmalloc =
#ifdef MALLOC_XMALLOC
opt_xmalloc ? true :