aboutsummaryrefslogtreecommitdiffstats
path: root/vm_insnhelper.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-04-17 02:08:41 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-04-17 02:08:41 +0000
commit70f17dfbcc4395b59dd3b4e809059591ac3e1049 (patch)
treea39fb1712d7a18a31963649e24f36d5f32128e8a /vm_insnhelper.c
parent51ba1ad56bcf492d197f98fcee70235efe77bbde (diff)
downloadruby-70f17dfbcc4395b59dd3b4e809059591ac3e1049.tar.gz
vm_insnhelper.c: rb_threadptr_stack_overflow
* vm_insnhelper.c (rb_threadptr_stack_overflow): move from thread.c and integrate with vm_stackoverflow. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58379 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm_insnhelper.c')
-rw-r--r--vm_insnhelper.c30
1 files changed, 29 insertions, 1 deletions
diff --git a/vm_insnhelper.c b/vm_insnhelper.c
index 6006b5d579..fd259fd428 100644
--- a/vm_insnhelper.c
+++ b/vm_insnhelper.c
@@ -30,12 +30,40 @@ ruby_vm_special_exception_copy(VALUE exc)
return e;
}
+NORETURN(static void threadptr_stack_overflow(rb_thread_t *, int));
+static void
+threadptr_stack_overflow(rb_thread_t *th, int setup)
+{
+ VALUE mesg = th->vm->special_exceptions[ruby_error_sysstack];
+ th->raised_flag = 0;
+ if (setup) {
+ VALUE at = rb_threadptr_backtrace_object(th);
+ mesg = ruby_vm_special_exception_copy(mesg);
+ rb_ivar_set(mesg, idBt, at);
+ rb_ivar_set(mesg, idBt_locations, at);
+ }
+ th->errinfo = mesg;
+ TH_JUMP_TAG(th, TAG_RAISE);
+}
+
static void
vm_stackoverflow(void)
{
- rb_exc_raise(ruby_vm_special_exception_copy(sysstack_error));
+ threadptr_stack_overflow(GET_THREAD(), TRUE);
+}
+
+NORETURN(void rb_threadptr_stack_overflow(rb_thread_t *th));
+void
+rb_threadptr_stack_overflow(rb_thread_t *th)
+{
+#ifdef USE_SIGALTSTACK
+ threadptr_stack_overflow(th, !rb_threadptr_during_gc(th));
+#else
+ threadptr_stack_overflow(th, FALSE);
+#endif
}
+
#if VM_CHECK_MODE > 0
static int
callable_class_p(VALUE klass)