Reimplement wasmtime-wasi
on top of wasmtime
#899
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This commit reimplements the
wasmtime-wasi
crate on top of thewasmtime
API crate, instead of being placed on top of thewasmtime-*
family of internal crates. The purpose here is to continue to exercise
the API as well as avoid usage of internals wherever possible and
instead use the safe API as much as possible.
The
wasmtime-wasi
crate's API has been updated as part of this PR aswell. The general outline of it is now:
WasiCtxBuilder
,WasiCtx
, andWasi
type.
WasiCtx*
types are reexported fromwasi-common
.Wasi
type is synthesized by thewig
crate's procedural macroWasi
type exposes one constructor which takes aStore
and aWasiCtx
, and produces aWasi
Wasi
struct fields for all the exported functions in that wasimodule. They're all public an they all have type
wasmtime::Func
Wasi
type has aget_export
method to fetch an struct field byname.
The intention here is that we can continue to make progress on #727 by
integrating WASI construction into the
Instance::new
experience, butit requires everything to be part of the same system!
The main oddity required by the
wasmtime-wasi
crate is that it needsaccess to the caller's
memory
export, if any. This is currently donewith a bit of a hack and is expected to go away once interface types are
more fully baked in.