Module

This module allows for introspection of YJIT, CRuby’s in-process just-in-time compiler. This module exists only to help develop YJIT, as such, everything in the module is highly implementation specific and comes with no API stability guarantee whatsoever.

This module may not exist if YJIT does not support the particular platform for which CRuby is built. There is also no API stability guarantee as to in what situations this module is defined.

Class Methods

Free and recompile all existing JIT code

Produce disassembly for an iseq

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.

Check if YJIT is enabled

If –yjit-trace-exits is enabled parse the hashes from Primitive.rb_yjit_get_exit_locations into a format readable by Stackprof. This will allow us to find the exact location of a side exit in YJIT based on the instruction that is exiting.

Produce a list of instructions compiled by YJIT for an iseq

Discard statistics collected for –yjit-stats.

Return a hash for statistics generated for the –yjit-stats command line option. Return nil when option is not passed or unavailable.

Check if –yjit-stats is used.

Check if rb_yjit_trace_exit_locations_enabled_p is enabled.