aboutsummaryrefslogtreecommitdiffstats
path: root/eval_intern.h
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-11-21 06:33:41 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-11-21 06:33:41 +0000
commit1df5ebf450b13427466c4e31fd3970c8430b6ac7 (patch)
tree4daa8678f0f8dad8d416b52e7707397061842945 /eval_intern.h
parent6869a65a8c6801984ae5bfc1b793843933925ef6 (diff)
downloadruby-1df5ebf450b13427466c4e31fd3970c8430b6ac7.tar.gz
* eval_intern.h (SAVE_ROOT_JMPBUF): workaround for the failure of
test/ruby/test_exception.rb on Windows. wrap by __try and __exception statements on mswin to raise SIGSEGV when EXCEPTION_STACK_OVERFLOW is occurred, because MSVCRT doesn't handle the exception. however, (1) mingw-gcc doesn't support __try and __exception statements, and (2) we cannot retry SystemStackError after this change yet (maybe crashed) because SEH and longjmp() are too uncongenial. * signal.c (check_stack_overflow, CHECK_STACK_OVERFLOW): now defined on Windows, too. * thread_win32.c (ruby_stack_overflowed_p): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43748 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'eval_intern.h')
-rw-r--r--eval_intern.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/eval_intern.h b/eval_intern.h
index 5802e277ee..a0ecb5086b 100644
--- a/eval_intern.h
+++ b/eval_intern.h
@@ -83,9 +83,28 @@ extern int select_large_fdset(int, fd_set *, fd_set *, fd_set *, struct timeval
#include <sys/stat.h>
+#ifdef _MSC_VER
+#define SAVE_ROOT_JMPBUF_BEFORE_STMT \
+ __try {
+#define SAVE_ROOT_JMPBUF_AFTER_STMT \
+ } \
+ __except (GetExceptionCode() == EXCEPTION_STACK_OVERFLOW ? \
+ (rb_thread_raised_set(GET_THREAD(), RAISED_STACKOVERFLOW), \
+ raise(SIGSEGV), \
+ EXCEPTION_EXECUTE_HANDLER) : \
+ EXCEPTION_CONTINUE_SEARCH) { \
+ /* never reaches here */ \
+ }
+#else
+#define SAVE_ROOT_JMPBUF_BEFORE_STMT
+#define SAVE_ROOT_JMPBUF_AFTER_STMT
+#endif
+
#define SAVE_ROOT_JMPBUF(th, stmt) do \
if (ruby_setjmp((th)->root_jmpbuf) == 0) { \
+ SAVE_ROOT_JMPBUF_BEFORE_STMT \
stmt; \
+ SAVE_ROOT_JMPBUF_AFTER_STMT \
} \
else { \
rb_fiber_start(); \