Browse Source

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. :^)
Andreas Kling 1 year ago
parent
commit
e63423554f
1 changed files with 0 additions and 7 deletions
  1. 0 7
      Userland/Libraries/LibJIT/Assembler.h

+ 0 - 7
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<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));