summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorGiovanni Campagna <gcampagn@cs.stanford.edu>2015-07-17 11:55:49 +0100
committerSimon Marlow <marlowsd@gmail.com>2015-07-22 17:50:02 +0100
commit0d1a8d09f452977aadef7897aa12a8d41c7a4af0 (patch)
tree3e8404c7f37c77b67ca913521e6890d6491f4721 /configure.ac
parentb949c96b4960168a3b399fe14485b24a2167b982 (diff)
downloadhaskell-0d1a8d09f452977aadef7897aa12a8d41c7a4af0.tar.gz
Two step allocator for 64-bit systems
Summary: The current OS memory allocator conflates the concepts of allocating address space and allocating memory, which makes the HEAP_ALLOCED() implementation excessively complicated (as the only thing it cares about is address space layout) and slow. Instead, what we want is to allocate a single insanely large contiguous block of address space (to make HEAP_ALLOCED() checks fast), and then commit subportions of that in 1MB blocks as we did before. This is currently behind a flag, USE_LARGE_ADDRESS_SPACE, that is only enabled for certain OSes. Test Plan: validate Reviewers: simonmar, ezyang, austin Subscribers: thomie, carter Differential Revision: https://phabricator.haskell.org/D524 GHC Trac Issues: #9706
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac36
1 files changed, 36 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index 8d66f3f66a..d896c8bf48 100644
--- a/configure.ac
+++ b/configure.ac
@@ -968,6 +968,42 @@ else
fi
AC_SUBST(HavePapi)
+dnl large address space support (see includes/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
+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
+fi
+if test "$use_large_address_space" = "yes" ; then
+ AC_DEFINE([USE_LARGE_ADDRESS_SPACE], [1], [Enable single heap address space support])
+fi
+
if test "$HAVE_DOCBOOK_XSL" = "NO" ||
test "$XsltprocCmd" = ""
then