Skip to content
  • Sergei Trofimovich's avatar
    fix osReserveHeapMemory block alignment · e175aaf6
    Sergei Trofimovich authored
    
    
    Before the change osReserveHeapMemory() attempted
    to allocate chunks of memory via osTryReserveHeapMemory()
    not multiple of MBLOCK_SIZE in the following fallback code:
    
    ```
        if (at == NULL) {
            *len -= *len / 8;
    ```
    
    and caused assertion failure:
    
    ```
    $ make fulltest TEST=T11607 WAY=threaded1
    T11607: internal error: ASSERTION FAILED: file rts/posix/OSMem.c, line 457
        (GHC version 8.7.20180716 for riscv64_unknown_linux)
    
    ```
    
    The change applies alignment mask before each MBLOCK allocation attempt
    and fixes WAY=threaded1 test failures on qemu-riscv64.
    
    Signed-off-by: default avatarSergei Trofimovich <slyfox@gentoo.org>
    
    Test Plan: run 'make fulltest WAY=threaded1'
    
    Reviewers: simonmar, bgamari, erikd
    
    Reviewed By: simonmar
    
    Subscribers: rwbarton, thomie, carter
    
    Differential Revision: https://phabricator.haskell.org/D4982
    e175aaf6