Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implementing a wasmer backend for wiggle #2949

Closed
Michael-F-Bryan opened this issue May 28, 2021 · 3 comments
Closed

Implementing a wasmer backend for wiggle #2949

Michael-F-Bryan opened this issue May 28, 2021 · 3 comments

Comments

@Michael-F-Bryan
Copy link

Michael-F-Bryan commented May 28, 2021

We are currently using wasmer as a WebAssembly runtime and I'd like to simplify the way host functions are done by using WITX as an interface definition language and generating guest/host bindings with wiggle.

Is there a list of things I would need to do in order to implement a wasmer-wiggle crate? Or could you point me to a list of resources I can use as a starting point?

@bjorn3
Copy link
Contributor

bjorn3 commented May 28, 2021

Based on the source of wiggle-wasmtime I think you need to first implement wiggle::GuestMemory and then make a macro like https://github.com/bytecodealliance/wasmtime/blob/33c791e1f54c585a002ca244ac8ce2ef01a9cc34/crates/wiggle/wasmtime/macro/src/lib.rs to register the host functions to wasmer and create wrapper functions for calling into wasm.

@pchickey
Copy link
Contributor

I'm not familiar with how wasmer works so you'll mostly be on your own for this. You might be able to port wiggle today, but you may end up having to fork it in the long run depending on what your goals are.

In addition to wiggle-wasmtime you can also use the sources of lucet-wiggle as a reference: https://github.com/bytecodealliance/lucet/tree/main/lucet-wiggle Note that wiggle use in the lucet repo is currently based on a newer version of wiggle that is landing soon in #2897. Note that another change in 2897 is folding wiggle-wasmtime functionality straight into the wiggle crate - doesn't make a big difference for now besides erasing some crates by using cargo features for optional functionality instead.

Wasmtime has nearly subsumed Lucet in our (Fastly) production use. Once we have EOL'd Lucet, we intend to refactor wiggle to specialize it to just work with Wasmtime. Having wiggle factored to support two different runtimes makes it harder to read & write, among other design compromises we've been forced into. So, wiggle may end up evolving so that it is not viable to use on a different engine. Additionally, there is ongoing work to evolve the witx language and define the first ABI for Interface Types (WebAssembly/WASI#422, WebAssembly/interface-types#132), and we'll be evolving wiggle to support those developments as well.

@alexcrichton
Copy link
Member

I'm going to close this since wiggle is unsable enough that we're not going to be adding this to this repository. The wiggle infrastructure is not slated to suvive indefinitely as it's intended to be supplanted with wit-bindgen in the future as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants