Stream: general

Topic: Visual Language based on wasm


view this post on Zulip ibrahim (Feb 29 2024 at 21:39):

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?

view this post on Zulip Dan Gohman (Feb 29 2024 at 21:42):

Would wasm-encoder be applicable here?

view this post on Zulip ibrahim (Feb 29 2024 at 21:51):

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

view this post on Zulip Dan Gohman (Feb 29 2024 at 21:53):

Yes, a guest program that traps is surfaced the API as an error that you can handle.

view this post on Zulip Dan Gohman (Feb 29 2024 at 21:53):

See this example, for example.

view this post on Zulip ibrahim (Feb 29 2024 at 22:00):

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.

view this post on Zulip Dan Gohman (Feb 29 2024 at 22:01):

I'm not current on that myself, but you might try asking in the SIG-debugging channel.

view this post on Zulip ibrahim (Feb 29 2024 at 22:03):

Gratitude!

view this post on Zulip fitzgen (he/him) (Mar 01 2024 at 13:48):

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

View the slide with "Slide Mode".

view this post on Zulip akesling (Mar 06 2024 at 19:31):

@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.

Walrus is a WebAssembly transformation library ๐ŸŒŠ๐Ÿ˜. Contribute to rustwasm/walrus development by creating an account on GitHub.

Last updated: Dec 23 2024 at 12:05 UTC