Closed rookieCookies closed 6 months ago
Miri is unable to interpret jitted code, so even if this compile error is fixed, you still wouldn't be able to run wasm modules using wasmtime inside miri. It should be possible to compile wasm modules without actually running them though once this error is fixed.
It should be possible to compile wasm modules without actually running them though once this error is fixed.
Why? Can't it run in interpret-only mode?
Why? Can't it run in interpret-only mode?
Wasmtime doesn't have an interpreter tier, unfortunately; all Wasm execution depends on running native code generated by Cranelift.
Wasmtime doesn't have an interpreter tier, unfortunately; all Wasm execution depends on running native code generated by Cranelift. Ahh, seriously? Bit unrelated to the PR but do you know of any way I can miri wasm?
If you want to run miri on some code you want to compile to wasm, you did have to use cargo miri run --target wasm32-wasi
instead of cargo run --target wasm32-wasi
. Miri currently doesn't support wasi though afaik. You can't run miri on a wasm module. Miri can only run the MIR intermediate representation of rustc. After compilation to wasm only something like valgrind which uses dynamic instrumentation and heuristics about the source language is possible. It just so happens that wasmtime already has support for something like this behind the -W wmemcheck
flag: https://github.com/bytecodealliance/wasmtime/blob/main/docs/wmemcheck.md You will need to recompile wasmtime with the wmemcheck
cargo feature enable for this and as I said it uses heuristics and doesn't catch all UB something like miri would catch. For example violations of the stacked borrows rules or invalid values are not catched.
Steps to Reproduce
wasmtime = "*"
cargo miri run
Expected Results
Miri compiles and runs successfully
Actual Results
Failed to compile because of something inside the crate itself. I looked into the module traphandlers and sure enough there is no function named that
Versions and Environment
Wasmtime version or commit: 17.0.1
Operating system: MacOS
Architecture: ARM