summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--eval.c1
-rw-r--r--vm_core.h1
-rw-r--r--vm_insnhelper.c4
3 files changed, 5 insertions, 1 deletions
diff --git a/eval.c b/eval.c
index 2b6f7849fd..c94fbe4275 100644
--- a/eval.c
+++ b/eval.c
@@ -1930,6 +1930,7 @@ Init_eval(void)
rb_define_global_function("untrace_var", rb_f_untrace_var, -1); /* in variable.c */
rb_vm_register_special_exception(ruby_error_reenter, rb_eFatal, "exception reentered");
+ rb_vm_register_special_exception(ruby_error_sysstack_gc, rb_eFatal, "machine stack overflow while GC is running.");
id_signo = rb_intern_const("signo");
id_status = rb_intern_const("status");
diff --git a/vm_core.h b/vm_core.h
index 5fc7b2b3ba..861cae0018 100644
--- a/vm_core.h
+++ b/vm_core.h
@@ -455,6 +455,7 @@ enum ruby_special_exceptions {
ruby_error_reenter,
ruby_error_nomemory,
ruby_error_sysstack,
+ ruby_error_sysstack_gc,
ruby_error_stream_closed,
ruby_special_error_count
};
diff --git a/vm_insnhelper.c b/vm_insnhelper.c
index 303f9cc2fb..03b9d49e0e 100644
--- a/vm_insnhelper.c
+++ b/vm_insnhelper.c
@@ -57,7 +57,9 @@ void
rb_threadptr_stack_overflow(rb_thread_t *th)
{
if (rb_during_gc()) {
- rb_fatal("machine stack overflow while GC is running.");
+ th->ec.raised_flag = RAISED_STACKOVERFLOW;
+ th->ec.errinfo = th->vm->special_exceptions[ruby_error_sysstack_gc];
+ TH_JUMP_TAG(th, TAG_RAISE);
}
#ifdef USE_SIGALTSTACK
threadptr_stack_overflow(th, TRUE);