configure: Add --with-lg-vaddr configure option.

This patch allows to override the lg-vaddr values, which
are defined by the build machine's CPUID information (x86_64)
or default values (other architectures like aarch64).

Signed-off-by: Christoph Muellner <christoph.muellner@theobroma-systems.com>
This commit is contained in:
Christoph Muellner 2018-05-03 16:52:03 +02:00 committed by Qi Wang
parent 95789a24fa
commit 63712b4c4e
2 changed files with 46 additions and 28 deletions

View File

@ -260,6 +260,14 @@ any of the following arguments (not a definitive list) to 'configure':
configuration, jemalloc will provide additional size classes that are not configuration, jemalloc will provide additional size classes that are not
16-byte-aligned (24, 40, and 56). 16-byte-aligned (24, 40, and 56).
* `--with-lg-vaddr=<lg-vaddr>`
Specify the number of significant virtual address bits. jemalloc uses
pointer tagging if the pointer size is bigger than the required size for
virtual addresses. By default the configure script determines this via CPUID
information on x86_64 and uses default values for other architectures. This
option may be useful when cross compiling.
* `--disable-initial-exec-tls` * `--disable-initial-exec-tls`
Disable the initial-exec TLS model for jemalloc's internal thread-local Disable the initial-exec TLS model for jemalloc's internal thread-local

View File

@ -409,22 +409,29 @@ esac
AC_DEFINE_UNQUOTED([HAVE_CPU_SPINWAIT], [$HAVE_CPU_SPINWAIT]) AC_DEFINE_UNQUOTED([HAVE_CPU_SPINWAIT], [$HAVE_CPU_SPINWAIT])
AC_DEFINE_UNQUOTED([CPU_SPINWAIT], [$CPU_SPINWAIT]) AC_DEFINE_UNQUOTED([CPU_SPINWAIT], [$CPU_SPINWAIT])
AC_ARG_WITH([lg_vaddr],
[AS_HELP_STRING([--with-lg-vaddr=<lg-vaddr>], [Number of significant virtual address bits])],
[LG_VADDR="$with_lg_vaddr"], [LG_VADDR="detect"])
case "${host_cpu}" in case "${host_cpu}" in
aarch64) aarch64)
AC_MSG_CHECKING([number of significant virtual address bits]) if test "x$LG_VADDR" = "xdetect"; then
if test "x${ac_cv_sizeof_void_p}" = "x4" ; then AC_MSG_CHECKING([number of significant virtual address bits])
#aarch64 ILP32 if test "x${LG_SIZEOF_PTR}" = "x2" ; then
LG_VADDR=32 #aarch64 ILP32
else LG_VADDR=32
#aarch64 LP64 else
LG_VADDR=48 #aarch64 LP64
LG_VADDR=48
fi
AC_MSG_RESULT([$LG_VADDR])
fi fi
AC_MSG_RESULT([$LG_VADDR])
;; ;;
x86_64) x86_64)
AC_CACHE_CHECK([number of significant virtual address bits], if test "x$LG_VADDR" = "xdetect"; then
[je_cv_lg_vaddr], AC_CACHE_CHECK([number of significant virtual address bits],
AC_RUN_IFELSE([AC_LANG_PROGRAM( [je_cv_lg_vaddr],
AC_RUN_IFELSE([AC_LANG_PROGRAM(
[[ [[
#include <stdio.h> #include <stdio.h>
#ifdef _WIN32 #ifdef _WIN32
@ -461,27 +468,30 @@ typedef unsigned __int32 uint32_t;
[je_cv_lg_vaddr=`cat conftest.out`], [je_cv_lg_vaddr=`cat conftest.out`],
[je_cv_lg_vaddr=error], [je_cv_lg_vaddr=error],
[je_cv_lg_vaddr=57])) [je_cv_lg_vaddr=57]))
if test "x${je_cv_lg_vaddr}" != "x" ; then if test "x${je_cv_lg_vaddr}" != "x" ; then
LG_VADDR="${je_cv_lg_vaddr}" LG_VADDR="${je_cv_lg_vaddr}"
fi fi
if test "x${LG_VADDR}" != "xerror" ; then if test "x${LG_VADDR}" != "xerror" ; then
AC_DEFINE_UNQUOTED([LG_VADDR], [$LG_VADDR]) AC_DEFINE_UNQUOTED([LG_VADDR], [$LG_VADDR])
else else
AC_MSG_ERROR([cannot determine number of significant virtual address bits]) AC_MSG_ERROR([cannot determine number of significant virtual address bits])
fi
fi fi
;; ;;
*) *)
AC_MSG_CHECKING([number of significant virtual address bits]) if test "x$LG_VADDR" = "xdetect"; then
if test "x${LG_SIZEOF_PTR}" = "x3" ; then AC_MSG_CHECKING([number of significant virtual address bits])
LG_VADDR=64 if test "x${LG_SIZEOF_PTR}" = "x3" ; then
elif test "x${LG_SIZEOF_PTR}" = "x2" ; then LG_VADDR=64
LG_VADDR=32 elif test "x${LG_SIZEOF_PTR}" = "x2" ; then
elif test "x${LG_SIZEOF_PTR}" = "xLG_SIZEOF_PTR_WIN" ; then LG_VADDR=32
LG_VADDR="(1U << (LG_SIZEOF_PTR_WIN+3))" elif test "x${LG_SIZEOF_PTR}" = "xLG_SIZEOF_PTR_WIN" ; then
else LG_VADDR="(1U << (LG_SIZEOF_PTR_WIN+3))"
AC_MSG_ERROR([Unsupported lg(pointer size): ${LG_SIZEOF_PTR}]) else
AC_MSG_ERROR([Unsupported lg(pointer size): ${LG_SIZEOF_PTR}])
fi
AC_MSG_RESULT([$LG_VADDR])
fi fi
AC_MSG_RESULT([$LG_VADDR])
;; ;;
esac esac
AC_DEFINE_UNQUOTED([LG_VADDR], [$LG_VADDR]) AC_DEFINE_UNQUOTED([LG_VADDR], [$LG_VADDR])