author | Mike Hommey <mh+mozilla@glandium.org> |
Sat, 31 Mar 2012 09:23:19 +0200 | |
changeset 90774 | c2a9fb6260384b17046911ddc5cafef4a23b2256 |
parent 90773 | 5b524a2b9ec195b43aae1185642af73f25fbc540 |
child 90775 | 82c315c0bd1446798b74edc9a7be7b695a14de1e |
push id | 22382 |
push user | bmo@edmorley.co.uk |
push date | Sat, 31 Mar 2012 21:44:34 +0000 |
treeherder | mozilla-central@bbe5086163c9 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | jlebar, ted |
bugs | 736963 |
milestone | 14.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/Makefile.in +++ b/Makefile.in @@ -75,16 +75,17 @@ endif ifeq (gonk,$(MOZ_WIDGET_TOOLKIT)) tier_base_dirs += \ other-licenses/android \ $(NULL) endif ifdef MOZ_MEMORY tier_base_dirs += memory/jemalloc +tier_base_dirs += memory/build endif tier_base_dirs += \ mozglue \ memory/mozalloc \ $(NULL) endif ifdef COMPILE_ENVIRONMENT
--- a/allmakefiles.sh +++ b/allmakefiles.sh @@ -83,16 +83,17 @@ if [ ! "$LIBXUL_SDK" ]; then add_makefiles " memory/mozalloc/Makefile mozglue/Makefile mozglue/build/Makefile " if [ "$MOZ_MEMORY" ]; then add_makefiles " memory/jemalloc/Makefile + memory/build/Makefile " fi if [ "$MOZ_WIDGET_TOOLKIT" = "android" ]; then add_makefiles " other-licenses/android/Makefile other-licenses/skia-npapi/Makefile mozglue/android/Makefile "
new file mode 100644 --- /dev/null +++ b/memory/build/Makefile.in @@ -0,0 +1,19 @@ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this file, +# You can obtain one at http://mozilla.org/MPL/2.0/. + +DEPTH = ../.. +topsrcdir = @top_srcdir@ +srcdir = @srcdir@ +VPATH = @srcdir@ + +include $(DEPTH)/config/autoconf.mk + +MODULE = memory +LIBRARY_NAME = memory +FORCE_STATIC_LIB = 1 +STLFLAGS = + +CSRCS = extraMallocFuncs.c + +include $(topsrcdir)/config/rules.mk
new file mode 100644 --- /dev/null +++ b/memory/build/extraMallocFuncs.c @@ -0,0 +1,34 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include <string.h> +#include "mozilla/Types.h" + +#ifdef ANDROID +#define wrap(a) __wrap_ ## a +#endif + +#if defined(XP_WIN) || defined(XP_MACOSX) +#define wrap(a) je_ ## a +#endif + +#ifdef wrap +void *wrap(malloc)(size_t); + +MOZ_EXPORT_API(char *) +wrap(strndup)(const char *src, size_t len) +{ + char* dst = (char*) wrap(malloc)(len + 1); + if (dst) + strncpy(dst, src, len + 1); + return dst; +} + +MOZ_EXPORT_API(char *) +wrap(strdup)(const char *src) +{ + size_t len = strlen(src); + return wrap(strndup)(src, len); +} +#endif
--- a/memory/jemalloc/jemalloc.c +++ b/memory/jemalloc/jemalloc.c @@ -6211,32 +6211,16 @@ malloc_shutdown() #define malloc(a) wrap(malloc)(a) #define memalign(a, b) wrap(memalign)(a, b) #define posix_memalign(a, b, c) wrap(posix_memalign)(a, b, c) #define valloc(a) wrap(valloc)(a) #define calloc(a, b) wrap(calloc)(a, b) #define realloc(a, b) wrap(realloc)(a, b) #define free(a) wrap(free)(a) #define malloc_usable_size(a) wrap(malloc_usable_size)(a) - -void *malloc(size_t size); - -char * -wrap(strndup)(const char *src, size_t len) { - char* dst = (char*) malloc(len + 1); - if (dst) - strncpy(dst, src, len + 1); - return dst; -} - -char * -wrap(strdup)(const char *src) { - size_t len = strlen(src); - return wrap(strndup)(src, len); -} #endif /* * Even though we compile with MOZ_MEMORY, we may have to dynamically decide * not to use jemalloc, as discussed above. However, we call jemalloc * functions directly from mozalloc. Since it's pretty dangerous to mix the * allocators, we need to call the OSX allocators from the functions below, * when osx_use_jemalloc is not (dynamically) set.
--- a/mozglue/build/Makefile.in +++ b/mozglue/build/Makefile.in @@ -43,17 +43,18 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk MODULE = mozglue LIBRARY_NAME = mozglue DIST_INSTALL = 1 ifdef MOZ_MEMORY -SHARED_LIBRARY_LIBS = $(call EXPAND_LIBNAME_PATH,jemalloc,$(DEPTH)/memory/jemalloc) +SHARED_LIBRARY_LIBS = $(call EXPAND_LIBNAME_PATH,memory,$(DEPTH)/memory/build) +SHARED_LIBRARY_LIBS += $(call EXPAND_LIBNAME_PATH,jemalloc,$(DEPTH)/memory/jemalloc) else # Temporary, until bug 662814 lands VISIBILITY_FLAGS = CPPSRCS = dummy.cpp endif # Build mozglue as a shared lib on Windows, OSX and Android. # If this is ever changed, update MOZ_SHARED_MOZGLUE in browser/installer/Makefile.in