I was looking at the dissasembly of a function call and found this:
movq %rsp, %rbp
pushq %rbx
subq $136, %rsp ; Pad the stack
....
addq $136, %rsp ; Unpad the stack
popq %rbx
popq %rbp
ret
What is the value of doing this?
That's the space for local variables, not padding.
The compiler will create that stack space for any register spills and local variables it has to store while running this function.
You could see some padding, when disassembling x86-64 code with the SysV ABI (most things that aren't Windows, I don't know how it is in the latter), since function calls have to have the stack aligned at 16 bytes. But in this case it's actually reserving space for local variables.
You might want to look at this or look for more information on how compilers work.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With