Register window

From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by Maury Markowitz (talk | contribs) at 04:31, 24 February 2004 (added downside). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Jump to navigation Jump to search

In computer engineering, the use of register windows is a technique to improve the performance of a particularily common operation, the procedure call. By devoting hardware to this problem, almost all computer programs will run faster. This was one of the main design features of the original Berkeley RISC design, which would later be commercialized as the SPARC.

Most CPU designs includes a small amount of very high-speed memory known as registers. Registers are used by the CPU in order to hold temporary values while working on longer strings of instructions. Considerable performance can be added to a design with more registers, however, since the registers are a visible piece of the CPU's instruction set, the number cannot typically be changed after the design has been released.

While registers are almost a universal solution to performance, they do have a drawback. Different parts of a computer program all use their own temporary values, and therefore compete for the use of the registers. Since a good understanding of the nature of program flow at runtime is very difficult, there is no easy way for the developer to know in advance how many registers they should use, and how many to leave aside for other parts of the program. In general these sorts of considerations are ignored, and the developers, and more likely, the compilers they use, attempt to use all the registers visible to them.

This is were register windows become useful. Since every part of a program wants registers for its own use, it makes sense to provide several sets of registers for the different parts of the program. Of course if these registers were visible, there would simply be more registers to compete over, the "trick" is to make them invisible. This is actually somewhat simpler than it might sound, as the movement from one part of the program to another during a procedure call is easily "seen" (it is accomplished by one of a small number of instructions), and the new set can be "swapped in" at that point. Likewise the end of such a call can also easily be seen (the "return"), allowing one of the sets of registers to be reclaimed for some other part of the program.

In the Berekely RISC design, only eight registers were visible to the programs, out of a total of 64. This allowed up to eight procedure calls to have their own register sets, completely invisibly. As long as the program did not call down chains longer than eight calls deep, the registers never had to be saved out to main memory (or cache), a terribly slow process compared to register access. For many programs a chain of six is as deep as the program will go.

Register windows also provide an easy upgrade path. Since the additional registers are invisible to the programs, additional windows can be added at any time. For instance the use of object-oriented programming often results in a greater number of "smaller" calls, which can be accomidated by increasing the windows from eight to sixteen for instance.

Register windows are not the only way to improve register performance. The group at Stanford University designing the MIPS architecture saw the Berkeley work and decided that the problem was not enough registers, but making poor use of them. They instead invested more time in their compiler, making sure it wisely used the larger set available in the MIPS instruction set. This resulted in reduced complexity of the chip, with one half the total number of registers, while offering potentially higher performance in those cases where a single procedure could make use of the larger register space. In the end, with modern compilers, the MIPS design makes better use of its register space even during procedure calls.

See also: register renaming