summaryrefslogtreecommitdiff
path: root/lib/ruby_vm/rjit/compiler.rb
diff options
context:
space:
mode:
authorTakashi Kokubun <[email protected]>2023-04-03 22:52:38 -0700
committerTakashi Kokubun <[email protected]>2023-04-04 00:35:29 -0700
commit19506650efeb8b19cea3f72d3f95547c5cbc3659 ()
treebe5eacc769e42bd350dd5420e265d052f168c9dc /lib/ruby_vm/rjit/compiler.rb
parent2c560b976ed86730dfa305266fcc69033f6790cc (diff)
RJIT: Add --rjit-verify-ctx option
-rw-r--r--lib/ruby_vm/rjit/compiler.rb70
1 files changed, 70 insertions, 0 deletions
@@ -279,6 +279,8 @@ module RubyVM::RJIT
end
# @param asm [RubyVM::RJIT::Assembler]
def compile_block(asm, jit:, pc:, ctx: Context.new)
# Mark the block start address and prepare an exit code storage
ctx = limit_block_versions(jit.iseq, pc, ctx)
@@ -292,6 +294,7 @@ module RubyVM::RJIT
# Compile each insn
index = (pc - iseq.body.iseq_encoded.to_i) / C.VALUE.size
while index < iseq.body.iseq_size
insn = self.class.decode_insn(iseq.body.iseq_encoded[index])
jit.pc = (iseq.body.iseq_encoded + index).to_i
jit.stack_size_for_pc = ctx.stack_size
@@ -308,6 +311,11 @@ module RubyVM::RJIT
jit.record_boundary__point = false
end
case status = @insn_compiler.compile(jit, ctx, asm, insn)
when KeepCompiling
# For now, reset the chain depth after each instruction as only the
@@ -435,5 +443,67 @@ module RubyVM::RJIT
rescue RangeError # bignum too big to convert into `unsigned long long' (RangeError)
-1
end
end
end