1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 22:48:11 +00:00

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. :^)
This commit is contained in:
Andreas Kling 2023-10-28 07:56:57 +02:00
parent 538a570852
commit e63423554f

View file

@ -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<u64>(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));