Stream: git-wasmtime

Topic: wasmtime / PR #11113 Change `wasmtime wast` to be powered...


view this post on Zulip Wasmtime GitHub notifications bot (Jun 23 2025 at 20:28):

alexcrichton opened PR #11113 from alexcrichton:wast-json to bytecodealliance:main:

This commit is a refactoring of the wasmtime-wast crate to use the json-from-wast crate added in bytecodealliance/wasm-tools#2247 instead of the wast crate directly. The primary motivation for this PR is to make spec tests more suitable for running inside of Miri. There are two primary factors in how Miri is slow with wast tests today:

The goal of this commit was to leverage json-from-wast to perform much of the heavy lifting on the host and then have a "cheap" parse step in Miri which deserializes the JSON and runs precompiled *.cwasm files. The main change then required of wasmtime-wast was to use the JSON AST as its "IR" instead of wast directly. The actual transformation of the wasmtime-wast crate isn't too bad, mostly just some refactorings here and there.

A new ./ci/miri-wast.sh script is added which first runs on native with wasmtime wast --precompile-save and then runs in Miri with wasmtime wast --precompile-load. In this manner I was able to get a number of spec test *.wast files running in Miri.

Unfortunately, though, Miri is still far too slow to run in CI. One major bottleneck is that the *.json files are pretty large and take a nontrivial amount of time to parse. Another issue is that these tests run a fair bit of code which with Miri's ~million-x slowdown. For the first problem I tried using other more-binary serialization formats but the JSON AST is unfortunately not compatible with many of them (e.g. postcard, which we use for Wasmtime, is not compatible with the JSON AST's structure in Rust types). For the latter I'm not sure what to do...

In the end I figured this might be a reasonable refactoring to go ahead and land anyway. It at least enables running *.wast tests in Miri while removing a large part of the runtime slowdown. We can in theory still allow-list some tests to run as they don't all take forever. Some future breakthrough is still going to be required though to run everything through Miri.

<!--
Please make sure you include the following information:

Our development process is documented in the Wasmtime book:
https://docs.wasmtime.dev/contributing-development-process.html

Please ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->

view this post on Zulip Wasmtime GitHub notifications bot (Jun 23 2025 at 20:29):

alexcrichton commented on PR #11113:

My rough hope here is that we can at least use this to run scripts during development, but I'm also curious what others' thoughts on this are.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 23 2025 at 21:45):

github-actions[bot] commented on PR #11113:

Subscribe to Label Action

cc @fitzgen

<details>
This issue or pull request has been labeled: "fuzzing"

Thus the following users have been cc'd because of the following labels:

To subscribe or unsubscribe from this label, edit the <code>.github/subscribe-to-label.json</code> configuration file.

Learn more.
</details>

view this post on Zulip Wasmtime GitHub notifications bot (Jun 24 2025 at 15:28):

fitzgen submitted PR review:

In general, I like the approach.

We can potentially try bincode or peekpoke or something for the serialization.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 24 2025 at 15:28):

fitzgen created PR review comment:

Can you put a comment at the top with an example usage, showing the CLI args expected and all that?

view this post on Zulip Wasmtime GitHub notifications bot (Jul 28 2025 at 20:04):

alexcrichton updated PR #11113.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 28 2025 at 20:05):

alexcrichton updated PR #11113.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 28 2025 at 20:06):

alexcrichton updated PR #11113.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 28 2025 at 20:06):

alexcrichton has marked PR #11113 as ready for review.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 28 2025 at 20:06):

alexcrichton requested wasmtime-fuzz-reviewers for a review on PR #11113.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 28 2025 at 20:06):

alexcrichton requested fitzgen for a review on PR #11113.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 28 2025 at 20:06):

alexcrichton requested wasmtime-compiler-reviewers for a review on PR #11113.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 28 2025 at 20:06):

alexcrichton requested wasmtime-core-reviewers for a review on PR #11113.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 28 2025 at 20:06):

alexcrichton requested wasmtime-default-reviewers for a review on PR #11113.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 28 2025 at 20:07):

alexcrichton commented on PR #11113:

Ok with the publication of wasm-tools this is now ready to go. I tried bincode and postcard but unfortunately neither works with the #[serde] attributes being used in json-from-wast which are done to match the wast2json output (mostly). This still ends up accelerating wast tests by a fair bit by skipping the whole compilation stage though, but there's still work to be done to improve the json parsing (or actually get it onto a binary format)

view this post on Zulip Wasmtime GitHub notifications bot (Jul 29 2025 at 14:34):

alexcrichton updated PR #11113.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 29 2025 at 16:58):

fitzgen submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 29 2025 at 20:37):

alexcrichton updated PR #11113.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 29 2025 at 20:37):

alexcrichton has enabled auto merge for PR #11113.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 29 2025 at 20:58):

alexcrichton has disabled auto merge for PR #11113.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 29 2025 at 21:14):

alexcrichton merged PR #11113.


Last updated: Dec 06 2025 at 06:05 UTC