Longjmping back, and back again; Coroutines in C

Ge' Weijers ge at kunivv1.sci.kun.nl
Sat Dec 9 01:20:55 AEST 1989


kenmoore at unix.cis.pitt.edu (Kenneth L Moore) writes:

>Yup. This is state of the art computater (sic) architecture. This idea
>arose along with RISC (Reduced Instruction Set Computer) but can be used
>on RISC or CISC (Complex Instruction Set Computer) machines.

And a sorry state it is. I'd rather have twice the number of registers,
a store-multiple-registers instruction, and NO register windows.
It's just as fast, because you mostly save registers that contain
garbage. The SPARC was designed with the assumption in mind that nobody
uses recursion anyway. This might be true for C programmers.

>Remember that RISC is the result of a statistical study that showed that
>99% of the instructions used on a CISC machine were a sub-set of some 30
>(out of maybe 256? on an IBM 360) commands. Also, 10 instructions
>accounted for 80% and 21 accounted for 95%.

This has nothing to to with register windows.

>Another aspect that became apparent during these studies was that much
>of the overhead in a processor was consumed in keeping track of
>subroutine calls and returns.

Recent studies have also shown that you can do the same in software,
using a simple analysis.

>The original RISC-I guys had a lot of left over chip area and decided
>that the thing to do with the extra area was to make extra registers.
>And they shrewdly decided to use the registers to facilitate subroutine
>handling.

It was a good idea as an experiment. It's a pain if your recursion goes
500 deep. But because the SPARC has no other way to save a lot of
registers in reasonable time, you're stuck with it.
It also introduces quite a bit of overhead when the OS has to switch
contexts.

>C programmers, keep these facts in mind as they will dominate computer
>architecture in the near term.

Prolog/ML/other implementors keep these facts in mind, as they will 
limit the performance of your programs.
I don't think the SPARC is bad, it's just not as good as other processors
for some uses.

Ge' Weijers


Ge' Weijers                                    Internet/UUCP: ge at cs.kun.nl
Faculty of Mathematics and Computer Science,   (uunet.uu.net!cs.kun.nl!ge)
University of Nijmegen, Toernooiveld 1         
6525 ED Nijmegen, the Netherlands              tel. +3180612483 (UTC-2)



More information about the Comp.lang.c mailing list