module RubyVM::YJIT
This module allows for introspection of YJIT, CRuby’s just-in-time compiler. Everything in the module is highly implementation specific and the API might be less stable compared to the standard library. This module may not exist if YJIT does not support the particular platform for which CRuby is built.
Public Class Methods
() → void
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/core/ruby_vm.rbs, line 658
def self.code_gc: () -> void
Discard existing compiled code to reclaim memory and allow for recompilations in the future.
(untyped filename) → void
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/core/ruby_vm.rbs, line 684
def self.dump_exit_locations: (untyped filename) -> void
Marshal dumps exit locations to the given filename. Usage: If --yjit-exit-locations is passed, a file named “yjit_exit_locations.dump” will automatically be generated. If you want to collect traces manually, call dump_exit_locations directly. Note that calling this in a script will generate stats after the dump is created, so the stats data may include exits from the dump itself. In a script call: at_exit do RubyVM::YJIT.dump_exit_locations(“my_file.dump”) end
Then run the file with the following options: ruby –yjit –yjit-trace-exits test.rb
Once the code is done running, use Stackprof to read the dump file. See Stackprof documentation for options.
(?stats: false | true | :quiet) → void
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/core/ruby_vm.rbs, line 704
def self.enable: (?stats: false | true | :quiet) -> void
Enable YJIT compilation. stats option decides whether to enable YJIT stats or not. log decides whether to enable YJIT compilation logging or not. Optional mem_size and call_threshold can be provided to override default configuration. * stats: * false: Don’t enable stats. * true: Enable stats. Print stats at exit. * :quiet: Enable stats. Do not print stats at exit. * log: * false: Don’t enable the log. * true: Enable the log. Print log at exit. * :quiet: Enable the log. Do not print log at exit.
() → bool
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/core/ruby_vm.rbs, line 712
def self.enabled?: () -> bool
Check if YJIT is enabled.
(untyped pad, untyped number) → untyped
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/core/ruby_vm.rbs, line 720
def self.format_number: (untyped pad, untyped number) -> untyped
Format large numbers with comma separators for readability
(untyped pad, untyped number, untyped total) → untyped
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/core/ruby_vm.rbs, line 728
def self.format_number_pct: (untyped pad, untyped number, untyped total) -> untyped
Format a number along with a percentage over a total value
() → void
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/core/ruby_vm.rbs, line 736
def self.reset_stats!: () -> void
Discard statistics collected for --yjit-stats.
(?context: bool) → Hash[untyped, untyped]?
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/core/ruby_vm.rbs, line 748
def self.runtime_stats: (?context: bool) -> Hash[untyped, untyped]?
Return a hash for statistics generated for the --yjit-stats command line option. Return nil when option is not passed or unavailable. If a symbol argument is provided, return only the value for the named stat. If any other type is provided, raises TypeError.
() → bool
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/core/ruby_vm.rbs, line 756
def self.stats_enabled?: () -> bool
Check if --yjit-stats is used.