summaryrefslogtreecommitdiff
path: root/lib/ruby_vm/mjit/insn_compiler.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/ruby_vm/mjit/insn_compiler.rb')
-rw-r--r--lib/ruby_vm/mjit/insn_compiler.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/ruby_vm/mjit/insn_compiler.rb b/lib/ruby_vm/mjit/insn_compiler.rb
index 386a97eb26..33c7db5435 100644
--- a/lib/ruby_vm/mjit/insn_compiler.rb
+++ b/lib/ruby_vm/mjit/insn_compiler.rb
@@ -1294,7 +1294,10 @@ module RubyVM::MJIT
asm.comment('set up new frame')
cfp_offset = -C.rb_control_frame_t.size # callee CFP
- # Not setting PC since JIT code will do that as needed
+ # For ISEQ, JIT code will set it as needed. However, C func needs 0 there for svar frame detection.
+ if iseq.nil?
+ asm.mov([CFP, cfp_offset + C.rb_control_frame_t.offsetof(:pc)], 0)
+ end
asm.mov(:rax, iseq.to_i)
asm.mov([CFP, cfp_offset + C.rb_control_frame_t.offsetof(:iseq)], :rax)
self_index = ctx.sp_offset - (1 + argc) # TODO: +1 for VM_CALL_ARGS_BLOCKARG