Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 2 Oct 2012 07:39:39 GMT
From:      svn-freebsd-gecko@chruetertee.ch
To:        freebsd-gecko@freebsd.org
Subject:   [SVN-Commit] r1051 - in trunk: mail/thunderbird/files www/firefox-nightly/files www/firefox/files www/seamonkey/files
Message-ID:  <201210020739.q927ddKA097088@trillian.chruetertee.ch>

next in thread | raw e-mail | index | archive | help
Author: jbeich
Date: Tue Oct  2 07:39:39 2012
New Revision: 1051

Log:
sync with bug 788955

Modified:
   trunk/mail/thunderbird/files/patch-bug788955
   trunk/www/firefox-nightly/files/patch-bug788955
   trunk/www/firefox/files/patch-bug788955
   trunk/www/seamonkey/files/patch-bug788955

Modified: trunk/mail/thunderbird/files/patch-bug788955
==============================================================================
--- trunk/mail/thunderbird/files/patch-bug788955	Mon Oct  1 10:34:07 2012	(r1050)
+++ trunk/mail/thunderbird/files/patch-bug788955	Tue Oct  2 07:39:39 2012	(r1051)
@@ -14,7 +14,7 @@
  endif
  ifndef MOZ_NATIVE_ZLIB
 diff --git allmakefiles.sh allmakefiles.sh
-index 6a9be4b..544beff 100755
+index 6a9be4b..d2e49e3 100755
 --- mozilla/allmakefiles.sh
 +++ mozilla/allmakefiles.sh
 @@ -59,7 +59,7 @@ if [ ! "$LIBXUL_SDK" ]; then
@@ -22,7 +22,7 @@
      mozglue/build/Makefile
    "
 -  if [ "$MOZ_JEMALLOC" ]; then
-+  if [ "$MOZ_JEMALLOC" -a ! "$MOZ_NATIVE_JEMALLOC" ]; then
++  if [ "$MOZ_JEMALLOC" -a -z "$MOZ_NATIVE_JEMALLOC" ]; then
      add_makefiles "
        memory/jemalloc/Makefile
      "
@@ -37,10 +37,10 @@
  MOZ_ENABLE_PROFILER_SPS = @MOZ_ENABLE_PROFILER_SPS@
  MOZ_JPROF       = @MOZ_JPROF@
 diff --git configure.in configure.in
-index cfcdbc0..ee9a299 100644
+index bb05782..2f32516 100644
 --- mozilla/configure.in
 +++ mozilla/configure.in
-@@ -3730,21 +3730,22 @@ fi
+@@ -3711,21 +3711,22 @@ fi
  
  dnl Check for the existence of various allocation headers/functions
  
@@ -72,7 +72,7 @@
  dnl See if compiler supports some gcc-style attributes
  
  AC_CACHE_CHECK(for __attribute__((always_inline)),
-@@ -6960,6 +6961,18 @@ else
+@@ -6939,6 +6940,18 @@ else
  fi
  
  if test -z "$MOZ_MEMORY"; then
@@ -91,7 +91,7 @@
    case "${target}" in
      *-mingw*)
        if test -z "$WIN32_REDIST_DIR" -a -z "$MOZ_DEBUG"; then
-@@ -7054,6 +7067,7 @@ else
+@@ -7033,6 +7046,7 @@ else
  fi # MOZ_MEMORY
  AC_SUBST(MOZ_MEMORY)
  AC_SUBST(MOZ_JEMALLOC)
@@ -99,7 +99,7 @@
  AC_SUBST(MOZ_GLUE_LDFLAGS)
  AC_SUBST(MOZ_GLUE_PROGRAM_LDFLAGS)
  AC_SUBST(WIN32_CRT_LIBS)
-@@ -8819,10 +8833,27 @@ fi
+@@ -8820,10 +8834,22 @@ fi
  
  # Run jemalloc configure script
  
@@ -109,63 +109,22 @@
 -  if test "$OS_ARCH" = "Linux"; then
 -    MANGLE="malloc calloc valloc free realloc memalign posix_memalign malloc_usable_size"
 +  case "$OS_ARCH" in
-+    Linux)
-+      MANGLE="malloc calloc valloc free realloc memalign posix_memalign malloc_usable_size"
-+      ;;
-+    DragonFly|NetBSD|OpenBSD)
++    Linux|DragonFly|FreeBSD|NetBSD|OpenBSD)
 +      MANGLE="malloc calloc valloc free realloc posix_memalign"
-+      ;;
-+    FreeBSD)
-+      # common
-+      MANGLE="malloc calloc valloc free realloc posix_memalign malloc_usable_size"
-+      # old jemalloc
-+      MANGLE="$MANGLE reallocf _malloc_message _malloc_options"
-+      # jemalloc 3.0.0
-+      MANGLE="$MANGLE aligned_alloc malloc_message malloc_conf"
-+      MANGLE="$MANGLE malloc_stats_print mallctl mallctlnametomib mallctlbymib"
-+      MANGLE="$MANGLE allocm rallocm sallocm dallocm nallocm"
++      case "$OS_ARCH" in
++        Linux)
++          MANGLE="$MANGLE memalign malloc_usable_size"
++          ;;
++        FreeBSD)
++          MANGLE="$MANGLE malloc_usable_size"
++          ;;
++      esac
 +      ;;
 +  esac
 +  if test -n "$MANGLE"; then
      MANGLED=
      JEMALLOC_WRAPPER=
      if test -n "$_WRAP_MALLOC"; then
