ruby-changes:71351
From: Jeremy <ko1@a...>
Date: Thu, 10 Mar 2022 08:16:18 +0900 (JST)
Subject: [ruby-changes:71351] 5f4e784233 (master): Avoid unnecessary conditional
https://git.ruby-lang.org/ruby.git/commit/?id=5f4e784233 From 5f4e78423337662d0fc6cccf63a0fc8835715fae Mon Sep 17 00:00:00 2001 From: Jeremy Evans <code@j...> Date: Tue, 10 Aug 2021 14:46:17 -0700 Subject: 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. --- vm_backtrace.c | 6 ++++-- 1 file 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 https://github.com/ruby/ruby/blob/trunk/vm_backtrace.c#L648 } } } - 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, https://github.com/ruby/ruby/blob/trunk/vm_backtrace.c#L918 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; -- cgit v1.2.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/