Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2011-08

Stackframes

5 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Ludo Brands

In http://www.freepascal.org/docs-html/prog/progsu72.html#x78-770001.1.72 is written:

...
the compiler will omit the generation of a stackframe if the following conditions are satisfied:

The procedure has no parameters.
...

This condition should read: The procedure has no parameters on the stack. Parameters passed in registers do not trigger stackframe generation.

There are a lot of wrapper functions, with register only parameters, in the rtl and elsewhere that don't generate stack frames.

Ludo

Reply by email

Michael Van Canneyt
to Ludo Brands
Ludo Brands wrote 15 lines
In http://www.freepascal.org/docs-html/prog/progsu72.html#x78-770001.1.72 is written: ... the compiler will omit the generation of a stackframe if the following conditions are satisfied: The procedure has no parameters. ... This condition should read: The procedure has no parameters on the stack. Parameters passed in registers do not trigger stackframe generation. There are a lot of wrapper functions, with register only parameters, in the rtl and elsewhere that don't generate stack frames.

If the compiler developers can confirm this, then I'll adapt the documentation.

Michael.

Reply by email

Florian Klämpfl
to Michael Van Canneyt
Michael Van Canneyt wrote 24 lines
On Sat, 27 Aug 2011, Ludo Brands wrote: > In > http://www.freepascal.org/docs-html/prog/progsu72.html#x78-770001.1.72 is > written: > > ... > the compiler will omit the generation of a stackframe if the following > conditions are satisfied: > > The procedure has no parameters. > ... > > This condition should read: The procedure has no parameters on the stack. > Parameters passed in registers do not trigger stackframe generation. > > There are a lot of wrapper functions, with register only parameters, > in the > rtl and elsewhere that don't generate stack frames. If the compiler developers can confirm this, then I'll adapt the documentation.

Find some generic text aiming on complexity or whatever :) The rules when it happens or not are pretty complex, they also depend on the target architecture. See e.g. psub.pas:953+ and all occurences of pi_needs_stackframe in the compiler

Reply by email

Michael Van Canneyt
to Florian Klämpfl
Florian Klämpfl wrote 30 lines
Am 27.08.2011 12:50, schrieb Michael Van Canneyt: > > > On Sat, 27 Aug 2011, Ludo Brands wrote: > >> In >> http://www.freepascal.org/docs-html/prog/progsu72.html#x78-770001.1.72 is >> written: >> >> ... >> the compiler will omit the generation of a stackframe if the following >> conditions are satisfied: >> >> The procedure has no parameters. >> ... >> >> This condition should read: The procedure has no parameters on the stack. >> Parameters passed in registers do not trigger stackframe generation. >> >> There are a lot of wrapper functions, with register only parameters, >> in the >> rtl and elsewhere that don't generate stack frames. > > If the compiler developers can confirm this, then I'll adapt the > documentation. Find some generic text aiming on complexity or whatever :) The rules when it happens or not are pretty complex, they also depend on the target architecture. See e.g. psub.pas:953+ and all occurences of pi_needs_stackframe in the compiler

I knew I should ask confirmation, I will adapt the docs to be more careful ;-)

Michael.

Reply by email

Ludo Brands
to Michael Van Canneyt
Show quoted text 9 lines
> Find some generic text aiming on complexity or whatever :) The rules > when it happens or not are pretty complex, they also depend on the > target architecture. See e.g. psub.pas:953+ and all occurences of > pi_needs_stackframe in the compiler I knew I should ask confirmation, I will adapt the docs to be more careful ;-)

The list of conditions listed now is so restrictive that one would expect very few procedures without a stackframe. When you start unwinding the stack, reality is quite different (on i386 at least). Hence my suggestion to change the docs. Hint (from D6 help): stack frames are only generated when they're required, as determined by the routine's use of local variables. If that isn't generic...

Ludo

Reply by email