diff options
author | Yusuke Endoh <[email protected]> | 2025-05-02 16:06:13 +0900 |
---|---|---|
committer | Yusuke Endoh <[email protected]> | 2025-06-18 14:51:56 +0900 |
commit | ca10c521ff748bded89e481ab3f1767a8e56a71c () | |
tree | e76e1ac8545f0bd21be37c6ea3dbc93c4768bbed /vm_backtrace.c | |
parent | f0d32ee8d3b4e4da68191f4c1a3e6f06ae33e584 (diff) |
refactor: rename bt_update_cfunc_loc to bt_back_loc
In preparation for using it to update not only cfunc frames but also internal frames, the function (and related variable names) are chagned. I felt that the word "back" is more appropriate than the more general verb "update" here.
Notes: Merged: https://.com/ruby/ruby/pull/13238
-rw-r--r-- | vm_backtrace.c | 26 |
1 files changed, 13 insertions, 13 deletions
@@ -621,11 +621,11 @@ is_rescue_or_ensure_frame(const rb_control_frame_t *cfp) } static void -bt_update_cfunc_loc(unsigned long cfunc_counter, rb_backtrace_location_t *cfunc_loc, const rb_iseq_t *iseq, const VALUE *pc) { - for (; cfunc_counter > 0; cfunc_counter--, cfunc_loc--) { - cfunc_loc->iseq = iseq; - cfunc_loc->pc = pc; } } @@ -648,7 +648,7 @@ rb_ec_partial_backtrace_object(const rb_execution_context_t *ec, long start_fram rb_backtrace_t *bt = NULL; VALUE btobj = Qnil; rb_backtrace_location_t *loc = NULL; - unsigned long cfunc_counter = 0; bool skip_next_frame = FALSE; // In the case the thread vm_stack or cfp is not initialized, there is no backtrace. @@ -701,16 +701,16 @@ rb_ec_partial_backtrace_object(const rb_execution_context_t *ec, long start_fram if (rb_iseq_attr_p(cfp->iseq, BUILTIN_ATTR_C_TRACE)) { loc->iseq = NULL; loc->pc = NULL; - cfunc_counter++; } else { RB_OBJ_WRITE(btobj, &loc->iseq, iseq); loc->pc = pc; - bt_update_cfunc_loc(cfunc_counter, loc-1, iseq, pc); if (do_yield) { - bt_yield_loc(loc - cfunc_counter, cfunc_counter+1, btobj); } - cfunc_counter = 0; } } skip_next_frame = is_rescue_or_ensure_frame(cfp); @@ -727,21 +727,21 @@ rb_ec_partial_backtrace_object(const rb_execution_context_t *ec, long start_fram RB_OBJ_WRITE(btobj, &loc->cme, rb_vm_frame_method_entry(cfp)); loc->iseq = NULL; loc->pc = NULL; - cfunc_counter++; } } } // When a backtrace entry corresponds to a method defined in C (e.g. rb_define_method), the reported file:line // is the one of the caller Ruby frame, so if the last entry is a C frame we find the caller Ruby frame here. - if (cfunc_counter > 0) { for (; cfp != end_cfp; cfp = RUBY_VM_PREVIOUS_CONTROL_FRAME(cfp)) { if (cfp->iseq && cfp->pc && !(skip_internal && is_internal_location(cfp))) { VM_ASSERT(!skip_next_frame); // ISEQ_TYPE_RESCUE/ISEQ_TYPE_ENSURE should have a caller Ruby ISEQ, not a cfunc - bt_update_cfunc_loc(cfunc_counter, loc, cfp->iseq, cfp->pc); RB_OBJ_WRITTEN(btobj, Qundef, cfp->iseq); if (do_yield) { - bt_yield_loc(loc - cfunc_counter, cfunc_counter, btobj); } break; } |