summaryrefslogtreecommitdiffhomepage
path: root/mrbgems/mruby-bin-mirb/tools
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2017-10-16 22:35:25 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2017-10-16 22:35:25 +0900
commit1988bec23e4a0eb3dbabea19a02dd6cdb91158c3 (patch)
tree72c73608048a6f01587e90f61e12395dc2f66929 /mrbgems/mruby-bin-mirb/tools
parentc3710dbb969948928f01c17a480e14a86b30fe5a (diff)
downloadmruby-1988bec23e4a0eb3dbabea19a02dd6cdb91158c3.tar.gz
mruby-1988bec23e4a0eb3dbabea19a02dd6cdb91158c3.zip
Need to adjust the stack length of the top-level environment; fix #3819
Diffstat (limited to 'mrbgems/mruby-bin-mirb/tools')
-rw-r--r--mrbgems/mruby-bin-mirb/tools/mirb/mirb.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/mrbgems/mruby-bin-mirb/tools/mirb/mirb.c b/mrbgems/mruby-bin-mirb/tools/mirb/mirb.c
index fe311d830..891259a3f 100644
--- a/mrbgems/mruby-bin-mirb/tools/mirb/mirb.c
+++ b/mrbgems/mruby-bin-mirb/tools/mirb/mirb.c
@@ -544,6 +544,13 @@ done:
if (args.verbose) {
mrb_codedump_all(mrb, proc);
}
+ /* adjest stack length of toplevel environment */
+ if (mrb->c->cibase->env) {
+ struct REnv *e = mrb->c->cibase->env;
+ if (MRB_ENV_STACK_LEN(e) < proc->body.irep->nlocals) {
+ MRB_SET_ENV_STACK_LEN(e, proc->body.irep->nlocals);
+ }
+ }
/* pass a proc for evaluation */
/* evaluate the bytecode */
result = mrb_vm_run(mrb,