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

One VM to rule them all

Published: 29 October 2013 Publication History

Abstract

Building high-performance virtual machines is a complex and expensive undertaking; many popular languages still have low-performance implementations. We describe a new approach to virtual machine (VM) construction that amortizes much of the effort in initial construction by allowing new languages to be implemented with modest additional effort. The approach relies on abstract syntax tree (AST) interpretation where a node can rewrite itself to a more specialized or more general node, together with an optimizing compiler that exploits the structure of the interpreter. The compiler uses speculative assumptions and deoptimization in order to produce efficient machine code. Our initial experience suggests that high performance is attainable while preserving a modular and layered architecture, and that new high-performance language implementations can be obtained by writing little more than a stylized interpreter.

References

[1]
R. Affeldt, H. Masuhara, E. Sumii, and A. Yonezawa. Supporting objects in run-time bytecode specialization. In Proceedings of the ASIAN Symposium on Partial Evaluation and Semantics-Based Program Manipulation, pages 50--60. ACM Press, 2002.
[2]
B. Alpern, S. Augart, S. M. Blackburn, M. Butrico, A. Cocchi, P. Cheng, J. Dolby, S. Fink, D. Grove, M. Hind, K. S. McKinley, M. Mergen, J. E. B. Moss, T. Ngo, and V. Sarkar. The Jikes Research Virtual Machine project: Building an open-source research community. IBM Systems Journal, 44 (2): 399--417, 2005.
[3]
D. Ancona, M. Ancona, A. Cuni, and N. D. Matsakis. RPython: A step towards reconciling dynamically and statically typed OO languages. In Proceedings of the Dynamic Languages Symposium, pages 53--64. ACM Press, 2007.
[4]
Apache Commons. Javaflow, 2009. URL http://commons.apache.org/sandbox/javaflow/.
[5]
G. Benson. Zero and Shark: a zero-assembly port of OpenJDK, 2009. URL http://today.java.net/pub/a/today/2009/05/21/zero-and-shark-openjdk-port.html.
[6]
C. F. Bolz and A. Rigo. How to not write virtual machines for dynamic languages. In Proceedings of the Workshop on Dynamic Languages and Applications, 2007.
[7]
C. F. Bolz and L. Tratt. The impact of meta-tracing on VM design and implementation. Science of Computer Programming, 2013.
[8]
C. F. Bolz, A. Cuni, M. Fijałkowski, and A. Rigo. Tracing the meta-level: PyPy's tracing JIT compiler. In Proceedings of the Workshop on the Implementation, Compilation, Optimization of Object-Oriented Languages and Programming Systems, pages 18--25. ACM Press, 2009.
[9]
C. F. Bolz, A. Cuni, M. Fijałkowski, M. Leuschel, S. Pedroni, and A. Rigo. Runtime feedback in a meta-tracing JIT for efficient dynamic languages. In Proceedings of the Workshop on the Implementation, Compilation, Optimization of Object-Oriented Languages and Programming Systems, pages 9:1--9:8. ACM Press, 2011.
[10]
C. F. Bolz, A. Cuni, M. Fijałkowski, M. Leuschel, S. Pedroni, and A. Rigo. Allocation removal by partial evaluation in a tracing JIT. In Proceedings of the ACM SIGPLAN Workshop on Partial Evaluation and Program Manipulation, pages 43--52. ACM Press, 2011.
[11]
S. Brunthaler. Efficient interpretation using quickening. In Proceedings of the Dynamic Languages Symposium, pages 1--14. ACM Press, 2010.
[12]
S. Brunthaler. Inline caching meets quickening. In Proceedings of the European Conference on Object-Oriented Programming, pages 429--451. Springer-Verlag, 2010.
[13]
K. Casey, M. A. Ertl, and D. Gregg. Optimizing indirect branch prediction accuracy in virtual machine interpreters. ACM Transactions on Programming Languages and Systems, 29 (6), 2007.
[14]
J. Castanos, D. Edelsohn, K. Ishizaki, P. Nagpurkar, T. Nakatani, T. Ogasawara, and P. Wu. On the benefits and pitfalls of extending a statically typed language JIT compiler for dynamic scripting languages. In Proceedings of the ACM SIGPLAN Conference on Object-Oriented Programming Systems, Languages, and Applications, pages 195--212. ACM Press, 2012.
[15]
Y. Chiba. Redundant boxing elimination by a dynamic compiler for Java. In Proceedings of the International Conference on the Principles and Practice of Programming in Java, pages 215--220. ACM Press, 2007.
[16]
R. Cytron, J. Ferrante, B. K. Rosen, M. N. Wegman, and F. K. Zadeck. Efficiently computing static single assignment form and the control dependence graph. ACM Transactions on Programming Languages and Systems, 13 (4): 451--490, 1991.
[17]
M. A. Ertl and D. Gregg. Combining stack caching with dynamic superinstructions. In Proceedings of the Workshop on Interpreters, Virtual Machines and Emulators, pages 7--14. ACM Press, 2004.
[18]
B. Folliot, I. Piumarta, and F. Riccardi. A dynamically configurable, multi-language execution platform. In Proceedings of the European Workshop on Support for Composing Distributed Applications, pages 175--181. ACM Press, 1998.
[19]
D. Frampton, S. M. Blackburn, P. Cheng, R. J. Garner, D. Grove, J. E. B. Moss, and S. I. Salishev. Demystifying magic: high-level low-level programming. In Proceedings of the International Conference on Virtual Execution Environments, pages 81--90. ACM Press, 2009.
[20]
B. Fulgham. The computer language benchmarks game, 2013. URL http://benchmarksgame.alioth.debian.org/.
[21]
Y. Futamura. Partial evaluation of computation process - an approach to a compiler-compiler. Systems, Computers, Controls, 2 (5): 721--728, 1971.
[22]
E. Gagnon and L. Hendren. Effective inline-threaded interpretation of Java bytecode using preparation sequences. In Proceedings of the International Conference on Compiler Construction, pages 170--184. Springer-Verlag, 2003. 10.1007/3-540-36579-6_13.
[23]
N. Geoffray, G. Thomas, J. Lawall, G. Muller, and B. Folliot. VMKit: A substrate for managed runtime environments. In Proceedings of the International Conference on Virtual Execution Environments, pages 51--62, 2010. 10.1145/1735997.1736006.
[24]
L. Hendren, J. Doherty, A. Dubrau, R. Garg, N. Lameed, S. Radpour, A. Aslam, T. Aslam, A. Casey, M. C. Boisvert, J. Li, C. Verbrugge, and O. S. Belanger. McLAB: enabling programming language, compiler and software engineering research for MATLAB. In Companion to the ACM SIGPLAN Conference on Object Oriented Programming Systems, Languages, and Applications, pages 195--196. ACM Press, 2011. 10.1145/2048147.2048203.
[25]
U. Hölzle and D. Ungar. Optimizing dynamically-dispatched calls with run-time type feedback. In Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation, pages 326--336. ACM Press, 1994. 10.1145/178243.178478.
[26]
U. Hölzle, C. Chambers, and D. Ungar. Optimizing dynamically-typed object-oriented languages with polymorphic inline caches. In Proceedings of the European Conference on Object-Oriented Programming, pages 21--38. Springer-Verlag, 1991.
[27]
U. Hölzle, C. Chambers, and D. Ungar. Debugging optimized code with dynamic deoptimization. In Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation, pages 32--43. ACM Press, 1992. 10.1145/143095.143114.
[28]
HotSpot JVM. Java version history (J2SE 1.3), 2013. URL http://en.wikipedia.org/wiki/Java_version_history.
[29]
R. K. W. Hui, K. E. Iverson, E. E. McDonnell, and A. T. Whitney. APL\? In Conference Proceedings on APL 90: for the future, pages 192--200. ACM Press, 1990. 10.1145/97811.97845.
[30]
IBM. Java 2 Platform, Standard Edition, 2013. URL https://www.ibm.com/developerworks/java/jdk/.
[31]
K. Ishizaki, T. Ogasawara, J. Castanos, P. Nagpurkar, D. Edelsohn, and T. Nakatani. Adding dynamically-typed language support to a statically-typed language compiler: performance evaluation, analysis, and tradeoffs. In Proceedings of the International Conference on Virtual Execution Environments, pages 169--180. ACM Press, 2012. 10.1145/2151024.2151047.
[32]
K. E. Iverson. A Programming Language. John Wiley & Sons, Inc., 1962. ISBN 0-471430-14-5.
[33]
N. D. Jones and A. J. Glenstrup. Program generation, termination, and binding-time analysis. In Generative Programming and Component Engineering, volume 2487 of Lecture Notes in Computer Science, pages 1--31. Springer-Verlag, 2002. 10.1007/3-540-45821-2_1.
[34]
JRuby. JRuby: The Ruby programming language on the JVM, 2013. URL http://jruby.org/.
[35]
JSR 223. JSR 223: Scripting for the Java™ platform, 2006. URL http://www.jcp.org/en/jsr/detail?id=223.
[36]
T. Kotzmann and H. Mössenböck. Escape analysis in the context of dynamic compilation and deoptimization. In Proceedings of the International Conference on Virtual Execution Environments, pages 111--120. ACM Press, 2005. 10.1145/1064979.1064996.
[37]
T. Kotzmann and H. Mössenböck. Run-time support for optimizations based on escape analysis. In Proceedings of the International Symposium on Code Generation and Optimization, pages 49--60. IEEE Computer Society, 2007. 10.1109/CGO.2007.34.
[38]
C. Lattner and V. Adve. LLVM: A compilation framework for lifelong program analysis & transformation. In Proceedings of the International Symposium on Code Generation and Optimization, pages 75--86. IEEE Computer Society, 2004. 10.1109/CGO.2004.1281665.
[39]
MacRuby. MacRuby, 2013. URL http://macruby.org/.
[40]
M. Marquard and B. Steensgaard. Partial evaluation of an object-oriented imperative language. Master's thesis, DIKU, University of Copenhagen, 1992.
[41]
H. Masuhara and A. Yonezawa. A portable-approach to dynamic optimization in run-time specialization. New Generation Computing, 20 (1): 101--124, 2002. 10.1007/BF03037261.
[42]
E. Meijer and J. Gough. Technical overview of the Common Language Runtime, 2000. URL https://research.microsoft.com/en-us/um/people/emeijer/papers/clr.pdf.
[43]
F. Morandat, B. Hill, L. Osvald, and J. Vitek. Evaluating the design of the R language - Objects and functions for data analysis. In Proceedings of the European Conference on Object-Oriented Programming, pages 104--131. Springer-Verlag, 2012. 10.1007/978-3-642-31057-7_6.
[44]
R. Odaira and K. Hiraki. Sentinel PRE: Hoisting beyond exception dependency with dynamic deoptimization. In Proceedings of the International Symposium on Code Generation and Optimization, pages 328--338. IEEE Computer Society, 2005. 10.1109/CGO.2005.32.
[45]
OpenJDK. Graal project, 2013. URL http://openjdk.java.net/projects/graal.
[46]
OpenJDK. Project Sumatra, 2013. URL http://openjdk.java.net/projects/sumatra/.
[47]
I. Piumarta and F. Riccardi. Optimizing direct threaded code by selective inlining. In Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation, pages 291--300. ACM Press, 1998. 10.1145/277650.277743.
[48]
G. Richards, C. Hammer, B. Burg, and J. Vitek. The eval that men do: A large-scale study of the use of eval in JavaScript applications. In Proceedings of the European Conference on Object-Oriented Programming, pages 52--78. Springer-Verlag, 2011. 10.1007/978-3-642-22655-7_4.
[49]
A. Rigo and S. Pedroni. PyPy's approach to virtual machine construction. In Companion to the ACM SIGPLAN Conference on Object Oriented Programming Systems, Languages, and Applications, pages 944--953. ACM Press, 2006. 10.1145/1176617.1176753.
[50]
River Trail. Parallel EcmaScript (River Trail) API, 2013. URL http://wiki.ecmascript.org/doku.php?id=strawman:data_parallelism.
[51]
J. R. Rose. Bytecodes meet combinators: invokedynamic on the JVM. In Proceedings of the ACM Workshop on Virtual Machines and Intermediate Languages, 2009.
[52]
Rubinius. Rubinius: Use Ruby, 2013. URL http://rubini.us/.
[53]
E. Ruf and D. Weise. Opportunities for online partial evaluation. Technical report, Stanford University, 1992.
[54]
D. Schneider and C. F. Bolz. The efficient handling of guards in the design of RPython's tracing JIT. In Proceedings of the ACM Workshop on Virtual Machines and Intermediate Languages, pages 3--12. ACM Press, 2012. 10.1145/2414740.2414743.
[55]
U. P. Schultz, J. L. Lawall, C. Consel, and G. Muller. Towards automatic specialization of Java programs. In Proceedings of the European Conference on Object-Oriented Programming, pages 367--390. Springer-Verlag, 1999. 10.1007/3-540-48743-3_17.
[56]
U. P. Schultz, J. L. Lawall, and C. Consel. Automatic program specialization for Java. In ACM Transactions on Programming Languages and Systems, pages 452--499. ACM Press, 2003. 10.1145/778559.778561.
[57]
A. Schwaighofer. Tail call optimization in the Java HotSpot VM. Master's thesis, Johannes Kepler University Linz, 2009.
[58]
A. Shali and W. R. Cook. Hybrid partial evaluation. In Proceedings of the ACM SIGPLAN Conference on Object-Oriented Programming Systems, Languages, and Applications, pages 375--390. ACM Press, 2011. 10.1145/2048066.2048098.
[59]
Y. Shi, K. Casey, M. A. Ertl, and D. Gregg. Virtual machine showdown: Stack versus registers. ACM Transactions on Architecture and Code Optimization, 4 (4), 2008. 10.1145/1328195.1328197.
[60]
J. M. Sipelstein and G. E. Blelloch. Collection-oriented languages. Proceedings of the IEEE, 79 (4): 504--523, 1991.
[61]
Smalltalk/X, 2013. URL http://live.exept.de/doc/online/english/programming/java.html.
[62]
L. Stadler, C. Wimmer, T. Würthinger, H. Mössenböck, and J. Rose. Lazy continuations for Java virtual machines. In Proceedings of the International Conference on the Principles and Practice of Programming in Java, pages 143--152. ACM Press, 2009. 10.1145/1596655.1596679.
[63]
L. Stadler, T. Würthinger, and C. Wimmer. Efficient coroutines for the Java platform. In Proceedings of the International Conference on the Principles and Practice of Programming in Java, pages 20--28. ACM Press, 2010. 10.1145/1852761.1852765.
[64]
S. Thibault, C. Consel, J. L. Lawall, R. Marlet, and G. Muller. Static and dynamic program compilation by interpreter specialization. Journal on Higher-Order and Symbolic Computation, 13 (3): 161--178, 2000. 10.1023/A:1010078412711.
[65]
D. Ungar and R. B. Smith. Self: The power of simplicity. In Proceedings of the ACM SIGPLAN Conference on Object-Oriented Programming Systems, Languages, and Applications, pages 227--242. ACM Press, 1987. 10.1145/38765.38828.
[66]
Unladen Swallow. unladen-swallow, 2009. URL http://code.google.com/p/unladen-swallow/.
[67]
R. C. Waters. Automatic transformation of series expressions into loops. ACM Transactions on Programming Languages and Systems, 13 (1): 52--98, 1992. 10.1145/114005.102806.
[68]
C. Wimmer and Hanspeter Mössenböck. Automatic feedback-directed object fusing. ACM Transactions on Architecture and Code Optimization, 7 (2), 2010. 10.1145/1839667.1839669.
[69]
C. Wimmer, M. Haupt, M. L. Van De Vanter, M. Jordan, L. Daynès, and D. Simon. Maxine: An approachable virtual machine for, and in, Java. ACM Transactions on Architecture and Code Optimization, 9 (4): 30:1--30:24, 2013. 10.1145/2400682.2400689.
[70]
M. Wolczko, O. Agesen, and D. Ungar. Towards a universal implementation substrate for object-oriented languages. In Proceedings of the Workshop on Simplicity, Performance and Portability in Virtual Machine Design, 1999.
[71]
T. Würthinger, C. Wimmer, and H. Mössenböck. Array bounds check elimination in the context of deoptimization. Science of Computer Programming, 74 (5-6), 2009. 10.1016/j.scico.2009.01.002.
[72]
T. Würthinger, A. Wöß, L. Stadler, G. Duboscq, D. Simon, and C. Wimmer. Self-optimizing AST interpreters. In Proceedings of the Dynamic Languages Symposium, pages 73--82. ACM Press, 2012. 10.1145/2384577.2384587.

Cited By

View all
  • (2025)Debugging WebAssembly? Put Some Whamm on It!Proceedings of the ACM on Programming Languages10.1145/37631249:OOPSLA2(2058-2086)Online publication date: 9-Oct-2025
  • (2025)Tracing Just-in-Time Compilation for Effects and HandlersProceedings of the ACM on Programming Languages10.1145/37630859:OOPSLA2(978-1006)Online publication date: 9-Oct-2025
  • (2025)Fast and Compact: Reducing Size of AOT-Compiled Java Code without Sacrificing PerformanceProceedings of the 22nd ACM SIGPLAN International Conference on Managed Programming Languages and Runtimes10.1145/3759426.3760976(12-22)Online publication date: 9-Oct-2025
  • Show More Cited By

Recommendations

Comments