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
This commit is contained in:
parent
158c742b51
commit
e97ac02f84
4
signal.c
4
signal.c
@ -761,7 +761,7 @@ static const char *received_signal;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(USE_SIGALTSTACK) || defined(_WIN32)
|
#if defined(USE_SIGALTSTACK) || defined(_WIN32)
|
||||||
NORETURN(void ruby_thread_stack_overflow(rb_thread_t *th));
|
NORETURN(void rb_threadptr_stack_overflow(rb_thread_t *th));
|
||||||
# if defined __HAIKU__
|
# if defined __HAIKU__
|
||||||
# define USE_UCONTEXT_REG 1
|
# define USE_UCONTEXT_REG 1
|
||||||
# elif !(defined(HAVE_UCONTEXT_H) && (defined __i386__ || defined __x86_64__ || defined __amd64__))
|
# elif !(defined(HAVE_UCONTEXT_H) && (defined __i386__ || defined __x86_64__ || defined __amd64__))
|
||||||
@ -792,7 +792,7 @@ raise_stack_overflow(int sig, rb_thread_t *th)
|
|||||||
rb_bug_errno(STRINGIZE(ruby_sigunmask)":unblock", errno);
|
rb_bug_errno(STRINGIZE(ruby_sigunmask)":unblock", errno);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
ruby_thread_stack_overflow(th);
|
rb_threadptr_stack_overflow(th);
|
||||||
}
|
}
|
||||||
|
|
||||||
# ifdef USE_UCONTEXT_REG
|
# ifdef USE_UCONTEXT_REG
|
||||||
|
14
thread.c
14
thread.c
@ -2165,20 +2165,6 @@ rb_threadptr_signal_exit(rb_thread_t *th)
|
|||||||
#define USE_SIGALTSTACK
|
#define USE_SIGALTSTACK
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
NORETURN(void ruby_thread_stack_overflow(rb_thread_t *th));
|
|
||||||
void
|
|
||||||
ruby_thread_stack_overflow(rb_thread_t *th)
|
|
||||||
{
|
|
||||||
th->raised_flag = 0;
|
|
||||||
#ifdef USE_SIGALTSTACK
|
|
||||||
if (!rb_threadptr_during_gc(th)) {
|
|
||||||
rb_exc_raise(sysstack_error);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
th->errinfo = sysstack_error;
|
|
||||||
TH_JUMP_TAG(th, TAG_RAISE);
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
int
|
||||||
rb_threadptr_set_raised(rb_thread_t *th)
|
rb_threadptr_set_raised(rb_thread_t *th)
|
||||||
{
|
{
|
||||||
|
@ -30,12 +30,40 @@ ruby_vm_special_exception_copy(VALUE exc)
|
|||||||
return e;
|
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
|
static void
|
||||||
vm_stackoverflow(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
|
#if VM_CHECK_MODE > 0
|
||||||
static int
|
static int
|
||||||
callable_class_p(VALUE klass)
|
callable_class_p(VALUE klass)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user