Skip to content

Commit b2c5c7e

Browse files
committed
fix spill code
1 parent 5fe5ffa commit b2c5c7e

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

zjit/src/backend/arm64/mod.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -699,12 +699,14 @@ impl Assembler {
699699
}
700700

701701
/// split_stack_membase but without split_large_disp. This should be used only by lea.
702-
fn split_only_stack_membase(asm: &mut Assembler, opnd: Opnd, scratch_opnd: Opnd, stack_state: &StackState) -> Opnd {
702+
fn split_only_stack_membase(_asm: &mut Assembler, opnd: Opnd, _scratch_opnd: Opnd, stack_state: &StackState) -> Opnd {
703703
if let Opnd::Mem(Mem { base: stack_membase @ MemBase::Stack { .. }, disp: opnd_disp, num_bits: opnd_num_bits }) = opnd {
704-
let base = Opnd::Mem(stack_state.stack_membase_to_mem(stack_membase));
705-
let base = split_large_disp(asm, base, scratch_opnd);
706-
asm.load_into(scratch_opnd, base);
707-
Opnd::Mem(Mem { base: MemBase::Reg(scratch_opnd.unwrap_reg().reg_no), disp: opnd_disp, num_bits: opnd_num_bits })
704+
// Convert MemBase::Stack to MemBase::Reg(NATIVE_BASE_PTR) with the
705+
// correct stack displacement. The stack slot value lives directly at
706+
// [NATIVE_BASE_PTR + stack_disp], so we just adjust the base and
707+
// combine displacements — no indirection needed.
708+
let Mem { base, disp: stack_disp, .. } = stack_state.stack_membase_to_mem(stack_membase);
709+
Opnd::Mem(Mem { base, disp: stack_disp + opnd_disp, num_bits: opnd_num_bits })
708710
} else {
709711
opnd
710712
}

0 commit comments

Comments
 (0)