ruby-changes:48569
From: ko1 <ko1@a...>
Date: Tue, 7 Nov 2017 14:22:13 +0900 (JST)
Subject: [ruby-changes:48569] ko1:r60684 (trunk): * eval_intern.h: rename macros rb_thread_raised_* to
ko1 2017-11-07 14:22:09 +0900 (Tue, 07 Nov 2017) New Revision: 60684 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=60684 Log: * eval_intern.h: rename macros rb_thread_raised_* to rb_ec_raised_*. Modified files: trunk/eval.c trunk/eval_error.c trunk/eval_intern.h trunk/gc.c trunk/thread_win32.c trunk/vm.c trunk/vm_eval.c trunk/vm_insnhelper.c Index: thread_win32.c =================================================================== --- thread_win32.c (revision 60683) +++ thread_win32.c (revision 60684) @@ -734,7 +734,7 @@ native_reset_timer_thread(void) https://github.com/ruby/ruby/blob/trunk/thread_win32.c#L734 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 https://github.com/ruby/ruby/blob/trunk/thread_win32.c#L742 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 https://github.com/ruby/ruby/blob/trunk/thread_win32.c#L754 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); } } Index: eval_error.c =================================================================== --- eval_error.c (revision 60683) +++ eval_error.c (revision 60684) @@ -172,7 +172,7 @@ rb_ec_error_print(rb_execution_context_t https://github.com/ruby/ruby/blob/trunk/eval_error.c#L172 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 https://github.com/ruby/ruby/blob/trunk/eval_error.c#L203 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'") Index: vm_eval.c =================================================================== --- vm_eval.c (revision 60683) +++ vm_eval.c (revision 60684) @@ -255,12 +255,10 @@ rb_current_receiver(void) https://github.com/ruby/ruby/blob/trunk/vm_eval.c#L255 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); } } Index: eval.c =================================================================== --- eval.c (revision 60683) +++ eval.c (revision 60684) @@ -598,7 +598,7 @@ rb_longjmp(rb_execution_context_t *ec, i https://github.com/ruby/ruby/blob/trunk/eval.c#L598 { 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); } Index: gc.c =================================================================== --- gc.c (revision 60683) +++ gc.c (revision 60684) @@ -7697,27 +7697,27 @@ ruby_memerror(void) https://github.com/ruby/ruby/blob/trunk/gc.c#L7697 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 * Index: vm.c =================================================================== --- vm.c (revision 60683) +++ vm.c (revision 60684) @@ -1813,7 +1813,7 @@ vm_exec(rb_execution_context_t *ec) https://github.com/ruby/ruby/blob/trunk/vm.c#L1813 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; Index: vm_insnhelper.c =================================================================== --- vm_insnhelper.c (revision 60683) +++ vm_insnhelper.c (revision 60684) @@ -1859,8 +1859,8 @@ vm_cfp_consistent_p(rb_execution_context https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L1859 { 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; Index: eval_intern.h =================================================================== --- eval_intern.h (revision 60683) +++ eval_intern.h (revision 60684) @@ -98,7 +98,7 @@ extern int select_large_fdset(int, fd_se https://github.com/ruby/ruby/blob/trunk/eval_intern.h#L98 #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 { https://github.com/ruby/ruby/blob/trunk/eval_intern.h#L280 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); -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/