Thomas Schatzl a écrit : > > 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. > > This is exactly the same as Delphi (7) behaves.
I don't know, I have Delphi 5.01. > >> procedure nx_fill(P: PLongword; Count: Longint; Value: Longword); > >> assembler; > >> asm > >> pushl %edi > >> movl %eax,%edi // edi <- P > >> movl %ecx,%eax // eax <- Value > >> movl %edx,%ecx // ecx <- Count > >> rep > >> stosl > >> popl %edi > >> end; > > 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. Yes, but this way a program becomes a mineland. You write this, a few weeks later, for some reason, you change the line order, and you waste time to find why, suddenly, your program crashes (and yet, assuming you immediately activate the bug). -- mm http://www.ellipsa.net/ _______________________________________________ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal