Stream: wasi

Topic: wasi in the browser


view this post on Zulip bjorn3 (Sep 05 2021 at 15:19):

I cleaned up a pure javascript wasi shim for in the browser I wrote a while back: https://github.com/bjorn3/browser_wasi_shim It is far from feature complete, but it is able to run programs that don't interface with the os too much, like a rustc compiled to wasi.

A WASI shim for in the browser. Contribute to bjorn3/browser_wasi_shim development by creating an account on GitHub.

view this post on Zulip fitzgen (he/him) (Sep 07 2021 at 18:31):

out of curiosity, how did you get rustc working on wasi? I was under the impression that basically the first thing rustc does is spawn a thread where the real work is done and that trying to make rustc use just the main thread would be quite difficult

would be great to add rustc as a benchmark to sightglass

view this post on Zulip bjorn3 (Sep 07 2021 at 18:40):

making rustc use the main thread is a matter of removing a thread::spawn. making it work on the main thread soundly when running more than 1 compilation session is less easy, but this only runs a single compilation session, so it is fine.

view this post on Zulip bjorn3 (Sep 07 2021 at 18:43):

as for the how to patch it exactly see https://github.com/rust-lang/miri/issues/722#issuecomment-819831196. The only difference in my case is that the rustc is older and I used cg_clif instead of miri. At one point I had a matching sysroot and was able to compile a hello world to x86_64 excluding linking, but I deleted it it seems.

Compiling the whole Rustc to WASM is a pretty big undertaking for many reasons. However, Miri doesn't need an actual codegen and many other parts of the whole Rustc, so I wonder how realistic i...

view this post on Zulip Dan Gohman (Sep 08 2021 at 00:46):

This is cool, thanks for posting this!


Last updated: Nov 22 2024 at 17:03 UTC