summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/vm.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/vm.c b/src/vm.c
index 3c8bc0b36..0e3c0a81e 100644
--- a/src/vm.c
+++ b/src/vm.c
@@ -2251,10 +2251,10 @@ RETRY_TRY_BLOCK:
/* stop VM */
L_STOP:
{
- int n = mrb->c->ci->eidx;
-
- while (n--) {
- ecall(mrb, n);
+ int eidx_stop = mrb->c->ci == mrb->c->cibase ? 0 : mrb->c->ci[-1].eidx;
+ int eidx = mrb->c->ci->eidx;
+ while (eidx > eidx_stop) {
+ ecall(mrb, --eidx);
}
}
ERR_PC_CLR(mrb);
@@ -2307,8 +2307,6 @@ mrb_toplevel_run(mrb_state *mrb, struct RProc *proc)
}
ci = cipush(mrb);
ci->acc = CI_ACC_SKIP;
- ci->eidx = 0;
- ci->ridx = 0;
ci->target_class = mrb->object_class;
v = mrb_context_run(mrb, proc, mrb_top_self(mrb), 0);
cipop(mrb);