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

Method start_raw

crates/wasmtime/src/runtime/instance.rs:359–380  ·  view source on GitHub ↗
(&self, store: &mut StoreContextMut<'_, T>)

Source from the content-addressed store, hash-verified

357 }
358
359 fn start_raw<T>(&self, store: &mut StoreContextMut<'_, T>) -> Result<()> {
360 // If a start function is present, invoke it. Make sure we use all the
361 // trap-handling configuration in `store` as well.
362 let store_id = store.0.id();
363 let (mut instance, registry) = self.id.get_mut_and_module_registry(store.0);
364 // SAFETY: the `store_id` is the id of the store that owns this
365 // instance and any function stored within the instance.
366 let f = unsafe {
367 instance
368 .as_mut()
369 .get_startup_func(registry, store_id)
370 .expect("should have a startup function")
371 };
372 let caller_vmctx = instance.vmctx();
373 unsafe {
374 let funcref = f.vm_func_ref(store.0);
375 super::func::invoke_wasm_and_catch_traps(store, |_default_caller, vm| {
376 VMFuncRef::array_call(funcref, vm, caller_vmctx, NonNull::from(&mut []))
377 })?;
378 }
379 Ok(())
380 }
381
382 /// Get this instance's module.
383 pub fn module<'a, T: 'static>(&self, store: impl Into<StoreContext<'a, T>>) -> &'a Module {

Callers 1

new_startedMethod · 0.80

Calls 10

fromFunction · 0.85
OkFunction · 0.85
get_startup_funcMethod · 0.80
vm_func_refMethod · 0.80
idMethod · 0.45
expectMethod · 0.45
as_mutMethod · 0.45
vmctxMethod · 0.45

Tested by

no test coverage detected