summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2017-11-17 01:08:46 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2017-11-17 01:08:46 +0900
commitc8da60275281dc54310aa0d7e45085c55ee8bda3 (patch)
tree99cc3dde482e6133ee3ade42d6a4d7e9c0575778 /src
parent03a3bd917800134c247bcc2317534da2a0233535 (diff)
downloadmruby-c8da60275281dc54310aa0d7e45085c55ee8bda3.tar.gz
mruby-c8da60275281dc54310aa0d7e45085c55ee8bda3.zip
Need to save stack space by number of registers from the current proc,
Not from the execution ensure proc; fix #3849
Diffstat (limited to 'src')
-rw-r--r--src/vm.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/vm.c b/src/vm.c
index dd68e8a79..6bf6877a4 100644
--- a/src/vm.c
+++ b/src/vm.c
@@ -309,6 +309,7 @@ static void
ecall(mrb_state *mrb, int i)
{
struct RProc *p;
+ int nregs;
struct mrb_context *c = mrb->c;
mrb_callinfo *ci = c->ci;
struct RObject *exc;
@@ -323,6 +324,7 @@ ecall(mrb_state *mrb, int i)
p = c->ensure[i];
if (!p) return;
mrb_assert(!MRB_PROC_CFUNC_P(p));
+ nregs = ci->proc->body.irep->nregs;
c->ensure[i] = NULL;
cioff = ci - c->cibase;
ci = cipush(mrb);
@@ -335,7 +337,7 @@ ecall(mrb_state *mrb, int i)
ci->target_class = MRB_PROC_TARGET_CLASS(p);
env = MRB_PROC_ENV(p);
mrb_assert(env);
- c->stack += p->body.irep->nregs;
+ c->stack += nregs;
exc = mrb->exc; mrb->exc = 0;
if (exc) {
mrb_gc_protect(mrb, mrb_obj_value(exc));