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

Method clear_runtime_state

core/src/vm/context.rs:387–395  ·  view source on GitHub ↗

Resets all runtime state (registers, frame pointer, call stack, error handler, and program counter) to their initial values. This completely wipes execution context. Callers that want to preserve the program counter (e.g. to continue executing the same image after resetting variables) must save and restore it themselves.

(&mut self)

Source from the content-addressed store, hash-verified

385 /// (e.g. to continue executing the same image after resetting variables) must save and restore
386 /// it themselves.
387 pub(super) fn clear_runtime_state(&mut self) {
388 self.pc = 0;
389 self.regs.fill(0);
390 self.fp = usize::from(Register::MAX_GLOBAL);
391 self.stop = None;
392 self.err_handler = ErrorHandler::None;
393 self.call_stack.clear();
394 self.yield_pending = false;
395 }
396
397 /// Starts or resumes execution of `image`.
398 ///

Callers 2

resetMethod · 0.80
clearMethod · 0.80

Calls 2

fillMethod · 0.80
clearMethod · 0.45

Tested by

no test coverage detected