wasm web/wasi target
Probable issues:
- External lib (maybe wasm build exists for some?): libpcre, mimalloc (can be turned of
-Duse_mimalloc=false) - VM tail call not supported: the VM does not uses a big switch to dispatch opcode but tailcalls, this does not seem to be supported by llvm_stage2 for the wasm64-wasi target
- JIT must be turned off (
-Djit=false) - Targeting wasm32 would require NaN boxing to operate on a
u32rather than au64 std.DynLibhas no implementation for wasm- That would require std libs to not be built as shared libraries but bundled with buzz exe
Are there any plans for compiling buzz to wasm directly? Assuming this ticket is to just allow the buzz interpreter to run within wasm?
Not sure what you mean? buzz can only run within wasm if built for wasm.
Ah sorry, I meant creating something like a new RunFlavor that compiles buzz to wasm (similar to assemblyscript).
For example:
// main.buzz
import "std";
fun main([str] _) > void {
print("hello, world");
}
$ buzz -target=wasi_wasm32 -out=main.wasm main.buzz
$ wasmer main.wasm # hello world
This is most likely out of scope for the project, but I was just curious if this is a plan for the future.
Yes this is out of scope. That would require buzz to become an AOT compiled language.
Reopening because of https://ziglang.org/download/0.12.0/release-notes.html#Bring-Your-Own-OS-API-Layer-Regressed which effectively kills this feature