MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / do_func_call_async

Function do_func_call_async

crates/c-api/src/async.rs:223–246  ·  view source on GitHub ↗
(
    #[cfg(feature = "gc")] mut store: wasmtime::RootScope<WasmtimeStoreContextMut<'_>>,
    #[cfg(not(feature = "gc"))] mut store: WasmtimeStoreContextMut<'_>,
    func: &Func,
    args: impl ExactS

Source from the content-addressed store, hash-verified

221}
222
223async fn do_func_call_async(
224 #[cfg(feature = "gc")] mut store: wasmtime::RootScope<WasmtimeStoreContextMut<'_>>,
225 #[cfg(not(feature = "gc"))] mut store: WasmtimeStoreContextMut<'_>,
226 func: &Func,
227 args: impl ExactSizeIterator<Item = Val>,
228 results: &mut [MaybeUninit<wasmtime_val_t>],
229 trap_ret: &mut *mut wasm_trap_t,
230 err_ret: &mut *mut wasmtime_error_t,
231) {
232 let mut params = mem::take(&mut store.as_context_mut().data_mut().wasm_val_storage);
233 let (wt_params, wt_results) = translate_args(&mut params, args, results.len());
234 let result = func.call_async(&mut store, wt_params, wt_results).await;
235
236 match result {
237 Ok(()) => {
238 for (slot, val) in results.iter_mut().zip(wt_results.iter()) {
239 crate::initialize(slot, wasmtime_val_t::from_val(&mut store, *val));
240 }
241 params.truncate(0);
242 store.as_context_mut().data_mut().wasm_val_storage = params;
243 }
244 Err(err) => handle_call_error(err, trap_ret, err_ret),
245 }
246}
247
248#[unsafe(no_mangle)]
249pub unsafe extern "C" fn wasmtime_func_call_async<'a>(

Callers 1

wasmtime_func_call_asyncFunction · 0.85

Calls 10

translate_argsFunction · 0.85
handle_call_errorFunction · 0.85
initializeFunction · 0.70
data_mutMethod · 0.45
as_context_mutMethod · 0.45
lenMethod · 0.45
call_asyncMethod · 0.45
iter_mutMethod · 0.45
iterMethod · 0.45
truncateMethod · 0.45

Tested by

no test coverage detected