Call `stack_clear()` after `stack_extend()`; fix #3682

parent eb5a606f
...@@ -853,10 +853,10 @@ mrb_vm_run(mrb_state *mrb, struct RProc *proc, mrb_value self, unsigned int stac ...@@ -853,10 +853,10 @@ mrb_vm_run(mrb_state *mrb, struct RProc *proc, mrb_value self, unsigned int stac
} }
if (stack_keep > nregs) if (stack_keep > nregs)
nregs = stack_keep; nregs = stack_keep;
stack_extend(mrb, nregs);
if (nregs > stack_keep) { if (nregs > stack_keep) {
stack_clear(c->stack + stack_keep, nregs - stack_keep); stack_clear(c->stack + stack_keep, nregs - stack_keep);
} }
stack_extend(mrb, nregs);
c->stack[0] = self; c->stack[0] = self;
result = mrb_vm_exec(mrb, proc, irep->iseq); result = mrb_vm_exec(mrb, proc, irep->iseq);
if (c->ci - c->cibase > cioff) { if (c->ci - c->cibase > cioff) {
......
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