Abstract
Most high-performance dynamic language virtual machines duplicate language semantics in the interpreter, compiler, and runtime system. This violates the principle to not repeat yourself. In contrast, we define languages solely by writing an interpreter. The interpreter performs specializations, e.g., augments the interpreted program with type information and profiling information. Compiled code is derived automatically using partial evaluation while incorporating these specializations. This makes partial evaluation practical in the context of dynamic languages: It reduces the size of the compiled code while still compiling all parts of an operation that are relevant for a particular program. When a speculation fails, execution transfers back to the interpreter, the program re-specializes in the interpreter, and later partial evaluation again transforms the new state of the interpreter to compiled code. We evaluate our approach by comparing our implementations of JavaScript, Ruby, and R with best-in-class specialized production implementations. Our general-purpose compilation system is competitive with production systems even when they have been heavily optimized for the one language they support. For our set of benchmarks, our speedup relative to the V8 JavaScript VM is 0.83x, relative to JRuby is 3.8x, and relative to GNU R is 5x.
- 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. Google Scholar
Digital Library
- O. Agesen and D. Detlefs. Mixed-mode bytecode execution. Technical report, Sun Microsystems, Inc., 2000. Google Scholar
Digital Library
- 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 opensource research community. IBM Systems Journal, 44(2):399– 417, 2005. Google Scholar
Digital Library
- M. Arnold, S. J. Fink, D. Grove, M. Hind, and P. F. Sweeney. Adaptive optimization in the Jalape˜no JVM. In Proceedings of the ACM SIGPLAN Conference on Object-Oriented Programming Systems, Languages, and Applications, pages 47– 65. ACM Press, 2000. Google Scholar
Digital Library
- G. Benson. Zero and Shark: a zero-assembly port of Open-JDK, 2009.Google Scholar
- 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.Google Scholar
- C. F. Bolz and L. Tratt. The impact of meta-tracing on VM design and implementation. Science of Computer Programming, 98(3):408–421, 2015. Google Scholar
Digital Library
- 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. Google Scholar
Digital Library
- C. F. Bolz, M. Leuschel, and A. Rigo. Towards just-in-time partial evaluation of Prolog. In Proceedings of the International Conference on Logic-Based Program Synthesis and Transformation, pages 158–172. Springer-Verlag, 2010. Google Scholar
Digital Library
- 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. Google Scholar
Digital Library
- M. Chevalier-Boisvert, L. Hendren, and C. Verbrugge. Optimizing MATLAB through just-in-time specialization. In Proceedings of the International Conference on Compiler Construction, pages 46–65. Springer-Verlag, 2010. Google Scholar
Digital Library
- B. Daloze, S. Marr, D. Bonetta, and H. Mössenböck. Efficient and thread-safe objects for dynamically-typed languages. In Proceedings of the ACM SIGPLAN Conference on Object-Oriented Programming Systems, Languages, and Applications, pages 642–659. ACM Press, 2016. Google Scholar
Digital Library
- G. Duboscq, L. Stadler, T. Würthinger, D. Simon, C. Wimmer, and H. Mössenböck. Graal IR: An extensible declarative intermediate representation. In Proceedings of the Asia-Pacific Programming Languages and Compilers Workshop, 2013.Google Scholar
- G. Duboscq, T. Würthinger, L. Stadler, C. Wimmer, D. Simon, and H. Mössenböck. An intermediate representation for speculative optimizations in a dynamic compiler. In Proceedings of the ACM Workshop on Virtual Machines and Intermediate Languages, 2013. Google Scholar
Digital Library
- Y. Futamura. Partial evaluation of computation process–an approach to a compiler-compiler. Systems, Computers, Controls, 2(5):721–728, 1971.Google Scholar
- 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. Google Scholar
Digital Library
- GitHub. Graal multi-language VM, 2016.Google Scholar
- I. Gouy. The computer language benchmarks game, 2016.Google Scholar
- M. Grimmer, M. Rigger, R. Schatz, L. Stadler, and H. Mössenböck. TruffleC: Dynamic execution of C on a Java virtual machine. In Proceedings of the International Conference on the Principles and Practice of Programming in Java, pages 17–26. ACM Press, 2014. Google Scholar
Digital Library
- M. Grimmer, R. Schatz, C. Seaton, T. Würthinger, and H. Mössenböck. Memory-safe execution of C on a Java VM. In Proceedings of the ACM Workshop on Programming Languages and Analysis for Security, pages 16–27. ACM Press, 2015. Google Scholar
Digital Library
- M. Grimmer, C. Seaton, R. Schatz, T. Würthinger, and H. Mössenböck. High-performance cross-language interoperability in a multi-language runtime. In Proceedings of the Dynamic Languages Symposium, pages 78–90. ACM Press, 2015. Google Scholar
Digital Library
- M. Grimmer, C. Seaton, T. Würthinger, and H. Mössenböck. Dynamically composing languages in a modular way: Supporting C extensions for dynamic languages. In Proceedings of the International Conference on Modularity, pages 1–13. ACM Press, 2015. Google Scholar
Digital Library
- U. Hölzle and D. Ungar. A third-generation SELF implementation: Reconciling responsiveness with performance. In Proceedings of the ACM SIGPLAN Conference on Object-Oriented Programming Systems, Languages, and Applications, pages 229–243. ACM Press, 1994. Google Scholar
Digital Library
- 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. Google Scholar
Digital Library
- 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. Google Scholar
Digital Library
- C. Humer, C. Wimmer, C. Wirth, A. Wöß, and T. Würthinger. A domain-specific language for building self-optimizing AST interpreters. In Proceedings of the International Conference on Generative Programming and Component Engineering, pages 123–132. ACM Press, 2014. Google Scholar
Digital Library
- 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. Google Scholar
Digital Library
- 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. Google Scholar
Digital Library
- 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. Google Scholar
Digital Library
- MacRuby. MacRuby, 2013.Google Scholar
- S. Marr, B. Daloze, and H. Mössenböck. Cross-language compiler benchmarking: Are we fast yet? In Proceedings of the Dynamic Languages Symposium, pages 120–131. ACM Press, 2016. Google Scholar
Digital Library
- H. Masuhara and A. Yonezawa. A portable-approach to dynamic optimization in run-time specialization. New Generation Computing, 20(1):101–124, 2002. Google Scholar
Digital Library
- 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. Google Scholar
Digital Library
- C. Nutter. So you want to optimize Ruby, 2012.Google Scholar
- Optcarrot. Optcarrot: A NES emulator for Ruby benchmark, 2016.Google Scholar
- Oracle. Oracle Labs GraalVM downloads, 2016.Google Scholar
- M. Paleczny, C. Vick, and C. Click. The Java HotSpot TM server compiler. In Proceedings of the Java Virtual Machine Research and Technology Symposium, pages 1–12. USENIX, 2001. Google Scholar
Digital Library
- M. Rigger, M. Grimmer, C. Wimmer, T. Würthinger, and H. Mössenböck. Bringing low-level languages to the JVM: Efficient execution of LLVM IR on Truffle. In Proceedings of the ACM Workshop on Virtual Machines and Intermediate Languages, pages 6–15. ACM Press, 2016. Google Scholar
Digital Library
- 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. Google Scholar
Digital Library
- T. Rompf, A. K. Sujeeth, K. J. Brown, H. Lee, H. Chafi, and K. Olukotun. Surgical precision JIT compilers. In Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation, pages 41–52. ACM Press, 2014. Google Scholar
Digital Library
- Rubinius. Rubinius: Use Ruby, 2013.Google Scholar
- G. Savrun-Yenic¸eri, M. L. Van de Vanter, P. Larsen, S. Brunthaler, and M. Franz. An efficient and generic event-based profiler framework for dynamic languages. In Proceedings of the International Conference on the Principles and Practice of Programming in Java, pages 102–112. ACM Press, 2015. Google Scholar
Digital Library
- 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. Google Scholar
Digital Library
- 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. Google Scholar
Digital Library
- C. Seaton. AST specialisation and partial evaluation for easy high-performance metaprogramming. In Workshop on Meta-Programming Techniques and Reflection, 2016.Google Scholar
- C. Seaton, M. L. Van De Vanter, and M. Haupt. Debugging at full speed. In Proceedings of the Workshop on Dynamic Languages and Applications, pages 2:1–2:13. ACM Press, 2014. Google Scholar
Digital Library
- 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. Google Scholar
Digital Library
- 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. Google Scholar
Digital Library
- D. Simon, C. Wimmer, B. Urban, G. Duboscq, L. Stadler, and T. Würthinger. Snippets: Taking the high road to a low level. ACM Transactions on Architecture and Code Optimization, 12 (2):20:1–20:25, 2015. Google Scholar
Digital Library
- 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. Google Scholar
Digital Library
- 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. Google Scholar
Digital Library
- L. Stadler, T. Würthinger, and H. Mössenböck. Partial escape analysis and scalar replacement for java. In Proceedings of the International Symposium on Code Generation and Optimization, pages 165–174. ACM Press, 2014. Google Scholar
Digital Library
- L. Stadler, A. Welc, C. Humer, and M. Jordan. Optimizing R language execution via aggressive speculation. In Proceedings of the Dynamic Languages Symposium, pages 84–95. ACM Press, 2016. Google Scholar
Digital Library
- TC39. Official ecmascript conformance test suite, 2016.Google Scholar
- Unladen Swallow. unladen-swallow, 2009.Google Scholar
- S. Urbanek. R benchmarks 2.5, 2008.Google Scholar
- M. L. Van De Vanter. Building debuggers and other tools: We can ”have it all”. In Proceedings of the Workshop on the Implementation, Compilation, Optimization of Object-Oriented Languages and Programming Systems, pages 2:1–2:3. ACM Press, 2015. Google Scholar
Digital Library
- 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. Google Scholar
Digital Library
- C. Wimmer, V. Jovanovic, E. Eckstein, and T. Würthinger. One compiler: Deoptimization to optimized code. In Proceedings of the International Conference on Compiler Construction, pages 55–64. ACM Press, 2017. Google Scholar
Digital Library
- A. Wöß, C. Wirth, D. Bonetta, C. Seaton, C. Humer, and H. Mössenböck. An object storage model for the truffle language implementation framework. In Proceedings of the International Conference on the Principles and Practice of Programming in Java, pages 133–144. ACM Press, 2014. Google Scholar
Digital Library
- T. Würthinger, C. Wimmer, A. Wöß, L. Stadler, G. Duboscq, C. Humer, G. Richards, D. Simon, and M. Wolczko. One VM to rule them all. In Proceedings of Onward! ACM Press, 2013. Google Scholar
Digital Library
- W. Zhang, P. Larsen, S. Brunthaler, and M. Franz. Accelerating iterators in optimizing AST interpreters. In Proceedings of the ACM SIGPLAN Conference on Object-Oriented Programming Systems, Languages, and Applications, pages 727–743. ACM Press, 2014. Google Scholar
Digital Library
Index Terms
Practical partial evaluation for high-performance dynamic language runtimes
Recommendations
High-performance cross-language interoperability in a multi-language runtime
DLS 2015: Proceedings of the 11th Symposium on Dynamic LanguagesProgrammers combine different programming languages because it allows them to use the most suitable language for a given problem, to gradually migrate existing projects from one language to another, or to reuse existing source code. However, existing ...
Practical partial evaluation for high-performance dynamic language runtimes
PLDI 2017: Proceedings of the 38th ACM SIGPLAN Conference on Programming Language Design and ImplementationMost high-performance dynamic language virtual machines duplicate language semantics in the interpreter, compiler, and runtime system. This violates the principle to not repeat yourself. In contrast, we define languages solely by writing an ...
High-performance language interoperability in multi-language runtimes
SPLASH '14: Proceedings of the companion publication of the 2014 ACM SIGPLAN conference on Systems, Programming, and Applications: Software for HumanityPrograms often consist of parts that are written in different languages because sub-problems lend themselves to being implemented in a particular language. However, multi-language programs often suffer from poor performance, complex cross-language ...






Comments