Reduce the size of VM stack clear window; ref #3676

parent 2599c193
...@@ -851,17 +851,15 @@ mrb_vm_run(mrb_state *mrb, struct RProc *proc, mrb_value self, unsigned int stac ...@@ -851,17 +851,15 @@ mrb_vm_run(mrb_state *mrb, struct RProc *proc, mrb_value self, unsigned int stac
mrb_value result; mrb_value result;
struct mrb_context *c = mrb->c; struct mrb_context *c = mrb->c;
int cioff = c->ci - c->cibase; int cioff = c->ci - c->cibase;
int nregs = irep->nregs; unsigned int nregs = irep->nregs;
mrb_value *stk;
if (!c->stack) { if (!c->stack) {
stack_init(mrb); stack_init(mrb);
} }
if (stack_keep > nregs) if (stack_keep > nregs)
nregs = stack_keep; nregs = stack_keep;
stk = c->stack + stack_keep; if (nregs > stack_keep) {
if (stk < c->stend) { stack_clear(c->stack + stack_keep, nregs - stack_keep);
stack_clear(stk, c->stend - stk);
} }
stack_extend(mrb, nregs); stack_extend(mrb, nregs);
c->stack[0] = self; c->stack[0] = self;
......
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