Backed out changeset 484c5137e19f (bug 1365194) to clean up spidermonkey
authorCarsten "Tomcat" Book <cbook@mozilla.com>
Wed, 17 May 2017 11:44:17 +0200
changeset 358757 6e3ca5b38f7173b214b10de49e58cb01890bf39d
parent 358756 056723013e36b851553dc620c21c3933efc93e5f
child 358758 89f59c12ff7f7e5352d445ef60e4134d06f43370
child 358825 ba98768b0e42d43a1423545b5d913abc553bc5e6
child 358837 da3cf916787847ada469e47db9c4796a29819d22
child 359358 2190c9bfb8db8e16761969b66a0be1854c391e63
push id90373
push usercbook@mozilla.com
push dateWed, 17 May 2017 10:28:10 +0000
treeherdermozilla-inbound@89f59c12ff7f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1365194
milestone55.0a1
backs out484c5137e19f869ba72af620d514f1cd7a891504
first release with
nightly linux32
6e3ca5b38f71 / 55.0a1 / 20170517100341 / files
nightly linux64
6e3ca5b38f71 / 55.0a1 / 20170517100341 / files
nightly mac
6e3ca5b38f71 / 55.0a1 / 20170517030204 / files
nightly win32
6e3ca5b38f71 / 55.0a1 / 20170517030204 / files
nightly win64
6e3ca5b38f71 / 55.0a1 / 20170517030204 / files
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backed out changeset 484c5137e19f (bug 1365194) to clean up spidermonkey
memory/mozjemalloc/jemalloc.c
memory/mozjemalloc/moz.build
--- a/memory/mozjemalloc/jemalloc.c
+++ b/memory/mozjemalloc/jemalloc.c
@@ -303,18 +303,16 @@ typedef long ssize_t;
 #endif
 
 #endif
 
 #include "jemalloc_types.h"
 #include "linkedlist.h"
 #include "mozmemory_wrap.h"
 
-extern void moz_abort();
-
 /* Some tools, such as /dev/dsp wrappers, LD_PRELOAD libraries that
  * happen to override mmap() and call dlsym() from their overridden
  * mmap(). The problem is that dlsym() calls malloc(), and this ends
  * up in a dead lock in jemalloc.
  * On these systems, we prefer to directly use the system call.
  * We do that for Linux systems and kfreebsd with GNU userland.
  * Note sanity checks are not done (alignment of offset, ...) because
  * the uses of mmap are pretty limited, in jemalloc.
@@ -1517,25 +1515,25 @@ pages_decommit(void *addr, size_t size)
 	* to VirtualAlloc and recycled, so decommitting the entire region in one
 	* go may not be valid. However, since we allocate at least a chunk at a
 	* time, we may touch any region in chunksized increments.
 	*/
 	size_t pages_size = min(size, chunksize -
 		CHUNK_ADDR2OFFSET((uintptr_t)addr));
 	while (size > 0) {
 		if (!VirtualFree(addr, pages_size, MEM_DECOMMIT))
-			moz_abort();
+			abort();
 		addr = (void *)((uintptr_t)addr + pages_size);
 		size -= pages_size;
 		pages_size = min(size, chunksize);
 	}
 #else
 	if (mmap(addr, size, PROT_NONE, MAP_FIXED | MAP_PRIVATE | MAP_ANON, -1,
 	    0) == MAP_FAILED)
