Showing the changes to src/vm/execution_table.cpp (1 of 11 files). Show all
Unified · Split
| @@ -1466,7 +1466,9 @@ namespace · 1465 unmodified lines | ||
| 1466 | 1466 | r.mp_base = r.module_ref->mp_base; |
| 1467 | 1467 | } |
| 1468 | 1468 | |
| 1469 | − r.stack.pop_frame(); | |
| 1469 | + auto new_frame = r.stack.pop_frame(); | |
| 1470 | + if (new_frame == nullptr) | |
| 1471 | + r.current_thread_state = vm_thread_state_t::empty_stack; | |
| 1470 | 1472 | |
| 1471 | 1473 | if (debug::is_component_tracing_enabled<debug::component_trace_t::stack>()) |
| 1472 | 1474 | debug::log_msg(debug::component_trace_t::stack, debug::log_level_t::debug, "exit: function\n"); |
| @@ -1587,7 +1589,9 @@ namespace · 114 unmodified lines | ||
| 1587 | 1589 | vm.fork(r.thread.get_thread_id(), *r.module_ref, *spawned_frame, starting_pc); |
| 1588 | 1590 | |
| 1589 | 1591 | // After the new thread is forked pop off the argument passing frame. |
| 1590 | − r.stack.pop_frame(); | |
| 1592 | + auto new_frame = r.stack.pop_frame(); | |
| 1593 | + if (new_frame == nullptr) | |
| 1594 | + r.current_thread_state = vm_thread_state_t::empty_stack; | |
| 1591 | 1595 | } |
| 1592 | 1596 | |
| 1593 | 1597 | EXEC_DECL(mspawn) |
| @@ -1616,7 +1620,9 @@ namespace · 22 unmodified lines | ||
| 1616 | 1620 | vm.fork(r.thread.get_thread_id(), *target_module_ref, *spawned_frame, function_ref.entry_pc); |
| 1617 | 1621 | |
| 1618 | 1622 | // After the new thread is forked pop off the argument passing frame. |
| 1619 | − r.stack.pop_frame(); | |
| 1623 | + auto new_frame = r.stack.pop_frame(); | |
| 1624 | + if (new_frame == nullptr) | |
| 1625 | + r.current_thread_state = vm_thread_state_t::empty_stack; | |
| 1620 | 1626 | } |
| 1621 | 1627 | |
| 1622 | 1628 | EXEC_DECL(exit) |