1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Avoid unnecessary conditional

All frames should be either iseq frames or cfunc frames.  Use a
VM assert instead of a conditional to check for a cfunc frame if
the current frame is not an iseq frame.
This commit is contained in:
Jeremy Evans 2021-08-10 14:46:17 -07:00
parent 72c038a8f5
commit 5f4e784233
Notes: git 2022-03-10 08:16:27 +09:00

View file

@ -648,7 +648,8 @@ rb_ec_partial_backtrace_object(const rb_execution_context_t *ec, long start_fram
}
}
}
else if (RUBYVM_CFUNC_FRAME_P(cfp)) {
else {
VM_ASSERT(RUBYVM_CFUNC_FRAME_P(cfp));
if (start_frame > 0) {
start_frame--;
}
@ -917,7 +918,8 @@ backtrace_each(const rb_execution_context_t *ec,
iter_iseq(arg, cfp);
}
}
else if (RUBYVM_CFUNC_FRAME_P(cfp)) {
else {
VM_ASSERT(RUBYVM_CFUNC_FRAME_P(cfp));
const rb_callable_method_entry_t *me = rb_vm_frame_method_entry(cfp);
ID mid = me->def->original_id;