Commit 03a708ba authored by Andreas Klebinger's avatar Andreas Klebinger Committed by Marge Bot

Enable large address space optimization on windows.

Starting with Win 8.1/Server 2012 windows no longer preallocates
page tables for reserverd memory eagerly, which prevented us from
using this approach in the past.

We also try to allocate the heap high in the memory space.
Hopefully this makes it easier to allocate things in the low
4GB of memory that need to be there. Like jump islands for the
linker.
parent a1f34d37
......@@ -1219,11 +1219,15 @@ 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" = "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],[],[],
[
......
......@@ -40,6 +40,11 @@ Highlights
GHC is now able to detect the case alt returning 3 as redundant.
- Some more performance improvements in edge cases.
* Windows: Use the larg address space allocator.
This improves runtime but causes increased memory usage on Windows versions
older than Win 8.1/Server 2012.
Full details
------------
......@@ -166,6 +171,12 @@ Runtime system
- Support for Windows Vista has been dropped. GHC-compiled programs now require
Windows 7 or later.
- Windows now uses the large address space allocator by default.
In extreme cases we saw improvements by up to 3% decreased runtime.
The downside is that haskell apps run on older (Pre Win-8.1/Server 2012)
systems will have higher memory footprints.
Template Haskell
~~~~~~~~~~~~~~~~
......
......@@ -459,7 +459,7 @@ void *osReserveHeapMemory (void *startAddress, W_ *len)
void *start;
heap_base = VirtualAlloc(startAddress, *len + MBLOCK_SIZE,
MEM_RESERVE, PAGE_READWRITE);
MEM_RESERVE | MEM_TOP_DOWN, PAGE_READWRITE);
if (heap_base == NULL) {
if (GetLastError() == ERROR_NOT_ENOUGH_MEMORY) {
errorBelch("out of memory");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment