aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--eval_intern.h1
-rw-r--r--gc.c6
-rw-r--r--vm_eval.c3
3 files changed, 9 insertions, 1 deletions
diff --git a/eval_intern.h b/eval_intern.h
index c5210b14de..eb1746bfb2 100644
--- a/eval_intern.h
+++ b/eval_intern.h
@@ -268,6 +268,7 @@ int rb_threadptr_reset_raised(rb_thread_t *th);
#define rb_thread_raised_reset(th, f) ((th)->raised_flag &= ~(f))
#define rb_thread_raised_p(th, f) (((th)->raised_flag & (f)) != 0)
#define rb_thread_raised_clear(th) ((th)->raised_flag = 0)
+int rb_threadptr_stack_check(rb_thread_t *th);
VALUE rb_f_eval(int argc, const VALUE *argv, VALUE self);
VALUE rb_make_exception(int argc, const VALUE *argv);
diff --git a/gc.c b/gc.c
index ef4770a797..2c23abf0fa 100644
--- a/gc.c
+++ b/gc.c
@@ -3966,6 +3966,12 @@ stack_check(rb_thread_t *th, int water_mark)
#define STACKFRAME_FOR_CALL_CFUNC 512
int
+rb_threadptr_stack_check(rb_thread_t *th)
+{
+ return stack_check(th, STACKFRAME_FOR_CALL_CFUNC);
+}
+
+int
ruby_stack_check(void)
{
return stack_check(GET_THREAD(), STACKFRAME_FOR_CALL_CFUNC);
diff --git a/vm_eval.c b/vm_eval.c
index 3ea0b8d921..2713af0550 100644
--- a/vm_eval.c
+++ b/vm_eval.c
@@ -300,7 +300,8 @@ rb_current_receiver(void)
static inline void
stack_check(rb_thread_t *th)
{
- if (!rb_thread_raised_p(th, RAISED_STACKOVERFLOW) && ruby_stack_check()) {
+ if (!rb_thread_raised_p(th, RAISED_STACKOVERFLOW) &&
+ rb_threadptr_stack_check(th)) {
rb_thread_raised_set(th, RAISED_STACKOVERFLOW);
rb_exc_raise(sysstack_error);
}