зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1365194 - Call moz_abort directly instead of using a macro to override abort. r=njn
Using -Dabort=moz_abort actually makes the build fail in some libstdc++ headers when building as C++. --HG-- extra : rebase_source : 77828d5c42f231372a8e75f5e3cd6af135d1d5e8
This commit is contained in:
Родитель
c530406a95
Коммит
782764a6fd
|
@ -308,6 +308,8 @@ typedef long ssize_t;
|
|||
#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
|
||||
|
@ -1520,7 +1522,7 @@ pages_decommit(void *addr, size_t size)
|
|||
CHUNK_ADDR2OFFSET((uintptr_t)addr));
|
||||
while (size > 0) {
|
||||
if (!VirtualFree(addr, pages_size, MEM_DECOMMIT))
|
||||
abort();
|
||||
moz_abort();
|
||||
addr = (void *)((uintptr_t)addr + pages_size);
|
||||
size -= pages_size;
|
||||
pages_size = min(size, chunksize);
|
||||
|
@ -1528,7 +1530,7 @@ pages_decommit(void *addr, size_t size)
|
|||
#else
|
||||
if (mmap(addr, size, PROT_NONE, MAP_FIXED | MAP_PRIVATE | MAP_ANON, -1,
|
||||
0) == MAP_FAILED)
|
||||
abort();
|
||||
moz_abort();
|
||||
MozTagAnonymousMemory(addr, size, "jemalloc-decommitted");
|
||||
#endif
|
||||
}
|
||||
|
@ -1548,7 +1550,7 @@ pages_commit(void *addr, size_t size)
|
|||
CHUNK_ADDR2OFFSET((uintptr_t)addr));
|
||||
while (size > 0) {
|
||||
if (!VirtualAlloc(addr, pages_size, MEM_COMMIT, PAGE_READWRITE))
|
||||
abort();
|
||||
moz_abort();
|
||||
addr = (void *)((uintptr_t)addr + pages_size);
|
||||
size -= pages_size;
|
||||
pages_size = min(size, chunksize);
|
||||
|
@ -1556,7 +1558,7 @@ pages_commit(void *addr, size_t size)
|
|||
# else
|
||||
if (mmap(addr, size, PROT_READ | PROT_WRITE, MAP_FIXED | MAP_PRIVATE |
|
||||
MAP_ANON, -1, 0) == MAP_FAILED)
|
||||
abort();
|
||||
moz_abort();
|
||||
MozTagAnonymousMemory(addr, size, "jemalloc");
|
||||
# endif
|
||||
}
|
||||
|
@ -1849,7 +1851,7 @@ pages_unmap(void *addr, size_t size)
|
|||
_malloc_message(_getprogname(),
|
||||
": (malloc) Error in VirtualFree()\n", "", "");
|
||||
if (opt_abort)
|
||||
abort();
|
||||
moz_abort();
|
||||
}
|
||||
}
|
||||
#else
|
||||
|
@ -1958,7 +1960,7 @@ pages_map(void *addr, size_t size)
|
|||
": (malloc) Error in munmap(): ", buf, "\n");
|
||||
}
|
||||
if (opt_abort)
|
||||
abort();
|
||||
moz_abort();
|
||||
}
|
||||
ret = NULL;
|
||||
}
|
||||
|
@ -1988,7 +1990,7 @@ pages_unmap(void *addr, size_t size)
|
|||
": (malloc) Error in munmap(): ", buf, "\n");
|
||||
}
|
||||
if (opt_abort)
|
||||
abort();
|
||||
moz_abort();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -4305,7 +4307,7 @@ arenas_fallback()
|
|||
_malloc_message(_getprogname(),
|
||||
": (malloc) Error initializing arena\n", "", "");
|
||||
if (opt_abort)
|
||||
abort();
|
||||
moz_abort();
|
||||
|
||||
return arenas[0];
|
||||
}
|
||||
|
@ -4760,7 +4762,7 @@ malloc_init_hard(void)
|
|||
_malloc_message(_getprogname(),
|
||||
"Compile-time page size does not divide the runtime one.\n",
|
||||
"", "");
|
||||
abort();
|
||||
moz_abort();
|
||||
}
|
||||
#else
|
||||
pagesize = (size_t) result;
|
||||
|
@ -5136,7 +5138,7 @@ RETURN:
|
|||
_malloc_message(_getprogname(),
|
||||
": (malloc) Error in malloc(): out of memory\n", "",
|
||||
"");
|
||||
abort();
|
||||
moz_abort();
|
||||
}
|
||||
#endif
|
||||
errno = ENOMEM;
|
||||
|
@ -5218,7 +5220,7 @@ RETURN:
|
|||
if (opt_xmalloc && ret == NULL) {
|
||||
_malloc_message(_getprogname(),
|
||||
": (malloc) Error in memalign(): out of memory\n", "", "");
|
||||
abort();
|
||||
moz_abort();
|
||||
}
|
||||
#endif
|
||||
return (ret);
|
||||
|
@ -5241,7 +5243,7 @@ posix_memalign_impl(void **memptr, size_t alignment, size_t size)
|
|||
_malloc_message(_getprogname(),
|
||||
": (malloc) Error in posix_memalign(): "
|
||||
"invalid alignment\n", "", "");
|
||||
abort();
|
||||
moz_abort();
|
||||
}
|
||||
#endif
|
||||
return (EINVAL);
|
||||
|
@ -5267,7 +5269,7 @@ aligned_alloc_impl(size_t alignment, size_t size)
|
|||
_malloc_message(_getprogname(),
|
||||
": (malloc) Error in aligned_alloc(): "
|
||||
"size is not multiple of alignment\n", "", "");
|
||||
abort();
|
||||
moz_abort();
|
||||
}
|
||||
#endif
|
||||
return (NULL);
|
||||
|
@ -5326,7 +5328,7 @@ RETURN:
|
|||
_malloc_message(_getprogname(),
|
||||
": (malloc) Error in calloc(): out of memory\n", "",
|
||||
"");
|
||||
abort();
|
||||
moz_abort();
|
||||
}
|
||||
#endif
|
||||
errno = ENOMEM;
|
||||
|
@ -5366,7 +5368,7 @@ realloc_impl(void *ptr, size_t size)
|
|||
_malloc_message(_getprogname(),
|
||||
": (malloc) Error in realloc(): out of "
|
||||
"memory\n", "", "");
|
||||
abort();
|
||||
moz_abort();
|
||||
}
|
||||
#endif
|
||||
errno = ENOMEM;
|
||||
|
@ -5383,7 +5385,7 @@ realloc_impl(void *ptr, size_t size)
|
|||
_malloc_message(_getprogname(),
|
||||
": (malloc) Error in realloc(): out of "
|
||||
"memory\n", "", "");
|
||||
abort();
|
||||
moz_abort();
|
||||
}
|
||||
#endif
|
||||
errno = ENOMEM;
|
||||
|
@ -5836,7 +5838,7 @@ void
|
|||
jemalloc_darwin_init(void)
|
||||
{
|
||||
if (malloc_init_hard())
|
||||
abort();
|
||||
moz_abort();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -23,8 +23,6 @@ if CONFIG['OS_ARCH'] == 'SunOS' and not CONFIG['GNU_CC'] \
|
|||
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 += [
|
||||
|
|
Загрузка…
Ссылка в новой задаче