Skip to content

Commit

Permalink
Reduce the size of VM stack clear window; ref #3676
Browse files Browse the repository at this point in the history
  • Loading branch information
matz committed May 30, 2017
1 parent 2599c19 commit acd3ac6
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/vm.c
Original file line number Diff line number Diff line change
Expand Up @@ -851,17 +851,15 @@ mrb_vm_run(mrb_state *mrb, struct RProc *proc, mrb_value self, unsigned int stac
mrb_value result;
struct mrb_context *c = mrb->c;
int cioff = c->ci - c->cibase;
int nregs = irep->nregs;
mrb_value *stk;
unsigned int nregs = irep->nregs;

if (!c->stack) {
stack_init(mrb);
}
if (stack_keep > nregs)
nregs = stack_keep;
stk = c->stack + stack_keep;
if (stk < c->stend) {
stack_clear(stk, c->stend - stk);
if (nregs > stack_keep) {
stack_clear(c->stack + stack_keep, nregs - stack_keep);
}
stack_extend(mrb, nregs);
c->stack[0] = self;
Expand Down

0 comments on commit acd3ac6

Please sign in to comment.