diff options
-rw-r--r-- | memory/mozjemalloc/jemalloc.c | 4 | ||||
-rw-r--r-- | memory/mozjemalloc/rb.h | 54 |
2 files changed, 20 insertions, 38 deletions
diff --git a/memory/mozjemalloc/jemalloc.c b/memory/mozjemalloc/jemalloc.c index ccbc1aeba..c46e3c047 100644 --- a/memory/mozjemalloc/jemalloc.c +++ b/memory/mozjemalloc/jemalloc.c @@ -378,10 +378,6 @@ void *_mmap(void *addr, size_t length, int prot, int flags, #define __DECONST(type, var) ((type)(uintptr_t)(const void *)(var)) #endif -#ifdef MOZ_MEMORY_WINDOWS - /* MSVC++ does not support C99 variable-length arrays. */ -# define RB_NO_C99_VARARRAYS -#endif #include "rb.h" #ifdef MALLOC_DEBUG diff --git a/memory/mozjemalloc/rb.h b/memory/mozjemalloc/rb.h index 431ad9ddb..a1b08973b 100644 --- a/memory/mozjemalloc/rb.h +++ b/memory/mozjemalloc/rb.h @@ -36,7 +36,6 @@ * (Optional.) * #define SIZEOF_PTR ... * #define SIZEOF_PTR_2POW ... - * #define RB_NO_C99_VARARRAYS * * (Optional, see assert(3).) * #define NDEBUG @@ -769,39 +768,26 @@ a_prefix##remove(a_tree_type *tree, a_type *node) { \ * effort. */ -#ifdef RB_NO_C99_VARARRAYS - /* - * Avoid using variable-length arrays, at the cost of using more stack space. - * Size the path arrays such that they are always large enough, even if a - * tree consumes all of memory. Since each node must contain a minimum of - * two pointers, there can never be more nodes than: - * - * 1 << ((SIZEOF_PTR<<3) - (SIZEOF_PTR_2POW+1)) - * - * Since the depth of a tree is limited to 3*lg(#nodes), the maximum depth - * is: - * - * (3 * ((SIZEOF_PTR<<3) - (SIZEOF_PTR_2POW+1))) - * - * This works out to a maximum depth of 87 and 180 for 32- and 64-bit - * systems, respectively (approximatly 348 and 1440 bytes, respectively). - */ -# define rbp_compute_f_height(a_type, a_field, a_tree) -# define rbp_f_height (3 * ((SIZEOF_PTR<<3) - (SIZEOF_PTR_2POW+1))) -# define rbp_compute_fr_height(a_type, a_field, a_tree) -# define rbp_fr_height (3 * ((SIZEOF_PTR<<3) - (SIZEOF_PTR_2POW+1))) -#else -# define rbp_compute_f_height(a_type, a_field, a_tree) \ - /* Compute the maximum possible tree depth (3X the black height). */\ - unsigned rbp_f_height; \ - rbp_black_height(a_type, a_field, a_tree, rbp_f_height); \ - rbp_f_height *= 3; -# define rbp_compute_fr_height(a_type, a_field, a_tree) \ - /* Compute the maximum possible tree depth (3X the black height). */\ - unsigned rbp_fr_height; \ - rbp_black_height(a_type, a_field, a_tree, rbp_fr_height); \ - rbp_fr_height *= 3; -#endif +/* + * Avoid using variable-length arrays. + * Size the path arrays such that they are always large enough, even if a + * tree consumes all of memory. Since each node must contain a minimum of + * two pointers, there can never be more nodes than: + * + * 1 << ((SIZEOF_PTR<<3) - (SIZEOF_PTR_2POW+1)) + * + * Since the depth of a tree is limited to 3*lg(#nodes), the maximum depth + * is: + * + * (3 * ((SIZEOF_PTR<<3) - (SIZEOF_PTR_2POW+1))) + * + * This works out to a maximum depth of 87 and 180 for 32- and 64-bit + * systems, respectively (approximatly 348 and 1440 bytes, respectively). + */ +#define rbp_compute_f_height(a_type, a_field, a_tree) +#define rbp_f_height (3 * ((SIZEOF_PTR<<3) - (SIZEOF_PTR_2POW+1))) +#define rbp_compute_fr_height(a_type, a_field, a_tree) +#define rbp_fr_height (3 * ((SIZEOF_PTR<<3) - (SIZEOF_PTR_2POW+1))) #define rb_foreach_begin(a_type, a_field, a_tree, a_var) { \ rbp_compute_f_height(a_type, a_field, a_tree) \ |