ruby-changes:42648
From: nobu <ko1@a...>
Date: Sat, 23 Apr 2016 11:26:52 +0900 (JST)
Subject: [ruby-changes:42648] nobu:r54722 (trunk): eval_error.c: reuse threadptr
nobu 2016-04-23 12:23:28 +0900 (Sat, 23 Apr 2016) New Revision: 54722 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=54722 Log: eval_error.c: reuse threadptr * eval_error.c (error_print, error_handle): reuse same threadptr by passing as an argument. Modified files: trunk/eval.c trunk/eval_error.c Index: eval.c =================================================================== --- eval.c (revision 54721) +++ eval.c (revision 54722) @@ -76,7 +76,7 @@ ruby_init(void) https://github.com/ruby/ruby/blob/trunk/eval.c#L76 int state = ruby_setup(); if (state) { if (RTEST(ruby_debug)) - error_print(); + error_print(GET_THREAD()); exit(EXIT_FAILURE); } } Index: eval_error.c =================================================================== --- eval_error.c (revision 54721) +++ eval_error.c (revision 54722) @@ -87,10 +87,9 @@ set_backtrace(VALUE info, VALUE bt) https://github.com/ruby/ruby/blob/trunk/eval_error.c#L87 } static void -error_print(void) +error_print(rb_thread_t *th) { volatile VALUE errat = Qundef; - rb_thread_t *th = GET_THREAD(); VALUE errinfo = th->errinfo; int raised_flag = th->raised_flag; volatile VALUE eclass = Qundef, e = Qundef; @@ -200,7 +199,7 @@ error_print(void) https://github.com/ruby/ruby/blob/trunk/eval_error.c#L199 void ruby_error_print(void) { - error_print(); + error_print(GET_THREAD()); } #define undef_mesg_for(v, k) rb_fstring_cstr("undefined"v" method `%1$s' for "k" `%2$s'") @@ -301,7 +300,7 @@ error_handle(int ex) https://github.com/ruby/ruby/blob/trunk/eval_error.c#L300 warn_print("unexpected throw\n"); break; case TAG_RAISE: { - VALUE errinfo = GET_THREAD()->errinfo; + VALUE errinfo = th->errinfo; if (rb_obj_is_kind_of(errinfo, rb_eSystemExit)) { status = sysexit_status(errinfo); } @@ -310,12 +309,12 @@ error_handle(int ex) https://github.com/ruby/ruby/blob/trunk/eval_error.c#L309 /* no message when exiting by signal */ } else { - error_print(); + error_print(th); } break; } case TAG_FATAL: - error_print(); + error_print(th); break; default: unknown_longjmp_status(ex); -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/