Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!swrinde!cs.utexas.edu!rutgers!devon!sojurn!mike From: mike@sojurn.UUCP (Mike Sangrey) Newsgroups: comp.unix.questions Subject: Re: Unix Stack Frame Questions Summary: Recurrsion requires stack frame Message-ID: <236@sojurn.UUCP> Date: 20 Apr 91 17:58:47 GMT References: <125@epic.epic.com> <3465@unisoft.UUCP> <647@taumet.com> Reply-To: devon!sojurn!mike (Mike Sangrey) Distribution: na Organization: The Humble Sojournage Palace; Paradise, Pa Lines: 28 In article <647@taumet.com> steve@taumet.com (Stephen Clamage) writes: >greywolf@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 ---------------------------------------------------------------------------