Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2004-06

Default calling convention

3 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Marcel Martin

Hello,

I noticed that, with FPC 1.9.4, the (default) calling convention "register" depends on the fact that a routine is or is not embedded in an other routine.

With "proc(A,B,C: Longint);", if "proc" is not embedded then eax = A, edx = B and ecx = C but if "proc" is embedded then edx = A, ecx = B and C is on the stack.

Is this convention definitive or temporary? I am not sure it is definitive since it makes the code of assembler routines dependent on their status: embedded or not.

Thanks,

Peter Vreman
to Marcel Martin
Show quoted text 13 lines
Hello, I noticed that, with FPC 1.9.4, the (default) calling convention "register" depends on the fact that a routine is or is not embedded in an other routine. With "proc(A,B,C: Longint);", if "proc" is not embedded then eax = A, edx = B and ecx = C but if "proc" is embedded then edx = A, ecx = B and C is on the stack. Is this convention definitive or temporary? I am not sure it is definitive since it makes the code of assembler routines dependent on their status: embedded or not.

The framepointer of the parent function is passed in EAX

Marco van de Voort
to Peter Vreman
Show quoted text 14 lines
> > I noticed that, with FPC 1.9.4, the (default) calling convention > "register" depends on the fact that a routine is or is not embedded > in an other routine. > > With "proc(A,B,C: Longint);", if "proc" is not embedded then > eax = A, edx = B and ecx = C but if "proc" is embedded then edx = A, > ecx = B and C is on the stack. > > Is this convention definitive or temporary? I am not sure it is > definitive since it makes the code of assembler routines dependent > on their status: embedded or not. The framepointer of the parent function is passed in EAX

In general it is not wise anyway to let the assembler become to dependant on calling convention.

Keep on using

mov eax,param1
mov ecx,param2

etc. Clearer, and doesn't have the problem between procedure/methods/nested procedures.