Skip to main content

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.

Filter by
Sorted by
Tagged with
4 votes
2 answers
311 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 ...
16 votes
2 answers
1k 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 ...
11 votes
6 answers
4k 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
260 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 ...
8 votes
6 answers
999 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 ...
12 votes
2 answers
498 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 ...
5 votes
2 answers
862 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 ...