From 4797a0dd2b933c44fa21e534913b4541119c73aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20Mei=C3=9Fner?= Date: Wed, 25 Sep 2024 09:17:53 +0200 Subject: [PATCH] Removes REGISTER_OTHER_SCRATCH from ANCHOR_ANCHOR_INTERNAL_FUNCTION_CALL_REG. --- src/jit.rs | 5 ++--- src/x86.rs | 1 + 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/jit.rs b/src/jit.rs index 0a618260..d58a5900 100644 --- a/src/jit.rs +++ b/src/jit.rs @@ -1508,9 +1508,8 @@ impl<'a, C: ContextObject> JitCompiler<'a, C> { // Load the frame pointer again since we've clobbered REGISTER_MAP[FRAME_PTR_REG] self.emit_ins(X86Instruction::load(OperandSize::S64, REGISTER_PTR_TO_VM, REGISTER_MAP[FRAME_PTR_REG], stack_pointer_access)); // Restore the clobbered REGISTER_MAP[0] - self.emit_ins(X86Instruction::mov(OperandSize::S64, REGISTER_MAP[0], REGISTER_OTHER_SCRATCH)); - self.emit_ins(X86Instruction::pop(REGISTER_MAP[0])); - self.emit_ins(X86Instruction::jump_reg(REGISTER_OTHER_SCRATCH, None)); // Tail call to host_target_address + self.emit_ins(X86Instruction::xchg(OperandSize::S64, REGISTER_MAP[0], RSP, Some(X86IndirectAccess::OffsetIndexShift(0, RSP, 0)))); // Swap REGISTER_MAP[0] and host_target_address + self.emit_ins(X86Instruction::return_near()); // Tail call to host_target_address // Translates a vm memory address to a host memory address for (access_type, len) in &[ diff --git a/src/x86.rs b/src/x86.rs index b592f475..ccb2467b 100644 --- a/src/x86.rs +++ b/src/x86.rs @@ -614,6 +614,7 @@ impl X86Instruction { } /// Jump to absolute destination + #[allow(dead_code)] #[inline] pub const fn jump_reg(destination: u8, indirect: Option) -> Self { Self {