diff options
author | Takashi Kokubun <[email protected]> | 2023-02-10 21:54:35 -0800 |
---|---|---|
committer | Takashi Kokubun <[email protected]> | 2023-03-05 22:41:35 -0800 |
commit | cacf2f3709a570560085e6a95c3a78e8fb8cc0f5 (patch) | |
tree | e33514f4ce3a4eb493b95dea15533776300a37a3 /lib/ruby_vm | |
parent | 9e42f315741b8e1be38540ea3d115ef0fc72cd51 (diff) |
Set 0 to cfp->pc on C func send
Diffstat (limited to 'lib/ruby_vm')
-rw-r--r-- | lib/ruby_vm/mjit/insn_compiler.rb | 5 |
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 |