summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-06-23 15:08:11 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-06-23 15:08:11 +0000
commitc22cbdc1306dbf0a4019299057fca688aaa9106b (patch)
treea4b602d7fbf2d57869ff99f2bb1314c37352e69e
parente9373b36c856ca69e4d989af7a3700ca894df368 (diff)
merge revision(s) r45947,r45951: [Backport #9739] [Backport #9844]
* 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. Exception Handling by AddVectoredExceptionHandler() for machine This would be equivalent to the handling using __try and __except git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@46522 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog8
-rw-r--r--eval_intern.h9
-rw-r--r--thread_win32.c12
-rw-r--r--version.h2
4 files changed, 30 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 349a7a65a2..8bd5de4f51 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+Tue Jun 24 00:06:41 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 __except
+ on mswin introduced by r43748.
+
Mon Jun 23 23:56:54 2014 Eric Wong <e@80x24.org>
* signal.c (signal_exec): ignore immediate cmd for SIG_IGN
diff --git a/eval_intern.h b/eval_intern.h
index a0ecb5086b..5064fde257 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
diff --git a/thread_win32.c b/thread_win32.c
index 7eb640aa6c..aea3fc20ac 100644
--- a/thread_win32.c
+++ b/thread_win32.c
@@ -754,6 +754,18 @@ ruby_stack_overflowed_p(const rb_thread_t *th, const void *addr)
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
void
ruby_alloca_chkstk(size_t len, void *sp)
diff --git a/version.h b/version.h
index 22c0ea81b3..921abe0f7c 100644
--- a/version.h
+++ b/version.h
@@ -1,6 +1,6 @@
#define RUBY_VERSION "2.1.2"
#define RUBY_RELEASE_DATE "2014-06-24"
-#define RUBY_PATCHLEVEL 138
+#define RUBY_PATCHLEVEL 139
#define RUBY_RELEASE_YEAR 2014
#define RUBY_RELEASE_MONTH 6