The case for virtual register machines

Virtual machines (VMs) are a popular target for language implementers. Conventional wisdom tells us that virtual stack architectures can be implemented with an interpreter more efficiently, since the location of operands is implicit in the stack pointer. In contrast, the operands of register machine instructions must be specified explicitly. In this paper, we present a working system for translating stack-based Java virtual machine (JVM) code to a simple register code. We describe the translation process, the complicated parts of the JVM which make translation more difficult, and the optimisations needed to eliminate copy instructions. Experimental results show that a register format reduces the number of executed instructions by 34.88%, while increasing the number of bytecode loads by an average of 44.81%. Overall, this corresponds to an increase of 2.32 loads for each dispatch removed. We believe that the high cost of dispatches makes register machines attractive even at the cost of increased loads.

[1]  Ian Piumarta,et al.  Optimizing direct threaded code by selective inlining , 1998, PLDI 1998.

[2]  Peter U. Schulthess,et al.  Reply to the case against stack-oriented instruction sets , 1977, CARN.

[3]  Shirley Dex,et al.  JR 旅客販売総合システム(マルス)における運用及び管理について , 1991 .

[4]  Lex Augusteijn,et al.  A code compression system based on pipelined interpreters , 1999, Softw. Pract. Exp..

[5]  John Waldron Dynamic bytecode usage by object oriented Java programs , 1999, Proceedings Technology of Object-Oriented Languages and Systems. TOOLS 29 (Cat. No.PR00275).

[6]  Laurie J. Hendren,et al.  SableVM: A Research Framework for the Efficient Execution of Java Bytecode , 2001, Java Virtual Machine Research and Technology Symposium.

[7]  Glenford J. Myers,et al.  The case against stack-oriented instruction sets , 1977, CARN.

[8]  David Gregg,et al.  The Behavior of Efficient Virtual Machine Interpreters on Modern Architectures , 2001, Euro-Par.

[9]  Roberto Ierusalimschy,et al.  Programming in Lua , 2003 .

[10]  Glenford J. Myers,et al.  The evaluation of expressions in a storage-to-storage architecture , 1978, CARN.

[11]  J. Davenport Editor , 1960 .

[12]  A. Rossier Letter to the Editor , 1986, Paraplegia.

[13]  Richard L. Sites A combined register-stack architecture , 1978, CARN.

[14]  Todd A. Proebsting Optimizing an ANSI C interpreter with superoperators , 1995, POPL '95.

[15]  Alan Kay The early history of Smalltalk , 1996 .

[16]  Vítor Santos Costa,et al.  Optimising Bytecode Emulation for Prolog , 1999, PPDP.

[17]  David Gregg,et al.  Vmgen—a generator of efficient virtual machine interpreters , 2002, Softw. Pract. Exp..

[18]  David Bulman Stack Computers [Guest editor's introduction] , 1977, Computer.

[19]  Laurie J. Hendren,et al.  Effective Inline-Threaded Interpretation of Java Bytecode Using Preparation Sequences , 2003, CC.

[20]  James R. Bell,et al.  Threaded code , 1973, CACM.

[21]  J. L. Keedy On the use of stacks in the evaluation of expressions , 1978, CARN.

[22]  Etienne Gagnon,et al.  A portable research framework for the execution of java bytecode , 2003 .

[23]  M. Anton Ertl,et al.  Stack caching for interpreters , 1995, PLDI '95.

[24]  Lorna Smith,et al.  Benchmarking Java Grande Applications , 2000 .

[25]  Rajiv Gupta,et al.  Complete removal of redundant expressions , 1998, PLDI 1998.

[26]  David Gregg,et al.  Optimizing indirect branch prediction accuracy in virtual machine interpreters , 2003, PLDI '03.

[27]  Glenn Krasner,et al.  Smalltalk-80: bits of history, words of advice , 1983 .

[28]  M. Anton Ertl Implementation of Stack-Based Languages on Register Machines , 1996 .

[29]  Phil Winterbottom,et al.  The design of the Inferno virtual machine , 1997 .