[TUHS] Early Unix function calls: expensive?
scj at yaccman.com
scj at yaccman.com
Mon Jan 4 10:42:45 AEST 2016
Well, I certainly said this on several occasions, and the fact that it is
recorded more or less exactly as I remember saying it suggests that I may
have even written it somewhere, but if so, I don't recall where...
As part of the PCC work, I wrote a technical report on how to design a C
calling sequence, but that was before the VAX. Early calling sequences
had both a stack pointer and a frame pointer, but for most machines it
was possible to get by with just one, so calling sequences got better as
time went on. Also, RISC machines with many more registers than the
PDP-11 also led to more efficient calls by putting some arguments in
registers. Later standardizations like varargs were painful on some
architectures (especially those which had different registers for pointers
The CALLS instruction was indeed a pig -- a space-time tradeoff in the
wrong direction! For languages like FORTRAN it might have been justified,
but for C it was awful. It is my memory too that CALLS was abandoned,
perhaps first at UCB. But I actually had little hands-on experience with
the VAX C compiler...
> I just re-found a quote about Unix processes that I'd "lost". It's by
> Steve Johnson:
> Dennis Ritchie encouraged modularity by telling all and sundry that
> function calls were really, really cheap in C. Everybody started
> writing small functions and modularizing. Years later we found out
> that function calls were still expensive on the PDP-11, and VAX code
> was often spending 50% of its time in the CALLS instruction. Dennis
> had lied to us! But it was too late; we were all hooked...
> Steve, can you recollect when you said this, was it just a quote for
> Eric's book or did it come from elsewhere?
> Does anybodu have a measure of the expense of function calls under Unix
> on either platform?
> Cheers, Warren
More information about the TUHS