Skip to content
  • bitonic's avatar
    Make start address of `osReserveHeapMemory` tunable via command line -xb · 1b5f9207
    bitonic authored and Tamar Christina's avatar Tamar Christina committed
    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
    1b5f9207