[fpc-pascal]Default calling convention

Florian Klaempfl Florian.Klaempfl at gmx.de
Sun Jul 4 09:38:27 CEST 2004

Marcel Martin wrote:

> Florian Klaempfl a écrit :
>>Thomas Schatzl wrote:
>>>In this case
>>>  procedure nx_fill(P: PLongword; Count: Longint; Value: Longword);
>>>  assembler;
>>>  asm
>>>          pushl   %edi
>>>          movl    P,%edi  // edi <- P
>>>          movl    Value,%eax  // eax <- Value
>>>          movl    Count,%ecx  // ecx <- Count
>>>          rep
>>>          stosl
>>>          popl    %edi
>>>  end;
>>>works both as embedded and non-embedded assembler procedure because the
>>>order of assignments is ok in both cases.
>>>Btw, there's already a method in the system unit which does the same
>>>thing as your routine: filldword()...
>>... and with better instruction selection ;)
> 1) This little routine was sent to point out a problem. 
> 2) Better than what? Where do you see an "instruction selection" 

Push instead of mov. mov is faster on modern machines because it causes 
less instruction dependencies.

> in my procedure. There is none. And there is none because this 
> is useless. 'nx_fill' is in a unit called 'nxkernel', this unit 
> contains all the low level routines for the library, and with these 
> routines, it is up to the calling procedures to check the validity 
> of the transmitted parameters. This is as simple as that.

More information about the fpc-pascal mailing list