Bug 1395088 - Remove the jemalloc_bool type. r=njn
authorMike Hommey <mh+mozilla@glandium.org>
Wed, 30 Aug 2017 18:04:47 +0900
changeset 377787 334107d19c857dbd19677397baf513ffafe57e80
parent 377786 96bea603414ca6b452ff87eb65e41501f4cfe918
child 377788 d87bd54dc409c481e1c28a16be50e76ea91cf6c3
push id94338
push userkwierso@gmail.com
push dateThu, 31 Aug 2017 02:58:58 +0000
treeherdermozilla-inbound@9ca18987dabb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnjn
bugs1395088, 488608
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 1395088 - Remove the jemalloc_bool type. r=njn Back when it was added (for Windows CE, in bug 488608), mozjemalloc was C and all the supported compilers didn't support C99 bools. Now mozjemalloc is C++, and all the supported compilers support C99 bools for the cases where the type is used from C.
layout/style/ServoBindings.cpp
memory/build/malloc_decls.h
memory/build/mozmemory.h
memory/mozjemalloc/mozjemalloc_types.h
memory/replace/replace/ReplaceMalloc.cpp
--- a/layout/style/ServoBindings.cpp
+++ b/layout/style/ServoBindings.cpp
@@ -2767,19 +2767,17 @@ Gecko_DocumentRule_UseForPresentation(Ra
   return css::DocumentRule::UseForPresentation(doc, docURI, docURISpec,
                                                *aPattern, aURLMatchingFunction);
 }
 
 void
 Gecko_SetJemallocThreadLocalArena(bool enabled)
 {
 #if defined(MOZ_MEMORY)
-  // At this point we convert |enabled| from a plain C++ bool to a
-  // |jemalloc_bool|, so be on the safe side.
-  jemalloc_thread_local_arena(!!enabled);
+  jemalloc_thread_local_arena(enabled);
 #endif
 }
 
 #include "nsStyleStructList.h"
 
 #undef STYLE_STRUCT
 
 #ifndef MOZ_STYLO
--- a/memory/build/malloc_decls.h
+++ b/memory/build/malloc_decls.h
@@ -56,16 +56,16 @@ MALLOC_DECL(memalign, void *, size_t, si
 MALLOC_DECL(valloc, void *, size_t)
 MALLOC_DECL(malloc_usable_size, size_t, usable_ptr_t)
 MALLOC_DECL(malloc_good_size, size_t, size_t)
 #  endif
 #  if MALLOC_FUNCS & MALLOC_FUNCS_JEMALLOC
 MALLOC_DECL_VOID(jemalloc_stats, jemalloc_stats_t *)
 MALLOC_DECL_VOID(jemalloc_purge_freed_pages)
 MALLOC_DECL_VOID(jemalloc_free_dirty_pages)
-MALLOC_DECL_VOID(jemalloc_thread_local_arena, jemalloc_bool)
+MALLOC_DECL_VOID(jemalloc_thread_local_arena, bool)
 #  endif
 
 #  undef MALLOC_DECL_VOID
 #endif /* MALLOC_DECL */
 
 #undef MALLOC_DECL
 #undef MALLOC_FUNCS
--- a/memory/build/mozmemory.h
+++ b/memory/build/mozmemory.h
@@ -80,11 +80,11 @@ MOZ_JEMALLOC_API void jemalloc_purge_fre
 /*
  * Free all unused dirty pages in all arenas. Calling this function will slow
  * down subsequent allocations so it is recommended to use it only when
  * memory needs to be reclaimed at all costs (see bug 805855). This function
  * provides functionality similar to mallctl("arenas.purge") in jemalloc 3.
  */
 MOZ_JEMALLOC_API void jemalloc_free_dirty_pages();
 
-MOZ_JEMALLOC_API void jemalloc_thread_local_arena(jemalloc_bool enabled);
+MOZ_JEMALLOC_API void jemalloc_thread_local_arena(bool enabled);
 
 #endif /* mozmemory_h */
--- a/memory/mozjemalloc/mozjemalloc_types.h
+++ b/memory/mozjemalloc/mozjemalloc_types.h
@@ -33,34 +33,33 @@
 #define _JEMALLOC_TYPES_H_
 
 /* grab size_t */
 #ifdef _MSC_VER
 #include <crtdefs.h>
 #else
 #include <stddef.h>
 #endif
+#include <stdbool.h>
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-typedef unsigned char jemalloc_bool;
-
 /*
  * jemalloc_stats() is not a stable interface.  When using jemalloc_stats_t, be
  * sure that the compiled results of jemalloc.c are in sync with this header
  * file.
  */
 typedef struct {
 	/*
 	 * Run-time configuration settings.
 	 */
-	jemalloc_bool	opt_junk;	/* Fill allocated memory with kAllocJunk? */
-	jemalloc_bool	opt_zero;	/* Fill allocated memory with 0x0? */
+	bool	opt_junk;	/* Fill allocated memory with kAllocJunk? */
+	bool	opt_zero;	/* Fill allocated memory with 0x0? */
 	size_t	narenas;	/* Number of arenas. */
 	size_t	quantum;	/* Allocation quantum. */
 	size_t	small_max;	/* Max quantum-spaced allocation size. */
 	size_t	large_max;	/* Max sub-chunksize allocation size. */
 	size_t	chunksize;	/* Size of each virtual memory mapping. */
 	size_t	dirty_max;	/* Max dirty pages per arena. */
 
 	/*
--- a/memory/replace/replace/ReplaceMalloc.cpp
+++ b/memory/replace/replace/ReplaceMalloc.cpp
@@ -248,16 +248,16 @@ replace_jemalloc_free_dirty_pages(void)
   gFuncs->jemalloc_free_dirty_pages();
   const malloc_hook_table_t* hook_table = gHookTable;
   if (hook_table && hook_table->jemalloc_free_dirty_pages_hook) {
     hook_table->jemalloc_free_dirty_pages_hook();
   }
 }
 
 void
-replace_jemalloc_thread_local_arena(jemalloc_bool aEnabled)
+replace_jemalloc_thread_local_arena(bool aEnabled)
 {
   gFuncs->jemalloc_thread_local_arena(aEnabled);
   const malloc_hook_table_t* hook_table = gHookTable;
   if (hook_table && hook_table->jemalloc_thread_local_arena_hook) {
     hook_table->jemalloc_thread_local_arena_hook(aEnabled);
   }
 }