fix osReserveHeapMemory block alignment
ClosedPublic

Authored by trofi on Jul 17 2018, 6:11 PM.

Details

Summary

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)

$ make fulltest TEST=T11607 WAY=threaded1

The change applies alignment mask before each MBLOCK allocation attempt
and fixes WAY=threaded1 test failures on qemu-riscv64.

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>

Test Plan

run 'make fulltest WAY=threaded1'

Diff Detail

Repository
rGHC Glasgow Haskell Compiler
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
trofi created this revision.Jul 17 2018, 6:11 PM
simonmar accepted this revision.Jul 18 2018, 2:44 AM

Good catch.

This revision is now accepted and ready to land.Jul 18 2018, 2:44 AM
This revision was automatically updated to reflect the committed changes.