summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--eval.c2
-rw-r--r--eval_error.c4
-rw-r--r--eval_intern.h10
-rw-r--r--gc.c16
-rw-r--r--thread_win32.c10
-rw-r--r--vm.c2
-rw-r--r--vm_eval.c8
-rw-r--r--vm_insnhelper.c4
8 files changed, 27 insertions, 29 deletions
diff --git a/eval.c b/eval.c
index 76df737..46c7c18 100644
--- a/eval.c
+++ b/eval.c
@@ -598,7 +598,7 @@ rb_longjmp(rb_execution_context_t *ec, int tag, volatile VALUE mesg, VALUE cause
{
mesg = exc_setup_message(ec, mesg, &cause);
setup_exception(ec, tag, mesg, cause);
- rb_thread_raised_clear(rb_ec_thread_ptr(ec));
+ rb_ec_raised_clear(ec);
EC_JUMP_TAG(ec, tag);
}
diff --git a/eval_error.c b/eval_error.c
index cd4e703..fa9fa8c 100644
--- a/eval_error.c
+++ b/eval_error.c
@@ -172,7 +172,7 @@ rb_ec_error_print(rb_execution_context_t * volatile ec, volatile VALUE errinfo)
if (NIL_P(errinfo))
return;
- rb_thread_raised_clear(rb_ec_thread_ptr(ec));
+ rb_ec_raised_clear(ec);
EC_PUSH_TAG(ec);
if (EC_EXEC_TAG() == TAG_NONE) {
@@ -203,7 +203,7 @@ rb_ec_error_print(rb_execution_context_t * volatile ec, volatile VALUE errinfo)
error:
EC_POP_TAG();
ec->errinfo = errinfo;
- rb_thread_raised_set(rb_ec_thread_ptr(ec), raised_flag);
+ rb_ec_raised_set(ec, raised_flag);
}
#define undef_mesg_for(v, k) rb_fstring_cstr("undefined"v" method `%1$s' for "k" `%2$s'")
diff --git a/eval_intern.h b/eval_intern.h
index ed94921..36c1004 100644
--- a/eval_intern.h
+++ b/eval_intern.h
@@ -98,7 +98,7 @@ extern int select_large_fdset(int, fd_set *, fd_set *, fd_set *, struct timeval
#define SAVE_ROOT_JMPBUF_AFTER_STMT \
} \
__except (GetExceptionCode() == EXCEPTION_STACK_OVERFLOW ? \
- (rb_thread_raised_set(GET_THREAD(), RAISED_STACKOVERFLOW), \
+ (rb_ec_raised_set(GET_EC(), RAISED_STACKOVERFLOW), \
raise(SIGSEGV), \
EXCEPTION_EXECUTE_HANDLER) : \
EXCEPTION_CONTINUE_SEARCH) { \
@@ -280,10 +280,10 @@ enum {
RAISED_STACKOVERFLOW = 2,
RAISED_NOMEMORY = 4
};
-#define rb_thread_raised_set(th, f) ((th)->ec->raised_flag |= (f))
-#define rb_thread_raised_reset(th, f) ((th)->ec->raised_flag &= ~(f))
-#define rb_thread_raised_p(th, f) (((th)->ec->raised_flag & (f)) != 0)
-#define rb_thread_raised_clear(th) ((th)->ec->raised_flag = 0)
+#define rb_ec_raised_set(ec, f) ((ec)->raised_flag |= (f))
+#define rb_ec_raised_reset(ec, f) ((ec)->raised_flag &= ~(f))
+#define rb_ec_raised_p(ec, f) (((ec)->raised_flag & (f)) != 0)
+#define rb_ec_raised_clear(ec) ((ec)->raised_flag = 0)
int rb_ec_set_raised(rb_execution_context_t *ec);
int rb_ec_reset_raised(rb_execution_context_t *th);
int rb_ec_stack_check(rb_execution_context_t *ec);
diff --git a/gc.c b/gc.c
index 49b5cbc..c1bcdd2 100644
--- a/gc.c
+++ b/gc.c
@@ -7697,27 +7697,27 @@ ruby_memerror(void)
void
rb_memerror(void)
{
- rb_thread_t *th = GET_THREAD();
- rb_objspace_t *objspace = rb_objspace_of(th->vm);
+ rb_execution_context_t *ec = GET_EC();
+ rb_objspace_t *objspace = rb_objspace_of(rb_ec_vm_ptr(ec));
VALUE exc;
if (during_gc) gc_exit(objspace, "rb_memerror");
exc = nomem_error;
if (!exc ||
- rb_thread_raised_p(th, RAISED_NOMEMORY)) {
+ rb_ec_raised_p(ec, RAISED_NOMEMORY)) {
fprintf(stderr, "[FATAL] failed to allocate memory\n");
exit(EXIT_FAILURE);
}
- if (rb_thread_raised_p(th, RAISED_NOMEMORY)) {
- rb_thread_raised_clear(th);
+ if (rb_ec_raised_p(ec, RAISED_NOMEMORY)) {
+ rb_ec_raised_clear(ec);
}
else {
- rb_thread_raised_set(th, RAISED_NOMEMORY);
+ rb_ec_raised_set(ec, RAISED_NOMEMORY);
exc = ruby_vm_special_exception_copy(exc);
}
- th->ec->errinfo = exc;
- EC_JUMP_TAG(th->ec, TAG_RAISE);
+ ec->errinfo = exc;
+ EC_JUMP_TAG(ec, TAG_RAISE);
}
static void *
diff --git a/thread_win32.c b/thread_win32.c
index c82bbfc..e0d79d7 100644
--- a/thread_win32.c
+++ b/thread_win32.c
@@ -734,7 +734,7 @@ native_reset_timer_thread(void)
int
ruby_stack_overflowed_p(const rb_thread_t *th, const void *addr)
{
- return rb_thread_raised_p(th, RAISED_STACKOVERFLOW);
+ return rb_ec_raised_p(th->ec, RAISED_STACKOVERFLOW);
}
#if defined(__MINGW32__)
@@ -742,7 +742,7 @@ 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);
+ rb_ec_raised_set(GET_EC(), RAISED_STACKOVERFLOW);
raise(SIGSEGV);
}
return EXCEPTION_CONTINUE_SEARCH;
@@ -754,9 +754,9 @@ void
ruby_alloca_chkstk(size_t len, void *sp)
{
if (ruby_stack_length(NULL) * sizeof(VALUE) >= len) {
- rb_thread_t *th = GET_THREAD();
- if (!rb_thread_raised_p(th, RAISED_STACKOVERFLOW)) {
- rb_thread_raised_set(th, RAISED_STACKOVERFLOW);
+ rb_execution_context_t *ec = GET_EC();
+ if (!rb_ec_raised_p(ec, RAISED_STACKOVERFLOW)) {
+ rb_ec_raised_set(ec, RAISED_STACKOVERFLOW);
rb_exc_raise(sysstack_error);
}
}
diff --git a/vm.c b/vm.c
index c6714b9..e9fd3c5 100644
--- a/vm.c
+++ b/vm.c
@@ -1813,7 +1813,7 @@ vm_exec(rb_execution_context_t *ec)
const rb_control_frame_t *escape_cfp;
err = (struct vm_throw_data *)ec->errinfo;
- rb_thread_raised_reset(rb_ec_thread_ptr(ec), RAISED_STACKOVERFLOW);
+ rb_ec_raised_reset(ec, RAISED_STACKOVERFLOW);
exception_handler:
cont_pc = cont_sp = 0;
diff --git a/vm_eval.c b/vm_eval.c
index 7b2415e..6930919 100644
--- a/vm_eval.c
+++ b/vm_eval.c
@@ -255,12 +255,10 @@ rb_current_receiver(void)
static inline void
stack_check(rb_execution_context_t *ec)
{
- rb_thread_t *th = rb_ec_thread_ptr(ec);
-
- if (!rb_thread_raised_p(th, RAISED_STACKOVERFLOW) &&
+ if (!rb_ec_raised_p(ec, RAISED_STACKOVERFLOW) &&
rb_ec_stack_check(ec)) {
- rb_thread_raised_set(th, RAISED_STACKOVERFLOW);
- rb_ec_stack_overflow(th->ec, FALSE);
+ rb_ec_raised_set(ec, RAISED_STACKOVERFLOW);
+ rb_ec_stack_overflow(ec, FALSE);
}
}
diff --git a/vm_insnhelper.c b/vm_insnhelper.c
index 0cc43af..102e73f 100644
--- a/vm_insnhelper.c
+++ b/vm_insnhelper.c
@@ -1859,8 +1859,8 @@ vm_cfp_consistent_p(rb_execution_context_t *ec, const rb_control_frame_t *reg_cf
{
const int ov_flags = RAISED_STACKOVERFLOW;
if (LIKELY(reg_cfp == ec->cfp + 1)) return TRUE;
- if (rb_thread_raised_p(rb_ec_thread_ptr(ec), ov_flags)) {
- rb_thread_raised_reset(rb_ec_thread_ptr(ec), ov_flags);
+ if (rb_ec_raised_p(ec, ov_flags)) {
+ rb_ec_raised_reset(ec, ov_flags);
return TRUE;
}
return FALSE;