summaryrefslogtreecommitdiff
path: root/eval_intern.h
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-05-15 08:32:55 (GMT)
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-05-15 08:32:55 (GMT)
commit3343feeebf5f3f7f3219eadab1d93e11b5ba9f6a (patch)
tree2742f395e17e5c6396e0a6860be3390d2d62b704 /eval_intern.h
parent48de9363d230f8b23afe14e5b18d0683858004ae (diff)
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
Diffstat (limited to 'eval_intern.h')
-rw-r--r--eval_intern.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/eval_intern.h b/eval_intern.h
index f19c252..eb78a41 100644
--- a/eval_intern.h
+++ b/eval_intern.h
@@ -95,6 +95,15 @@ extern int select_large_fdset(int, fd_set *, fd_set *, fd_set *, struct timeval
EXCEPTION_CONTINUE_SEARCH) { \
/* 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
#define SAVE_ROOT_JMPBUF_BEFORE_STMT
#define SAVE_ROOT_JMPBUF_AFTER_STMT