-
Notifications
You must be signed in to change notification settings - Fork 2
Description
Tracking changes in the Compute ABI is currently a manual process. When this project started there was no documentation on the ABI, and I had to manually inspect the members of the fastly_sys crate, then write and link compatible function signatures in fastlike.
But now things are positioned a little bit better. With viceroy there's now a WIT description of the interface along with a plethora of wit-based tools.
There's a wit-bindgen-go program and library that can take a wasm file or a wit file and generate Go code, although that code is focused on guest programs written in Go (or TinyGo) and may not work directly, but it may be possible to use the wit package as a parser and write our own codegen based on the parsed IDL.
There are a few options for the generated code. One option would be a Go interface for every WIT interface described, and then fastlike implements those interfaces. Those interfaces could then be used to drive a second codegen pass that implements a lower level binding along with standardized logging calls. This is where we could automate lifting and lowering.
Of course, there may be a much simpler way to go about this, and there's the risk of the WIT not being comprehensive. For instance, the fastly_sys crate describes fastly_abi::init but that does not seem to be represented in the WIT description (granted, this may be by design as it's used for version negotiation between the guest program and the host).