[fpc-pascal] code optimization
jonas.maebe at elis.ugent.be
Fri Sep 24 15:36:03 CEST 2010
On 24 Sep 2010, at 14:35, Jonas Maebe wrote:
> On 24 Sep 2010, at 11:48, Adrian Veith wrote:
>> Register allocation is on a comparable level for both versions.
> Delphi keeps the "Bar" pointer in a register, while FPC spills it to
> the stack. Because Bar is used in most of the most-executed
> statements, this has a huge impact.
Correction: Delphi keeps the hidden parent frame pointer parameter in
a register (which is required every time Bar is accessed), while FPC
puts it on the stack. The end result is the same though: 1 extra
memory access every time Bar or any other variable from the parent
procedure is accessed.
More information about the fpc-pascal