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

Method call

pulley/src/interp.rs:69–89  ·  view source on GitHub ↗

Call a bytecode function. The given `func` must point to the beginning of a valid Pulley bytecode function. The given `args` must match the number and type of arguments that function expects. The given `rets` must match the function's actual return types. Returns either the resulting values, or the PC at which a trap was raised.

(
        &'a mut self,
        func: NonNull<u8>,
        args: &[Val],
        rets: T,
    )

Source from the content-addressed store, hash-verified

67 /// Returns either the resulting values, or the PC at which a trap was
68 /// raised.
69 pub unsafe fn call<'a, T>(
70 &'a mut self,
71 func: NonNull<u8>,
72 args: &[Val],
73 rets: T,
74 ) -> DoneReason<impl Iterator<Item = Val> + use<'a, T>>
75 where
76 T: IntoIterator<Item = RegType> + 'a,
77 {
78 unsafe {
79 let lr = self.call_start(args);
80
81 match self.call_run(func) {
82 DoneReason::ReturnToHost(()) => DoneReason::ReturnToHost(self.call_end(lr, rets)),
83 DoneReason::Trap { pc, kind } => DoneReason::Trap { pc, kind },
84 DoneReason::CallIndirectHost { id, resume } => {
85 DoneReason::CallIndirectHost { id, resume }
86 }
87 }
88 }
89 }
90
91 /// Performs the initial part of [`Vm::call`] in setting up the `args`
92 /// provided in registers according to Pulley's ABI.

Callers 15

func_wrap_host_buf_apiFunction · 0.45
take_and_return_list_u8Function · 0.45
bench_wasiFunction · 0.45
duration_of_callFunction · 0.45
bench_host_to_wasmFunction · 0.45
bench_instanceFunction · 0.45
same_calleeFunction · 0.45
different_calleesFunction · 0.45
parseMethod · 0.45
runFunction · 0.45

Calls 4

call_startMethod · 0.80
call_runMethod · 0.80
call_endMethod · 0.80
as_ptrMethod · 0.45

Tested by 1

runFunction · 0.36