[prev in list] [next in list] [prev in thread] [next in thread] 

List:       tuhs
Subject:    Re: [TUHS] Memory management in Dennis Ritchie's C Compiler
From:       Paul Ruizendaal <pnr () planet ! nl>
Date:       2020-08-27 8:37:58
Message-ID: 91C9F0D7-181D-4677-AFCD-155D45858788 () planet ! nl
[Download RAW message or body]

Doug,

"In fact Dennis's compiler did not use AID instructions for that purpose."

Whilst local variables are indeed accessed as an offset from the base pointer, I'm \
not sure that the above statement is correct. In the V6 compiler (-sp) was certainly \
used to push arguments to the stack, and when the register allocation overflowed, the \
interim results were pushed to the stack as well with (-sp).

See c10.c, the case CALL in rcexpr(), the function comarg() and sptab (which is right \
at the end of table.s)

Links:
https://www.tuhs.org/cgi-bin/utree.pl?file=V6/usr/source/c/c10.c
https://www.tuhs.org/cgi-bin/utree.pl?file=V6/usr/source/c/table.s

For interim result pushing/popping I refer to the FS and SS macro's. Dennis discusses \
these in his "A tour of the C compiler" paper. \
https://www.jslite.net/cgi-bin/9995/doc/tip/doc/old-ctour.pdf

Of course this is all implementational detail, not a core design aspect - as Richard \
Miller showed in his port to the Interdata architecture (including a port of the \
Ritchie C compiler). Maybe the sentence should have read: "In fact Dennis's compiler \
did not rely on having AID instructions for that purpose."

Paul

@Warren: at moments like these I really like having the line highlight feature that \
we discussed before Summer.


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic