summaryrefslogtreecommitdiff
path: root/yjit.rb
diff options
context:
space:
mode:
authorAlan Wu <XrXr@users.noreply.github.com>2023-10-19 13:41:38 -0400
committerAlan Wu <XrXr@users.noreply.github.com>2023-10-19 15:14:20 -0400
commit9047fe5ea4e8c989c1081aa10f741a413c546534 (patch)
treec35e4e3e9bc5d2dbbcd01c511ccfa41c6c5a7203 /yjit.rb
parentcdc2a18541a42e63a8a0a3c2c5b72978ace01afa (diff)
YJIT: Print exit reasons on failure in test_yjit.rb
For <https://bugs.ruby-lang.org/issues/19921>, I suspect the test is failing due to a timing related interrupt, which on paper could happen with slow-enough GC runs. In any case, it's helpful for debugging to have more information when tests fail. Co-authored-by: Takashi Kokubun <takashikkbn@gmail.com>
Diffstat (limited to 'yjit.rb')
-rw-r--r--yjit.rb19
1 files changed, 12 insertions, 7 deletions
diff --git a/yjit.rb b/yjit.rb
index 295e88ef34..c39175d12d 100644
--- a/yjit.rb
+++ b/yjit.rb
@@ -245,13 +245,8 @@ module RubyVM::YJIT
$stderr.puts("YJIT exit locations dumped to `#{filename}`.")
end
- # Format and print out counters
- def _print_stats(out: $stderr) # :nodoc:
- stats = runtime_stats(context: true)
- return unless Primitive.rb_yjit_stats_enabled_p
-
- out.puts("***YJIT: Printing YJIT statistics on exit***")
-
+ # Print a summary of reasons for adverse performance events (e.g. exits)
+ def _print_stats_reasons(stats, out) # :nodoc:
print_counters(stats, out: out, prefix: 'send_', prompt: 'method call fallback reasons: ')
print_counters(stats, out: out, prefix: 'invokeblock_', prompt: 'invokeblock fallback reasons: ')
print_counters(stats, out: out, prefix: 'invokesuper_', prompt: 'invokesuper fallback reasons: ')
@@ -286,6 +281,16 @@ module RubyVM::YJIT
end
print_counters(stats, out: out, prefix: 'lshift_', prompt: 'left shift (ltlt) exit reasons: ')
print_counters(stats, out: out, prefix: 'invalidate_', prompt: 'invalidation reasons: ')
+ end
+
+ # Format and print out counters
+ def _print_stats(out: $stderr) # :nodoc:
+ stats = runtime_stats(context: true)
+ return unless Primitive.rb_yjit_stats_enabled_p
+
+ out.puts("***YJIT: Printing YJIT statistics on exit***")
+
+ _print_stats_reasons(stats, out)
# Number of failed compiler invocations
compilation_failure = stats[:compilation_failure]