[前][次][番号順一覧][スレッド一覧]

ruby-changes:69194

From: Alan <ko1@a...>
Date: Thu, 21 Oct 2021 08:23:20 +0900 (JST)
Subject: [ruby-changes:69194] cc2aa1221f (master): Fix avg_len_in_yjit

https://git.ruby-lang.org/ruby.git/commit/?id=cc2aa1221f

From cc2aa1221f96055c1d1d70ea4407b1ee12ed9a6b Mon Sep 17 00:00:00 2001
From: Alan Wu <XrXr@u...>
Date: Fri, 10 Sep 2021 11:04:14 -0400
Subject: Fix avg_len_in_yjit

We weren't counting completing an entire method in YJIT as exits so the
avg_len_in_yjit for

    ./miniruby --yjit-call-threshold=1 --yjit-stats -e'def foo; end; foo'

was infinite.
---
 yjit.rb | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/yjit.rb b/yjit.rb
index 51424a6a5e..0e118cc87e 100644
--- a/yjit.rb
+++ b/yjit.rb
@@ -162,10 +162,12 @@ module YJIT https://github.com/ruby/ruby/blob/trunk/yjit.rb#L162
       print_counters(stats, prefix: 'oaref_', prompt: 'opt_aref exit reasons: ')
       print_counters(stats, prefix: 'expandarray_', prompt: 'expandarray exit reasons: ')
 
-      total_exits = total_exit_count(stats)
+      side_exits = total_exit_count(stats)
+      total_exits = side_exits + stats[:leave_interp_return]
 
-      # Number of instructions that finish executing in YJIT
-      retired_in_yjit = stats[:exec_instruction] - total_exits
+      # Number of instructions that finish executing in YJIT.
+      # See :count-placement: about the subtraction.
+      retired_in_yjit = stats[:exec_instruction] - side_exits
 
       # Average length of instruction sequences executed by YJIT
       avg_len_in_yjit = retired_in_yjit.to_f / total_exits
-- 
cgit v1.2.1


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]