Flash Gordon
10/22/2009 7:06:00 PM
Dik T. Winter wrote:
> In article <slrnhdvilt.s2q.usenet-nospam@guild.seebs.net> Seebs <usenet-nospam@seebs.net> writes:
> ...
> > The objection is not to the term itself, but to a particular interpretation
> > of it. Basically, if someone refers to the call frames, etc., as "the
> > stack", the chances are about 9:1 that they think it's a single contiguous
> > region of memory with monotonically decreasing addresses, and this is not
> > a particularly good way to conceptualize it;
>
> Strange enough, the first machines I did program had a stack with *increasing*
> addresses, it was ony when I encountered the PDP that I saw a machine where
> it was commonly done differently.
One of the processors I used to program (the first I programmed in C, in
fact), had a hardware stack in a very pure form. A call pushed the
return address on to the stack and a return popped it off. The only
other instuctions that allowed you to access it were the push
instruction (pushing a value on) and pop instuction (popping it off).
You literally could *not* read any item on the stack except by popping
items until you reached the one you wanted. This is very different from
hardware stacks on other processors, and is of no use for a lot of the
implementation of "call frames", i.e. you could not use it for local
variables.
It also had a number of index registers any of which *could* be used to
increment a contiguous stack, and there was nothing in the processor
that made it prefer growing in any particular direction.
--
Flash Gordon