Module: RubyVM::RJIT

Defined in:
lib/ruby_vm/rjit/insn_compiler.rb,
lib/ruby_vm/rjit/exit_compiler.rb,
lib/ruby_vm/rjit/branch_stub.rb,
lib/ruby_vm/rjit/invariants.rb,
lib/ruby_vm/rjit/entry_stub.rb,
lib/ruby_vm/rjit/code_block.rb,
lib/ruby_vm/rjit/jit_state.rb,
lib/ruby_vm/rjit/c_pointer.rb,
lib/ruby_vm/rjit/assembler.rb,
lib/ruby_vm/rjit/compiler.rb,
lib/ruby_vm/rjit/context.rb,
lib/ruby_vm/rjit/c_type.rb,
lib/ruby_vm/rjit/stats.rb,
lib/ruby_vm/rjit/hooks.rb,
lib/ruby_vm/rjit/type.rb

Defined Under Namespace

Modules: CPointer, CType, Hooks, OperandMatcher, TypeDiff Classes: Assembler, BranchStub, BranchTarget, BytePtr, CodeBlock, Compiler, Context, DwordPtr, EntryStub, ExitCompiler, InsnCompiler, Invariants, JITState, MapToLocal, StackOpnd, Type

Constant Summary collapse

Next0 =

Branch shapes

:Next0
Next1 =

target0 is a fallthrough

:Next1
Default =

target1 is a fallthrough

:Default
QwordPtr =

64-bit memory access

Array
C_ARGS =

SystemV x64 calling convention

[:rdi, :rsi, :rdx, :rcx, :r8, :r9]
C_RET =
:rax
KeepCompiling =

Compilation status

:KeepCompiling
CantCompile =
:CantCompile
EndBlock =
:EndBlock
Qtrue =

Ruby constants

Fiddle::Qtrue
Qfalse =
Fiddle::Qfalse
Qnil =
Fiddle::Qnil
Qundef =
Fiddle::Qundef
EC =

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

:r14
CFP =
:r15
SP =
:rbx
GC_REFS =

Mark objects in this Array during GC

[]
MAX_VERSIONS =

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

4
MAX_TEMP_TYPES =

Maximum number of temp value types we keep track of

8
MAX_LOCAL_TYPES =

Maximum number of local variable types we keep track of

8
SelfOpnd =

Operand to a YARV bytecode instruction

:SelfOpnd
MapToStack =

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

:MapToStack
MapToSelf =

Normal stack value

:MapToSelf

Class Method Summary collapse

Class Method Details

.runtime_stats ⇒ Object

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



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/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