-diff --git js/src/configure.in js/src/configure.in
-index 846482c..4022506 100644
---- mozilla/js/src/configure.in
-+++ mozilla/js/src/configure.in
-@@ -3094,21 +3094,22 @@ fi
- 
- dnl Check for the existence of various allocation headers/functions
- 
-+MALLOC_HEADERS="malloc.h malloc_np.h malloc/malloc.h sys/malloc.h"
- MALLOC_H=
--MOZ_CHECK_HEADER(malloc.h,        [MALLOC_H=malloc.h])
--if test "$MALLOC_H" = ""; then
--  MOZ_CHECK_HEADER(malloc/malloc.h, [MALLOC_H=malloc/malloc.h])
--  if test "$MALLOC_H" = ""; then
--    MOZ_CHECK_HEADER(sys/malloc.h,    [MALLOC_H=sys/malloc.h])
-+
-+for file in $MALLOC_HEADERS; do
-+  MOZ_CHECK_HEADER($file, [MALLOC_H=$file])
-+  if test "$MALLOC_H" != ""; then
-+    AC_DEFINE_UNQUOTED(MALLOC_H, <$MALLOC_H>)
-+    break
-   fi
--fi
--if test "$MALLOC_H" != ""; then
--   AC_DEFINE_UNQUOTED(MALLOC_H, <$MALLOC_H>)
--fi
-+done
- 
- MOZ_ALLOCATING_FUNCS="strndup posix_memalign memalign valloc"
- AC_CHECK_FUNCS(strndup posix_memalign memalign valloc)
- 
-+AC_CHECK_FUNCS(malloc_usable_size)
-+
- dnl See if compiler supports some gcc-style attributes
- 
- AC_CACHE_CHECK(for __attribute__((always_inline)),
 diff --git memory/build/Makefile.in memory/build/Makefile.in
 index dca0f48..af93ee0 100644
 --- mozilla/memory/build/Makefile.in
@@ -181,51 +140,57 @@
  SHARED_LIBRARY_LIBS += $(call EXPAND_LIBNAME_PATH,jemalloc,$(DEPTH)/memory/mozjemalloc)
  endif
 diff --git memory/build/extraMallocFuncs.c memory/build/extraMallocFuncs.c
-index 9d87629..76a2981 100644
+index 9d87629..03c8320 100644
 --- mozilla/memory/build/extraMallocFuncs.c
 +++ mozilla/memory/build/extraMallocFuncs.c
-@@ -94,7 +94,19 @@ wrap(wcsdup)(const wchar_t *src)
+@@ -94,8 +94,16 @@ wrap(wcsdup)(const wchar_t *src)
  #endif
  
  #ifdef MOZ_JEMALLOC
-+#if defined(MALLOC_H) && defined(MOZ_NATIVE_JEMALLOC)
-+#include MALLOC_H
-+#endif
 +
-+#if defined(MOZ_NATIVE_JEMALLOC) || defined(__FreeBSD__)
-+#define je_malloc_conf malloc_conf
-+#define je_malloc_message malloc_message
++#undef wrap
++#if defined(MOZ_NATIVE_JEMALLOC)
++#define wrap(a) a
++#else
++#define wrap(a) je_ ## a
 +#endif
 +
  /* Override some jemalloc defaults */
-+#if defined(MOZ_NATIVE_JEMALLOC)
-+MOZ_EXTERNAL_VIS
-+#endif
- const char *je_malloc_conf = "narenas:1,lg_chunk:20";
+-const char *je_malloc_conf = "narenas:1,lg_chunk:20";
++MOZ_IMPORT_DATA(const char *) wrap(malloc_conf) = "narenas:1,lg_chunk:20";
  
  #ifdef ANDROID
+ #include <android/log.h>
 diff --git memory/build/mozjemalloc_compat.c memory/build/mozjemalloc_compat.c
-index 10a845a..798c299 100644
+index 10a845a..94ad96e 100644
 --- mozilla/memory/build/mozjemalloc_compat.c
 +++ mozilla/memory/build/mozjemalloc_compat.c
-@@ -5,7 +5,17 @@
+@@ -5,14 +5,21 @@
  #include "mozilla/Types.h"
  #include "jemalloc_types.h"
  
-+#if defined(MALLOC_H) && defined(MOZ_NATIVE_JEMALLOC)
-+#include MALLOC_H
-+#endif
-+
-+#if defined(MOZ_NATIVE_JEMALLOC) || defined(__FreeBSD__)
-+#define je_mallctl mallctl
-+#endif
-+
-+#if !defined(MOZ_NATIVE_JEMALLOC)
- extern int je_mallctl(const char*, void*, size_t*, void*, size_t);
+-extern int je_mallctl(const char*, void*, size_t*, void*, size_t);
++#if defined(MOZ_NATIVE_JEMALLOC)
++#define wrap(a) a
++#else
++#define wrap(a) je_ ## a
 +#endif
  
- MOZ_EXPORT_API (void)
+-MOZ_EXPORT_API (void)
++extern MOZ_IMPORT_API(int)
++wrap(mallctl)(const char*, void*, size_t*, void*, size_t);
++
++MOZ_EXPORT_API(void)
  jemalloc_stats(jemalloc_stats_t *stats)
+ {
+   size_t size = sizeof(stats->mapped);
+-  je_mallctl("stats.mapped", &stats->mapped, &size, NULL, 0);
+-  je_mallctl("stats.allocated", &stats->allocated, &size, NULL, 0);
++  wrap(mallctl)("stats.mapped", &stats->mapped, &size, NULL, 0);
++  wrap(mallctl)("stats.allocated", &stats->allocated, &size, NULL, 0);
+   stats->committed = -1;
+   stats->dirty = -1;
+ }
 diff --git memory/jemalloc/src/src/mutex.c memory/jemalloc/src/src/mutex.c
 index 37a843e..55e18c2 100644
 --- mozilla/memory/jemalloc/src/src/mutex.c
@@ -272,23 +237,17 @@
  #elif defined(XP_WIN)
      return _msize(ptr);
 diff --git memory/mozjemalloc/jemalloc.h memory/mozjemalloc/jemalloc.h
-index f0e0878..e74fb4d 100644
+index f0e0878..2486e83 100644
 --- mozilla/memory/mozjemalloc/jemalloc.h
 +++ mozilla/memory/mozjemalloc/jemalloc.h
-@@ -32,23 +32,29 @@
- #ifndef _JEMALLOC_H_
- #define _JEMALLOC_H_
- 
--#if defined(MOZ_MEMORY_DARWIN)
--#include <malloc/malloc.h>
-+#if defined(MALLOC_H) \
-+  && (defined(MOZ_NATIVE_JEMALLOC) || defined(MOZ_MEMORY_DARWIN))
-+#include MALLOC_H
+@@ -37,22 +37,29 @@
  #endif
  #include "jemalloc_types.h"
  
-+#if defined(MOZ_NATIVE_JEMALLOC) || defined(__FreeBSD__)
-+#define je_nallocm nallocm
++#if defined(MOZ_NATIVE_JEMALLOC)
++#define wrap(a) a
++#else
++#define wrap(a) je_ ## a
 +#endif
 +
  #ifdef __cplusplus
@@ -303,13 +262,38 @@
  void	jemalloc_stats(jemalloc_stats_t *stats);
  
  /* Computes the usable size in advance. */
--#if !defined(MOZ_MEMORY_DARWIN)
+ #if !defined(MOZ_MEMORY_DARWIN)
 -#if defined(MOZ_MEMORY_LINUX)
-+#if !defined(MOZ_NATIVE_JEMALLOC) && !defined(MOZ_MEMORY_DARWIN)
 +#if defined(MOZ_MEMORY_LINUX) || defined(MOZ_MEMORY_BSD)
  __attribute__((weak))
  #endif
  #if defined(MOZ_JEMALLOC)
+-int je_nallocm(size_t *rsize, size_t size, int flags);
++MOZ_IMPORT_API(int) wrap(nallocm)(size_t *rsize, size_t size, int flags);
+ #else
+ size_t je_malloc_good_size(size_t size);
+ #endif
+@@ -62,11 +69,11 @@ static inline size_t je_malloc_usable_size_in_advance(size_t size) {
+ #if defined(MOZ_MEMORY_DARWIN)
+   return malloc_good_size(size);
+ #elif defined(MOZ_JEMALLOC)
+-  if (je_nallocm) {
++  if (wrap(nallocm)) {
+     size_t ret;
+     if (size == 0)
+       size = 1;
+-    if (!je_nallocm(&ret, size, 0))
++    if (!wrap(nallocm)(&ret, size, 0))
+       return ret;
+   }
+   return size;
+@@ -113,4 +120,6 @@ void    jemalloc_purge_freed_pages();
+ } /* extern "C" */
+ #endif
+ 
++#undef wrap
++
+ #endif /* _JEMALLOC_H_ */
 diff --git mozglue/build/Makefile.in mozglue/build/Makefile.in
 index c333647..15ba505 100644
 --- mozilla/mozglue/build/Makefile.in

Modified: trunk/www/firefox-nightly/files/patch-bug788955
==============================================================================
--- trunk/www/firefox-nightly/files/patch-bug788955	Mon Oct  1 10:34:07 2012	(r1050)
+++ trunk/www/firefox-nightly/files/patch-bug788955	Tue Oct  2 07:39:39 2012	(r1051)
@@ -14,7 +14,7 @@
  endif
  ifndef MOZ_NATIVE_ZLIB
 diff --git allmakefiles.sh allmakefiles.sh
-index 6a9be4b..544beff 100755
+index 6a9be4b..d2e49e3 100755
 --- allmakefiles.sh
 +++ allmakefiles.sh
 @@ -59,7 +59,7 @@ if [ ! "$LIBXUL_SDK" ]; then
@@ -22,15 +22,15 @@
      mozglue/build/Makefile
    "
 -  if [ "$MOZ_JEMALLOC" ]; then
-+  if [ "$MOZ_JEMALLOC" -a ! "$MOZ_NATIVE_JEMALLOC" ]; then
++  if [ "$MOZ_JEMALLOC" -a -z "$MOZ_NATIVE_JEMALLOC" ]; then
      add_makefiles "
        memory/jemalloc/Makefile
      "
 diff --git configure.in configure.in
-index cfcdbc0..ee9a299 100644
+index bb05782..2f32516 100644
 --- configure.in
 +++ configure.in
-@@ -3730,21 +3730,22 @@ fi
+@@ -3711,21 +3711,22 @@ fi
  
  dnl Check for the existence of various allocation headers/functions
  
@@ -62,7 +62,7 @@
  dnl See if compiler supports some gcc-style attributes
  
  AC_CACHE_CHECK(for __attribute__((always_inline)),
-@@ -6960,6 +6961,18 @@ else
+@@ -6939,6 +6940,18 @@ else
  fi
  
  if test -z "$MOZ_MEMORY"; then
@@ -81,7 +81,7 @@
    case "${target}" in
      *-mingw*)
        if test -z "$WIN32_REDIST_DIR" -a -z "$MOZ_DEBUG"; then
-@@ -7054,6 +7067,7 @@ else
+@@ -7033,6 +7046,7 @@ else
  fi # MOZ_MEMORY
  AC_SUBST(MOZ_MEMORY)
  AC_SUBST(MOZ_JEMALLOC)
@@ -89,7 +89,7 @@
  AC_SUBST(MOZ_GLUE_LDFLAGS)
  AC_SUBST(MOZ_GLUE_PROGRAM_LDFLAGS)
  AC_SUBST(WIN32_CRT_LIBS)
-@@ -8819,10 +8833,27 @@ fi
+@@ -8820,10 +8834,22 @@ fi
  
  # Run jemalloc configure script
  
@@ -99,63 +99,22 @@
 -  if test "$OS_ARCH" = "Linux"; then
 -    MANGLE="malloc calloc valloc free realloc memalign posix_memalign malloc_usable_size"
 +  case "$OS_ARCH" in
-+    Linux)
-+      MANGLE="malloc calloc valloc free realloc memalign posix_memalign malloc_usable_size"
-+      ;;
-+    DragonFly|NetBSD|OpenBSD)
++    Linux|DragonFly|FreeBSD|NetBSD|OpenBSD)
 +      MANGLE="malloc calloc valloc free realloc posix_memalign"
