Resets runtime state (registers, heap, last error, call stack, program counter) but preserves upcall caches so the same image can continue to be executed. Note: because the program counter is also reset, callers need to either re-set it to a specific location or replace the image with one that resumes from the start.
(&mut self)
| 266 | /// Note: because the program counter is also reset, callers need to either re-set it to a |
| 267 | /// specific location or replace the image with one that resumes from the start. |
| 268 | pub fn clear(&mut self) { |
| 269 | self.heap.clear(); |
| 270 | self.context.clear_runtime_state(); |
| 271 | self.last_error = None; |
| 272 | self.pending_upcall = None; |
| 273 | } |
| 274 | |
| 275 | /// Clears the current error handler without affecting execution state or captured errors. |
| 276 | pub fn clear_error_handler(&mut self) { |