Skip to content

Commit

Permalink
Reset chain_depth in more places
Browse files Browse the repository at this point in the history
  • Loading branch information
k0kubun committed Mar 6, 2023
1 parent 4a124dc commit bd0d0d3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/ruby_vm/mjit/compiler.rb
Expand Up @@ -239,6 +239,10 @@ def compile_block(asm, jit:, pc: jit.iseq.body.iseq_encoded.to_i, ctx: Context.n

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?)
Expand Down
1 change: 1 addition & 0 deletions lib/ruby_vm/mjit/insn_compiler.rb
Expand Up @@ -3623,6 +3623,7 @@ def jit_push_frame(jit, ctx, asm, cme, flags, argc, frame_type, block_handler, i
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,
Expand Down

0 comments on commit bd0d0d3

Please sign in to comment.