-+      ;;
-+    FreeBSD)
-+      # common
-+      MANGLE="malloc calloc valloc free realloc posix_memalign malloc_usable_size"
-+      # old jemalloc
-+      MANGLE="$MANGLE reallocf _malloc_message _malloc_options"
-+      # jemalloc 3.0.0
-+      MANGLE="$MANGLE aligned_alloc malloc_message malloc_conf"
-+      MANGLE="$MANGLE malloc_stats_print mallctl mallctlnametomib mallctlbymib"
-+      MANGLE="$MANGLE allocm rallocm sallocm dallocm nallocm"
++      case "$OS_ARCH" in
++        Linux)
++          MANGLE="$MANGLE memalign malloc_usable_size"
++          ;;
++        FreeBSD)
++          MANGLE="$MANGLE malloc_usable_size"
++          ;;
++      esac
 +      ;;
 +  esac
 +  if test -n "$MANGLE"; then
      MANGLED=
      JEMALLOC_WRAPPER=
      if test -n "$_WRAP_MALLOC"; then
-diff --git js/src/configure.in js/src/configure.in
-index 846482c..4022506 100644
---- js/src/configure.in
-+++ js/src/configure.in
-@@ -3094,21 +3094,22 @@ fi
- 
- dnl Check for the existence of various allocation headers/functions
- 
-+MALLOC_HEADERS="malloc.h malloc_np.h malloc/malloc.h sys/malloc.h"
- MALLOC_H=
--MOZ_CHECK_HEADER(malloc.h,        [MALLOC_H=malloc.h])
--if test "$MALLOC_H" = ""; then
--  MOZ_CHECK_HEADER(malloc/malloc.h, [MALLOC_H=malloc/malloc.h])
--  if test "$MALLOC_H" = ""; then
--    MOZ_CHECK_HEADER(sys/malloc.h,    [MALLOC_H=sys/malloc.h])
-+
-+for file in $MALLOC_HEADERS; do
-+  MOZ_CHECK_HEADER($file, [MALLOC_H=$file])
-+  if test "$MALLOC_H" != ""; then
-+    AC_DEFINE_UNQUOTED(MALLOC_H, <$MALLOC_H>)
-+    break
-   fi
--fi
--if test "$MALLOC_H" != ""; then
--   AC_DEFINE_UNQUOTED(MALLOC_H, <$MALLOC_H>)
--fi
-+done
- 
- MOZ_ALLOCATING_FUNCS="strndup posix_memalign memalign valloc"
- AC_CHECK_FUNCS(strndup posix_memalign memalign valloc)
- 
-+AC_CHECK_FUNCS(malloc_usable_size)
-+
- dnl See if compiler supports some gcc-style attributes
- 
- AC_CACHE_CHECK(for __attribute__((always_inline)),
 diff --git memory/build/Makefile.in memory/build/Makefile.in
 index dca0f48..af93ee0 100644
 --- memory/build/Makefile.in
@@ -171,51 +130,57 @@
  SHARED_LIBRARY_LIBS += $(call EXPAND_LIBNAME_PATH,jemalloc,$(DEPTH)/memory/mozjemalloc)
  endif
 diff --git memory/build/extraMallocFuncs.c memory/build/extraMallocFuncs.c
-index 9d87629..76a2981 100644
+index 9d87629..03c8320 100644
 --- memory/build/extraMallocFuncs.c
 +++ memory/build/extraMallocFuncs.c
-@@ -94,7 +94,19 @@ wrap(wcsdup)(const wchar_t *src)
+@@ -94,8 +94,16 @@ wrap(wcsdup)(const wchar_t *src)
  #endif
  
  #ifdef MOZ_JEMALLOC
-+#if defined(MALLOC_H) && defined(MOZ_NATIVE_JEMALLOC)
-+#include MALLOC_H
-+#endif
 +
-+#if defined(MOZ_NATIVE_JEMALLOC) || defined(__FreeBSD__)
-+#define je_malloc_conf malloc_conf
-+#define je_malloc_message malloc_message
++#undef wrap
++#if defined(MOZ_NATIVE_JEMALLOC)
++#define wrap(a) a
++#else
++#define wrap(a) je_ ## a
 +#endif
 +
  /* Override some jemalloc defaults */
-+#if defined(MOZ_NATIVE_JEMALLOC)
-+MOZ_EXTERNAL_VIS
-+#endif
- const char *je_malloc_conf = "narenas:1,lg_chunk:20";
+-const char *je_malloc_conf = "narenas:1,lg_chunk:20";
++MOZ_IMPORT_DATA(const char *) wrap(malloc_conf) = "narenas:1,lg_chunk:20";
  
  #ifdef ANDROID
+ #include <android/log.h>
 diff --git memory/build/mozjemalloc_compat.c memory/build/mozjemalloc_compat.c
-index 10a845a..798c299 100644
+index 10a845a..94ad96e 100644
 --- memory/build/mozjemalloc_compat.c
 +++ memory/build/mozjemalloc_compat.c
-@@ -5,7 +5,17 @@
+@@ -5,14 +5,21 @@
  #include "mozilla/Types.h"
  #include "jemalloc_types.h"
  
-+#if defined(MALLOC_H) && defined(MOZ_NATIVE_JEMALLOC)
-+#include MALLOC_H
-+#endif
-+
-+#if defined(MOZ_NATIVE_JEMALLOC) || defined(__FreeBSD__)
-+#define je_mallctl mallctl
-+#endif
-+
-+#if !defined(MOZ_NATIVE_JEMALLOC)
- extern int je_mallctl(const char*, void*, size_t*, void*, size_t);
+-extern int je_mallctl(const char*, void*, size_t*, void*, size_t);
++#if defined(MOZ_NATIVE_JEMALLOC)
++#define wrap(a) a
++#else
++#define wrap(a) je_ ## a
 +#endif
  
- MOZ_EXPORT_API (void)
+-MOZ_EXPORT_API (void)
++extern MOZ_IMPORT_API(int)
++wrap(mallctl)(const char*, void*, size_t*, void*, size_t);
++
++MOZ_EXPORT_API(void)
  jemalloc_stats(jemalloc_stats_t *stats)
+ {
+   size_t size = sizeof(stats->mapped);
+-  je_mallctl("stats.mapped", &stats->mapped, &size, NULL, 0);
+-  je_mallctl("stats.allocated", &stats->allocated, &size, NULL, 0);
++  wrap(mallctl)("stats.mapped", &stats->mapped, &size, NULL, 0);
++  wrap(mallctl)("stats.allocated", &stats->allocated, &size, NULL, 0);
+   stats->committed = -1;
+   stats->dirty = -1;
+ }
 diff --git memory/jemalloc/src/src/mutex.c memory/jemalloc/src/src/mutex.c
 index 37a843e..55e18c2 100644
 --- memory/jemalloc/src/src/mutex.c
@@ -262,23 +227,17 @@
  #elif defined(XP_WIN)
      return _msize(ptr);
 diff --git memory/mozjemalloc/jemalloc.h memory/mozjemalloc/jemalloc.h
-index f0e0878..e74fb4d 100644
+index f0e0878..2486e83 100644
 --- memory/mozjemalloc/jemalloc.h
 +++ memory/mozjemalloc/jemalloc.h
-@@ -32,23 +32,29 @@
- #ifndef _JEMALLOC_H_
- #define _JEMALLOC_H_
- 
--#if defined(MOZ_MEMORY_DARWIN)
--#include <malloc/malloc.h>
-+#if defined(MALLOC_H) \
-+  && (defined(MOZ_NATIVE_JEMALLOC) || defined(MOZ_MEMORY_DARWIN))
-+#include MALLOC_H
+@@ -37,22 +37,29 @@
  #endif
  #include "jemalloc_types.h"
  
-+#if defined(MOZ_NATIVE_JEMALLOC) || defined(__FreeBSD__)
-+#define je_nallocm nallocm
++#if defined(MOZ_NATIVE_JEMALLOC)
++#define wrap(a) a
++#else
++#define wrap(a) je_ ## a
 +#endif
 +
  #ifdef __cplusplus
@@ -293,13 +252,38 @@
  void	jemalloc_stats(jemalloc_stats_t *stats);
  
  /* Computes the usable size in advance. */
--#if !defined(MOZ_MEMORY_DARWIN)
+ #if !defined(MOZ_MEMORY_DARWIN)
 -#if defined(MOZ_MEMORY_LINUX)
-+#if !defined(MOZ_NATIVE_JEMALLOC) && !defined(MOZ_MEMORY_DARWIN)
 +#if defined(MOZ_MEMORY_LINUX) || defined(MOZ_MEMORY_BSD)
  __attribute__((weak))
  #endif
  #if defined(MOZ_JEMALLOC)
+-int je_nallocm(size_t *rsize, size_t size, int flags);
++MOZ_IMPORT_API(int) wrap(nallocm)(size_t *rsize, size_t size, int flags);
+ #else
+ size_t je_malloc_good_size(size_t size);
+ #endif
+@@ -62,11 +69,11 @@ static inline size_t je_malloc_usable_size_in_advance(size_t size) {
+ #if defined(MOZ_MEMORY_DARWIN)
+   return malloc_good_size(size);
+ #elif defined(MOZ_JEMALLOC)
+-  if (je_nallocm) {
++  if (wrap(nallocm)) {
+     size_t ret;
+     if (size == 0)
+       size = 1;
+-    if (!je_nallocm(&ret, size, 0))
++    if (!wrap(nallocm)(&ret, size, 0))
+       return ret;
+   }
+   return size;
+@@ -113,4 +120,6 @@ void    jemalloc_purge_freed_pages();
+ } /* extern "C" */
+ #endif
+ 
++#undef wrap
++
+ #endif /* _JEMALLOC_H_ */
 diff --git mozglue/build/Makefile.in mozglue/build/Makefile.in
 index c333647..15ba505 100644
 --- mozglue/build/Makefile.in

Modified: trunk/www/firefox/files/patch-bug788955
==============================================================================
--- trunk/www/firefox/files/patch-bug788955	Mon Oct  1 10:34:07 2012	(r1050)
+++ trunk/www/firefox/files/patch-bug788955	Tue Oct  2 07:39:39 2012	(r1051)
@@ -14,7 +14,7 @@
  endif
  ifndef MOZ_NATIVE_ZLIB
 diff --git allmakefiles.sh allmakefiles.sh
-index 6a9be4b..544beff 100755
+index 6a9be4b..d2e49e3 100755
 --- allmakefiles.sh
 +++ allmakefiles.sh
 @@ -59,7 +59,7 @@ if [ ! "$LIBXUL_SDK" ]; then
@@ -22,7 +22,7 @@
      mozglue/build/Makefile
    "
 -  if [ "$MOZ_JEMALLOC" ]; then
-+  if [ "$MOZ_JEMALLOC" -a ! "$MOZ_NATIVE_JEMALLOC" ]; then
++  if [ "$MOZ_JEMALLOC" -a -z "$MOZ_NATIVE_JEMALLOC" ]; then
      add_makefiles "
        memory/jemalloc/Makefile
      "
@@ -37,10 +37,10 @@
  MOZ_ENABLE_PROFILER_SPS = @MOZ_ENABLE_PROFILER_SPS@
  MOZ_JPROF       = @MOZ_JPROF@
 diff --git configure.in configure.in
-index cfcdbc0..ee9a299 100644
+index bb05782..2f32516 100644
 --- configure.in
 +++ configure.in
-@@ -3730,21 +3730,22 @@ fi
+@@ -3711,21 +3711,22 @@ fi
  
  dnl Check for the existence of various allocation headers/functions
  
@@ -72,7 +72,7 @@
  dnl See if compiler supports some gcc-style attributes
  
  AC_CACHE_CHECK(for __attribute__((always_inline)),
-@@ -6960,6 +6961,18 @@ else
+@@ -6939,6 +6940,18 @@ else
  fi
  
  if test -z "$MOZ_MEMORY"; then
@@ -91,7 +91,7 @@
    case "${target}" in
      *-mingw*)
        if test -z "$WIN32_REDIST_DIR" -a -z "$MOZ_DEBUG"; then
-@@ -7054,6 +7067,7 @@ else
+@@ -7033,6 +7046,7 @@ else
  fi # MOZ_MEMORY
  AC_SUBST(MOZ_MEMORY)
  AC_SUBST(MOZ_JEMALLOC)
@@ -99,7 +99,7 @@
  AC_SUBST(MOZ_GLUE_LDFLAGS)
  AC_SUBST(MOZ_GLUE_PROGRAM_LDFLAGS)
  AC_SUBST(WIN32_CRT_LIBS)
-@@ -8819,10 +8833,27 @@ fi
+@@ -8820,10 +8834,22 @@ fi
  
  # Run jemalloc configure script
  
@@ -109,63 +109,22 @@
 -  if test "$OS_ARCH" = "Linux"; then
 -    MANGLE="malloc calloc valloc free realloc memalign posix_memalign malloc_usable_size"
 +  case "$OS_ARCH" in
-+    Linux)
-+      MANGLE="malloc calloc valloc free realloc memalign posix_memalign malloc_usable_size"
-+      ;;
-+    DragonFly|NetBSD|OpenBSD)
++    Linux|DragonFly|FreeBSD|NetBSD|OpenBSD)
 +      MANGLE="malloc calloc valloc free realloc posix_memalign"
