Oberon calling convention

The calling conventions used by MPW Oberon are very similar to the ones used by the Operating system. All parameters are passed in the order of their declaration. Function procedures return the result in D0 for integer expressions and in FP0 for floating-point expressions. Pointers are considered as integer expressions and are returned in D0.

Arrays or records passed by value are pushed onto the stack if their size is at most 4 bytes. Otherwise the address of the record is pushed. The callee is responsible for making a local copy of the parameter to preserve the semantic of the call. Records passed by reference occupy 8 bytes for the record's address and its type tag. Array passed by references occupy only 4 bytes for the address of the array.

Floating-point values are pushed onto the stack regardless whether they are of type REAL or LONGREAL. For reference parameters the address of the variable is passed.

For open arrays more than the address of the array is needed in order to perform range checking and address computations. For each dimension of an open array its length is pushed onto the stack. Thus passing an array with n dimensions requires to push n+1 values. The lengths are pushed in the order of the declaration. Consider the following array a:

a: ARRAY 1,2,3 OF INTEGER;
For this array the lengths will be pushed in the order shown, i.e. 1 is pushed first and 3 is pushed last. The lengths are followed by the address of the array.

The following table lists the size of the types supported by MPW Oberon:

TypeBytesRange
SHORTINT1-128..127
BYTE10..255
INTEGER2-32,768..32,767
LONGINT4-2,147,483,648..2,147,483,647
REAL8
LONGREAL10/12
SET4-
address4-
The size of record types is the sum of the size of its fields. Note that fields may be aligned to the next word boundary. Aligning is performed if the following field contains 2 or more bytes. The size of array is the number of elements times the size of the base type. No align is added between the array's elements.
Previous Section, Next Section, Contents
Jürgen Geßwein; 2. Juni 1995