roc icon indicating copy to clipboard operation
roc copied to clipboard

Implement dec_alloca for Wasi

Open isaacvando opened this issue 1 year ago • 7 comments

This function needs to be implemented for wasi. https://github.com/roc-lang/roc/blob/11ecfe0bc6b225b5f40d8cee9790eec139eb720c/crates/compiler/gen_llvm/src/llvm/lowlevel.rs#L2111 The implementation may be the same as for Unix.

isaacvando avatar Jan 18 '24 03:01 isaacvando

Commented on the "new contributors" convo about this, gonna try and fix this issue

cjglo avatar Jan 18 '24 22:01 cjglo

for context, what sort of program hits this todo!()?

folkertdev avatar Jan 30 '24 17:01 folkertdev

@folkertdev A roc-wasm4 program with a Dec on the model. I just ended up using F32 instead.

isaacvando avatar Jan 30 '24 17:01 isaacvando

do you think you can make a failing test case? I'm not sure how we don't hit this in the test suite. We do run that with llvm-wasm so it should touch a lot of the surrounding code.

folkertdev avatar Jan 30 '24 20:01 folkertdev

Yeah, I will take a look later and try to make a repro

isaacvando avatar Jan 30 '24 21:01 isaacvando

@folkertdev Here's a repro

Running

roc build --target wasm32 --no-link

with

app "repro"
    packages {
        pf: "https://github.com/roc-lang/basic-cli/releases/download/0.7.0/bkGby8jb0tmZYsy2hg1E_B2QrCgcSTxdUlHtETwm5m4.tar.br",
    }
    imports [
        pf.Task,
    ]
    provides [main] to pf

main =
    foo = 10dec + 1
    Task.ok {}

yields

thread 'main' panicked at 'not implemented', crates/compiler/gen_llvm/src/llvm/lowlevel.rs:1992:17
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

isaacvando avatar Feb 01 '24 03:02 isaacvando

Sorry for the delay on this, lots of random personal life stuff.

Currently using the array of 2 64s like unix causes a parameter mismatch issue in the LLVM IR code. I think Wasi actually uses two distinct 64 bit numbers and not an array, although looking into if under the hood there is really a difference.

cjglo avatar Feb 08 '24 18:02 cjglo