Skip to content

Commit b82975b

Browse files
committed
ZJIT: Decode bare opcodes in locals_written_in_block
locals_written_in_block scans child block ISEQs for setlocal/send instructions. After profiling, ZJIT rewrites send to zjit_send, so rb_iseq_opcode_at_pc returns the specialized opcode which doesn't match YARVINSN_send. Use rb_vm_insn_decode to strip zjit/trace specializations and always match on bare opcodes.
1 parent 9309f14 commit b82975b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

zjit/src/hir.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6267,7 +6267,8 @@ fn locals_written_in_block(parent_iseq: IseqPtr, blockiseq: IseqPtr, target_dept
62676267

62686268
while insn_idx < iseq_size {
62696269
let pc = unsafe { rb_iseq_pc_at_idx(blockiseq, insn_idx) };
6270-
let opcode = unsafe { rb_iseq_opcode_at_pc(blockiseq, pc) } as u32;
6270+
// Use rb_vm_insn_decode to get the bare opcode, stripping zjit/trace specializations.
6271+
let opcode = unsafe { rb_vm_insn_decode(*pc) } as u32;
62716272

62726273
match opcode {
62736274
YARVINSN_setlocal | YARVINSN_setblockparam

0 commit comments

Comments
 (0)