Virtual machine showdown: stack versus registers

  • Authors:
  • Yunhe Shi;David Gregg;Andrew Beatty;M. Anton Ertl

  • Affiliations:
  • University of Dublin, Trinity College, Dublin 2, Ireland;University of Dublin, Trinity College, Dublin 2, Ireland;University of Dublin, Trinity College, Dublin 2, Ireland;TU Wien, Wien, Austria

  • Venue:
  • Proceedings of the 1st ACM/USENIX international conference on Virtual execution environments
  • Year:
  • 2005

Quantified Score

Hi-index 0.00

Visualization

Abstract

Virtual machines (VMs) are commonly used to distribute programs in an architecture-neutral format, which can easily be interpreted or compiled. A long-running question in the design of VMs is whether stack architecture or register architecture can be implemented more efficiently with an interpreter. We extend existing work on comparing virtual stack and virtual register architectures in two ways. Firstly, our translation from stack to register code is much more sophisticated. The result is that we eliminate an average of more than 47% of executed VM instructions, with the register machine bytecode size only 25% larger than that of the corresponding stack bytecode. Secondly we present an implementation of a register machine in a fully standard-compliant implementation of the Java VM. We find that, on the Pentium 4, the register architecture requires an average of 32.3% less time to execute standard benchmarks if dispatch is performed using a C switch statement. Even if more efficient threaded dispatch is available (which requires labels as first class values), the reduction in running time is still approximately 26.5% for the register architecture.