Should clear ensure stack at `OP_RETURN break`; #3715

This is a resurrection of d0a7e01d, which is accidentally
removed by 93f5f225; Fix #3715
parent 92e24f80
...@@ -338,13 +338,13 @@ ecall(mrb_state *mrb, int i) ...@@ -338,13 +338,13 @@ ecall(mrb_state *mrb, int i)
ci->target_class = MRB_PROC_TARGET_CLASS(p); ci->target_class = MRB_PROC_TARGET_CLASS(p);
env = MRB_PROC_ENV(p); env = MRB_PROC_ENV(p);
mrb_assert(env); mrb_assert(env);
c->stack = c->stack + p->body.irep->nregs; c->stack += p->body.irep->nregs;
exc = mrb->exc; mrb->exc = 0; exc = mrb->exc; mrb->exc = 0;
if (exc) { if (exc) {
mrb_gc_protect(mrb, mrb_obj_value(exc)); mrb_gc_protect(mrb, mrb_obj_value(exc));
} }
mrb_run(mrb, p, env->stack[0]); mrb_run(mrb, p, env->stack[0]);
c = mrb->c; mrb->c = c;
c->ci = c->cibase + cioff; c->ci = c->cibase + cioff;
if (!mrb->exc) mrb->exc = exc; if (!mrb->exc) mrb->exc = exc;
mrb_gc_arena_restore(mrb, ai); mrb_gc_arena_restore(mrb, ai);
...@@ -1981,13 +1981,13 @@ RETRY_TRY_BLOCK: ...@@ -1981,13 +1981,13 @@ RETRY_TRY_BLOCK:
if (MRB_PROC_ENV(proc)->cxt != mrb->c) { if (MRB_PROC_ENV(proc)->cxt != mrb->c) {
goto L_BREAK_ERROR; goto L_BREAK_ERROR;
} }
while (mrb->c->eidx > mrb->c->ci->epos) {
ecall_adjust();
}
/* break from fiber block */ /* break from fiber block */
if (ci == mrb->c->cibase && ci->pc) { if (ci == mrb->c->cibase && ci->pc) {
struct mrb_context *c = mrb->c; struct mrb_context *c = mrb->c;
while (c->eidx > c->ci->epos) {
ecall_adjust();
}
mrb->c = c->prev; mrb->c = c->prev;
c->prev = NULL; c->prev = NULL;
ci = mrb->c->ci; ci = mrb->c->ci;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment