From a93c650312c11fd22e146ec51d3208da28595152 Mon Sep 17 00:00:00 2001 From: ko1 Date: Sun, 29 Oct 2017 14:06:58 +0000 Subject: `rb_ec_error_print()`. * eval_error.c (rb_threadptr_error_print): renamed to rb_ec_error_print() and it accepts `ec`. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60545 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- eval.c | 2 +- eval_error.c | 28 ++++++++++++++-------------- process.c | 6 +++--- thread.c | 2 +- vm_core.h | 2 +- 5 files changed, 20 insertions(+), 20 deletions(-) diff --git a/eval.c b/eval.c index fa97b9d973..3ddef05cad 100644 --- a/eval.c +++ b/eval.c @@ -78,7 +78,7 @@ ruby_init(void) int state = ruby_setup(); if (state) { if (RTEST(ruby_debug)) - error_print(GET_THREAD()); + error_print(GET_EC()); exit(EXIT_FAILURE); } } diff --git a/eval_error.c b/eval_error.c index fd97fb3539..1e763046a7 100644 --- a/eval_error.c +++ b/eval_error.c @@ -67,9 +67,9 @@ set_backtrace(VALUE info, VALUE bt) } static void -error_print(rb_thread_t *th) +error_print(rb_execution_context_t *ec) { - rb_threadptr_error_print(th, th->ec->errinfo); + rb_ec_error_print(ec, ec->errinfo); } static void @@ -164,17 +164,17 @@ print_backtrace(const VALUE eclass, const VALUE errat, int reverse) } void -rb_threadptr_error_print(rb_thread_t *volatile th, volatile VALUE errinfo) +rb_ec_error_print(rb_execution_context_t * volatile ec, volatile VALUE errinfo) { volatile VALUE errat = Qundef; - volatile int raised_flag = th->ec->raised_flag; + volatile int raised_flag = ec->raised_flag; volatile VALUE eclass = Qundef, emesg = Qundef; if (NIL_P(errinfo)) return; - rb_thread_raised_clear(th); + rb_thread_raised_clear(rb_ec_thread_ptr(ec)); - EC_PUSH_TAG(th->ec); + EC_PUSH_TAG(ec); if (EC_EXEC_TAG() == TAG_NONE) { errat = rb_get_backtrace(errinfo); } @@ -202,8 +202,8 @@ rb_threadptr_error_print(rb_thread_t *volatile th, volatile VALUE errinfo) } error: EC_POP_TAG(); - th->ec->errinfo = errinfo; - rb_thread_raised_set(th, raised_flag); + ec->errinfo = errinfo; + rb_thread_raised_set(rb_ec_thread_ptr(ec), raised_flag); } #define undef_mesg_for(v, k) rb_fstring_cstr("undefined"v" method `%1$s' for "k" `%2$s'") @@ -269,9 +269,9 @@ static int error_handle(int ex) { int status = EXIT_FAILURE; - rb_thread_t *th = GET_THREAD(); + rb_execution_context_t *ec = GET_EC(); - if (rb_threadptr_set_raised(th)) + if (rb_threadptr_set_raised(rb_ec_thread_ptr(ec))) return EXIT_FAILURE; switch (ex & TAG_MASK) { case 0: @@ -304,7 +304,7 @@ error_handle(int ex) warn_print("unexpected throw\n"); break; case TAG_RAISE: { - VALUE errinfo = th->ec->errinfo; + VALUE errinfo = ec->errinfo; if (rb_obj_is_kind_of(errinfo, rb_eSystemExit)) { status = sysexit_status(errinfo); } @@ -313,17 +313,17 @@ error_handle(int ex) /* no message when exiting by signal */ } else { - rb_threadptr_error_print(th, errinfo); + rb_ec_error_print(ec, errinfo); } break; } case TAG_FATAL: - error_print(th); + error_print(ec); break; default: unknown_longjmp_status(ex); break; } - rb_threadptr_reset_raised(th); + rb_threadptr_reset_raised(rb_ec_thread_ptr(ec)); return status; } diff --git a/process.c b/process.c index 16d489a7ec..a67e63b89d 100644 --- a/process.c +++ b/process.c @@ -3850,10 +3850,10 @@ rb_f_abort(int argc, const VALUE *argv) { rb_check_arity(argc, 0, 1); if (argc == 0) { - rb_thread_t *th = GET_THREAD(); - VALUE errinfo = th->ec->errinfo; + rb_execution_context_t *ec = GET_EC(); + VALUE errinfo = ec->errinfo; if (!NIL_P(errinfo)) { - rb_threadptr_error_print(th, errinfo); + rb_ec_error_print(ec, errinfo); } rb_exit(EXIT_FAILURE); } diff --git a/thread.c b/thread.c index 5a98a19cf3..8e32b04424 100644 --- a/thread.c +++ b/thread.c @@ -642,7 +642,7 @@ thread_start_func_2(rb_thread_t *th, VALUE *stack_start, VALUE *register_stack_s VALUE mesg = rb_thread_to_s(th->self); rb_str_cat_cstr(mesg, " terminated with exception:\n"); rb_write_error_str(mesg); - rb_threadptr_error_print(th, errinfo); + rb_ec_error_print(th->ec, errinfo); } if (th->vm->thread_abort_on_exception || th->abort_on_exception || RTEST(ruby_debug)) { diff --git a/vm_core.h b/vm_core.h index 11ee962fc7..4dcc7aad48 100644 --- a/vm_core.h +++ b/vm_core.h @@ -1676,7 +1676,7 @@ void rb_threadptr_unlock_all_locking_mutexes(rb_thread_t *th); void rb_threadptr_pending_interrupt_clear(rb_thread_t *th); void rb_threadptr_pending_interrupt_enque(rb_thread_t *th, VALUE v); int rb_threadptr_pending_interrupt_active_p(rb_thread_t *th); -void rb_threadptr_error_print(rb_thread_t *volatile th, volatile VALUE errinfo); +void rb_ec_error_print(rb_execution_context_t * volatile ec, volatile VALUE errinfo); void rb_execution_context_mark(const rb_execution_context_t *ec); void rb_fiber_close(rb_fiber_t *fib); void Init_native_thread(rb_thread_t *th); -- cgit v1.2.3