The callinfo stack may be reallocated in `cipush`; fix rest of #3809

fix #3809
parent 3d8c1a7e
...@@ -1319,30 +1319,29 @@ RETRY_TRY_BLOCK: ...@@ -1319,30 +1319,29 @@ RETRY_TRY_BLOCK:
CASE(OP_EPOP) { CASE(OP_EPOP) {
/* A A.times{ensure_pop().call} */ /* A A.times{ensure_pop().call} */
int a = GETARG_A(i); int a = GETARG_A(i);
mrb_callinfo *ci, *nci; mrb_callinfo *ci;
mrb_value self = regs[0]; mrb_value self = regs[0];
mrb_assert(a==1); /* temporary limitation */ mrb_assert(a==1); /* temporary limitation */
ci = mrb->c->ci; if (mrb->c->eidx == mrb->c->ci->epos) {
if (mrb->c->eidx == ci->epos) {
NEXT; NEXT;
} }
proc = mrb->c->ensure[--mrb->c->eidx]; proc = mrb->c->ensure[--mrb->c->eidx];
nci = cipush(mrb);
nci->mid = ci->mid;
nci->argc = 0;
nci->proc = proc;
nci->stackent = mrb->c->stack;
nci->nregs = irep->nregs;
nci->target_class = proc->target_class;
nci->pc = pc + 1;
nci->acc = nci->nregs;
mrb->c->stack += ci->nregs;
stack_extend(mrb, nci->nregs);
irep = proc->body.irep; irep = proc->body.irep;
pool = irep->pool; pool = irep->pool;
syms = irep->syms; syms = irep->syms;
ci = cipush(mrb);
ci->mid = ci[-1].mid;
ci->argc = 0;
ci->proc = proc;
ci->stackent = mrb->c->stack;
ci->nregs = irep->nregs;
ci->target_class = proc->target_class;
ci->pc = pc + 1;
ci->acc = ci[-1].nregs;
mrb->c->stack += ci->acc;
stack_extend(mrb, ci->nregs);
regs[0] = self; regs[0] = self;
pc = irep->iseq; pc = irep->iseq;
JUMP; JUMP;
......
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