From 4c2faa8a7c42a47a6bea509f5a23234bc5a66d40 Mon Sep 17 00:00:00 2001 From: Jason Evans Date: Tue, 13 Mar 2012 11:09:23 -0700 Subject: [PATCH] Fix a regression in JE_COMPILABLE(). Revert JE_COMPILABLE() so that it detects link errors. Cross-compiling should still work as long as a valid configure cache is provided. Clean up some comments/whitespace. --- configure.ac | 28 +++++++++---------- .../jemalloc/internal/jemalloc_internal.h.in | 9 ++---- src/jemalloc.c | 5 +--- 3 files changed, 18 insertions(+), 24 deletions(-) diff --git a/configure.ac b/configure.ac index 5cf2855f..a5ca859b 100644 --- a/configure.ac +++ b/configure.ac @@ -26,14 +26,17 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM( ]) dnl JE_COMPILABLE(label, hcode, mcode, rvar) +dnl +dnl Use AC_RUN_IFELSE() rather than AC_COMPILE_IFELSE() so that linker errors +dnl cause failure. AC_DEFUN([JE_COMPILABLE], [ AC_CACHE_CHECK([whether $1 is compilable], [$4], - [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([$2], - [$3])], - [$4=yes], - [$4=no])]) + [AC_RUN_IFELSE([AC_LANG_PROGRAM([$2], + [$3])], + [$4=yes], + [$4=no])]) ]) dnl ============================================================================ @@ -801,16 +804,13 @@ dnl ============================================================================ dnl Check for ffsl(3), and fail if not found. This function exists on all dnl platforms that jemalloc currently has a chance of functioning on without dnl modification. -JE_COMPILABLE([a program using ffsl], - [ - #include - ], - [ - { - int rv = ffsl(0x08); - } - ], - [je_cv_function_ffsl]) +JE_COMPILABLE([a program using ffsl], [ +#include +], [ + { + int rv = ffsl(0x08); + } +], [je_cv_function_ffsl]) if test "x${je_cv_function_ffsl}" != "xyes" ; then AC_MSG_ERROR([Cannot build without ffsl(3)]) fi diff --git a/include/jemalloc/internal/jemalloc_internal.h.in b/include/jemalloc/internal/jemalloc_internal.h.in index 3774bb5d..5759ed58 100644 --- a/include/jemalloc/internal/jemalloc_internal.h.in +++ b/include/jemalloc/internal/jemalloc_internal.h.in @@ -240,14 +240,14 @@ static const bool config_ivsalloc = #define LONG_MASK (LONG - 1) /* Return the smallest long multiple that is >= a. */ -#define LONG_CEILING(a) \ +#define LONG_CEILING(a) \ (((a) + LONG_MASK) & ~LONG_MASK) #define SIZEOF_PTR (1U << LG_SIZEOF_PTR) #define PTR_MASK (SIZEOF_PTR - 1) /* Return the smallest (void *) multiple that is >= a. */ -#define PTR_CEILING(a) \ +#define PTR_CEILING(a) \ (((a) + PTR_MASK) & ~PTR_MASK) /* @@ -566,10 +566,7 @@ sa2u(size_t size, size_t alignment, size_t *run_size_p) } } -/* - * Choose an arena based on a per-thread value (fast-path code, calls slow-path - * code if necessary). - */ +/* Choose an arena based on a per-thread value. */ JEMALLOC_INLINE arena_t * choose_arena(void) { diff --git a/src/jemalloc.c b/src/jemalloc.c index e148ae0e..f564b65e 100644 --- a/src/jemalloc.c +++ b/src/jemalloc.c @@ -101,10 +101,7 @@ arenas_extend(unsigned ind) return (arenas[0]); } -/* - * Choose an arena based on a per-thread value (slow-path code only, called - * only by choose_arena()). - */ +/* Slow path, called only by choose_arena(). */ arena_t * choose_arena_hard(void) {