configure.ac: Allow disabling of large-address-space
authorErik de Castro Lopo <erikd@mega-nerd.com>
Tue, 25 Aug 2015 01:33:32 +0000 (11:33 +1000)
committerErik de Castro Lopo <erikd@mega-nerd.com>
Tue, 25 Aug 2015 20:54:05 +0000 (06:54 +1000)
Recent changes (commit 0d1a8d09f4) for 64 bit platforms allowed GHC
to mmap one huge (currently 1 terrabyte) memory region from which to
do its own allocations. This is enabled by default, but it would be
nice (even just from the point of view of testing) to be able to
disable this at configure time.

Test Plan: configure and grep mk/config.h for USE_LARGE_ADDRESS_SPACE

Reviewers: austin, ezyang, bgamari, rwbarton

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D1170

GHC Trac Issues: #10791

configure.ac

index e7f9144..793ec0f 100644 (file)
@@ -1066,24 +1066,34 @@ 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,
+    [AC_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 "$ghc_host_os" = "darwin" ; then
-           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
+    if test "x$EnableLargeAddressSpace" = "xyes" ; then
+        if test "$ghc_host_os" = "darwin" ; then
+            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])