Auto-generate the hostcalls module of wasi-common#846
Auto-generate the hostcalls module of wasi-common#846alexcrichton merged 9 commits intobytecodealliance:masterfrom
hostcalls module of wasi-common#846Conversation
kubkon
left a comment
There was a problem hiding this comment.
LGTM, just a couple of questions. Also, just an FYI so that we don't duplicate the effort that @pchickey and myself are currently working on an upgraded version of wig, the wiggle crate which should help us use the polyfill functionality of the witx crate to generate wasi_unstable and any future snapshots in a way that almost completely removes any unnecessary duplication in hostcalls implementation, etc. It should also help us auto-generate the memory.rs module.
Oh, and the link to |
This commit is effectively just doing what bytecodealliance#707 already did, but applying it to the `snapshot_0` module as well. The end result is the same, where we cut down on all the boilerplate in `snapshot_0` and bring it in line with the main `wasi_snapshot_preview1` implementation. The goal here is to make it easier to change the two in tandem since they're both doing the same thing.
This commit migrates the `hostcalls` module to being auto-generated by a macro rather than duplicating a handwritten signature for each wasi syscall.
Similar to the previous commit, but for `snapshot_0`
This is no longer needed with the hostcalls macro now, we can easily fold the definition of the cbindgen macro into the same crate.
3477bf8 to
2a90a98
Compare
Nice! I'm happy to go whichever way here, was just eager to help cut down on more boilerplate, and I also needed this for a refactoring of the |
This commit updates the
wasi-commoncrate to remove a souce of duplication from the*.witxfiles to what's listed in the source. Ideally we're now getting to the point where adding a WASI API means you update the*.witxfile, then you write an implementation, then you're done. No further shims you need to write!Some changes in this PR are:
wasi_unstablemodule #845hostcallsmodule, both for the current snapshot and old snapshot, are entirely generated from the*.witxfiles.&mut WasiCtxis required everywhere instead of sometimes using&WasiCtxand sometimes&mut WasiCtx. Note that the handwritten bindings continue to use a mixture.wasi-common-cbindgencrate has been removed since its functionality is easy enough to fold into the existing macro.The general goal here is to continue to reduce duplication between all the WASI API definitions, ensuring that there's one source of truth for the signature and once source of truth for the implementation, and everything in the middle is auto-generated as necessary.