Skip to content

Commit 938caca

Browse files
committed
ZJIT: Add asm.sub_into helper
1 parent a9d9b9d commit 938caca

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

zjit/src/backend/lir.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2233,6 +2233,11 @@ impl Assembler {
22332233
out
22342234
}
22352235

2236+
pub fn sub_into(&mut self, left: Opnd, right: Opnd) -> Opnd {
2237+
self.push_insn(Insn::Sub { left, right, out: left });
2238+
left
2239+
}
2240+
22362241
#[must_use]
22372242
pub fn mul(&mut self, left: Opnd, right: Opnd) -> Opnd {
22382243
let out = self.new_vreg(Opnd::match_num_bits(&[left, right]));

zjit/src/codegen.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1474,8 +1474,7 @@ fn gen_string_concat(jit: &mut JITState, asm: &mut Assembler, strings: Vec<Opnd>
14741474
let allocation_size = aligned_stack_bytes(n);
14751475

14761476
asm_comment!(asm, "allocate {} bytes on C stack for {} strings", allocation_size, n);
1477-
let new_sp = asm.sub(NATIVE_STACK_PTR, allocation_size.into());
1478-
asm.mov(NATIVE_STACK_PTR, new_sp);
1477+
asm.sub_into(NATIVE_STACK_PTR, allocation_size.into());
14791478

14801479
// Calculate the total offset from NATIVE_BASE_PTR to our buffer
14811480
let total_offset_from_base = (frame_size + allocation_size) as i32;

0 commit comments

Comments
 (0)