summaryrefslogtreecommitdiff
path: root/yjit.rb
diff options
context:
space:
mode:
authorAlan Wu <XrXr@users.noreply.github.com>2021-10-26 15:15:46 -0400
committerAlan Wu <XrXr@users.noreply.github.com>2021-10-27 13:00:05 -0400
commitfdbae38546c6cd352e5becfd6c555ea22eb64b96 (patch)
tree230bc7a25b7c363ee91c3398e20f5bf0b24b4ab2 /yjit.rb
parent6875d6d1fa086fcec58c9d888cbacc1e108a0935 (diff)
YJIT: move --yjit-stats at_exit call into Ruby
This change fixes `-v --yjit-stats`. Previously in this situation, YJIT._print_stats wasn't defined as yjit.rb is not evaluated when there is only "-v" and no Ruby code to run.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/5022
Diffstat (limited to 'yjit.rb')
-rw-r--r--yjit.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/yjit.rb b/yjit.rb
index cbd2ea1e44..66c4eaf702 100644
--- a/yjit.rb
+++ b/yjit.rb
@@ -142,13 +142,18 @@ module YJIT
end
def self.stats_enabled?
- Primitive.cexpr! 'rb_yjit_opts.gen_stats ? Qtrue : Qfalse'
+ Primitive.yjit_stats_enabled_p
end
def self.enabled?
Primitive.cexpr! 'rb_yjit_enabled_p() ? Qtrue : Qfalse'
end
+ # Avoid calling a method here to not interfere with compilation tests
+ if Primitive.yjit_stats_enabled_p
+ at_exit { _print_stats }
+ end
+
class << self
private