Longjmping back, and back again; Coroutines in C

Kenneth L Moore kenmoore at unix.cis.pitt.edu
Tue Nov 28 21:45:58 AEST 1989


In article <1989Nov21.120938.9200 at psuvax1.cs.psu.edu> flee at shire.cs.psu.edu (Felix Lee) writes:
==>Jerker W}gberg <jerker at helios.se==> wrote:
==>==> The idea is that instead of actually switching stacks, I use the
==>==> "real" stack but swap it in and out of malloced memory.
==>==> 1. Can somebody explain why this fails on a SUN4.
==>
==>The Sun-4 has a curious hack known as register windows.  Rather than
==>putting things on the stack, it keeps everything in registers.  Each
==>subroutine gets its own set of 24 registers called a register window.
==>For passing arguments, register windows overlap: 8 output registers in
==>your window become input registers when you call another subroutine.
==>
==>--
==>Felix Lee	flee at shire.cs.psu.edu	*!psuvax1!flee

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.

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%.

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.

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.

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

Sign me:

KK    KK  EEEEEEEE  NN     NN  MM       MM   OOOOO    OOOOO   RRRRRR   EEEEEEEE
KK   KK   EEEEEEEE  NNN    NN  MMM     MMM  OOOOOOO  OOOOOOO  RR   RR  EEEEEEEE
KK  KK    EE        NNNN   NN  MMMM   MMMM  OO   OO  OO   OO  RR  RR   EE
KKKKK     EEEEE     NN NN  NN  MM MM MM MM  OO   OO  OO   OO  RRRRR    EEEEE
KKKKK     EEEEE     NN  NN NN  MM  MMM  MM  OO   OO  OO   OO  RR RR    EEEEE
KK  KK    EE        NN   NNNN  MM   M   MM  OO   OO  OO   OO  RR  RR   EE
KK   KK   EEEEEEEE  NN    NNN  MM       MM  OOOOOOO  OOOOOOO  RR   RR  EEEEEEEE
KK    KK  EEEEEEEE  NN     NN  MM       MM   OOOOO    OOOOO   RR    RR EEEEEEEE

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

(Sorry about the long signature but inews won't recognise my .signature...
even after "chmod 777 .signature". Tsk. Tsk.)



More information about the Comp.lang.c mailing list