Parrot Calling Conventions
1
Maintainer: Dan Sugalski Class: Internals PDD Number: 03 Version: 1 Status: Developing Last Modified: 26 April 2002 PDD Format: 1 Language: English
None. First version
This PDD describes Parrot's inter-routine calling conventions.
The caller is responsible for preserving any environment it is interested in keeping. This includes any and all registers, lexical scoping and scratchpads, opcode libraries, and so forth.
Use of the saveall opcode is recommended if the caller wishes to save everything, and the restoreall opcode to restore everything saveall saved.
saveall
restoreall
The following registers are used in calling all subs and methods
Holds the object representing the subroutine.
Holds the continuation for the caller, assuming this sub was called with callcc. Otherwise NULL.
Holds the object the sub was called on. (For method calls)
True if the sub is being called with prototyped parameters.
The number of items pushed onto the stack.
The following registers are used only when calling a subroutine for which there is a compile-time prototype.
The first 27 integer parameters.
The first 27 string parameters.
The first 27 numeric parameters.
The first 27 PMC parameters.
All overflow parameters are pushed on the stack in reverse order--that is the topmost entry on the stack is the first entry in the parameter list, and the bottom entry the last entry in the parameter list.
The PMC for a hash, array, or list is passed if one of the entries in the parameter list is a hash, array, or list. The aggregate is not flattened. (Though when accessing the parameters it may be)
Parameters are passed in S, I, and N registers only if the sub's prototype specifically indicates it takes parameters of that type.
Note that it doesn't matter what the order of the integer, string, numeric, and PMC parameters are in the parameter list up until overflow occurs.
On return from a function, the following registers are set. Return values are placed in registers only if the function is prototyped to do so. All values on the stack are in reverse order, such that the top value on the stack is the first value returned.
Holds the number of return values on the stack.
Holds the number of return values in integer registers.
Holds the number of return values in string registers.
Holds the number of return values in PMC registers.
Holds the number of return valies in numeric registers.
PMC return values
Integer return values
String return values
Numeric return values
Overflow values, or values for functions that don't have a return prototype.
To install Make, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Make
CPAN shell
perl -MCPAN -e shell install Make
For more information on module installation, please visit the detailed CPAN module installation guide.