Unix Stack Frame Questions

Mike Sangrey mike at sojurn.UUCP
Sun Apr 21 03:58:47 AEST 1991


In article <647 at taumet.com> steve at taumet.com (Stephen Clamage) writes:
>greywolf at unisoft.UUCP (The Grey Wolf) writes:
>
>>If there's not a stack frame, how are parameters passed to the
>>function...?  And how would you return...?
>>... a stack frame seems to be the most efficient way of dealing with
>>calls and returns.
>
>There is a useful distinction between using the stack and having a stack
>frame.  Usually a stack frame means keeping the address of a known point in
>the stack in a register, and storing known data at known places relative
>to that fixed point.  
	[ stuff deleted ]

>The compiler can keep track of stack changes as it generates code, and
>make all references relative to the current top of the stack.  

What about recurrsion?  There needs to be a "frame" (i.e. the current
instantiation of the function) for each function which has been called
and not yet completed.  The compiler won't be able to keep track of the
recurrsion.  The runtime environment could, but then what do you have?
You have a _logical_ stack frame implemented by using the stack.  Wouldn't
it be easier (and necessary) to just use a stack frame from the beginning?

---------------------------------------------------------------------------
|    Mike Sangrey
|                           "It muddles me rather" Winnie the Pooh
---------------------------------------------------------------------------



More information about the Comp.unix.questions mailing list