diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2017-12-01 09:32:51 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2017-12-01 10:01:46 +0900 |
| commit | c35a4026767cfc11488fde2bc02ec84877dd6194 (patch) | |
| tree | b87a755b758c930f276988d18ce95d8df74f13df /src | |
| parent | 86ef9a28062bf3cf5a9c65581067f06eb4608858 (diff) | |
| download | mruby-c35a4026767cfc11488fde2bc02ec84877dd6194.tar.gz mruby-c35a4026767cfc11488fde2bc02ec84877dd6194.zip | |
The stack shift width should be determined by `p->upper`; fix #3864
And check required register number from `ci->proc` as well.
The fixes for #3859 and #3862 were incomplete.
Diffstat (limited to 'src')
| -rw-r--r-- | src/vm.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -326,7 +326,10 @@ ecall(mrb_state *mrb) if (!p) return; mrb_assert(!MRB_PROC_CFUNC_P(p)); c->ensure[i] = NULL; - nregs = ci->proc->body.irep->nregs; + nregs = p->upper->body.irep->nregs; + if (ci->proc->body.irep->nregs > nregs) { + nregs = ci->proc->body.irep->nregs; + } cioff = ci - c->cibase; ci = cipush(mrb); ci->stackent = mrb->c->stack; @@ -336,9 +339,9 @@ ecall(mrb_state *mrb) ci->proc = p; ci->nregs = p->body.irep->nregs; ci->target_class = MRB_PROC_TARGET_CLASS(p); - c->stack += nregs; env = MRB_PROC_ENV(p); mrb_assert(env); + c->stack += nregs; exc = mrb->exc; mrb->exc = 0; if (exc) { mrb_gc_protect(mrb, mrb_obj_value(exc)); |
