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
16 votes
2 answers

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 ...
CPlus's user avatar
  • 7,911
13 votes
0 answers

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 ...
Alexis King's user avatar
  • 8,436
12 votes
2 answers

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 ...
Rydwolf Programs's user avatar
11 votes
6 answers

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 ...
Rob N's user avatar
  • 1,073
8 votes
6 answers

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 ...
CPlus's user avatar
  • 7,911
5 votes
2 answers

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 ...
Ray Butterworth's user avatar
4 votes
2 answers

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 ...
chrysante's user avatar
  • 748