Questions tagged [calling-conventions]
Calling conventions are specifications for how arguments are passed, other data preserved, and operations identified when calling a function in compiled machine- or byte-code. Use this tag for questions about choosing or designing a calling convention. Do not use it for questions about function call syntax within a language, unless that is exposing an underlying calling convention.
7 questions
4
votes
2
answers
447
views
What are the advantages if caller is responsible for argument destruction vs callee is responsible?
In languages with well defined object lifetimes the destructors of by-value parameters have to be called at some point. This can be the responsibility of the caller or of the callee.
GCC and Clang ...
15
votes
6
answers
7k
views
Are modern compilers passing parameters in registers instead of on the stack?
I'm reading Appel's book Modern Compiler Implementation in C. I just read the following statement in chapter 6, and I wonder if it is accurate. It says that on modern machines, the calling conventions ...
13
votes
0
answers
352
views
Why were OS/360 PL/I procedure calls so expensive?
In Guy Steele’s famous paper Debunking the “expensive procedure call” myth or, procedure call implementations considered harmful or, LAMBDA: The Ultimate GOTO, he describes the poor performance of ...
17
votes
2
answers
2k
views
What are the advantages and disadvantages of the callee versus caller clearing the stack after a call?
This is more a question about compiler design than language design, but in low level languages, when a function is called, the parameters are pushed onto the stack, and when the function returns, the ...
9
votes
6
answers
2k
views
Do variadic functions need to have a different calling convention to regular functions?
In C, calling a variadic functions are 'special' and not to be treated as regular functions or vice versa. Calling a variadic function through a regular function pointer, or vice-versa invokes ...
10
votes
5
answers
2k
views
Why was C implemented with a register preservation convention that seems to be far less efficient than its predecessor's?
In original implementations of the B language, the caller was responsible for saving and restoring any registers it cares about before calling a function.
But in the C language, the called function is ...
13
votes
2
answers
1k
views
Which calling convention should my compiler use?
The LLVM-IR Reference Manual's section on Calling Conventions lists as many as 15 supported calling conventions. These vary in ways including whether they support tail call optimization, how many and ...