ruby-changes:48408
From: ko1 <ko1@a...>
Date: Sat, 28 Oct 2017 22:22:11 +0900 (JST)
Subject: [ruby-changes:48408] ko1:r60522 (trunk): `th` -> `ec` for backtrace functions.
ko1 2017-10-28 22:22:04 +0900 (Sat, 28 Oct 2017) New Revision: 60522 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=60522 Log: `th` -> `ec` for backtrace functions. * vm_backtrace.c: accept `ec` and rename `threadptr` to `ec`. * rb_threadptr_backtrace_object -> rb_ec_backtrace_object * rb_threadptr_backtrace_str_ary -> rb_ec_backtrace_str_ar * rb_threadptr_backtrace_location_ary -> rb_ec_backtrace_location_ary * threadptr_backtrace_to_ary -> ec_backtrace_to_ary * vm_eval.c (adjust_backtrace_in_eval): accepts `ec`. Modified files: trunk/eval.c trunk/eval_intern.h trunk/thread.c trunk/vm_args.c trunk/vm_backtrace.c trunk/vm_eval.c trunk/vm_insnhelper.c Index: vm_args.c =================================================================== --- vm_args.c (revision 60521) +++ vm_args.c (revision 60522) @@ -697,11 +697,11 @@ raise_argument_error(rb_execution_contex https://github.com/ruby/ruby/blob/trunk/vm_args.c#L697 VM_BLOCK_HANDLER_NONE /* specval*/, Qfalse /* me or cref */, iseq->body->iseq_encoded, ec->cfp->sp, 0, 0 /* stack_max */); - at = rb_threadptr_backtrace_object(rb_ec_thread_ptr(ec)); + at = rb_ec_backtrace_object(ec); rb_vm_pop_frame(ec); } else { - at = rb_threadptr_backtrace_object(rb_ec_thread_ptr(ec)); + at = rb_ec_backtrace_object(ec); } rb_ivar_set(exc, idBt_locations, at); Index: eval_intern.h =================================================================== --- eval_intern.h (revision 60521) +++ eval_intern.h (revision 60522) @@ -314,9 +314,9 @@ void rb_thread_terminate_all(void); https://github.com/ruby/ruby/blob/trunk/eval_intern.h#L314 VALUE rb_vm_cbase(void); /* vm_backtrace.c */ -VALUE rb_threadptr_backtrace_object(rb_thread_t *th); -VALUE rb_threadptr_backtrace_str_ary(rb_thread_t *th, long lev, long n); -VALUE rb_threadptr_backtrace_location_ary(rb_thread_t *th, long lev, long n); +VALUE rb_ec_backtrace_object(const rb_execution_context_t *ec); +VALUE rb_ec_backtrace_str_ary(const rb_execution_context_t *ec, long lev, long n); +VALUE rb_ec_backtrace_location_ary(const rb_execution_context_t *ec, long lev, long n); #ifndef CharNext /* defined as CharNext[AW] on Windows. */ # ifdef HAVE_MBLEN Index: thread.c =================================================================== --- thread.c (revision 60521) +++ thread.c (revision 60522) @@ -4937,7 +4937,7 @@ debug_deadlock_check(rb_vm_t *vm, VALUE https://github.com/ruby/ruby/blob/trunk/thread.c#L4937 } } rb_str_catf(msg, "\n "); - rb_str_concat(msg, rb_ary_join(rb_threadptr_backtrace_str_ary(th, 0, 0), sep)); + rb_str_concat(msg, rb_ary_join(rb_ec_backtrace_str_ary(th->ec, 0, 0), sep)); rb_str_catf(msg, "\n"); } } Index: vm_insnhelper.c =================================================================== --- vm_insnhelper.c (revision 60521) +++ vm_insnhelper.c (revision 60522) @@ -37,7 +37,7 @@ ec_stack_overflow(rb_execution_context_t https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L37 VALUE mesg = rb_ec_vm_ptr(ec)->special_exceptions[ruby_error_sysstack]; ec->raised_flag = RAISED_STACKOVERFLOW; if (setup) { - VALUE at = rb_threadptr_backtrace_object(rb_ec_thread_ptr(ec)); + VALUE at = rb_ec_backtrace_object(ec); mesg = ruby_vm_special_exception_copy(mesg); rb_ivar_set(mesg, idBt, at); rb_ivar_set(mesg, idBt_locations, at); Index: vm_eval.c =================================================================== --- vm_eval.c (revision 60521) +++ vm_eval.c (revision 60522) @@ -1243,12 +1243,12 @@ rb_each(VALUE obj) https://github.com/ruby/ruby/blob/trunk/vm_eval.c#L1243 } static VALUE -adjust_backtrace_in_eval(rb_thread_t *th, VALUE errinfo) +adjust_backtrace_in_eval(const rb_execution_context_t *ec, VALUE errinfo) { VALUE errat = rb_get_backtrace(errinfo); VALUE mesg = rb_attr_get(errinfo, id_mesg); if (RB_TYPE_P(errat, T_ARRAY)) { - VALUE bt2 = rb_threadptr_backtrace_str_ary(th, 0, 0); + VALUE bt2 = rb_ec_backtrace_str_ary(ec, 0, 0); if (RARRAY_LEN(bt2) > 0) { if (RB_TYPE_P(mesg, T_STRING) && !RSTRING_LEN(mesg)) { rb_ivar_set(errinfo, id_mesg, RARRAY_AREF(errat, 0)); @@ -1318,7 +1318,7 @@ eval_string_with_cref(VALUE self, VALUE https://github.com/ruby/ruby/blob/trunk/vm_eval.c#L1318 iseq = rb_iseq_compile_with_option(src, fname, realpath, INT2FIX(line), base_block, Qnil); if (!iseq) { - rb_exc_raise(adjust_backtrace_in_eval(rb_ec_thread_ptr(ec), ec->errinfo)); + rb_exc_raise(adjust_backtrace_in_eval(ec, ec->errinfo)); } /* TODO: what the code checking? */ @@ -1357,7 +1357,7 @@ eval_string_with_cref(VALUE self, VALUE https://github.com/ruby/ruby/blob/trunk/vm_eval.c#L1357 if (state) { if (state == TAG_RAISE) { - adjust_backtrace_in_eval(rb_ec_thread_ptr(ec), ec->errinfo); + adjust_backtrace_in_eval(ec, ec->errinfo); } EC_JUMP_TAG(ec, state); } Index: vm_backtrace.c =================================================================== --- vm_backtrace.c (revision 60521) +++ vm_backtrace.c (revision 60522) @@ -512,12 +512,12 @@ bt_iter_cfunc(void *ptr, const rb_contro https://github.com/ruby/ruby/blob/trunk/vm_backtrace.c#L512 } VALUE -rb_threadptr_backtrace_object(rb_thread_t *th) +rb_ec_backtrace_object(const rb_execution_context_t *ec) { struct bt_iter_arg arg; arg.prev_loc = 0; - backtrace_each(th->ec, + backtrace_each(ec, bt_init, bt_iter_iseq, bt_iter_cfunc, @@ -650,15 +650,15 @@ backtrace_load_data(VALUE self, VALUE st https://github.com/ruby/ruby/blob/trunk/vm_backtrace.c#L650 } VALUE -rb_threadptr_backtrace_str_ary(rb_thread_t *th, long lev, long n) +rb_ec_backtrace_str_ary(const rb_execution_context_t *ec, long lev, long n) { - return backtrace_to_str_ary(rb_threadptr_backtrace_object(th), lev, n); + return backtrace_to_str_ary(rb_ec_backtrace_object(ec), lev, n); } VALUE -rb_threadptr_backtrace_location_ary(rb_thread_t *th, long lev, long n) +rb_ec_backtrace_location_ary(const rb_execution_context_t *ec, long lev, long n) { - return backtrace_to_location_ary(rb_threadptr_backtrace_object(th), lev, n); + return backtrace_to_location_ary(rb_ec_backtrace_object(ec), lev, n); } /* make old style backtrace directly */ @@ -812,15 +812,15 @@ rb_backtrace_each(VALUE (*iter)(VALUE re https://github.com/ruby/ruby/blob/trunk/vm_backtrace.c#L812 VALUE rb_make_backtrace(void) { - return rb_threadptr_backtrace_str_ary(GET_THREAD(), 0, 0); + return rb_ec_backtrace_str_ary(GET_EC(), 0, 0); } static VALUE -threadptr_backtrace_to_ary(rb_thread_t *th, int argc, const VALUE *argv, int lev_default, int lev_plus, int to_str) +ec_backtrace_to_ary(const rb_execution_context_t *ec, int argc, const VALUE *argv, int lev_default, int lev_plus, int to_str) { VALUE level, vn; long lev, n; - VALUE btval = rb_threadptr_backtrace_object(th); + VALUE btval = rb_ec_backtrace_object(ec); VALUE r; rb_backtrace_t *bt; @@ -894,7 +894,7 @@ thread_backtrace_to_ary(int argc, const https://github.com/ruby/ruby/blob/trunk/vm_backtrace.c#L894 if (target_th->to_kill || target_th->status == THREAD_KILLED) return Qnil; - return threadptr_backtrace_to_ary(target_th, argc, argv, 0, 0, to_str); + return ec_backtrace_to_ary(target_th->ec, argc, argv, 0, 0, to_str); } VALUE @@ -950,7 +950,7 @@ rb_vm_thread_backtrace_locations(int arg https://github.com/ruby/ruby/blob/trunk/vm_backtrace.c#L950 static VALUE rb_f_caller(int argc, VALUE *argv) { - return threadptr_backtrace_to_ary(GET_THREAD(), argc, argv, 1, 1, 1); + return ec_backtrace_to_ary(GET_EC(), argc, argv, 1, 1, 1); } /* @@ -978,7 +978,7 @@ rb_f_caller(int argc, VALUE *argv) https://github.com/ruby/ruby/blob/trunk/vm_backtrace.c#L978 static VALUE rb_f_caller_locations(int argc, VALUE *argv) { - return threadptr_backtrace_to_ary(GET_THREAD(), argc, argv, 1, 1, 0); + return ec_backtrace_to_ary(GET_EC(), argc, argv, 1, 1, 0); } /* called from Init_vm() in vm.c */ @@ -1178,7 +1178,7 @@ rb_debug_inspector_open(rb_debug_inspect https://github.com/ruby/ruby/blob/trunk/vm_backtrace.c#L1178 dbg_context.th = th; dbg_context.cfp = dbg_context.th->ec->cfp; - dbg_context.backtrace = rb_threadptr_backtrace_location_ary(th, 0, 0); + dbg_context.backtrace = rb_ec_backtrace_location_ary(th->ec, 0, 0); dbg_context.backtrace_size = RARRAY_LEN(dbg_context.backtrace); dbg_context.contexts = collect_caller_bindings(th); Index: eval.c =================================================================== --- eval.c (revision 60521) +++ eval.c (revision 60522) @@ -520,7 +520,7 @@ setup_exception(rb_execution_context_t * https://github.com/ruby/ruby/blob/trunk/eval.c#L520 exc_setup_cause(mesg, cause); } if (NIL_P(bt)) { - VALUE at = rb_threadptr_backtrace_object(rb_ec_thread_ptr(ec)); + VALUE at = rb_ec_backtrace_object(ec); rb_ivar_set(mesg, idBt_locations, at); set_backtrace(mesg, at); } -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/