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,
)
| 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. |