component model: async host function & embedding support (#5055)

* func_wrap_async typechecks

* func call async

* instantiate_async

* fixes

* async engine creation for tests

* start adding a component model test for async

* fix wrong check for async support, factor out Instance::new_started to an unchecked impl

* tests: wibbles

* component::Linker::func_wrap: replace IntoComponentFunc with directly accepting a closure

We find that this makes the Linker::func_wrap type signature much easier
to read. The IntoComponentFunc abstraction was adding a lot of weight to
"splat" a set of arguments from a tuple of types into individual
arguments to the closure. Additionally, making the StoreContextMut
argument optional, or the Result<return> optional, wasn't very
worthwhile.

* Fixes for the new style of closure required by component::Linker::func_wrap

* future of result of return

* add Linker::instantiate_async and {Typed}Func::post_return_async

* fix fuzzing generator

* note optimisation opportunity

* simplify test
This commit is contained in:
Pat Hickey
2022-10-18 13:40:57 -07:00
committed by GitHub
parent 25bc12ec82
commit 12e4a1ba18
8 changed files with 351 additions and 17 deletions

View File

@@ -1,10 +1,11 @@
use anyhow::Result;
use component_test_util::{engine, TypedFuncExt};
use component_test_util::{async_engine, engine, TypedFuncExt};
use std::fmt::Write;
use std::iter;
use wasmtime::component::Component;
use wasmtime_component_util::REALLOC_AND_FREE;
mod r#async;
mod dynamic;
mod func;
mod import;