Hi everyone,
I would like to ask for a rough plan on generating and running some wasm code in a rust application.
I made an attempt with binaryen js api to generate a wasm module and run it on the browser but it is problematic, to say the least.
Basically need something similar to IR-construction parts of binaryen before passing the module to wasmtime. Does that make some sense?
Would wasm-encoder be applicable here?
That sounds quite good! Thank you!
May I also ask if the embedding of wasmtime in a rust program as in [example] will allow me to recover from a crashing guest program?
[1]: https://docs.wasmtime.dev/examples-rust-hello-world.html
Yes, a guest program that traps is surfaced the API as an error that you can handle.
See this example, for example.
Very good! That should be enough for me to get a prototype.
If it is not so much of a bother, I would also like to pick your brain about how a debugger might work with or around wasmtime. Last years progress report suggested some work is going on around debugger but I can't really imagine what is involved in that.
I'm not current on that myself, but you might try asking in the SIG-debugging channel.
Gratitude!
regarding debugging, the vague plan is https://hackmd.io/@hvqFkDgPTuGNcu-NiycXZQ/SyXX166Yp?type=slide#/ and @Trevor Elliott is going to take over making an RFC to concretize more of that stuff and get consensus on it as an official plan of record. in the meantime, he is pushing on Winch completeness, which is a bit of pre-requisite for that debugging plan
@ibrahim As an alternate path to consider / compare: I'm a fan of using Walrus to build the Wasm program in Rust and then generate the binary for execution on Wasmtime. It has a pretty reasonable IR and is really quite pleasant for doing rewrite passes.
Last updated: Nov 22 2024 at 16:03 UTC