-+      ;;
-+    FreeBSD)
-+      # common
-+      MANGLE="malloc calloc valloc free realloc posix_memalign malloc_usable_size"
-+      # old jemalloc
-+      MANGLE="$MANGLE reallocf _malloc_message _malloc_options"
-+      # jemalloc 3.0.0
-+      MANGLE="$MANGLE aligned_alloc malloc_message malloc_conf"
-+      MANGLE="$MANGLE malloc_stats_print mallctl mallctlnametomib mallctlbymib"
-+      MANGLE="$MANGLE allocm rallocm sallocm dallocm nallocm"
++      case "$OS_ARCH" in
++        Linux)
++          MANGLE="$MANGLE memalign malloc_usable_size"
++          ;;
++        FreeBSD)
++          MANGLE="$MANGLE malloc_usable_size"
++          ;;
++      esac
 +      ;;
 +  esac
 +  if test -n "$MANGLE"; then
      MANGLED=
      JEMALLOC_WRAPPER=
      if test -n "$_WRAP_MALLOC"; then
-diff --git js/src/configure.in js/src/configure.in
-index 846482c..4022506 100644
---- js/src/configure.in
-+++ js/src/configure.in
-@@ -3094,21 +3094,22 @@ fi
- 
- dnl Check for the existence of various allocation headers/functions
- 
-+MALLOC_HEADERS="malloc.h malloc_np.h malloc/malloc.h sys/malloc.h"
- MALLOC_H=
--MOZ_CHECK_HEADER(malloc.h,        [MALLOC_H=malloc.h])
--if test "$MALLOC_H" = ""; then
--  MOZ_CHECK_HEADER(malloc/malloc.h, [MALLOC_H=malloc/malloc.h])
--  if test "$MALLOC_H" = ""; then
--    MOZ_CHECK_HEADER(sys/malloc.h,    [MALLOC_H=sys/malloc.h])
-+
-+for file in $MALLOC_HEADERS; do
-+  MOZ_CHECK_HEADER($file, [MALLOC_H=$file])
-+  if test "$MALLOC_H" != ""; then
-+    AC_DEFINE_UNQUOTED(MALLOC_H, <$MALLOC_H>)
-+    break
-   fi
--fi
--if test "$MALLOC_H" != ""; then
--   AC_DEFINE_UNQUOTED(MALLOC_H, <$MALLOC_H>)
--fi
-+done
- 
- MOZ_ALLOCATING_FUNCS="strndup posix_memalign memalign valloc"
- AC_CHECK_FUNCS(strndup posix_memalign memalign valloc)
- 
-+AC_CHECK_FUNCS(malloc_usable_size)
-+
- dnl See if compiler supports some gcc-style attributes
- 
- AC_CACHE_CHECK(for __attribute__((always_inline)),
 diff --git memory/build/Makefile.in memory/build/Makefile.in
 index dca0f48..af93ee0 100644
 --- memory/build/Makefile.in
@@ -181,51 +140,57 @@
  SHARED_LIBRARY_LIBS += $(call EXPAND_LIBNAME_PATH,jemalloc,$(DEPTH)/memory/mozjemalloc)
  endif
 diff --git memory/build/extraMallocFuncs.c memory/build/extraMallocFuncs.c
-index 9d87629..76a2981 100644
+index 9d87629..03c8320 100644
 --- memory/build/extraMallocFuncs.c
 +++ memory/build/extraMallocFuncs.c
-@@ -94,7 +94,19 @@ wrap(wcsdup)(const wchar_t *src)
+@@ -94,8 +94,16 @@ wrap(wcsdup)(const wchar_t *src)
  #endif
  
  #ifdef MOZ_JEMALLOC
-+#if defined(MALLOC_H) && defined(MOZ_NATIVE_JEMALLOC)
-+#include MALLOC_H
-+#endif
 +
-+#if defined(MOZ_NATIVE_JEMALLOC) || defined(__FreeBSD__)
-+#define je_malloc_conf malloc_conf
-+#define je_malloc_message malloc_message
++#undef wrap
++#if defined(MOZ_NATIVE_JEMALLOC)
++#define wrap(a) a
++#else
++#define wrap(a) je_ ## a
 +#endif
 +
  /* Override some jemalloc defaults */
-+#if defined(MOZ_NATIVE_JEMALLOC)
-+MOZ_EXTERNAL_VIS
-+#endif
- const char *je_malloc_conf = "narenas:1,lg_chunk:20";
+-const char *je_malloc_conf = "narenas:1,lg_chunk:20";
++MOZ_IMPORT_DATA(const char *) wrap(malloc_conf) = "narenas:1,lg_chunk:20";
  
  #ifdef ANDROID
+ #include <android/log.h>
 diff --git memory/build/mozjemalloc_compat.c memory/build/mozjemalloc_compat.c
-index 10a845a..798c299 100644
+index 10a845a..94ad96e 100644
 --- memory/build/mozjemalloc_compat.c
 +++ memory/build/mozjemalloc_compat.c
-@@ -5,7 +5,17 @@
+@@ -5,14 +5,21 @@
  #include "mozilla/Types.h"
  #include "jemalloc_types.h"
  
-+#if defined(MALLOC_H) && defined(MOZ_NATIVE_JEMALLOC)
-+#include MALLOC_H
-+#endif
-+
-+#if defined(MOZ_NATIVE_JEMALLOC) || defined(__FreeBSD__)
-+#define je_mallctl mallctl
-+#endif
-+
-+#if !defined(MOZ_NATIVE_JEMALLOC)
- extern int je_mallctl(const char*, void*, size_t*, void*, size_t);
+-extern int je_mallctl(const char*, void*, size_t*, void*, size_t);
++#if defined(MOZ_NATIVE_JEMALLOC)
++#define wrap(a) a
++#else
++#define wrap(a) je_ ## a
 +#endif
  
- MOZ_EXPORT_API (void)
+-MOZ_EXPORT_API (void)
++extern MOZ_IMPORT_API(int)
++wrap(mallctl)(const char*, void*, size_t*, void*, size_t);
++
++MOZ_EXPORT_API(void)
  jemalloc_stats(jemalloc_stats_t *stats)
+ {
+   size_t size = sizeof(stats->mapped);
+-  je_mallctl("stats.mapped", &stats->mapped, &size, NULL, 0);
+-  je_mallctl("stats.allocated", &stats->allocated, &size, NULL, 0);
++  wrap(mallctl)("stats.mapped", &stats->mapped, &size, NULL, 0);
++  wrap(mallctl)("stats.allocated", &stats->allocated, &size, NULL, 0);
+   stats->committed = -1;
+   stats->dirty = -1;
+ }
 diff --git memory/jemalloc/src/src/mutex.c memory/jemalloc/src/src/mutex.c
 index 37a843e..55e18c2 100644
 --- memory/jemalloc/src/src/mutex.c
@@ -272,23 +237,17 @@
  #elif defined(XP_WIN)
      return _msize(ptr);
 diff --git memory/mozjemalloc/jemalloc.h memory/mozjemalloc/jemalloc.h
-index f0e0878..e74fb4d 100644
+index f0e0878..2486e83 100644
 --- memory/mozjemalloc/jemalloc.h
 +++ memory/mozjemalloc/jemalloc.h
-@@ -32,23 +32,29 @@
- #ifndef _JEMALLOC_H_
- #define _JEMALLOC_H_
- 
--#if defined(MOZ_MEMORY_DARWIN)
--#include <malloc/malloc.h>
-+#if defined(MALLOC_H) \
-+  && (defined(MOZ_NATIVE_JEMALLOC) || defined(MOZ_MEMORY_DARWIN))
-+#include MALLOC_H
+@@ -37,22 +37,29 @@
  #endif
  #include "jemalloc_types.h"
  
-+#if defined(MOZ_NATIVE_JEMALLOC) || defined(__FreeBSD__)
-+#define je_nallocm nallocm
++#if defined(MOZ_NATIVE_JEMALLOC)
++#define wrap(a) a
++#else
++#define wrap(a) je_ ## a
 +#endif
 +
  #ifdef __cplusplus
@@ -303,13 +262,38 @@
  void	jemalloc_stats(jemalloc_stats_t *stats);
  
  /* Computes the usable size in advance. */
--#if !defined(MOZ_MEMORY_DARWIN)
+ #if !defined(MOZ_MEMORY_DARWIN)
 -#if defined(MOZ_MEMORY_LINUX)
-+#if !defined(MOZ_NATIVE_JEMALLOC) && !defined(MOZ_MEMORY_DARWIN)
 +#if defined(MOZ_MEMORY_LINUX) || defined(MOZ_MEMORY_BSD)
  __attribute__((weak))
  #endif
  #if defined(MOZ_JEMALLOC)
+-int je_nallocm(size_t *rsize, size_t size, int flags);
++MOZ_IMPORT_API(int) wrap(nallocm)(size_t *rsize, size_t size, int flags);
+ #else
+ size_t je_malloc_good_size(size_t size);
+ #endif
+@@ -62,11 +69,11 @@ static inline size_t je_malloc_usable_size_in_advance(size_t size) {
+ #if defined(MOZ_MEMORY_DARWIN)
+   return malloc_good_size(size);
+ #elif defined(MOZ_JEMALLOC)
+-  if (je_nallocm) {
++  if (wrap(nallocm)) {
+     size_t ret;
+     if (size == 0)
+       size = 1;
+-    if (!je_nallocm(&ret, size, 0))
++    if (!wrap(nallocm)(&ret, size, 0))
+       return ret;
+   }
+   return size;
+@@ -113,4 +120,6 @@ void    jemalloc_purge_freed_pages();
+ } /* extern "C" */
+ #endif
+ 
++#undef wrap
++
+ #endif /* _JEMALLOC_H_ */
 diff --git mozglue/build/Makefile.in mozglue/build/Makefile.in
 index c333647..15ba505 100644
 --- mozglue/build/Makefile.in

Modified: trunk/www/seamonkey/files/patch-bug788955
==============================================================================
--- trunk/www/seamonkey/files/patch-bug788955	Mon Oct  1 10:34:07 2012	(r1050)
+++ trunk/www/seamonkey/files/patch-bug788955	Tue Oct  2 07:39:39 2012	(r1051)
@@ -14,7 +14,7 @@
  endif
  ifndef MOZ_NATIVE_ZLIB
 diff --git allmakefiles.sh allmakefiles.sh
-index 6a9be4b..544beff 100755
+index 6a9be4b..d2e49e3 100755
 --- mozilla/allmakefiles.sh
 +++ mozilla/allmakefiles.sh
 @@ -59,7 +59,7 @@ if [ ! "$LIBXUL_SDK" ]; then
@@ -22,7 +22,7 @@
      mozglue/build/Makefile
    "
 -  if [ "$MOZ_JEMALLOC" ]; then
-+  if [ "$MOZ_JEMALLOC" -a ! "$MOZ_NATIVE_JEMALLOC" ]; then
++  if [ "$MOZ_JEMALLOC" -a -z "$MOZ_NATIVE_JEMALLOC" ]; then
      add_makefiles "
        memory/jemalloc/Makefile
      "
@@ -37,10 +37,10 @@
  MOZ_ENABLE_PROFILER_SPS = @MOZ_ENABLE_PROFILER_SPS@
  MOZ_JPROF       = @MOZ_JPROF@
 diff --git configure.in configure.in
-index cfcdbc0..ee9a299 100644
+index bb05782..2f32516 100644
 --- mozilla/configure.in
 +++ mozilla/configure.in
-@@ -3730,21 +3730,22 @@ fi
+@@ -3711,21 +3711,22 @@ fi
  
  dnl Check for the existence of various allocation headers/functions
  
@@ -72,7 +72,7 @@
  dnl See if compiler supports some gcc-style attributes
  
  AC_CACHE_CHECK(for __attribute__((always_inline)),
-@@ -6960,6 +6961,18 @@ else
+@@ -6939,6 +6940,18 @@ else
  fi
  
  if test -z "$MOZ_MEMORY"; then
@@ -91,7 +91,7 @@
    case "${target}" in
      *-mingw*)
        if test -z "$WIN32_REDIST_DIR" -a -z "$MOZ_DEBUG"; then
-@@ -7054,6 +7067,7 @@ else
+@@ -7033,6 +7046,7 @@ else
  fi # MOZ_MEMORY
  AC_SUBST(MOZ_MEMORY)
  AC_SUBST(MOZ_JEMALLOC)
@@ -99,7 +99,7 @@
  AC_SUBST(MOZ_GLUE_LDFLAGS)
  AC_SUBST(MOZ_GLUE_PROGRAM_LDFLAGS)
  AC_SUBST(WIN32_CRT_LIBS)
-@@ -8819,10 +8833,27 @@ fi
+@@ -8820,10 +8834,22 @@ fi
  
  # Run jemalloc configure script
  
@@ -109,63 +109,22 @@
 -  if test "$OS_ARCH" = "Linux"; then
 -    MANGLE="malloc calloc valloc free realloc memalign posix_memalign malloc_usable_size"
 +  case "$OS_ARCH" in
-+    Linux)
-+      MANGLE="malloc calloc valloc free realloc memalign posix_memalign malloc_usable_size"
-+      ;;
-+    DragonFly|NetBSD|OpenBSD)
++    Linux|DragonFly|FreeBSD|NetBSD|OpenBSD)
 +      MANGLE="malloc calloc valloc free realloc posix_memalign"
