diff options
author | Takashi Kokubun <takashikkbn@gmail.com> | 2023-12-19 11:47:27 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-19 11:47:27 -0800 |
commit | bd91c5127ff30f5a21547e73a493c06fbd6da7ae (patch) | |
tree | 461f5cd88079ac5c1ad47d050ad2a504acc4ade4 /yjit.rb | |
parent | 084b44e79dd456c9ce09ac06c6faf538160ac6b0 (diff) | |
download | ruby-bd91c5127ff30f5a21547e73a493c06fbd6da7ae.tar.gz |
YJIT: Add stats option to RubyVM::YJIT.enable (#9297)
Diffstat (limited to 'yjit.rb')
-rw-r--r-- | yjit.rb | 21 |
1 files changed, 13 insertions, 8 deletions
@@ -29,8 +29,10 @@ module RubyVM::YJIT end # Enable \YJIT compilation. - def self.enable - Primitive.rb_yjit_enable + def self.enable(stats: false) + return false if enabled? + at_exit { print_and_dump_stats } if stats + Primitive.rb_yjit_enable(stats, stats != :quiet) end # If --yjit-trace-exits is enabled parse the hashes from @@ -223,18 +225,21 @@ module RubyVM::YJIT Primitive.rb_yjit_simulate_oom_bang end - # Avoid calling a method here to not interfere with compilation tests + # Avoid calling a Ruby method here to not interfere with compilation tests if Primitive.rb_yjit_stats_enabled_p - at_exit do + at_exit { print_and_dump_stats } + end + + class << self # :stopdoc: + private + + # Print stats and dump exit locations + def print_and_dump_stats if Primitive.rb_yjit_print_stats_p _print_stats end _dump_locations end - end - - class << self # :stopdoc: - private def _dump_locations # :nodoc: return unless trace_exit_locations_enabled? |