module RubyVM::RJIT

Constants

CFP
C_ARGS

SystemV x64 calling convention

C_RET
CantCompile
Default
EC

Callee-saved registers TODO: support using r12/r13 here

EndBlock
GC_REFS

Mark objects in this Array during GC

KeepCompiling

Compilation status

MAX_LOCAL_TYPES

Maximum number of local variable types we keep track of

MAX_TEMP_TYPES

Maximum number of temp value types we keep track of

MAX_VERSIONS

Maximum number of versions per block 1 means always create generic versions

MapToLocal
MapToSelf
MapToStack

Potential mapping of a value on the temporary stack to self, a local variable, or constant so that we can track its type

Next0

Branch shapes

Next1
Qfalse
Qnil
Qtrue

Ruby constants

Qundef
QwordPtr

64-bit memory access

SP
SelfOpnd

Operand to a YARV bytecode instruction

StackOpnd
Type

Represent the type of a value (local/stack/self) in RJIT

Public Class Methods

runtime_stats() click to toggle source

Return a Hash for RJIT statistics. --rjit-stats makes more information available.

# File ruby_vm/rjit/stats.rb, line 4
def self.runtime_stats
  stats = {}

  # Insn exits
  INSNS.each_value do |insn|
    exits = C.rjit_insn_exits[insn.bin]
    if exits > 0
      stats[:"exit_#{insn.name}"] = exits
    end
  end

  # Runtime stats
  C.rb_rjit_runtime_counters.members.each do |member|
    stats[member] = C.rb_rjit_counters.public_send(member)
  end
  stats[:vm_insns_count] = C.rb_vm_insns_count

  # Other stats are calculated here
  stats[:side_exit_count] = stats.select { |name, _count| name.start_with?('exit_') }.sum(&:last)
  if stats[:vm_insns_count] > 0
    retired_in_rjit = stats[:rjit_insns_count] - stats[:side_exit_count]
    stats[:total_insns_count] = retired_in_rjit + stats[:vm_insns_count]
    stats[:ratio_in_rjit] = 100.0 * retired_in_rjit / stats[:total_insns_count]
  else
    stats.delete(:vm_insns_count)
  end

  stats
end