MCPcopy Index your code
hub / github.com/endbasic/endbasic / invoke

Method invoke

core/src/vm/mod.rs:84–100  ·  view source on GitHub ↗

Invokes the pending upcall.

(self)

Source from the content-addressed store, hash-verified

82impl<'a> UpcallHandler<'a> {
83 /// Invokes the pending upcall.
84 pub async fn invoke(self) -> Result<(), UpcallError> {
85 let vm = self.vm;
86 let image = self.image;
87 let (index, first_reg, upcall_pc) = vm
88 .pending_upcall
89 .take()
90 .expect("This is only reachable when the VM has a pending upcall");
91 let (upcall, scope) = vm.prepare_upcall(image, index, first_reg, upcall_pc);
92 let result = upcall.async_exec(scope).await;
93 match vm.handle_upcall_result(image, upcall_pc, result) {
94 Ok(()) => Ok(()),
95 Err(e) => {
96 vm.park_at_eof(image);
97 Err(e)
98 }
99 }
100 }
101}
102
103/// Representation of termination states from program execution.

Callers 5

run_to_endFunction · 0.80
run_imageFunction · 0.80
execMethod · 0.80

Calls 4

prepare_upcallMethod · 0.80
handle_upcall_resultMethod · 0.80
park_at_eofMethod · 0.80
async_execMethod · 0.45

Tested by 3

run_imageFunction · 0.64