Jonas Maebe wrote:

[EMAIL PROTECTED] wrote:

Example Powerpc with static link first:
  local
    static link  r3
    param no 1   r4
    ...

  global
    param no 1   r3
    ...

To avoid this problem, it would be better to have the static link last.

That won't work on x86 when the static link would be on the stack, because there the callee removes the parameters from the stack (so if it's a global function, it will remove sizeof(pointer) bytes too little from the stack.

On x86, you can generate code that checks the static link pointer at runtime, to see if it is nil or not (e.g. a global function or not). Then, you pass the static link pointer as the last parameter (for local procedures) or not (for global procedures).


Regards,

Adriaan  van Os


_______________________________________________ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to