Computing Reviews
Today's Issue Hot Topics Search Browse Recommended My Account Log In
Review Help
Search
Virtual machine showdown: stack versus registers
Shi Y., Casey K., Ertl M., Gregg D. ACM Transactions on Architecture and Code Optimization4 (4):1-36,2008.Type:Article
Date Reviewed: Aug 22 2008

Programming language interpreters represent the executing program as an abstract machine. The major representation for Java is an abstract stack machine called Java bytecodes. The alternative representation is an abstract register machine. This paper is a thorough comparison of the benefits of each representation. It comes to the conclusion that the stack machine is more space efficient, while the register machine provides faster interpretation.

The paper is remarkable. This subject is usually hotly contested, frequently with emotional zeal. The authors implement both representations and perform a careful analysis, taking care to make the comparison as honest as possible.

The abstract stack machine contains instructions that load operands onto an execution stack. The computational and comparison operations take values from the top of the stack and return results on top of the stack. This representation is space efficient, since the operands are not encoded in the individual instructions; however, the representation uses more instructions, since values must be loaded onto the stack before use and redundant expressions elimination is less effective.

The register machine looks much like a modern processor, with each instruction taking register numbers to indicate the registers holding the operands. Each instruction is larger than in the stack machine; however, there are fewer instructions, since most of the load operations can be eliminated.

The difference in interpreter performance can be attributed to the cost of dispatching the instructions for execution and the retrieval of operands from the stack. The paper analyzes a number of different techniques for dispatching instructions, ranging from using a C-style switch statement to machine-dependent techniques that minimize the cost of dispatch. The C-style switch statement is the most costly and gives the register machine the biggest advantage. As the dispatch mechanisms become more efficient, the performance advantage for the register machine decreases.

This is an excellent example of performing a difficult comparison. Shi et al. anticipate the questions that the reader might raise and carefully study them. I expect that some of the results surprised the authors themselves. The paper is well worth reading, both for the information and the comparison methodology.

Reviewer:  Charles Morgan Review #: CR135983 (0907-0671)
Bookmark and Share
 
Interpreters (D.3.4 ... )
 
Would you recommend this review?
yes
no
Other reviews under "Interpreters": Date
The APL IL Interpreter Generator
Alfonseca M., Selby D., Wilks R. IBM Systems Journal 30(4): 490-497, 1991. Type: Article
Dec 1 1993
Optimizing static scope LISP by repetitive interpretation of recursive functions calls
Felgentreu K., Lippe W., Simon F. IEEE Transactions on Software Engineering SE-13(6): 628-635, 1987. Type: Article
Mar 1 1988
Implementation of an interpreter for abstract equations
Hoffmann C., O’Donnell M., Strandh R. Software--Practice & Experience 15(12): 1185-1204, 1985. Type: Article
Jul 1 1986
more...

E-Mail This Printer-Friendly
Send Your Comments
Contact Us
Reproduction in whole or in part without permission is prohibited.   Copyright 1999-2024 ThinkLoud®
Terms of Use
| Privacy Policy