Calling Convention Article Index for
Calling
Website Links For
Calling
 

Information About

Calling Convention




Different ). This can cause problems when writing Software that combines modules written in multiple languages, or when calling operating system or library API s from a language other than the one in which they are written; in these cases, special care must be taken to coordinate the calling conventions used by caller and callee.


CALLING CONVENTIONS ON DIFFERENT PLATFORMS



x86

See Also: x86 calling conventions


The X86 Architecture features many different calling conventions. Due to the small number of architectural registers, the x86 calling conventions mostly pass arguments on the stack, while the return value (or a pointer to it) is passed in a register. Some conventions use registers for the first few parameters, which may improve performance for very short and simple procedures..


PowerPC

Since the PowerPC architecture has a large number of registers, most functions can pass all arguments in registers; further arguments are passed on the stack, and space for register-based arguments is always allocated on the stack as a convenience to the called function, in case it needs to free up more registers. A single calling convention is used for all procedural languages.


MIPS

The first four arguments to a function are passed in the registers -; subsequent arguments are passed on the stack. The return value (or a pointer to it) is stored in register .


Sparc

The Sparc architecture, unlike most RISC architectures, is built on Register Windows . There are 24 accessible registers in each register window, 8 of them are the "in" registers, 8 are registers for local variables, and 8 are out registers. The in registers are used to pass arguments to the function being called, so any additional arguments needed to be pushed onto the Stack . However, space is always allocated by the called function to handle a potential register window overflow, local variable, and returning a struct by value. To call a function, one places the argument for the function to be called in the out registers, when the function is called the out registers become the in registers and the called function access the argument in its in registers. When the called function returns, it places the return value in the first in register, which becomes the first out register when the called function returns.


SEE ALSO



EXTERNAL LINKS