Remove need for explicit `Config::async_support` knob (#12371)* Refactor component model host function definitionsPush the `async`-ness down one layer.* Remove need for explicit `Config::async
Remove need for explicit `Config::async_support` knob (#12371)* Refactor component model host function definitionsPush the `async`-ness down one layer.* Remove need for explicit `Config::async_support` knobThis commit is an attempt to step towards reconciling "old async" and"new async" in Wasmtime. The old async style is the original asyncsupport in Wasmtime with `call_async`, `func_wrap_async`, etc, where themain property is that the store is "locked" during an async operation.Put another way, a store can only execute at most one async operation ata time. This is in contrast to "new async" support in Wasmtime with thecomponent-model-async (WASIp3) support, where stores can have more thanone async operation in flight at once.This commit does not fully reconcile these differences, but it doesremove one hurdle along the way: `Config::async_support`. Since thebeginning of Wasmtime this configuration knob has existed to explicitlydemarcate a config/engine/store as "this thing requires `async` stuffinternally." This has started to make less and less sense over timewhere the line between sync and async has become more murky with WASIp3where the two worlds comingle. The goal of this commit is to deprecate`Config::async_support` and make the function not actually do anything.In isolation this can't simply be done, however, because there are manyload-bearing aspects of Wasmtime that rely on this `async_support` knob.For example once epochs + yielding are enabled it's required that allWasm is executed on a fiber lest it hit an epoch and not know how toyield. That means that this commit is not a simple removal of`async_support` but instead a refactoring/rearchitecting of how async isused internally within Wasmtime. The high-level ideas within Wasmtimenow are:* A `Store` has a "requires async" boolean stored within it.* All configuration options which end up requiring async, such as yielding with epochs, turn this boolean on.* Creation of host functions which use async (e.g. `func_wrap_{async,concurrent}`) will also turn this option on.* Synchronous API entrypoints into Wasmtime ensure that this boolean is disabled.* Asynchronous APIs are usable at any time.This means that the concept of an async store vs a sync store is nowgone. All stores are equally capable of executing sync/async, and thechange now is that dynamically some stores will require that async isused with certain configuration. Additionally all panicking conditionsaround `async_support` have been converted to errors instead. Allrelevant APIs already returned an error and things are murky enough nowthat it's not necessarily trivial to get this right at the embedderlevel. In the interest of avoiding panics all detected async mismatchesare now first-class `wasmtime::Error` values.The end result of this commit is that `Config::async_support` is adeprecated `#[doc(hidden)]` function that does nothing. While manyinternal changes happened as well as having new tests for all this sortof behavior this is not expected to have a great impact on externalconsumers. In general a deletion of `async_support(true)` is in theoryall that's required. This is intended to make it easier to think aboutasync/sync/etc in the future with WASIp3 and eventually reconcile`func_wrap_async` and `func_wrap_concurrent` for example. That's leftfor future refactorings however.prtest:full* Review comments* Fix CI failures
show more ...
Migrate the Wasmtime CLI to `wasmtime::error` (#12295)* Migrate wasmtime-cli to `wasmtime::error`* migrate benches to `wasmtime::error` as well* Remove new usage of anyhow that snuck in
Rename "preview{0,1}" in `wasmtime-wasi` to "p{0,1}" (#11380)* Rename "preview{0,1}" in `wasmtime-wasi` to "p{0,1}"This commit renames the `preview1` module and features to `p1` and doesthe same
Rename "preview{0,1}" in `wasmtime-wasi` to "p{0,1}" (#11380)* Rename "preview{0,1}" in `wasmtime-wasi` to "p{0,1}"This commit renames the `preview1` module and features to `p1` and doesthe same for `preview0`. This additionally cleans up the test suite abit to share more code amongst all the implementaitons and to also movethe p1 tests out of the p2 folder.This additionally adds a `p2` feature to the `wasmtime-wasi` crate butit does not currently gate the `p2` module because that'll require somemore refactoring an annotations to get that working.* Fix build of the CLI* Fix build of the C API* Fix bench-api build* Fix build of examples* More renamings
Unify WASIp{2,3} context structures (#11370)This removes `wasmtime_wasi::p{2,3}::{WasiCtx, WasiCtxBuilder,WasiView}` in favor of only having `wasmtime_wasi::{WasiCtx,WasiCtxBuilder, WasiView}` in
Unify WASIp{2,3} context structures (#11370)This removes `wasmtime_wasi::p{2,3}::{WasiCtx, WasiCtxBuilder,WasiView}` in favor of only having `wasmtime_wasi::{WasiCtx,WasiCtxBuilder, WasiView}` instead. Conceptually these revisions of WASIall provide the same functionality just with a different veneer that thecomponent model offers, so having only one way to configure host-sidebehavior will make it easier to both organize implementations internally(e.g. more sharing of code) as well as for embedders to configure (onlyone context to create/manage).
refactor: move wasip2 implementation to `wasmtime_wasi::p2` (#10073)* refactor: move `wasmtime-wasi` p2-specific functionality to `p2`Signed-off-by: Roman Volosatovs <[email protected]>* d
refactor: move wasip2 implementation to `wasmtime_wasi::p2` (#10073)* refactor: move `wasmtime-wasi` p2-specific functionality to `p2`Signed-off-by: Roman Volosatovs <[email protected]>* doc: move some of the p2 comments to top-levelSigned-off-by: Roman Volosatovs <[email protected]>* chore: shorten `network` and `filesystem` module namesSigned-off-by: Roman Volosatovs <[email protected]>---------Signed-off-by: Roman Volosatovs <[email protected]>
Revamp wasi example and related docs (#9788)* update examples/wasi/main.rs and related doc with a runtime issue* simplify building instruction* fix runtime issue* add a comment and cargo fmt
Revamp wasi example and related docs (#9788)* update examples/wasi/main.rs and related doc with a runtime issue* simplify building instruction* fix runtime issue* add a comment and cargo fmt* revamped wasi-async* remove the example of custom host states and add references* add calling function dynamically* cargo fmt* add post_return* update wording* add expects* change wording from "module" to "component"* fix CMakeLists.txt* compile wasi example with wasip1 to make the outdated WASIp1 C example happy* rename wasi examples* fix wording* fix format* add wasm32-wasip2 target* Revert "add wasm32-wasip2 target"This reverts commit 0aa610f6ce8c2617889238db2961f545b661ca27.* add wasm32-wasip2 target for test_capi job