From e63423554f4ff5ec5db6f5a0b5b3d3722a05f99a Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sat, 28 Oct 2023 07:56:57 +0200 Subject: [PATCH] LibJIT: Keep the stack pointer aligned for making native calls Instead of adjusting the stack pointer before/after making native calls, just make sure we come out of enter() with the stack pointer aligned for making calls. This is strictly a code size reduction. :^) --- Userland/Libraries/LibJIT/Assembler.h | 7 ------- 1 file changed, 7 deletions(-) diff --git a/Userland/Libraries/LibJIT/Assembler.h b/Userland/Libraries/LibJIT/Assembler.h index 1634b8919b..4e7a961171 100644 --- a/Userland/Libraries/LibJIT/Assembler.h +++ b/Userland/Libraries/LibJIT/Assembler.h @@ -456,7 +456,6 @@ struct Assembler { push(Operand::Register(Reg::RBP)); mov(Operand::Register(Reg::RBP), Operand::Register(Reg::RSP)); - sub(Operand::Register(Reg::RSP), Operand::Imm(8)); } void exit() @@ -578,9 +577,6 @@ struct Assembler { push(Operand::Register(Reg::R10)); push(Operand::Register(Reg::R11)); - // align the stack to 16-byte boundary - sub(Operand::Register(Reg::RSP), Operand::Imm(8)); - // load callee into RAX mov(Operand::Register(Reg::RAX), Operand::Imm(bit_cast(callee))); @@ -588,9 +584,6 @@ struct Assembler { emit8(0xff); emit8(0xd0); - // adjust stack pointer - add(Operand::Register(Reg::RSP), Operand::Imm(8)); - // restore caller-saved registers from the stack pop(Operand::Register(Reg::R11)); pop(Operand::Register(Reg::R10));