ruby-changes:47502
From: nobu <ko1@a...>
Date: Fri, 18 Aug 2017 21:18:04 +0900 (JST)
Subject: [ruby-changes:47502] nobu:r59618 (trunk): vm_insnhelper.c: raise ruby_error_sysstack_gc
nobu 2017-08-18 21:17:59 +0900 (Fri, 18 Aug 2017) New Revision: 59618 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=59618 Log: vm_insnhelper.c: raise ruby_error_sysstack_gc * vm_insnhelper.c (rb_threadptr_stack_overflow): rb_fatal is not available during GC. raise the preallocated fatal error. Modified files: trunk/eval.c trunk/vm_core.h trunk/vm_insnhelper.c Index: vm_insnhelper.c =================================================================== --- vm_insnhelper.c (revision 59617) +++ vm_insnhelper.c (revision 59618) @@ -57,7 +57,9 @@ void https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L57 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); Index: vm_core.h =================================================================== --- vm_core.h (revision 59617) +++ vm_core.h (revision 59618) @@ -455,6 +455,7 @@ enum ruby_special_exceptions { https://github.com/ruby/ruby/blob/trunk/vm_core.h#L455 ruby_error_reenter, ruby_error_nomemory, ruby_error_sysstack, + ruby_error_sysstack_gc, ruby_error_stream_closed, ruby_special_error_count }; Index: eval.c =================================================================== --- eval.c (revision 59617) +++ eval.c (revision 59618) @@ -1930,6 +1930,7 @@ Init_eval(void) https://github.com/ruby/ruby/blob/trunk/eval.c#L1930 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"); -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/