Showing the changes to src/vm/stack.cpp (1 of 5 files). Show all
Unified · Split
| @@ -295,24 +295,3 @@ vm_frame_t *vm_stack_t::peek_frame() const · 294 unmodified lines | |||
| 295 | auto layout = dynamic_cast<vm_stack_layout *>(_mem.get()); | 295 | auto layout = dynamic_cast<vm_stack_layout *>(_mem.get()); |
| 296 | return layout->top_frame; | 296 | return layout->top_frame; |
| 297 | } | 297 | } |
| 298 | |||
| 299 | void vm_stack_t::walk_stack(vm_stack_walk_callback_t callback) const | ||
| 300 | { | ||
| 301 | if (callback == nullptr) | ||
| 302 | return; | ||
| 303 | |||
| 304 | auto layout = dynamic_cast<vm_stack_layout *>(_mem.get()); | ||
| 305 | auto current_page = layout->top_page; | ||
| 306 | auto current_frame = layout->top_frame; | ||
| 307 | |||
| 308 | while (current_page != nullptr && current_frame != nullptr) | ||
| 309 | { | ||
| 310 | if (!callback(current_frame, current_page)) | ||
| 311 | break; | ||
| 312 | |||
| 313 | current_frame = current_frame->prev_frame(); | ||
| 314 | |||
| 315 | if (!current_page->contains_frame(current_frame)) | ||
| 316 | current_page = current_page->prev_page; | ||
| 317 | } | ||
| 318 | } | ||