summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTakashi Kokubun <takashikkbn@gmail.com>2023-03-04 22:13:20 -0800
committerTakashi Kokubun <takashikkbn@gmail.com>2023-03-05 23:28:59 -0800
commitbd0d0d3b387b4ed87dde8a13a62c83eb9aafdb3a (patch)
treeff46c4e1d41dab535ee54fc00e21881c104dd4ed /lib
parent4a124dc1de42600f979e5af53c6444645da2a5fa (diff)
Reset chain_depth in more places
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/7448
Diffstat (limited to 'lib')
-rw-r--r--lib/ruby_vm/mjit/compiler.rb4
-rw-r--r--lib/ruby_vm/mjit/insn_compiler.rb1
2 files changed, 5 insertions, 0 deletions
diff --git a/lib/ruby_vm/mjit/compiler.rb b/lib/ruby_vm/mjit/compiler.rb
index 2f67136102..85e6b5fa06 100644
--- a/lib/ruby_vm/mjit/compiler.rb
+++ b/lib/ruby_vm/mjit/compiler.rb
@@ -239,6 +239,10 @@ module RubyVM::MJIT
case status = @insn_compiler.compile(jit, ctx, asm, insn)
when KeepCompiling
+ # For now, reset the chain depth after each instruction as only the
+ # first instruction in the block can concern itself with the depth.
+ ctx.chain_depth = 0
+
index += insn.len
when EndBlock
# TODO: pad nops if entry exit exists (not needed for x86_64?)
diff --git a/lib/ruby_vm/mjit/insn_compiler.rb b/lib/ruby_vm/mjit/insn_compiler.rb
index ecdd00a617..a37c1c1b1c 100644
--- a/lib/ruby_vm/mjit/insn_compiler.rb
+++ b/lib/ruby_vm/mjit/insn_compiler.rb
@@ -3623,6 +3623,7 @@ module RubyVM::MJIT
return_ctx = ctx.dup
return_ctx.stack_size -= argc # Pop args. blockarg has been popped
return_ctx.sp_offset = 1 # SP is in the position after popping a receiver and arguments
+ return_ctx.chain_depth = 0
branch_stub = BranchStub.new(
iseq: jit.iseq,
shape: Default,