>>>>> "GB" == Graham Barr <[EMAIL PROTECTED]> writes:
GB> On Wed, May 23, 2001 at 10:30:32AM -0700, Hong Zhang wrote:
>> I think "stack based =~ register based". If we don't have Java-like "jsr"
GB> That comment reminds me of how the register file is implemented in
GB> a sun sparc. They have a large register file, but only some are accessable
GB> at any given time, say 16. When you do a sub call you place your
GB> arguments in the high registers, say 4, and shift the window pointer
GB> by 12 (in this case). What was r12-r15 now becomes r0-r3. On return
GB> the result is placed into r0-r3 which are then available to the
GB> caller as r12-r15.
GB> This allows very efficient argument passing without having to save
GB> registers to a stack and restor them later.
there have been arguments over whether register windows win or not. on
the plus side they make passing sub args very efficient (if you can fit
them all into the window). on the minus side, you have to do major
chunks of swapping registers to/from stack. the window size is a big
issue too and some think sparc has too small a window and too few total
registers.
and besides register windows is a hardware only solution (they just mung
the virtual base in a special register). i have not heard of it being
used in pure software as the extra costs of having many registers or a
deep stack in software is nothing while in hardware is has a real (and
heavy) cost.
uri
--
Uri Guttman --------- [EMAIL PROTECTED] ---------- http://www.sysarch.com
SYStems ARCHitecture and Stem Development ------ http://www.stemsystems.com
Learn Advanced Object Oriented Perl from Damian Conway - Boston, July 10-11
Class and Registration info: http://www.sysarch.com/perl/OOP_class.html