summaryrefslogtreecommitdiff
path: root/lib/ruby_vm/mjit/compiler.rb
diff options
context:
space:
mode:
authorTakashi Kokubun <[email protected]>2023-02-16 22:29:58 -0800
committerTakashi Kokubun <[email protected]>2023-03-05 23:28:59 -0800
commit2cc4f506bac0748277b41a4a5eb6f0ec41dd7344 (patch)
tree447fda3d7e563383f04292504b526d786475b906 /lib/ruby_vm/mjit/compiler.rb
parent2603d7a0b7b0e698bed8910a8ad5edefe236de77 (diff)
Implement optimized send
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/7448
Diffstat (limited to 'lib/ruby_vm/mjit/compiler.rb')
-rw-r--r--lib/ruby_vm/mjit/compiler.rb13
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/ruby_vm/mjit/compiler.rb b/lib/ruby_vm/mjit/compiler.rb
index 5aac3626fa..b34df4c392 100644
--- a/lib/ruby_vm/mjit/compiler.rb
+++ b/lib/ruby_vm/mjit/compiler.rb
@@ -170,6 +170,17 @@ module RubyVM::MJIT
insn = self.class.decode_insn(iseq.body.iseq_encoded[index])
jit.pc = (iseq.body.iseq_encoded + index).to_i
+ # If previous instruction requested to record the boundary
+ if jit.record_boundary_patch_point
+ # Generate an exit to this instruction and record it
+ exit_pos = Assembler.new.then do |ocb_asm|
+ @exit_compiler.compile_side_exit(jit.pc, ctx, ocb_asm)
+ @ocb.write(ocb_asm)
+ end
+ Invariants.record_global_inval_patch(asm, exit_pos)
+ jit.record_boundary_patch_point = false
+ end
+
case status = @insn_compiler.compile(jit, ctx, asm, insn)
when KeepCompiling
index += insn.len
@@ -177,7 +188,7 @@ module RubyVM::MJIT
# TODO: pad nops if entry exit exists
break
when CantCompile
- @exit_compiler.compile_side_exit(jit, ctx, asm)
+ @exit_compiler.compile_side_exit(jit.pc, ctx, asm)
break
else
raise "compiling #{insn.name} returned unexpected status: #{status.inspect}"