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

Martin lazarus at mfriebe.de
Fri Dec 7 18:10:14 CET 2012

On 07/12/2012 17:03, Jonas Maebe wrote:
> 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.
Ok then I IIRCed wrong...

>> 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.
"(calling method register)" (which I believe is default, if no 
specification is made?

>> 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.
Oh ox, I IIRCed half right. "Always first" not "always last"

Thanks for the info.

Yes, I know that this is only the current version, and can change and 
all the risk.
But today, there is no better way, to use PascalScript in a compiled 
app. Once a released FPC offers a better way, well great. But till then, 
I must go the risky way (or not go at all).

I have a testcase, that calls every function I use. So I can at least, 
test (or ask people to test) with every new fpc version.

More information about the fpc-devel mailing list