Skip to content

rts_clearMemory needs fixing to deal with changes in !9609

After !9609 (closed) lands, rts_clearMemory is broken in wasm, regardless of whether nonmoving GC is enabled:

test.wasm: internal error: invalid closure, info=0
    (GHC version 9.7.20230308 for wasm32_unknown_wasi)
    Please report this as a GHC bug:  https://www.haskell.org/ghc/reportabug
Error: the `wizer.initialize` function trapped

Caused by:
    wasm trap: wasm `unreachable` instruction executed
    wasm backtrace:
        0: 0x12f8fd - <unknown>!abort
        1: 0x82bf2 - <unknown>!rtsFatalInternalErrorFn
        2: 0x82f31 - <unknown>!barf
        3: 0xd2ee8 - <unknown>!evacuate
        4: 0x1008d1 - <unknown>!scavenge_one
        5: 0xfffe8 - <unknown>!scavenge_mutable_list
        6: 0xffa60 - <unknown>!scavenge_capability_mut_lists
        7: 0xdb45d - <unknown>!GarbageCollect
        8: 0xaee2c - <unknown>!scheduleDoGC
        9: 0xaea15 - <unknown>!schedule
       10: 0xac128 - <unknown>!scheduleWaitThread
       11: 0x7aa2b - <unknown>!rts_inCall
       12: 0x6ea1 - <unknown>!foo
       13: 0x6f48 - <unknown>!__wizer_initialize

Given the amount of storage manager internal changes, rts_clearMemory clearly needs fixing. I'll hold off ghc-wasm-meta bumps before it's fixed again. I'll also move the test out of ffi023 and to a separate one (see #23089 (closed)), ensuring this kind of regression is caught early in CI.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information