wasmfx / wasmfxtime

A fork of wasmtime (a fast and secure runtime for WebAssembly) supporting the WasmFX instruction set
https://wasmfx.dev/
Apache License 2.0
19 stars 1 forks source link

Add windows support #180

Closed oovm closed 6 months ago

oovm commented 6 months ago

I want to study examples on Windows platform, but wasmtime cannot be compiled on Windows, missing FiberStack:

https://github.com/wasmfx/wasmfxtime/blob/b783f55bd8c287241b5a623c159aa134c9b3b9e9/crates/runtime/src/fibre/mod.rs#L18

But there is a Windows version of FiberStack:

https://github.com/wasmfx/wasmfxtime/blob/b783f55bd8c287241b5a623c159aa134c9b3b9e9/crates/fiber/src/lib.rs#L9-L22

Is there any difference between the two?

dhil commented 6 months ago

The baseline implementation may work on Windows. Try to build with cargo build --features=wasmfx_baseline. Though, no guarantees as we currently only aim to support x64 Linux. I suppose you can build it in WSL too.

oovm commented 6 months ago

I am using

[dependencies.wasmtime]
version = "*"
features = ["async", "component-model", "gc", "wasmfx_baseline"]
git = "https://github.com/wasmfx/wasmfxtime"

and

let mut config = Config::new();
{
    // FIX: exceptions proposal not enabled
    config.wasm_exceptions(true);
    // FIX: typed continuations support is not enabled
    config.wasm_typed_continuations(true);
}

But always hit

https://github.com/wasmfx/wasmfxtime/blob/e21495922436f699bc45c87e10c0cfb1e18518df/crates/wasmtime/src/runtime/vm/continuation.rs#L790

and last call was

https://github.com/wasmfx/wasmfxtime/blob/e21495922436f699bc45c87e10c0cfb1e18518df/crates/wasmtime/src/runtime/vm/libcalls.rs#L836-L847

dhil commented 6 months ago

Thanks for you patch! The whole baseline/optimized toggling is a bit of a mess (c.f. #172), something which we will clean up soon. The baseline is built directly on top of wasmtime fiber, which has Windows support, whereas with the "optimized" (should really be called development version or something like that) we use a bespoke implementation, where we are currently only developing and testing for x86_64 Linux.