Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions zjit/src/backend/arm64/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -682,6 +682,7 @@ impl Assembler {
fn split_only_stack_membase(asm: &mut Assembler, opnd: Opnd, scratch_opnd: Opnd, stack_state: &StackState) -> Opnd {
match opnd {
Opnd::Mem(Mem { base: stack_membase @ MemBase::Stack { .. }, disp: opnd_disp, num_bits: opnd_num_bits }) => {
// TODO(max): Delete StackIndirect and revert it back to previous Stack behavior with load_into
// Convert MemBase::Stack to MemBase::Reg(NATIVE_BASE_PTR) with the
// correct stack displacement. The stack slot value lives directly at
// [NATIVE_BASE_PTR + stack_disp], so we just adjust the base and
Expand Down
8 changes: 6 additions & 2 deletions zjit/src/backend/x86_64/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,7 @@ impl Assembler {
fn split_stack_membase(asm: &mut Assembler, opnd: Opnd, scratch_opnd: Opnd, stack_state: &StackState) -> Opnd {
match opnd {
Opnd::Mem(Mem { base: stack_membase @ MemBase::Stack { .. }, disp: opnd_disp, num_bits: opnd_num_bits }) => {
// TODO(max): Delete StackIndirect and revert it back to previous Stack behavior with load_into
// Convert MemBase::Stack to MemBase::Reg(NATIVE_BASE_PTR) with the
// correct stack displacement. The stack slot value lives directly at
// [NATIVE_BASE_PTR + stack_disp], so we just adjust the base and
Expand Down Expand Up @@ -473,10 +474,12 @@ impl Assembler {
*left = split_if_both_memory(asm, *left, *right, SCRATCH0_OPND);
*right = split_stack_membase(asm, *right, SCRATCH1_OPND, &stack_state);
*right = split_64bit_immediate(asm, *right, SCRATCH1_OPND);
*out = split_stack_membase(asm, *out, SCRATCH1_OPND, &stack_state);

let (out, left) = (*out, *left);
asm.push_insn(insn);
// We can only use SCRATCH1_OPND because we're after the instruction but
// SCRATCH0_OPND is used inside `left`.
let out = split_stack_membase(asm, out, SCRATCH1_OPND, &stack_state);
asm_mov(asm, out, left, SCRATCH0_OPND);
}
Insn::Mul { left, right, out } => {
Expand All @@ -492,6 +495,8 @@ impl Assembler {

let (out, left) = (*out, *left);
asm.push_insn(insn);
// TODO(max): split_stack_membase of `out`, taking care to swap which scratch
// operand we use depending on if we swapped the `left`/`right`
asm_mov(asm, out, left, SCRATCH0_OPND);
}
&mut Insn::Not { opnd, out } |
Expand Down Expand Up @@ -544,7 +549,6 @@ impl Assembler {
*left = split_stack_membase(asm, *left, SCRATCH1_OPND, &stack_state);
*right = split_stack_membase(asm, *right, SCRATCH0_OPND, &stack_state);
*right = split_if_both_memory(asm, *right, *left, SCRATCH0_OPND);
*out = split_stack_membase(asm, *out, SCRATCH1_OPND, &stack_state);
let mem_out = split_memory_write(out, SCRATCH0_OPND);
asm.push_insn(insn);
if let Some(mem_out) = mem_out {
Expand Down
Loading