-+      ;;
-+    FreeBSD)
-+      # common
-+      MANGLE="malloc calloc valloc free realloc posix_memalign malloc_usable_size"
-+      # old jemalloc
-+      MANGLE="$MANGLE reallocf _malloc_message _malloc_options"
-+      # jemalloc 3.0.0
-+      MANGLE="$MANGLE aligned_alloc malloc_message malloc_conf"
-+      MANGLE="$MANGLE malloc_stats_print mallctl mallctlnametomib mallctlbymib"
-+      MANGLE="$MANGLE allocm rallocm sallocm dallocm nallocm"
++      case "$OS_ARCH" in
++        Linux)
++          MANGLE="$MANGLE memalign malloc_usable_size"
++          ;;
++        FreeBSD)
++          MANGLE="$MANGLE malloc_usable_size"
++          ;;
++      esac
 +      ;;
 +  esac
 +  if test -n "$MANGLE"; then
      MANGLED=
      JEMALLOC_WRAPPER=
      if test -n "$_WRAP_MALLOC"; then
-diff --git js/src/configure.in js/src/configure.in
-index 846482c..4022506 100644
---- mozilla/js/src/configure.in
-+++ mozilla/js/src/configure.in
-@@ -3094,21 +3094,22 @@ fi
- 
- dnl Check for the existence of various allocation headers/functions
- 
-+MALLOC_HEADERS="malloc.h malloc_np.h malloc/malloc.h sys/malloc.h"
- MALLOC_H=
--MOZ_CHECK_HEADER(malloc.h,        [MALLOC_H=malloc.h])
--if test "$MALLOC_H" = ""; then
--  MOZ_CHECK_HEADER(malloc/malloc.h, [MALLOC_H=malloc/malloc.h])
--  if test "$MALLOC_H" = ""; then
--    MOZ_CHECK_HEADER(sys/malloc.h,    [MALLOC_H=sys/malloc.h])
-+
-+for file in $MALLOC_HEADERS; do
-+  MOZ_CHECK_HEADER($file, [MALLOC_H=$file])
-+  if test "$MALLOC_H" != ""; then
-+    AC_DEFINE_UNQUOTED(MALLOC_H, <$MALLOC_H>)
-+    break
-   fi
--fi
--if test "$MALLOC_H" != ""; then
--   AC_DEFINE_UNQUOTED(MALLOC_H, <$MALLOC_H>)
--fi
-+done
- 
- MOZ_ALLOCATING_FUNCS="strndup posix_memalign memalign valloc"
- AC_CHECK_FUNCS(strndup posix_memalign memalign valloc)
- 
-+AC_CHECK_FUNCS(malloc_usable_size)
-+
- dnl See if compiler supports some gcc-style attributes
- 
- AC_CACHE_CHECK(for __attribute__((always_inline)),
 diff --git memory/build/Makefile.in memory/build/Makefile.in
 index dca0f48..af93ee0 100644
 --- mozilla/memory/build/Makefile.in
@@ -181,51 +140,57 @@
  SHARED_LIBRARY_LIBS += $(call EXPAND_LIBNAME_PATH,jemalloc,$(DEPTH)/memory/mozjemalloc)
  endif
 diff --git memory/build/extraMallocFuncs.c memory/build/extraMallocFuncs.c
-index 9d87629..76a2981 100644
+index 9d87629..03c8320 100644
 --- mozilla/memory/build/extraMallocFuncs.c
 +++ mozilla/memory/build/extraMallocFuncs.c
-@@ -94,7 +94,19 @@ wrap(wcsdup)(const wchar_t *src)
+@@ -94,8 +94,16 @@ wrap(wcsdup)(const wchar_t *src)
  #endif
  
  #ifdef MOZ_JEMALLOC
-+#if defined(MALLOC_H) && defined(MOZ_NATIVE_JEMALLOC)
-+#include MALLOC_H
-+#endif
 +
-+#if defined(MOZ_NATIVE_JEMALLOC) || defined(__FreeBSD__)
-+#define je_malloc_conf malloc_conf
-+#define je_malloc_message malloc_message
++#undef wrap
++#if defined(MOZ_NATIVE_JEMALLOC)
++#define wrap(a) a
++#else
++#define wrap(a) je_ ## a
 +#endif
 +
  /* Override some jemalloc defaults */
-+#if defined(MOZ_NATIVE_JEMALLOC)
-+MOZ_EXTERNAL_VIS
-+#endif
- const char *je_malloc_conf = "narenas:1,lg_chunk:20";
+-const char *je_malloc_conf = "narenas:1,lg_chunk:20";
++MOZ_IMPORT_DATA(const char *) wrap(malloc_conf) = "narenas:1,lg_chunk:20";
  
  #ifdef ANDROID
+ #include <android/log.h>
 diff --git memory/build/mozjemalloc_compat.c memory/build/mozjemalloc_compat.c
-index 10a845a..798c299 100644
+index 10a845a..94ad96e 100644
 --- mozilla/memory/build/mozjemalloc_compat.c
 +++ mozilla/memory/build/mozjemalloc_compat.c
-@@ -5,7 +5,17 @@
+@@ -5,14 +5,21 @@
  #include "mozilla/Types.h"
  #include "jemalloc_types.h"
  
-+#if defined(MALLOC_H) && defined(MOZ_NATIVE_JEMALLOC)
-+#include MALLOC_H
-+#endif
-+
-+#if defined(MOZ_NATIVE_JEMALLOC) || defined(__FreeBSD__)
-+#define je_mallctl mallctl
-+#endif
-+
-+#if !defined(MOZ_NATIVE_JEMALLOC)
- extern int je_mallctl(const char*, void*, size_t*, void*, size_t);
+-extern int je_mallctl(const char*, void*, size_t*, void*, size_t);
++#if defined(MOZ_NATIVE_JEMALLOC)
++#define wrap(a) a
++#else
++#define wrap(a) je_ ## a
 +#endif
  
- MOZ_EXPORT_API (void)
+-MOZ_EXPORT_API (void)
++extern MOZ_IMPORT_API(int)
++wrap(mallctl)(const char*, void*, size_t*, void*, size_t);
++
++MOZ_EXPORT_API(void)
  jemalloc_stats(jemalloc_stats_t *stats)
+ {
+   size_t size = sizeof(stats->mapped);
+-  je_mallctl("stats.mapped", &stats->mapped, &size, NULL, 0);
+-  je_mallctl("stats.allocated", &stats->allocated, &size, NULL, 0);
++  wrap(mallctl)("stats.mapped", &stats->mapped, &size, NULL, 0);
++  wrap(mallctl)("stats.allocated", &stats->allocated, &size, NULL, 0);
+   stats->committed = -1;
+   stats->dirty = -1;
+ }
 diff --git memory/jemalloc/src/src/mutex.c memory/jemalloc/src/src/mutex.c
 index 37a843e..55e18c2 100644
 --- mozilla/memory/jemalloc/src/src/mutex.c
@@ -272,23 +237,17 @@
  #elif defined(XP_WIN)
      return _msize(ptr);
 diff --git memory/mozjemalloc/jemalloc.h memory/mozjemalloc/jemalloc.h
-index f0e0878..e74fb4d 100644
+index f0e0878..2486e83 100644
 --- mozilla/memory/mozjemalloc/jemalloc.h
 +++ mozilla/memory/mozjemalloc/jemalloc.h
-@@ -32,23 +32,29 @@
- #ifndef _JEMALLOC_H_
- #define _JEMALLOC_H_
- 
--#if defined(MOZ_MEMORY_DARWIN)
--#include <malloc/malloc.h>
-+#if defined(MALLOC_H) \
-+  && (defined(MOZ_NATIVE_JEMALLOC) || defined(MOZ_MEMORY_DARWIN))
-+#include MALLOC_H
+@@ -37,22 +37,29 @@
  #endif
  #include "jemalloc_types.h"
  
-+#if defined(MOZ_NATIVE_JEMALLOC) || defined(__FreeBSD__)
-+#define je_nallocm nallocm
++#if defined(MOZ_NATIVE_JEMALLOC)
++#define wrap(a) a
++#else
++#define wrap(a) je_ ## a
 +#endif
 +
  #ifdef __cplusplus
@@ -303,13 +262,38 @@
  void	jemalloc_stats(jemalloc_stats_t *stats);
  
  /* Computes the usable size in advance. */
--#if !defined(MOZ_MEMORY_DARWIN)
+ #if !defined(MOZ_MEMORY_DARWIN)
 -#if defined(MOZ_MEMORY_LINUX)
-+#if !defined(MOZ_NATIVE_JEMALLOC) && !defined(MOZ_MEMORY_DARWIN)
 +#if defined(MOZ_MEMORY_LINUX) || defined(MOZ_MEMORY_BSD)
  __attribute__((weak))
  #endif
  #if defined(MOZ_JEMALLOC)
+-int je_nallocm(size_t *rsize, size_t size, int flags);
++MOZ_IMPORT_API(int) wrap(nallocm)(size_t *rsize, size_t size, int flags);
+ #else
+ size_t je_malloc_good_size(size_t size);
+ #endif
+@@ -62,11 +69,11 @@ static inline size_t je_malloc_usable_size_in_advance(size_t size) {
+ #if defined(MOZ_MEMORY_DARWIN)
+   return malloc_good_size(size);
+ #elif defined(MOZ_JEMALLOC)
+-  if (je_nallocm) {
++  if (wrap(nallocm)) {
+     size_t ret;
+     if (size == 0)
+       size = 1;
+-    if (!je_nallocm(&ret, size, 0))
++    if (!wrap(nallocm)(&ret, size, 0))
+       return ret;
+   }
+   return size;
+@@ -113,4 +120,6 @@ void    jemalloc_purge_freed_pages();
+ } /* extern "C" */
+ #endif
+ 
++#undef wrap
++
+ #endif /* _JEMALLOC_H_ */
 diff --git mozglue/build/Makefile.in mozglue/build/Makefile.in
 index c333647..15ba505 100644
 --- mozilla/mozglue/build/Makefile.in



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201210020739.q927ddKA097088>