[commit: ghc] master: Make start address of `osReserveHeapMemory` tunable via command line -xb (1b5f920)

git at git.haskell.org git at git.haskell.org
Fri Sep 9 17:26:27 UTC 2016


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/1b5f9207a649a64a1bba20b0283253425f9208d7/ghc

>---------------------------------------------------------------

commit 1b5f9207a649a64a1bba20b0283253425f9208d7
Author: Francesco Mazzoli <f at mazzo.li>
Date:   Fri Sep 9 18:15:49 2016 +0100

    Make start address of `osReserveHeapMemory` tunable via command line -xb
    
    Summary:
    We stumbled upon a case where an external library (OpenCL) does not work
    if a specific address (0x200000000) is taken.
    
    It so happens that `osReserveHeapMemory` starts trying to mmap at 0x200000000:
    
    ```
            void *hint = (void*)((W_)8 * (1 << 30) + attempt * BLOCK_SIZE);
            at = osTryReserveHeapMemory(*len, hint);
    ```
    
    This makes it impossible to use Haskell programs compiled with GHC 8
    with C functions that use OpenCL.
    
    See this example ​https://github.com/chpatrick/oclwtf for a repro.
    
    This patch allows the user to work around this kind of behavior outside
    our control by letting the user override the starting address through an
    RTS command line flag.
    
    Reviewers: bgamari, Phyx, simonmar, erikd, austin
    
    Reviewed By: Phyx, simonmar
    
    Subscribers: rwbarton, thomie
    
    Differential Revision: https://phabricator.haskell.org/D2513


>---------------------------------------------------------------

1b5f9207a649a64a1bba20b0283253425f9208d7
 docs/users_guide/8.0.2-notes.rst |  4 ++++
 includes/stg/Types.h             |  4 ++++
 rts/RtsFlags.c                   |  5 ++++-
 rts/posix/OSMem.c                | 30 +++++++++++++++++++++++-------
 rts/sm/MBlock.c                  |  6 +++++-
 rts/sm/OSMem.h                   |  5 ++++-
 rts/win32/OSMem.c                |  9 +++++----
 7 files changed, 49 insertions(+), 14 deletions(-)

Diff suppressed because of size. To see it, use:

    git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 1b5f9207a649a64a1bba20b0283253425f9208d7


More information about the ghc-commits mailing list