[TUHS] Memory management in Dennis Ritchie's C Compiler

John Cowan cowan at ccil.org
Thu Aug 27 01:41:21 AEST 2020

On Wed, Aug 26, 2020 at 9:25 AM Doug McIlroy <doug at cs.dartmouth.edu> wrote:

I hadn't heard this urban legend before. A stack is certainly
> manageable without auto-increment/decrement (AID) instructions.

Absolutely.  I should have qualified my remarks by saying "when writing in
assembly language", which was the universal language of all PDP-11
operating systems until Unix.  VMS adopted Bliss (which is what C would be
like if it had come to us through a different dharma line[*]) as its
principal implementation language.

> But when the stack contains
> local variables that are accessed multiple times, the accesses
> are offset from the stack pointer.

Or the frame pointer, which has the advantage that the callee can push
arbitrary stuff on the stack without having to explicitly account for it
later, and the disadvantage that it ties up yet another register when they
are in short supply.

[*] Don't laugh too hard: you yourself have already been mythologized in
precisely this fashion.  See <
http://www.catb.org/~esr/writings/unix-koans/two_paths.html> and <

John Cowan          http://vrici.lojban.org/~cowan        cowan at ccil.org
Mark Twain on Cecil Rhodes: I admire him, I freely admit it,
and when his time comes I shall buy a piece of the rope for a keepsake.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://minnie.tuhs.org/pipermail/tuhs/attachments/20200826/6dea4c7e/attachment.htm>

More information about the TUHS mailing list