diff --git a/configure.ac b/configure.ac index f3c7c773d9eb0469b4fe84c3ac9d34990f88114a..df17cbe5d98cc841db6ce57054116d6a148e8e7a 100644 --- a/configure.ac +++ b/configure.ac @@ -1059,61 +1059,6 @@ AC_COMPILE_IFELSE( AC_DEFINE([CC_SUPPORTS_TLS],[0],[Define to 1 if __thread is supported]) ]) -dnl large address space support (see rts/include/rts/storage/MBlock.h) -dnl -dnl Darwin has vm_allocate/vm_protect -dnl Linux has mmap(MAP_NORESERVE)/madv(MADV_DONTNEED) -dnl FreeBSD, Solaris and maybe other have MAP_NORESERVE/MADV_FREE -dnl (They also have MADV_DONTNEED, but it means something else!) -dnl -dnl Windows has VirtualAlloc MEM_RESERVE/MEM_COMMIT, however -dnl it counts page-table space as committed memory, and so quickly -dnl runs out of paging file when we have multiple processes reserving -dnl 1TB of address space, we get the following error: -dnl VirtualAlloc MEM_RESERVE 1099512676352 bytes failed: The paging file is too small for this operation to complete. -dnl - -AC_ARG_ENABLE(large-address-space, - [AS_HELP_STRING([--enable-large-address-space], - [Use a single large address space on 64 bit systems (enabled by default on 64 bit platforms)])], - EnableLargeAddressSpace=$enableval, - EnableLargeAddressSpace=yes -) - -use_large_address_space=no -if test "$ac_cv_sizeof_void_p" -eq 8 ; then - if test "x$EnableLargeAddressSpace" = "xyes" ; then - if test "$ghc_host_os" = "darwin" ; then - use_large_address_space=yes - elif test "$ghc_host_os" = "openbsd" ; then - # as of OpenBSD 5.8 (2015), OpenBSD does not support mmap with MAP_NORESERVE. - # The flag MAP_NORESERVE is supported for source compatibility reasons, - # but is completely ignored by OS mmap - use_large_address_space=no - elif test "$ghc_host_os" = "mingw32" ; then - # as of Windows 8.1/Server 2012 windows does no longer allocate the page - # tabe for reserved memory eagerly. So we are now free to use LAS there too. - use_large_address_space=yes - else - AC_CHECK_DECLS([MAP_NORESERVE, MADV_FREE, MADV_DONTNEED],[],[], - [ - #include <unistd.h> - #include <sys/types.h> - #include <sys/mman.h> - #include <fcntl.h> - ]) - if test "$ac_cv_have_decl_MAP_NORESERVE" = "yes" && - test "$ac_cv_have_decl_MADV_FREE" = "yes" || - test "$ac_cv_have_decl_MADV_DONTNEED" = "yes" ; then - use_large_address_space=yes - fi - fi - fi -fi -if test "$use_large_address_space" = "yes" ; then - AC_DEFINE([USE_LARGE_ADDRESS_SPACE], [1], [Enable single heap address space support]) -fi - GHC_ADJUSTORS_METHOD([Target]) AC_SUBST([UseLibffiForAdjustors]) diff --git a/rts/configure.ac b/rts/configure.ac index 5ccf7c6df05f8d8030e7b375d4f9a577a8476c49..54bc0630e93a97c1c5a2bc23859124bf80aaca3e 100644 --- a/rts/configure.ac +++ b/rts/configure.ac @@ -33,6 +33,62 @@ GHC_CONVERT_PLATFORM_PARTS([host], [Host]) FPTOOLS_SET_PLATFORM_VARS([host], [Host]) FPTOOLS_SET_HASKELL_PLATFORM_VARS([Host]) +dnl large address space support (see rts/include/rts/storage/MBlock.h) +dnl +dnl Darwin has vm_allocate/vm_protect +dnl Linux has mmap(MAP_NORESERVE)/madv(MADV_DONTNEED) +dnl FreeBSD, Solaris and maybe other have MAP_NORESERVE/MADV_FREE +dnl (They also have MADV_DONTNEED, but it means something else!) +dnl +dnl Windows has VirtualAlloc MEM_RESERVE/MEM_COMMIT, however +dnl it counts page-table space as committed memory, and so quickly +dnl runs out of paging file when we have multiple processes reserving +dnl 1TB of address space, we get the following error: +dnl VirtualAlloc MEM_RESERVE 1099512676352 bytes failed: The paging file is too small for this operation to complete. +dnl + +AC_ARG_ENABLE(large-address-space, + [AS_HELP_STRING([--enable-large-address-space], + [Use a single large address space on 64 bit systems (enabled by default on 64 bit platforms)])], + EnableLargeAddressSpace=$enableval, + EnableLargeAddressSpace=yes +) + +use_large_address_space=no +AC_CHECK_SIZEOF([void *]) +if test "$ac_cv_sizeof_void_p" -eq 8 ; then + if test "x$EnableLargeAddressSpace" = "xyes" ; then + if test "$ghc_host_os" = "darwin" ; then + use_large_address_space=yes + elif test "$ghc_host_os" = "openbsd" ; then + # as of OpenBSD 5.8 (2015), OpenBSD does not support mmap with MAP_NORESERVE. + # The flag MAP_NORESERVE is supported for source compatibility reasons, + # but is completely ignored by OS mmap + use_large_address_space=no + elif test "$ghc_host_os" = "mingw32" ; then + # as of Windows 8.1/Server 2012 windows does no longer allocate the page + # tabe for reserved memory eagerly. So we are now free to use LAS there too. + use_large_address_space=yes + else + AC_CHECK_DECLS([MAP_NORESERVE, MADV_FREE, MADV_DONTNEED],[],[], + [ + #include <unistd.h> + #include <sys/types.h> + #include <sys/mman.h> + #include <fcntl.h> + ]) + if test "$ac_cv_have_decl_MAP_NORESERVE" = "yes" && + test "$ac_cv_have_decl_MADV_FREE" = "yes" || + test "$ac_cv_have_decl_MADV_DONTNEED" = "yes" ; then + use_large_address_space=yes + fi + fi + fi +fi +if test "$use_large_address_space" = "yes" ; then + AC_DEFINE([USE_LARGE_ADDRESS_SPACE], [1], [Enable single heap address space support]) +fi + dnl ** Use MMAP in the runtime linker? dnl --------------------------------------------------------------