Re: Is there stack associated when a executing an inline function?
- From: Keith Thompson <kst-u@xxxxxxx>
- Date: Fri, 29 Feb 2008 13:43:01 -0800
jacob navia <jacob@xxxxxxxxxx> writes:
Kaz Kylheku wrote:
On Feb 29, 11:08 am, jacob navia <ja...@xxxxxxxxxx> wrote:
It would be completely weird that in an inline procedure the compiler
would save the current stack pointer and establish a new stack
frame since there is no function call.
However, it wouldn't be weird at all if the inlined procedure simply
moves the stack pointer by some delta to enlarge the current frame,
then references all of its locals with respect to the current frame,
and then moves the stack pointer back by the same delta upon
termination to release the storage.
That is normal, but that is not a stack frame!
That is just increasing the stack, like when you use
alloca().
That function (alloca()) doesn't create a stack frame.
So you have some specific definition of the term "stack frame" in
mind, one that includes the storage reserved by an ordinary function
call, but that excludes the storage that might be reserved in other
circumstances, such as a call to an inline function or a call to the
non-standard alloca() function.
Perhaps you can tell us what this definition is, preferably by citing
the standard.
There are a number of ways that inline functions, and calls to them,
could be implemented. For that matter, I understand that not
generating a new stack frame is a fairly common optimization for calls
to some ordinary functions. I see no particular reason why allocating
a stack frame and executing a call instruction must be tied together;
either could be done without the other if it's convenient.
The gory details would, of course, be perfectly topical in some
system-specific newsgroup.
--
Keith Thompson (The_Other_Keith) <kst-u@xxxxxxx>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
.
- Follow-Ups:
- Re: Is there stack associated when a executing an inline function?
- From: Richard Tobin
- Re: Is there stack associated when a executing an inline function?
- References:
- Is there stack associated when a executing an inline function?
- From: Mahesh
- Re: Is there stack associated when a executing an inline function?
- From: jacob navia
- Re: Is there stack associated when a executing an inline function?
- From: Keith Thompson
- Re: Is there stack associated when a executing an inline function?
- From: jacob navia
- Re: Is there stack associated when a executing an inline function?
- From: Micah Cowan
- Re: Is there stack associated when a executing an inline function?
- From: jacob navia
- Re: Is there stack associated when a executing an inline function?
- From: Kaz Kylheku
- Re: Is there stack associated when a executing an inline function?
- From: jacob navia
- Is there stack associated when a executing an inline function?
- Prev by Date: Re: calculating length of an substring - TPA
- Next by Date: Re: Variable-sized lines of text in linked list
- Previous by thread: Re: Is there stack associated when a executing an inline function?
- Next by thread: Re: Is there stack associated when a executing an inline function?
- Index(es):
Relevant Pages
|