diff options
author | 卜部昌平 <shyouhei@ruby-lang.org> | 2020-07-07 09:02:22 +0900 |
---|---|---|
committer | 卜部昌平 <shyouhei@ruby-lang.org> | 2020-07-10 12:23:41 +0900 |
commit | e4ee99209932e424be426c5f4cad7e9704522e34 (patch) | |
tree | 52a99f8d6e547dfa9350547be0a5dd046f459774 /vm_insnhelper.c | |
parent | 0e276dc458f94d9d79a0f7c7669bde84abe80f21 (diff) |
vm_push_frame_debug_counter_inc: use branches
Ko1 doesn't like previous code.
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/3296
Diffstat (limited to 'vm_insnhelper.c')
-rw-r--r-- | vm_insnhelper.c | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/vm_insnhelper.c b/vm_insnhelper.c index e026667af9..4b6542405d 100644 --- a/vm_insnhelper.c +++ b/vm_insnhelper.c @@ -301,12 +301,22 @@ vm_push_frame_debug_counter_inc( if (RUBY_VM_END_CONTROL_FRAME(ec) != prev_cfp) { const bool curr = VM_FRAME_RUBYFRAME_P(reg_cfp); const bool prev = VM_FRAME_RUBYFRAME_P(prev_cfp); - const enum rb_debug_counter_type pat[2][2] = { - { RB_DEBUG_COUNTER_frame_R2R, RB_DEBUG_COUNTER_frame_R2C, }, - { RB_DEBUG_COUNTER_frame_C2R, RB_DEBUG_COUNTER_frame_C2C, }, - }; - const enum rb_debug_counter_type i = pat[prev][curr]; - rb_debug_counter[i]++; + if (prev) { + if (crr) { + RB_DEBUG_COUNTER_INC(frame_R2R); + } + else { + RB_DEBUG_COUNTER_INC(frame_R2C); + } + } + else { + if (crr) { + RB_DEBUG_COUNTER_INC(frame_C2R); + } + else { + RB_DEBUG_COUNTER_INC(frame_C2C); + } + } } switch (type & VM_FRAME_MAGIC_MASK) { |