From 6316e0c75dc4762a4df0a3ed4f273fc3a039b277 Mon Sep 17 00:00:00 2001 From: "Yukihiro \"Matz\" Matsumoto" Date: Sat, 28 Oct 2017 23:27:07 +0900 Subject: Should clear ensure stack at `OP_RETURN break`; #3715 This is a resurrection of d0a7e01, which is accidentally removed by 93f5f22; Fix #3715 --- src/vm.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/vm.c b/src/vm.c index b050dfbeb..b9cd86b67 100644 --- a/src/vm.c +++ b/src/vm.c @@ -338,13 +338,13 @@ ecall(mrb_state *mrb, int i) ci->target_class = MRB_PROC_TARGET_CLASS(p); env = MRB_PROC_ENV(p); mrb_assert(env); - c->stack = c->stack + p->body.irep->nregs; + c->stack += p->body.irep->nregs; exc = mrb->exc; mrb->exc = 0; if (exc) { mrb_gc_protect(mrb, mrb_obj_value(exc)); } mrb_run(mrb, p, env->stack[0]); - c = mrb->c; + mrb->c = c; c->ci = c->cibase + cioff; if (!mrb->exc) mrb->exc = exc; mrb_gc_arena_restore(mrb, ai); @@ -1981,13 +1981,13 @@ RETRY_TRY_BLOCK: if (MRB_PROC_ENV(proc)->cxt != mrb->c) { goto L_BREAK_ERROR; } + while (mrb->c->eidx > mrb->c->ci->epos) { + ecall_adjust(); + } /* break from fiber block */ if (ci == mrb->c->cibase && ci->pc) { struct mrb_context *c = mrb->c; - while (c->eidx > c->ci->epos) { - ecall_adjust(); - } mrb->c = c->prev; c->prev = NULL; ci = mrb->c->ci; -- cgit v1.2.3