Bug 1365460 - Remove runtime support for SysV malloc semantics. r=njn

Support for them was only enabled on debug builds, and required an
opt-in through e.g. MALLOC_OPTIONS to actually enable at runtime.

--HG--
extra : rebase_source : 60c27585c2901a73eb790cec124b880c93da6ef7
This commit is contained in:
Mike Hommey 2017-05-18 10:28:28 +09:00
parent 92ba43731c
commit c6aa8aa7c7
2 changed files with 4 additions and 68 deletions

View File

@ -135,9 +135,6 @@
#ifdef MOZ_DEBUG
/* Support optional abort() on OOM. */
# define MALLOC_XMALLOC
/* Support SYSV semantics. */
# define MALLOC_SYSV
#endif
#include <sys/types.h>
@ -1071,9 +1068,6 @@ 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_SYSV
static bool opt_sysv = false;
#endif
#ifdef MALLOC_XMALLOC
static bool opt_xmalloc = false;
#endif
@ -4544,9 +4538,6 @@ malloc_print_stats(void)
opt_abort ? "A" : "a", "", "");
_malloc_message(opt_junk ? "J" : "j", "", "", "");
_malloc_message("P", "", "", "");
#ifdef MALLOC_SYSV
_malloc_message(opt_sysv ? "V" : "v", "", "", "");
#endif
#ifdef MALLOC_XMALLOC
_malloc_message(opt_xmalloc ? "X" : "x", "", "", "");
#endif
@ -4815,14 +4806,6 @@ MALLOC_OUT:
opt_small_max_2pow++;
break;
#endif
#ifdef MALLOC_SYSV
case 'v':
opt_sysv = false;
break;
case 'V':
opt_sysv = true;
break;
#endif
#ifdef MALLOC_XMALLOC
case 'x':
opt_xmalloc = false;
@ -5009,16 +4992,7 @@ malloc_impl(size_t size)
}
if (size == 0) {
#ifdef MALLOC_SYSV
if (opt_sysv == false)
#endif
size = 1;
#ifdef MALLOC_SYSV
else {
ret = NULL;
goto RETURN;
}
#endif
size = 1;
}
ret = imalloc(size);
@ -5076,16 +5050,7 @@ MEMALIGN(size_t alignment, size_t size)
}
if (size == 0) {
#ifdef MALLOC_SYSV
if (opt_sysv == false)
#endif
size = 1;
#ifdef MALLOC_SYSV
else {
ret = NULL;
goto RETURN;
}
#endif
size = 1;
}
alignment = alignment < sizeof(void*) ? sizeof(void*) : alignment;
@ -5173,16 +5138,7 @@ calloc_impl(size_t num, size_t size)
num_size = num * size;
if (num_size == 0) {
#ifdef MALLOC_SYSV
if ((opt_sysv == false) && ((num == 0) || (size == 0)))
#endif
num_size = 1;
#ifdef MALLOC_SYSV
else {
ret = NULL;
goto RETURN;
}
#endif
num_size = 1;
/*
* Try to avoid division here. We know that it isn't possible to
* overflow during multiplication if neither operand uses any of the
@ -5219,18 +5175,7 @@ realloc_impl(void *ptr, size_t size)
void *ret;
if (size == 0) {
#ifdef MALLOC_SYSV
if (opt_sysv == false)
#endif
size = 1;
#ifdef MALLOC_SYSV
else {
if (ptr != NULL)
idalloc(ptr);
ret = NULL;
goto RETURN;
}
#endif
size = 1;
}
if (ptr != NULL) {
@ -5268,9 +5213,6 @@ realloc_impl(void *ptr, size_t size)
}
}
#ifdef MALLOC_SYSV
RETURN:
#endif
return (ret);
}
@ -5357,11 +5299,6 @@ jemalloc_stats_impl(jemalloc_stats_t *stats)
*/
stats->opt_abort = opt_abort;
stats->opt_junk = opt_junk;
stats->opt_sysv =
#ifdef MALLOC_SYSV
opt_sysv ? true :
#endif
false;
stats->opt_xmalloc =
#ifdef MALLOC_XMALLOC
opt_xmalloc ? true :

View File

@ -56,7 +56,6 @@ typedef struct {
*/
jemalloc_bool opt_abort; /* abort(3) on error? */
jemalloc_bool opt_junk; /* Fill allocated memory with kAllocJunk? */
jemalloc_bool opt_sysv; /* SysV semantics? */
jemalloc_bool opt_xmalloc; /* abort(3) on OOM? */
jemalloc_bool opt_zero; /* Fill allocated memory with 0x0? */
size_t narenas; /* Number of arenas. */