diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2017-09-11 22:53:26 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2017-09-11 23:13:47 +0900 |
| commit | d6e41c3e512673dac91906416a9c4543bbb2ab19 (patch) | |
| tree | b77e04f95e444cffd659bb9235b33625714e31f8 | |
| parent | 3d8c1a7e97521e73703e198d1383839c201787ec (diff) | |
| download | mruby-d6e41c3e512673dac91906416a9c4543bbb2ab19.tar.gz mruby-d6e41c3e512673dac91906416a9c4543bbb2ab19.zip | |
The callinfo stack may be reallocated in `cipush`; fix rest of #3809
fix #3809
| -rw-r--r-- | src/vm.c | 27 |
1 files changed, 13 insertions, 14 deletions
@@ -1319,30 +1319,29 @@ RETRY_TRY_BLOCK: CASE(OP_EPOP) { /* A A.times{ensure_pop().call} */ int a = GETARG_A(i); - mrb_callinfo *ci, *nci; + mrb_callinfo *ci; mrb_value self = regs[0]; mrb_assert(a==1); /* temporary limitation */ - ci = mrb->c->ci; - if (mrb->c->eidx == ci->epos) { + if (mrb->c->eidx == mrb->c->ci->epos) { NEXT; } 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; pool = irep->pool; 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; pc = irep->iseq; JUMP; |
