Stream: wasmtime

Topic: ✔ Discrepancy between Instrument an Operation


view this post on Zulip Victor Adossi (Jun 27 2024 at 19:22):

Hey all -- I'm working on updating jco (in particular to support the recent semver @since/@after changes) with the latest (unreleased IIRC)wasmtime-environ changes, I've run into an interesting difference:

There's wasm_decoder's Instruction enum

And wasmparser's Operator enum

Now they're obviously the same except for using tuple variants vs struct variants... except for the fact that wasm_encoder::Function::instruction takes only Instructions...

Is there a way to go in between these two obviously-identical types, or should I write some new code to go between? I'm pretty sure the types match up, and there are only so many that actually have associated data... But feels like I might be missing something.

⚠️ DO NOT MERGE Still a couple issues left: define_translate macro broken Instruction vs Operation use in wasmparser::for_each_operator! Compiling js-component-bindgen v1.2.4 (/home/user/code/...

view this post on Zulip Alex Crichton (Jun 27 2024 at 19:27):

This was recently implemented in wasm-tools but hasn't been published yet. The per-operator translation looks like this

CLI and Rust libraries for low-level manipulation of WebAssembly modules - bytecodealliance/wasm-tools
CLI and Rust libraries for low-level manipulation of WebAssembly modules - bytecodealliance/wasm-tools

view this post on Zulip Alex Crichton (Jun 27 2024 at 19:28):

I think you want something like this line

CLI and Rust libraries for low-level manipulation of WebAssembly modules - bytecodealliance/wasm-tools

view this post on Zulip Victor Adossi (Jun 27 2024 at 19:35):

Ah thank you for the pointer!

view this post on Zulip Victor Adossi (Jun 27 2024 at 19:37):

I might see if I can pull in that newer version of wasm-encoder and get away with using it directly!

view this post on Zulip Notification Bot (Jun 27 2024 at 19:38):

Victor Adossi has marked this topic as resolved.


Last updated: Oct 23 2024 at 20:03 UTC