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)
| 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 | /// |