Open Dale-Black opened 1 month ago
The issue is the same as the one mentioned in https://github.com/tshort/WebAssemblyCompiler.jl/issues/17#issuecomment-2170996205. Basically, the function signature is unknown and therefore it is uncallable/unrepresentable.
I can see two workaround here:
call_indirect
on func (param i32) (result i32)
call_indirect
values accordingly. I played around having a special wasmcall
intrinsic which allows users to inject custom wasm in the compiled module, here we would have call_indirect
instead:
https://github.com/Pangoraw/WasmCompiler.jl/blob/6f38c79e6f6e50cc5b2e79e371c597bd085a0550/llama.jl#L16-L17The remaining problem would be to know which functions can be called since we donot want to compile the entire Base.
Can you see a potential path for being able to compile Function types using WASM? I am interested in creating a Signals based reactive frontend, similar to leptos.rs but both WasmCompiler.jl and WebAssemblyCompiler.jl do not allow for this
Something like:
But fails to compile like:
With this error: