I am writing a program in MASM64.
I use WinAPI a lot.
I don't use the push
and pop
instructions, I use mov [rsp + x]
instead.
I don't use local variables.
I don't use prolog/epilog.
I don't use RBP at all.
I do use sub rsp, x
to preserve a shadow space and keep the stack 16 bytes aligned.
What is the difference between ending a procedure with ret x
vs add rsp, x
?
I understand they both add value to RSP to clean up the stack.
Any performance difference?
I guess ret x
would be faster, since after add rsp, x
there will be a ret
anyway.