[fpc-devel] ABI question PPC, ARM: position of SELF

Jonas Maebe jonas.maebe at elis.ugent.be
Fri Dec 7 18:03:44 CET 2012

On 07 Dec 2012, at 17:51, Martin wrote:

> Does anyone know how self is passed on PPC or ARM?
> On the one hand IRRC I read self is passed as additional param at the end of the list.

I don't think that has ever been the case.

> But looking at intel code 32 bit, it looks like it always goes into EAX (calling method register)

That is not true if the method is declared as cdecl or so.

> On Intel 64 bit it is RCX or RDI depending on it in Windows or not
> What on the others, fixed register, or simply as if it was the last param?

It is *currently* (I don't think we specify anywhere how or in what order hidden parameters are passed) always passed as the first parameter. Whether this is a register or a memory location depends on the architecture, ABI and specified calling convention. On PPC resp. ARM this is always R3 resp. R0 with the currently existing ABIs.


More information about the fpc-devel mailing list