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

Method call_unchecked

crates/wasmtime/src/runtime/func.rs:1010–1022  ·  view source on GitHub ↗

Invokes this function in an "unchecked" fashion, reading parameters and writing results to `params_and_returns`. This function is the same as [`Func::call`] except that the arguments and results both use a different representation. If possible it's recommended to use [`Func::call`] if safety isn't necessary or to use [`Func::typed`] in conjunction with [`TypedFunc::call`] since that's both safer

(
        &self,
        mut store: impl AsContextMut,
        params_and_returns: *mut [ValRaw],
    )

Source from the content-addressed store, hash-verified

1008 /// These invariants are all upheld for you with [`Func::call`] and
1009 /// [`TypedFunc::call`].
1010 pub unsafe fn call_unchecked(
1011 &self,
1012 mut store: impl AsContextMut,
1013 params_and_returns: *mut [ValRaw],
1014 ) -> Result<()> {
1015 let mut store = store.as_context_mut();
1016 let func_ref = self.vm_func_ref(store.0);
1017 let params_and_returns = NonNull::new(params_and_returns).unwrap_or(NonNull::from(&mut []));
1018
1019 // SAFETY: the safety of this function call is the same as the contract
1020 // of this function.
1021 unsafe { Self::call_unchecked_raw(&mut store, func_ref, params_and_returns) }
1022 }
1023
1024 pub(crate) unsafe fn call_unchecked_raw<T>(
1025 store: &mut StoreContextMut<'_, T>,

Callers 5

bench_host_to_wasmFunction · 0.80
call_wrapped_funcFunction · 0.80
call_impl_do_callMethod · 0.80
thread_new_indirectMethod · 0.80

Calls 4

fromFunction · 0.85
vm_func_refMethod · 0.80
newFunction · 0.50
as_context_mutMethod · 0.45

Tested by 1

call_wrapped_funcFunction · 0.64