mirror of
https://github.com/ruby/ruby.git
synced 2025-09-15 16:44:01 +02:00
Handle machine stack overflow on mingw
* thread_win32.c (rb_w32_stack_overflow_handler): use Structured Exception Handling by Addvectoredexceptionhandler() for machine stack overflow on mingw. This would be equivalent to the handling using __try and __exept on mswin introduced by r43748. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45947 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
48de9363d2
commit
3343feeebf
3 changed files with 29 additions and 0 deletions
|
@ -1,3 +1,11 @@
|
||||||
|
Thu May 15 17:32:51 2014 Hiroshi Shirosaki <h.shirosaki@gmail.com>
|
||||||
|
|
||||||
|
* thread_win32.c (rb_w32_stack_overflow_handler): use Structured
|
||||||
|
Exception Handling by Addvectoredexceptionhandler() for machine
|
||||||
|
stack overflow on mingw.
|
||||||
|
This would be equivalent to the handling using __try and __exept
|
||||||
|
on mswin introduced by r43748.
|
||||||
|
|
||||||
Wed May 14 19:31:03 2014 Koichi Sasada <ko1@atdot.net>
|
Wed May 14 19:31:03 2014 Koichi Sasada <ko1@atdot.net>
|
||||||
|
|
||||||
* ext/openssl/depend: remove dependency from internal headers.
|
* ext/openssl/depend: remove dependency from internal headers.
|
||||||
|
|
|
@ -95,6 +95,15 @@ extern int select_large_fdset(int, fd_set *, fd_set *, fd_set *, struct timeval
|
||||||
EXCEPTION_CONTINUE_SEARCH) { \
|
EXCEPTION_CONTINUE_SEARCH) { \
|
||||||
/* never reaches here */ \
|
/* never reaches here */ \
|
||||||
}
|
}
|
||||||
|
#elif defined(__MINGW32__)
|
||||||
|
LONG WINAPI rb_w32_stack_overflow_handler(struct _EXCEPTION_POINTERS *);
|
||||||
|
#define SAVE_ROOT_JMPBUF_BEFORE_STMT \
|
||||||
|
do { \
|
||||||
|
PVOID _handler = AddVectoredExceptionHandler(1, rb_w32_stack_overflow_handler);
|
||||||
|
|
||||||
|
#define SAVE_ROOT_JMPBUF_AFTER_STMT \
|
||||||
|
RemoveVectoredExceptionHandler(_handler); \
|
||||||
|
} while (0);
|
||||||
#else
|
#else
|
||||||
#define SAVE_ROOT_JMPBUF_BEFORE_STMT
|
#define SAVE_ROOT_JMPBUF_BEFORE_STMT
|
||||||
#define SAVE_ROOT_JMPBUF_AFTER_STMT
|
#define SAVE_ROOT_JMPBUF_AFTER_STMT
|
||||||
|
|
|
@ -754,6 +754,18 @@ ruby_stack_overflowed_p(const rb_thread_t *th, const void *addr)
|
||||||
return rb_thread_raised_p(th, RAISED_STACKOVERFLOW);
|
return rb_thread_raised_p(th, RAISED_STACKOVERFLOW);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(__MINGW32__)
|
||||||
|
LONG WINAPI
|
||||||
|
rb_w32_stack_overflow_handler(struct _EXCEPTION_POINTERS *exception)
|
||||||
|
{
|
||||||
|
if (exception->ExceptionRecord->ExceptionCode == EXCEPTION_STACK_OVERFLOW) {
|
||||||
|
rb_thread_raised_set(GET_THREAD(), RAISED_STACKOVERFLOW);
|
||||||
|
raise(SIGSEGV);
|
||||||
|
}
|
||||||
|
return EXCEPTION_CONTINUE_SEARCH;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef RUBY_ALLOCA_CHKSTK
|
#ifdef RUBY_ALLOCA_CHKSTK
|
||||||
void
|
void
|
||||||
ruby_alloca_chkstk(size_t len, void *sp)
|
ruby_alloca_chkstk(size_t len, void *sp)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue