summaryrefslogtreecommitdiff
path: root/eval.c
diff options
context:
space:
mode:
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/eval.c b/eval.c
index 628758a93a..bc3a4b1a37 100644
--- a/eval.c
+++ b/eval.c
@@ -4150,6 +4150,8 @@ rb_f_missing(argc, argv, obj)
rb_raise(rb_eArgError, "no id given");
}
+ rb_stack_check();
+
id = SYM2ID(argv[0]);
switch (TYPE(obj)) {
@@ -4282,6 +4284,14 @@ stack_length(p)
#endif
}
+void
+rb_stack_check()
+{
+ if (stack_length(0) > STACK_LEVEL_MAX) {
+ rb_raise(rb_eSysStackError, "stack level too deep");
+ }
+}
+
static VALUE
call_cfunc(func, recv, len, argc, argv)
VALUE (*func)();
@@ -4397,9 +4407,7 @@ rb_call0(klass, recv, id, argc, argv, body, nosuper)
if ((++tick & 0xff) == 0) {
CHECK_INTS; /* better than nothing */
- if (stack_length(0) > STACK_LEVEL_MAX) {
- rb_raise(rb_eSysStackError, "stack level too deep");
- }
+ rb_stack_check();
}
PUSH_ITER(itr);
PUSH_FRAME();