Path: utzoo!attcan!uunet!seismo!sundc!pitstop!sun!amdcad!crackle!tim From: tim@crackle.amd.com (Tim Olson) Newsgroups: comp.arch Subject: Re: How the Japanese will win the MIPS wars with SPARC Message-ID: <23081@amdcad.AMD.COM> Date: 30 Sep 88 22:04:38 GMT References: <58@zeno.MN.ORG> <91@zeno.MN.ORG> Sender: news@amdcad.AMD.COM Reply-To: tim@crackle.amd.com (Tim Olson) Organization: Advanced Micro Devices, Inc. Sunnyvale CA Lines: 58 Summary: Expires: Sender: Followup-To: In article andrew@jung.harlqn.uucp (Andrew Watson) writes: | To explain - the whole point of windows is to minimise overall memory traffic | by eliminating most stack read/writes. If the on-chip register file does | overflow, then stack traffic is necessary, but the whole file can be dumped in | one go, potentially using an efficient memory burst mode (on the 4/110, for | instance). This is not the usual mode of operation. When a procedure call causes the stack cache to overflow, only the required amount of registers are saved to the stack (a single, fixed-sized frame for SPARC, or the exact number of registers required for Am29000) -- not the entire stack cache. This allows for a "hysterisis" effect whereby a "fill" is separated from the "spill" that caused it. For example, if the stack before a procedure call looked like: +-----+ | | | | Memory ~ ~ | | +-----+ <- rfb (register free boundary) | | | | Stack Cache (registers) |xxxxx| <- sp (current stack pointer) |xxxxx| +xxxxx+ <- rab (register allocate bound, == rfb - 512 bytes) xxxxx <- where sp needs to be after call (the xxxx marked area is the frame that needs to be allocated for the procedure we are calling). Since the allocation causes the sp to move below the rab, a "spill" occurs, moving enough registers from the rfb end of the stack cache into memory, and adjusting the rfb and rab pointers. After the call and spill, the stack looks like: +-----+ | | | | Memory ~ ~ <- old rfb pointed here | | +-----+ <- rfb (register free boundary) | | | | Stack cache (registers) | | | | +-----+ <- rab <- sp (both point to the same location) Now when we return from this procedure, we don't have to fill the spilled registers. In fact, we won't fill them until the sp crosses the rfb boundary. We can also now call this procedure again and not spill this time. This mechanism matches well with the typical call chain, which has a high degree of locality. Contrast this stack cache mechanism with a standard caller or callee saves convention -- there the registers are saved and restored from memory every time the procedure is called. -- Tim Olson Advanced Micro Devices (tim@crackle.amd.com)