[fpc-devel] Local procedures as procedural parameter
jonas at zeus.ugent.be
Wed Mar 16 17:51:47 CET 2005
On 16 mrt 2005, at 17:42, Adriaan van Os wrote:
>> 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).
Then you can do it just as well on ppc and other processors, but the
point of the trick was to avoid having to do this. Implementing this
sort of hacks will complicate the code generator (I'm not even
immediately sure how it would be implemented).
More information about the fpc-devel