Bug 1399350 - Remove jemalloc_*_impl macros. r=njn
authorMike Hommey <mh+mozilla@glandium.org>
Wed, 13 Sep 2017 14:25:21 +0900
changeset 430031 a2874ca1233d741eae2e6ecb679dd9f77eacbfd1
parent 430030 5fadfed6db0cf0d6de4d127b1d85e077b29a0090
child 430032 a590551725dcce30aee24b1acef374ed8279ce0d
push id7761
push userjlund@mozilla.com
push dateFri, 15 Sep 2017 00:19:52 +0000
treeherdermozilla-beta@c38455951db4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnjn
bugs1399350
milestone57.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
Bug 1399350 - Remove jemalloc_*_impl macros. r=njn Those macros are one more thing that needs to be added when the mozjemalloc API surface is increased, but after bug 1399350, nothing actually needs them, so remove them.
memory/build/mozjemalloc.cpp
memory/build/mozmemory_wrap.h
memory/replace/logalloc/replay/Replay.cpp
--- a/memory/build/mozjemalloc.cpp
+++ b/memory/build/mozjemalloc.cpp
@@ -5425,27 +5425,34 @@ replace_malloc_init_funcs()
   }
 #include "malloc_decls.h"
 }
 
 #endif /* MOZ_REPLACE_MALLOC */
 /******************************************************************************/
 /* Definition of all the _impl functions */
 
-#define GENERIC_MALLOC_DECL_HELPER(name, return, return_type, ...) \
-  return_type name##_impl(ARGS_HELPER(TYPED_ARGS, ##__VA_ARGS__)) \
+#define GENERIC_MALLOC_DECL_HELPER2(name, name_impl, return, return_type, ...) \
+  return_type name_impl(ARGS_HELPER(TYPED_ARGS, ##__VA_ARGS__)) \
   { \
     return DefaultMalloc::name(ARGS_HELPER(ARGS, ##__VA_ARGS__)); \
   }
 
+#define GENERIC_MALLOC_DECL_HELPER(name, return, return_type, ...) \
+  GENERIC_MALLOC_DECL_HELPER2(name, name##_impl, return, return_type, ##__VA_ARGS__)
+
 #define MALLOC_DECL(...) MOZ_MEMORY_API MACRO_CALL(GENERIC_MALLOC_DECL, (__VA_ARGS__))
 #define MALLOC_DECL_VOID(...) MOZ_MEMORY_API MACRO_CALL(GENERIC_MALLOC_DECL_VOID, (__VA_ARGS__))
 #define MALLOC_FUNCS MALLOC_FUNCS_MALLOC
 #include "malloc_decls.h"
 
+#undef GENERIC_MALLOC_DECL_HELPER
+#define GENERIC_MALLOC_DECL_HELPER(name, return, return_type, ...) \
+  GENERIC_MALLOC_DECL_HELPER2(name, name, return, return_type, ##__VA_ARGS__)
+
 #define MALLOC_DECL(...) MOZ_JEMALLOC_API MACRO_CALL(GENERIC_MALLOC_DECL, (__VA_ARGS__))
 #define MALLOC_DECL_VOID(...) MOZ_JEMALLOC_API MACRO_CALL(GENERIC_MALLOC_DECL_VOID, (__VA_ARGS__))
 #define MALLOC_FUNCS MALLOC_FUNCS_JEMALLOC
 #include "malloc_decls.h"
 /******************************************************************************/
 
 #ifdef HAVE_DLOPEN
 #  include <dlfcn.h>
--- a/memory/build/mozmemory_wrap.h
+++ b/memory/build/mozmemory_wrap.h
@@ -137,19 +137,16 @@
 #endif
 
 #ifndef mozmem_malloc_impl
 #  define mozmem_malloc_impl(a)   a
 #endif
 #ifndef mozmem_dup_impl
 #  define mozmem_dup_impl(a)      a
 #endif
-#ifndef mozmem_jemalloc_impl
-#  define mozmem_jemalloc_impl(a) a
-#endif
 
 /* Malloc implementation functions */
 #define malloc_impl              mozmem_malloc_impl(malloc)
 #define posix_memalign_impl      mozmem_malloc_impl(posix_memalign)
 #define aligned_alloc_impl       mozmem_malloc_impl(aligned_alloc)
 #define calloc_impl              mozmem_malloc_impl(calloc)
 #define realloc_impl             mozmem_malloc_impl(realloc)
 #define free_impl                mozmem_malloc_impl(free)
@@ -169,18 +166,9 @@
 #ifdef ANDROID
 /* Bug 801571 and Bug 879668, libstagefright uses vasprintf, causing malloc()/
  * free() to be mismatched between bionic and mozglue implementation.
  */
 #define vasprintf_impl  mozmem_dup_impl(vasprintf)
 #define asprintf_impl   mozmem_dup_impl(asprintf)
 #endif
 
-/* Jemalloc specific function */
-#define jemalloc_stats_impl              mozmem_jemalloc_impl(jemalloc_stats)
-#define jemalloc_purge_freed_pages_impl  mozmem_jemalloc_impl(jemalloc_purge_freed_pages)
-#define jemalloc_free_dirty_pages_impl   mozmem_jemalloc_impl(jemalloc_free_dirty_pages)
-#define jemalloc_thread_local_arena_impl \
-          mozmem_jemalloc_impl(jemalloc_thread_local_arena)
-#define jemalloc_ptr_info_impl \
-          mozmem_jemalloc_impl(jemalloc_ptr_info)
-
 #endif /* mozmemory_wrap_h */
--- a/memory/replace/logalloc/replay/Replay.cpp
+++ b/memory/replace/logalloc/replay/Replay.cpp
@@ -275,17 +275,17 @@ MOZ_BEGIN_EXTERN_C
 /* Function declarations for all the replace_malloc _impl functions.
  * See memory/build/replace_malloc.c */
 #define MALLOC_DECL(name, return_type, ...) \
   return_type name ## _impl(__VA_ARGS__);
 #define MALLOC_FUNCS MALLOC_FUNCS_MALLOC
 #include "malloc_decls.h"
 
 #define MALLOC_DECL(name, return_type, ...) \
-  return_type name ## _impl(__VA_ARGS__);
+  return_type name(__VA_ARGS__);
 #define MALLOC_FUNCS MALLOC_FUNCS_JEMALLOC
 #include "malloc_decls.h"
 
 /* mozjemalloc relies on DllMain to initialize, but DllMain is not invoked
  * for executables, so manually invoke mozjemalloc initialization. */
 #if defined(_WIN32)
 void malloc_init_hard(void);
 #endif
@@ -441,17 +441,17 @@ public:
   }
 
   void jemalloc_stats(Buffer& aArgs)
   {
     if (aArgs) {
       die("Malformed input");
     }
     jemalloc_stats_t stats;
-    ::jemalloc_stats_impl(&stats);
+    ::jemalloc_stats(&stats);
     FdPrintf(mStdErr,
              "#%zu mapped: %zu; allocated: %zu; waste: %zu; dirty: %zu; "
              "bookkeep: %zu; binunused: %zu\n", mOps, stats.mapped,
              stats.allocated, stats.waste, stats.page_cache,
              stats.bookkeeping, stats.bin_unused);
     /* TODO: Add more data, like actual RSS as measured by OS, but compensated
      * for the replay internal data. */
   }