mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
YJIT: Add stats option to RubyVM::YJIT.enable (#9297)
This commit is contained in:
parent
084b44e79d
commit
bd91c5127f
5 changed files with 45 additions and 17 deletions
21
yjit.rb
21
yjit.rb
|
@ -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?
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue