skip to main content
10.1145/1449764.1449796acmconferencesArticle/Chapter ViewAbstractPublication PagessplashConference Proceedingsconference-collections
research-article

Analyzing the performance of code-copying virtual machines

Published: 19 October 2008 Publication History

Abstract

Many popular programming languages use interpreter-based execution for portability, supporting dynamic or reflective properties, and ease of implementation. Code-copying is an optimization technique for interpreters that reduces the performance gap between interpretation and JIT compilation, offering significant speedups over direct-threading interpretation. Due to varying language features and virtual machine design, however, not all languages benefit from codecopying to the same extent. We consider here properties of interpreted languages, and in particular bytecode and virtual machine construction that enhance or reduce the impact of code-copying. We implemented code-copying and compared performance with the original direct-threading virtual machines for three languages, Java (SableVM), OCaml, and Ruby (Yarv), examining performance on three different architectures, ia32 (Pentium 4), x86_64 (AMD64) and PowerPC (G5). Best speedups are achieved on ia32 by OCaml (maximum 4.88 times, 2.81 times on average), where a small and simple bytecode design facilitates improvements to branch prediction brought by code-copying. Yarv only slightly improves over direct-threading; large working sizes of bytecodes, and a relatively small fraction of time spent in the actual interpreter loop both limit the application of codecopying and its overall net effect. We are able to show that simple ahead of time analysis of VM and execution properties can help determine the suitability of code-copying for a particular VM before an implementation of code-copying is even attempted.

References

[1]
David Bélanger. SableJIT: A retargetable just-in-time compiler. Master's thesis, McGill University, August 2004.
[2]
Marc Berndl, Benjamin Vitale, Mathew Zaleski, and Angela Demke Brown. Context threading: A flexible and efficient dispatch technique for virtual machine interpreters. In Proceedings of CGO-4, 2005.
[3]
S. M. Blackburn, R. Garner, C. Hoffman, A. M. Khan, K. S. McKinley, R. Bentzur, A. Diwan, D. Feinberg, D. Frampton, S. Z. Guyer, M. Hirzel, A. Hosking, M. Jump, H. Lee, J. E. B. Moss, A. Phansalkar, D. Stefanović, T. VanDrunen, D. von Dincklage, and B. Wiedermann. The DaCapo benchmarks: Java benchmarking development and analysis. In OOPSLA '06: Proceedings of the 21st annual ACM SIGPLAN conference on Object-Oriented Programing, Systems, Languages, and Applications, New York, NY, USA, October 2006. ACM Press.
[4]
Per Bothner. Compiling Java with GCJ. Linux J., 2003 (105):4, 2003. ISSN 1075-3583.
[5]
C. Consel, J.L. Lawall, and A.-F. Le Meur. A tour of Tempo: A program specializer for the C language. Science of Computer Programming, 2004.
[6]
Debian Shootout. http://shootout.alioth.debian.org/.
[7]
M. Anton Ertl and David Gregg. The behavior of efficient virtual machine interpreters on modern architectures. In Euro-Par '01: Proceedings of the 7th International Euro-Par Conference Manchester on Parallel Processing, pages 403--412, London, UK, 2001. Springer-Verlag. ISBN 3-540-42495-4.
[8]
M. Anton Ertl and David Gregg. Optimizing indirect branch prediction accuracy in virtual machine interpreters. In SIGPLAN '03 Conference on Programming Language Design and Implementation, 2003.
[9]
M. Anton Ertl and David Gregg. Retargeting JIT compilers by using C-compiler generated executable code. In Parallel Architecture and Compilation Techniques (PACT' 04), pages 41--50, 2004.
[10]
M. Anton Ertl, David Gregg, Andreas Krall, and Bernd Paysan. Vmgen: a generator of efficient virtual machine interpreters. Softw. Pract. Exper., 32(3):265--294, 2002. ISSN 0038-0644.
[11]
M. Anton Ertl, Christian Thalinger, and Andreas Krall. Superinstructions and replication in the Cacao JVM interpreter. Journal of .NET Technologies, 4:25--32, 2006. ISSN 1801-2108.
[12]
Etienne M. Gagnon. A Portable Research Framework for the Execution of Java Bytecode. PhD thesis, McGill University, 2002.
[13]
Etienne M. Gagnon and Laurie J. Hendren. SableCC, an object-oriented compiler framework. In TOOLS'98: Proceedings of the Technology of Object-Oriented Languages and Systems, page 140, Washington, DC, USA, 1998. IEEE Computer Society. ISBN 0-8186-8482-8.
[14]
Brian Grant, Matthai Philipose, Markus Mock, Craig Chambers, and Susan J. Eggers. A retrospective on: "an evaluation of staged run-time optimizations in DyC". SIGPLAN Not., 39(4):656--669, 2004. ISSN 0362-1340.
[15]
Chris Lattner and Vikram Adve. LLVM: A compilation framework for lifelong program analysis & transformation. In CGO '04: Proceedings of the international symposium on Code generation and optimization, page 75, Washington, DC, USA, 2004. IEEE Computer Society. ISBN 0-7695-2102-9
[16]
Hidehiko Masuhara and Akinori Yonezawa. Run-time bytecode specialization. Lecture Notes in Computer Science, 2053, 2001.
[17]
OCaml. http://caml.inria.fr.
[18]
OProfile. http://oprofile.sf.net/.
[19]
K. Palacz, J. Baker, C. Flack, C. Grothoff, H. Yamauchi, and J. Vitek. Engineering a customizable intermediate representation. In IVME '03: Proceedings of the 2003 workshop on Interpreters, virtual machines and emulators, pages 67--76, New York, NY, USA, 2003. ACM. ISBN 1-58113-655-2.
[20]
Jinzhan Peng, Gansha Wu, and Guei-Yuan Lueh. Code sharing among states for stack-caching interpreter. In IVME '04: Proceedings of the 2004 workshop on Interpreters, virtual machines and emulators, pages 15--22, New York, NY, USA, 2004. ACM. ISBN 1-58113-909-8.
[21]
Ian Piumarta and Fabio Riccardi. Optimizing direct threaded code by selective inlining. In PLDI '98: Proceedings of the ACM SIGPLAN 1998 conference on Programming language design and implementation, pages 291--300, New York, NY, USA, 1998. ACM Press. ISBN 0-89791-987-4.
[22]
Patrice Pominville, Feng Qian, Raja Vallée-Rai, Laurie Hendren, and Clark Verbrugge. A framework for optimizing Java using attributes. In Reinhard Wilhelm, editor, Proceedings of the 10th International Conference on Compiler Construction (CC '01), volume 2027 of Lecture Notes in Computer Science (LNCS), pages 334--354, April 2001.
[23]
Gregory B. Prokopski and Clark Verbrugge. Towards GCC as a compiler for multiple VMs. In GCC Developers' Summit, 2007.
[24]
Gregory B. Prokopski and Clark Verbrugge. Compilerguaranteed safety in code-copying virtual machines. In Compiler Construction, 17th International Conference, LNCS. Springer, 2008. to appear.
[25]
Gregory B. Prokopski, Etienne M. Gagnon, and Christian Arcand. Bytecode testing framework for SableVM code-copying engine. Technical Report SABLETR-2007-9, Sable Research Group, School of Computer Science, McGill University, Montréal, Québec, Canada, September 2007.
[26]
Raw results used for this publication. http://www.sable.mcgill.ca/~gproko/gcc/multi-08-raw-results.pdf.
[27]
Markku Rossi and Kengatharan Sivalingam. A survey of instruction dispatch techniques for byte-code interpreters. Technical Report TKO-C79, Faculty of Information Technology, Helsinki Univeristy of Technology, May 1996.
[28]
Koichi Sasada. YARV: yet another RubyVM: innovating the Ruby interpreter. In OOPSLA '05: Companion to the 20th annual ACM SIGPLAN conference on Object-oriented programming, systems, languages, and applications, pages 158--159, New York, NY, USA, 2005. ACM. ISBN 1-59593-193-7.
[29]
Standard Performance Evaluation Corporation. SPEC JVM98 Benchmarks. http://www.spec.org/jvm98.
[30]
Ben Stephenson and Wade Holst. Multicodes: optimizing virtual machines using bytecode sequences. In OOPSLA '03: Companion of the 18th annual ACM SIGPLAN conference on Object-oriented programming, systems, languages, and applications, pages 328--329, New York, NY, USA, 2003. ACM Press. ISBN 1-58113-751-6.
[31]
T. Suganuma, T. Ogasawara, M. Takeuchi, T. Yasue, M. Kawahito, K. Ishizaki, H. Komatsu, and T. Nakatani. Overview of the IBM Java Just-in-Time compiler. IBM Systems Journal, 39(1):175--193, 2000.
[32]
S. Thibault, C. Consel, J. Lawall, R. Marlet, and G. Muller. Static and dynamic program compilation by interpreter specialization. Higher-Order and Symbolic Computation, 13(3):161--178, September 2000.
[33]
Ankush Varma and Shuvra S. Bhattacharyya. Javathrough-C compilation: An enabling technology for Java in embedded systems. In DATE '04: Proceedings of the conference on Design, automation and test in Europe, page 30161, Washington, DC, USA, 2004. IEEE Computer Society. ISBN 0-7695-2085-5-3.
[34]
Benjamin Vitale and Mathew Zaleski. Alternative dispatch techniques for the tcl vm interpreter. In Proceedings of 12th Annual Tcl/Tk Conference, October 2005.
[35]
Mathew Zaleski, Marc Berndl, and Angela Demke Brown. Mixed mode execution with context threading. In CASCON '05: Proceedings of the 2005 conference of the Centre for Advanced Studies on Collaborative research, pages 305--319. IBM Press, 2005.

Cited By

View all
  • (2018)A framework for constructing javascript virtual machines with customized datatype representationsProceedings of the 33rd Annual ACM Symposium on Applied Computing10.1145/3167132.3167266(1238-1247)Online publication date: 9-Apr-2018
  • (2010)A graph theoretic approach to cache-conscious placement of data for direct mapped cachesACM SIGPLAN Notices10.1145/1837855.180667045:8(113-120)Online publication date: 5-Jun-2010
  • (2010)A graph theoretic approach to cache-conscious placement of data for direct mapped cachesProceedings of the 2010 international symposium on Memory management10.1145/1806651.1806670(113-120)Online publication date: 5-Jun-2010
  • Show More Cited By

Recommendations

Comments

Information & Contributors

Information

Published In

cover image ACM Conferences
OOPSLA '08: Proceedings of the 23rd ACM SIGPLAN conference on Object-oriented programming systems languages and applications
October 2008
654 pages
ISBN:9781605582153
DOI:10.1145/1449764
  • cover image ACM SIGPLAN Notices
    ACM SIGPLAN Notices  Volume 43, Issue 10
    September 2008
    613 pages
    ISSN:0362-1340
    EISSN:1558-1160
    DOI:10.1145/1449955
    Issue’s Table of Contents
Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

Sponsors

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 19 October 2008

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. branch prediction
  2. code-copying
  3. compiler optimization
  4. dynamic analysis
  5. performance
  6. virtual machines

Qualifiers

  • Research-article

Conference

OOPSLA08
Sponsor:

Acceptance Rates

Overall Acceptance Rate 268 of 1,244 submissions, 22%

Upcoming Conference

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)1
  • Downloads (Last 6 weeks)0
Reflects downloads up to 17 Jan 2025

Other Metrics

Citations

Cited By

View all
  • (2018)A framework for constructing javascript virtual machines with customized datatype representationsProceedings of the 33rd Annual ACM Symposium on Applied Computing10.1145/3167132.3167266(1238-1247)Online publication date: 9-Apr-2018
  • (2010)A graph theoretic approach to cache-conscious placement of data for direct mapped cachesACM SIGPLAN Notices10.1145/1837855.180667045:8(113-120)Online publication date: 5-Jun-2010
  • (2010)A graph theoretic approach to cache-conscious placement of data for direct mapped cachesProceedings of the 2010 international symposium on Memory management10.1145/1806651.1806670(113-120)Online publication date: 5-Jun-2010
  • (2022)A fast in-place interpreter for WebAssemblyProceedings of the ACM on Programming Languages10.1145/35633116:OOPSLA2(646-672)Online publication date: 31-Oct-2022
  • (2010)How to Select Superinstructions for RubyIPSJ Online Transactions10.2197/ipsjtrans.3.543(54-61)Online publication date: 2010

View Options

Login options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Media

Figures

Other

Tables

Share

Share

Share this Publication link

Share on social media