-		moz_abort();
+		abort();
 	MozTagAnonymousMemory(addr, size, "jemalloc-decommitted");
 #endif
 }
 
 static inline void
 pages_commit(void *addr, size_t size)
 {
 
@@ -1545,25 +1543,25 @@ pages_commit(void *addr, size_t size)
 	* to VirtualAlloc and recycled, so committing the entire region in one
 	* go may not be valid. However, since we allocate at least a chunk at a
 	* time, we may touch any region in chunksized increments.
 	*/
 	size_t pages_size = min(size, chunksize -
 		CHUNK_ADDR2OFFSET((uintptr_t)addr));
 	while (size > 0) {
 		if (!VirtualAlloc(addr, pages_size, MEM_COMMIT, PAGE_READWRITE))
-			moz_abort();
+			abort();
 		addr = (void *)((uintptr_t)addr + pages_size);
 		size -= pages_size;
 		pages_size = min(size, chunksize);
 	}
 #  else
 	if (mmap(addr, size, PROT_READ | PROT_WRITE, MAP_FIXED | MAP_PRIVATE |
 	    MAP_ANON, -1, 0) == MAP_FAILED)
-		moz_abort();
+		abort();
 	MozTagAnonymousMemory(addr, size, "jemalloc");
 #  endif
 }
 
 static bool
 base_pages_alloc(size_t minsize)
 {
 	size_t csize;
@@ -1846,17 +1844,17 @@ pages_map(void *addr, size_t size)
 
 static void
 pages_unmap(void *addr, size_t size)
 {
 	if (VirtualFree(addr, 0, MEM_RELEASE) == 0) {
 		_malloc_message(_getprogname(),
 		    ": (malloc) Error in VirtualFree()\n", "", "");
 		if (opt_abort)
-			moz_abort();
+			abort();
 	}
 }
 #else
 #ifdef JEMALLOC_USES_MAP_ALIGN
 static void *
 pages_map_align(size_t size, size_t alignment)
 {
 	void *ret;
@@ -1955,17 +1953,17 @@ pages_map(void *addr, size_t size)
 		if (munmap(ret, size) == -1) {
 			char buf[STRERROR_BUF];
 
 			if (strerror_r(errno, buf, sizeof(buf)) == 0) {
 				_malloc_message(_getprogname(),
 					": (malloc) Error in munmap(): ", buf, "\n");
 			}
 			if (opt_abort)
-				moz_abort();
+				abort();
 		}
 		ret = NULL;
 	}
 	if (ret != NULL) {
 		MozTagAnonymousMemory(ret, size, "jemalloc");
 	}
 
 #if defined(__ia64__) || (defined(__sparc__) && defined(__arch64__) && defined(__linux__))
@@ -1985,17 +1983,17 @@ pages_unmap(void *addr, size_t size)
 	if (munmap(addr, size) == -1) {
 		char buf[STRERROR_BUF];
 
 		if (strerror_r(errno, buf, sizeof(buf)) == 0) {
 			_malloc_message(_getprogname(),
 				": (malloc) Error in munmap(): ", buf, "\n");
 		}
 		if (opt_abort)
-			moz_abort();
+			abort();
 	}
 }
 #endif
 
 #ifdef MOZ_MEMORY_DARWIN
 #define	VM_COPY_MIN (pagesize << 5)
 static inline void
 pages_copy(void *dest, const void *src, size_t n)
@@ -4302,17 +4300,17 @@ arenas_fallback()
 	 * OOM here is quite inconvenient to propagate, since dealing with it
 	 * would require a check for failure in the fast path.  Instead, punt
 	 * by using arenas[0].
 	 * In practice, this is an extremely unlikely failure.
 	 */
 	_malloc_message(_getprogname(),
 	    ": (malloc) Error initializing arena\n", "", "");
 	if (opt_abort)
-		moz_abort();
+		abort();
 
 	return arenas[0];
 }
 
 /* Create a new arena and return it. */
 static arena_t *
 arenas_extend()
 {
@@ -4757,17 +4755,17 @@ malloc_init_hard(void)
 
 	/* We assume that the page size is a power of 2. */
 	assert(((result - 1) & result) == 0);
 #ifdef MALLOC_STATIC_SIZES
 	if (pagesize % (size_t) result) {
 		_malloc_message(_getprogname(),
 				"Compile-time page size does not divide the runtime one.\n",
 				"", "");
-		moz_abort();
+		abort();
 	}
 #else
 	pagesize = (size_t) result;
 	pagesize_mask = (size_t) result - 1;
 	pagesize_2pow = ffs((int)result) - 1;
 #endif
 
 	for (i = 0; i < 3; i++) {
@@ -5133,17 +5131,17 @@ malloc_impl(size_t size)
 
 RETURN:
 	if (ret == NULL) {
 #ifdef MALLOC_XMALLOC
 		if (opt_xmalloc) {
 			_malloc_message(_getprogname(),
 			    ": (malloc) Error in malloc(): out of memory\n", "",
 			    "");
-			moz_abort();
+			abort();
 		}
 #endif
 		errno = ENOMEM;
 	}
 
 	return (ret);
 }
 
@@ -5215,17 +5213,17 @@ MEMALIGN(size_t alignment, size_t size)
 	alignment = alignment < sizeof(void*) ? sizeof(void*) : alignment;
 	ret = ipalloc(alignment, size);
 
 RETURN:
 #ifdef MALLOC_XMALLOC
 	if (opt_xmalloc && ret == NULL) {
 		_malloc_message(_getprogname(),
 		": (malloc) Error in memalign(): out of memory\n", "", "");
-		moz_abort();
+		abort();
 	}
 #endif
 	return (ret);
 }
 
 #ifdef MOZ_MEMORY_ELF
 extern void *
 memalign_impl(size_t alignment, size_t size) __attribute__((alias ("memalign_internal"), visibility ("default")));
