Project

General

Profile

Bug #9739 ยป 0001-Handle-machine-stack-overflow-on-mingw.patch

h.shirosaki (Hiroshi Shirosaki), 05/15/2014 03:11 AM

View differences:

eval_intern.h
95 95
	      EXCEPTION_CONTINUE_SEARCH) { \
96 96
	/* never reaches here */ \
97 97
    }
98
#elif defined(__MINGW32__)
99
LONG WINAPI rb_w32_stack_overflow_handler(struct _EXCEPTION_POINTERS *);
100
#define SAVE_ROOT_JMPBUF_BEFORE_STMT \
101
  do { \
102
      PVOID _handler = AddVectoredExceptionHandler(1, rb_w32_stack_overflow_handler);
103
#define SAVE_ROOT_JMPBUF_AFTER_STMT \
104
      RemoveVectoredExceptionHandler(_handler); \
105
  } while (0);
98 106
#else
99 107
#define SAVE_ROOT_JMPBUF_BEFORE_STMT
100 108
#define SAVE_ROOT_JMPBUF_AFTER_STMT
thread_win32.c
754 754
    return rb_thread_raised_p(th, RAISED_STACKOVERFLOW);
755 755
}
756 756

  
757
#if defined(__MINGW32__)
758
LONG WINAPI
759
rb_w32_stack_overflow_handler(struct _EXCEPTION_POINTERS *exception)
760
{
761
    if (exception->ExceptionRecord->ExceptionCode == EXCEPTION_STACK_OVERFLOW) {
762
	rb_thread_raised_set(GET_THREAD(), RAISED_STACKOVERFLOW);
763
	raise(SIGSEGV);
764
    }
765
    return EXCEPTION_CONTINUE_SEARCH;
766
}
767
#endif
768

  
757 769
#ifdef RUBY_ALLOCA_CHKSTK
758 770
void
759 771
ruby_alloca_chkstk(size_t len, void *sp)
760
-