diff options
author | Jeremy Evans <code@jeremyevans.net> | 2021-08-10 14:46:17 -0700 |
---|---|---|
committer | Jeremy Evans <code@jeremyevans.net> | 2022-03-09 15:16:00 -0800 |
commit | 5f4e78423337662d0fc6cccf63a0fc8835715fae (patch) | |
tree | 9f980db58f769989c878670ddffd35c75defcd6c /vm_backtrace.c | |
parent | 72c038a8f5cbddceefe1c4bd9bdc4592b9c095b9 (diff) | |
download | ruby-5f4e78423337662d0fc6cccf63a0fc8835715fae.tar.gz |
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.
Diffstat (limited to 'vm_backtrace.c')
-rw-r--r-- | vm_backtrace.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/vm_backtrace.c b/vm_backtrace.c index 27e108af61..8cb4881e15 100644 --- a/vm_backtrace.c +++ b/vm_backtrace.c @@ -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; |