begin  quoting [EMAIL PROTECTED] as of Tue, Jan 22, 2008 at 03:05:03PM -0800:
> On Tue, Jan 22, 2008 at 02:38:29PM -0800, Andrew Lentvorski wrote:
[snip]
> > Stack is slow.  Registers are fast.  Nobody computes using the stack
> > unless they absolutely have to.  Stack is really only used as a place to
> > spill registers.
> >
> > Even all of those variables that C claims are going onto the "stack" are
> > really only allocated in registers if the compiler can get away with it.
> 
> So are you saying the way to build a fast CPU is to have as many registers as
> possible to avoid the stack as much as possible?

No, because too many registers really slow the machine down when you
have a context switch or function call.  All those registers have to be
saved off somewhere.

The SPARC idea of a "register window" is really interesting here, at
least for function calls.  It's sort of a stack of registers....

-- 
I want all the registers I can use, plus one,
You can have them back when my program is done.
Stewart Stremler

-- 
[email protected]
http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-lpsg

Reply via email to