Enable the new preview1 implementation by default #7365
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.
Currently Wasmtime has two implementations of the
wasi_snapshot_preview1
set of APIs. The now-historical implementation lives in thewasi-common
crate and the more recent implementation lives in thewasmtime-wasi
crate. The main difference is that thewasmtime-wasi
implementation is based on the implementation of preview2, meaning that the preview1 implementation is a shim in that direction. Additionally currently the preview2 implementation of preview1 is accessible via the-Spreview2
flag on the CLI.This commit updates the interpretation of the
-Spreview2
flag and the defaults around which implementation to choose. By default the preview1-built-on-preview2 implementation (the newwasmtime-wasi
implementation) is selected now. This means that thewasi-common
implementation is disabled by default. There are still two use cases to keep running thewasi-common
implementation, however:When running modules that import from
wasi_unstable
, the "snapshot" beforewasi_snapshot_preview1
, currentlywasi-common
is required. The shims to implementwasi_unstable
have not yet been implemented in thewasmtime-wasi
crate.When running with WASI threads (
-Sthreads
) the preview2 implementation does not work. This is because the preview2 implementation expects mutable access to the table which is not granted when threads are enabled.Tests using
wasi_unstable
now pass-Spreview2=n
to explicitly request the oldwasi-common
implementation. Additionally thewasi-common
implementation is still selected by default when-Sthreads
is passed (enabling the WASI threads proposal).