--- a/memory/mozjemalloc/mozjemalloc.cpp
+++ b/memory/mozjemalloc/mozjemalloc.cpp
@@ -130,19 +130,16 @@
*/
#ifdef MOZ_MEMORY_DARWIN
#define MALLOC_DOUBLE_PURGE
#endif
#ifdef MOZ_DEBUG
/* Support optional abort() on OOM. */
# define MALLOC_XMALLOC
-
- /* Support SYSV semantics. */
-# define MALLOC_SYSV
#endif
#include <sys/types.h>
#include <errno.h>
#include <stdlib.h>
#include <limits.h>
#include <stdarg.h>
@@ -1066,19 +1063,16 @@ 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_SYSV
-static bool opt_sysv = false;
-#endif
#ifdef MALLOC_XMALLOC
static bool opt_xmalloc = false;
#endif
/******************************************************************************/
/*
* Begin function prototypes for non-inline static functions.
*/
@@ -4539,19 +4533,16 @@ malloc_print_stats(void)
#else
"enabled",
#endif
"\n", "");
_malloc_message("Boolean MALLOC_OPTIONS: ",
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
_malloc_message(opt_zero ? "Z" : "z", "", "", "");
_malloc_message("\n", "", "", "");
_malloc_message("Max arenas: ", umax2s(narenas, 10, s), "\n",
"");
@@ -4810,24 +4801,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_SYSV
- case 'v':
- opt_sysv = false;
- break;
- case 'V':
- opt_sysv = true;
- break;
-#endif
#ifdef MALLOC_XMALLOC
case 'x':
opt_xmalloc = false;
break;
case 'X':
opt_xmalloc = true;
break;
#endif
@@ -5004,26 +4987,17 @@ malloc_impl(size_t size)
void *ret;
if (malloc_init()) {
ret = NULL;
goto RETURN;
}
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);
RETURN:
if (ret == NULL) {
#ifdef MALLOC_XMALLOC
if (opt_xmalloc) {
@@ -5071,26 +5045,17 @@ MEMALIGN(size_t alignment, size_t size)
assert(((alignment - 1) & alignment) == 0);
if (malloc_init()) {
ret = NULL;
goto RETURN;
}
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;
ret = ipalloc(alignment, size);
RETURN:
#ifdef MALLOC_XMALLOC
if (opt_xmalloc && ret == NULL) {
@@ -5168,26 +5133,17 @@ calloc_impl(size_t num, size_t size)
if (malloc_init()) {
num_size = 0;
ret = NULL;
goto RETURN;
}
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
* most significant half of the bits in a size_t.
*/
} else if (((num | size) & (SIZE_T_MAX << (sizeof(size_t) << 2)))
&& (num_size / size != num)) {
/* size_t overflow. */
@@ -5214,28 +5170,17 @@ RETURN:
}
MOZ_MEMORY_API void *
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) {
assert(malloc_initialized);
ret = iralloc(ptr, size);
if (ret == NULL) {
@@ -5263,19 +5208,16 @@ realloc_impl(void *ptr, size_t size)
"memory\n", "", "");
moz_abort();
}
#endif
errno = ENOMEM;
}
}
-#ifdef MALLOC_SYSV
-RETURN:
-#endif
return (ret);
}
MOZ_MEMORY_API void
free_impl(void *ptr)
{
size_t offset;
@@ -5352,21 +5294,16 @@ jemalloc_stats_impl(jemalloc_stats_t *st
assert(stats != NULL);
/*
* Gather runtime settings.
*/
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 :
#endif
false;
stats->opt_zero = opt_zero;
stats->narenas = narenas;
stats->quantum = quantum;