diff options
| author | Takashi Kokubun <takashikkbn@gmail.com> | 2026-03-26 17:13:05 -0700 |
|---|---|---|
| committer | Takashi Kokubun <takashikkbn@gmail.com> | 2026-03-27 16:26:12 -0700 |
| commit | 29755f4d5cc88e6cc8605e415299641caed38122 (patch) | |
| tree | f0542cbdb5e908096d032ffb51797da65fb6ae26 /zjit | |
| parent | 59fe446e8f80c67d31c12609a8bb39dba6f48ec5 (diff) | |
ZJIT: Move jit_return clearing from rb_set_cfp_pc into codegen
The jit_return = 0 write in rb_set_cfp_pc was only needed by ZJIT.
Move it to the codegen call site next to where iseq is also set,
making the intent clearer.
Diffstat (limited to 'zjit')
| -rw-r--r-- | zjit/src/codegen.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/zjit/src/codegen.rs b/zjit/src/codegen.rs index 493033a6b1..c59dfbe525 100644 --- a/zjit/src/codegen.rs +++ b/zjit/src/codegen.rs @@ -3067,11 +3067,13 @@ c_callable! { let iseq_call = unsafe { Rc::from_raw(iseq_call_ptr as *const IseqCall) }; let iseq = iseq_call.iseq.get(); let entry_insn_idxs = crate::hir::jit_entry_insns(iseq); - // gen_push_frame() doesn't set PC, so we need to set them before exit. - // function_stub_hit_body() may allocate and call gc_validate_pc(), so we always set PC. + // gen_push_frame() doesn't set PC or ISEQ, so we need to set them before exit. + // function_stub_hit_body() may allocate and call gc_validate_pc(), so we always set PC and ISEQ. + // Clear jit_return so the interpreter reads cfp->pc and cfp->iseq directly. let pc = unsafe { rb_iseq_pc_at_idx(iseq, entry_insn_idxs[iseq_call.jit_entry_idx.to_usize()]) }; unsafe { rb_set_cfp_pc(cfp, pc) }; unsafe { (*cfp).iseq = iseq }; + unsafe { (*cfp).jit_return = std::ptr::null_mut() }; } with_vm_lock(src_loc!(), || { |
