[Git][ghc/ghc][wip/andreask/large_address_space] Enable large address space optimization on windows.
Andreas Klebinger
gitlab at gitlab.haskell.org
Wed Jun 17 20:11:39 UTC 2020
Andreas Klebinger pushed to branch wip/andreask/large_address_space at Glasgow Haskell Compiler / GHC
Commits:
db133589 by Andreas Klebinger at 2020-06-17T22:09:31+02:00
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.
- - - - -
3 changed files:
- configure.ac
- docs/users_guide/8.12.1-notes.rst
- rts/win32/OSMem.c
Changes:
=====================================
configure.ac
=====================================
@@ -1217,11 +1217,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],[],[],
[
=====================================
docs/users_guide/8.12.1-notes.rst
=====================================
@@ -21,11 +21,11 @@ Highlights
* Pattern-Match Coverage Checking
- - The revamp of the pattern-match coverage checker that started in 8.10 concludes with this release and implements the
+ - The revamp of the pattern-match coverage checker that started in 8.10 concludes with this release and implements the
novel `*Lower Your Guards* <https://www.microsoft.com/en-us/research/uploads/prod/2020/03/lyg.pdf>`_ algorithm.
- Compared to 8.10, end users might notice improvements to "long-distance information": :: haskell
- :linenos:
+ :linenos:
f True = 1
f x = ... case x of { False -> 2; True -> 3 } ...
@@ -158,6 +158,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
~~~~~~~~~~~~~~~~
=====================================
rts/win32/OSMem.c
=====================================
@@ -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");
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/db133589ad7fdd2d5c34a46853108db7fc261b17
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/db133589ad7fdd2d5c34a46853108db7fc261b17
You're receiving this email because of your account on gitlab.haskell.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20200617/72f4796d/attachment-0001.html>
More information about the ghc-commits
mailing list