summaryrefslogtreecommitdiff
path: root/yjit.rb
diff options
context:
space:
mode:
authorAlan Wu <XrXr@users.noreply.github.com>2021-09-10 11:04:14 -0400
committerAlan Wu <XrXr@users.noreply.github.com>2021-10-20 18:19:40 -0400
commitcc2aa1221f96055c1d1d70ea4407b1ee12ed9a6b (patch)
tree26b4c41c52e34f5e414951230227fe4e65840729 /yjit.rb
parentcbb0271dd6256601aa6aea669ceac4f82fdb75fe (diff)
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.
Diffstat (limited to 'yjit.rb')
-rw-r--r--yjit.rb8
1 files 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
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