@@ -5238,17 +5236,17 @@ posix_memalign_impl(void **memptr, size_
 
 	/* Make sure that alignment is a large enough power of 2. */
 	if (((alignment - 1) & alignment) != 0 || alignment < sizeof(void *)) {
 #ifdef MALLOC_XMALLOC
 		if (opt_xmalloc) {
 			_malloc_message(_getprogname(),
 			    ": (malloc) Error in posix_memalign(): "
 			    "invalid alignment\n", "", "");
-			moz_abort();
+			abort();
 		}
 #endif
 		return (EINVAL);
 	}
 
 	/* The 0-->1 size promotion is done in the memalign() call below */
 
 	result = MEMALIGN(alignment, size);
@@ -5264,17 +5262,17 @@ MOZ_MEMORY_API void *
 aligned_alloc_impl(size_t alignment, size_t size)
 {
 	if (size % alignment) {
 #ifdef MALLOC_XMALLOC
 		if (opt_xmalloc) {
 			_malloc_message(_getprogname(),
 			    ": (malloc) Error in aligned_alloc(): "
 			    "size is not multiple of alignment\n", "", "");
-			moz_abort();
+			abort();
 		}
 #endif
 		return (NULL);
 	}
 	return MEMALIGN(alignment, size);
 }
 
 MOZ_MEMORY_API void *
@@ -5323,17 +5321,17 @@ calloc_impl(size_t num, size_t size)
 
 RETURN:
 	if (ret == NULL) {
 #ifdef MALLOC_XMALLOC
 		if (opt_xmalloc) {
 			_malloc_message(_getprogname(),
 			    ": (malloc) Error in calloc(): out of memory\n", "",
 			    "");
-			moz_abort();
+			abort();
 		}
 #endif
 		errno = ENOMEM;
 	}
 
 	return (ret);
 }
 
@@ -5363,34 +5361,34 @@ realloc_impl(void *ptr, size_t size)
 		ret = iralloc(ptr, size);
 
 		if (ret == NULL) {
 #ifdef MALLOC_XMALLOC
 			if (opt_xmalloc) {
 				_malloc_message(_getprogname(),
 				    ": (malloc) Error in realloc(): out of "
 				    "memory\n", "", "");
-				moz_abort();
+				abort();
 			}
 #endif
 			errno = ENOMEM;
 		}
 	} else {
 		if (malloc_init())
 			ret = NULL;
 		else
 			ret = imalloc(size);
 
 		if (ret == NULL) {
 #ifdef MALLOC_XMALLOC
 			if (opt_xmalloc) {
 				_malloc_message(_getprogname(),
 				    ": (malloc) Error in realloc(): out of "
 				    "memory\n", "", "");
-				moz_abort();
+				abort();
 			}
 #endif
 			errno = ENOMEM;
 		}
 	}
 
 #ifdef MALLOC_SYSV
 RETURN:
@@ -5833,17 +5831,17 @@ void
 
 #if defined(MOZ_MEMORY_DARWIN)
 
 __attribute__((constructor))
 void
 jemalloc_darwin_init(void)
 {
 	if (malloc_init_hard())
-		moz_abort();
+		abort();
 }
 
 #endif
 
 /*
  * is_malloc(malloc_impl) is some macro magic to detect if malloc_impl is
  * defined as "malloc" in mozmemory_wrap.h
  */
--- a/memory/mozjemalloc/moz.build
+++ b/memory/mozjemalloc/moz.build
@@ -18,16 +18,18 @@ if CONFIG['OS_ARCH'] == 'SunOS' and not 
         and CONFIG['MOZ_OPTIMIZE']:
     CFLAGS += ['-xO5']
 
 # For non release/esr builds, enable (some) fatal jemalloc assertions.  This
 # helps us catch memory errors.
 if CONFIG['MOZ_UPDATE_CHANNEL'] not in ('release', 'esr'):
     DEFINES['MOZ_JEMALLOC_HARD_ASSERTS'] = True
 
+DEFINES['abort'] = 'moz_abort'
+
 DEFINES['MOZ_JEMALLOC_IMPL'] = True
 
 LOCAL_INCLUDES += [
     '/memory/build',
 ]
 
 if CONFIG['GNU_CC']:
     CFLAGS += ['-Wno-unused'] # too many annoying warnings from mfbt/ headers