Skip to content

Commit 0dff4ec

Browse files
committed
unconditional jumps need to have branch args too
1 parent 50827f2 commit 0dff4ec

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

zjit/src/codegen.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,11 @@ fn gen_function(cb: &mut CodeBlock, iseq: IseqPtr, version: IseqVersionRef, func
357357
}
358358
Insn::Jump(target) => {
359359
let lir_target = hir_to_lir[&target.target];
360-
gen_jump(&mut jit, &mut asm, lir_target);
360+
let branch_edge = lir::BranchEdge {
361+
target: lir_target,
362+
args: target.args.iter().map(|insn_id| jit.get_opnd(*insn_id)).collect()
363+
};
364+
gen_jump(&mut jit, &mut asm, branch_edge);
361365
},
362366
_ => {
363367
if let Err(last_snapshot) = gen_insn(cb, &mut jit, &mut asm, function, insn_id, &insn) {
@@ -1258,9 +1262,9 @@ fn gen_param(asm: &mut Assembler, idx: usize) -> lir::Opnd {
12581262
}
12591263

12601264
/// Compile a jump to a basic block
1261-
fn gen_jump(_jit: &mut JITState, asm: &mut Assembler, branch: lir::BlockId) {
1265+
fn gen_jump(_jit: &mut JITState, asm: &mut Assembler, branch: lir::BranchEdge) {
12621266
// Jump to the basic block
1263-
asm.jmp(Target::Block(lir::BranchEdge { target: branch, args: vec![] }));
1267+
asm.jmp(Target::Block(branch));
12641268
}
12651269

12661270
/// Compile a conditional branch to a basic block

0 commit comments

Comments
 (0)