[fpc-devel] Re: Bug in revision 9781/2

Daniël Mantione daniel.mantione at freepascal.org
Sat Jan 19 16:52:09 CET 2008

Op Sat, 19 Jan 2008, schreef Marc Weustink:

> Daniël Mantione wrote:
>> Op Sat, 19 Jan 2008, schreef Jonas Maebe:
>>> On 19 Jan 2008, at 15:54, Peter Vreman wrote:
>>>> This call and pop is old-style PIC and not good for new cpus because it 
>>>> breaks the call-stack. Please use the new style that calls a function 
>>>> (fpc_geteipasebx). This also generated by the compiler. See 
>>>> i386/cgcpu.pas and search for g_maybe_got_init.
>>> I recently read that on the more recent processors, call/pop is slightly 
>>> faster again (I suppose they detect a call to next instruction and don't 
>>> add it to the internal call stack or so).
>>> http://lists.apple.com/archives/perfoptimization-dev/2007/Nov/msg00005.html 
>> Intel cpu's since Pentium M and AMD cpu's since Barcelona indeed have a 
>> stack analyzer. I'm still going to switch back to the fpc_geteipasebx 
>> helper since the extra call/ret penalty on those processors is small while 
>> the penalty of a broken call stack is large.
> Just for my information, this callstack, is it "tracked" by the CPU or 
> generated by FPC. I somehow fail to see why a call&pop will affect the 
> callstack in case it is generated.

It is tracked by the cpu. It exists to prevent the pipeline has to be 
flushed when encountering a ret; with the call stack the cpu can know
where the program will continue.


More information about the fpc-devel mailing list