Abstract
Dynamic programming languages face semantic and performance challenges in the presence of features, such as eval, that can inject new code into a running program. The Julia programming language introduces the novel concept of world age to insulate optimized code from one of the most disruptive side-effects of eval: changes to the definition of an existing function. This paper provides the first formal semantics of world age in a core calculus named juliette, and shows how world age enables compiler optimizations, such as inlining, in the presence of eval. While Julia also provides programmers with the means to bypass world age, we found that this mechanism is not used extensively: a static analysis of over 4,000 registered Julia packages shows that only 4-9% of packages bypass world age. This suggests that Julia's semantics aligns with programmer expectations.
Supplemental Material
- Julia Belyakova, Benjamin Chung, Jack Gelinas, Jameson Nash, Ross Tate, and Jan Vitek. 2020. World Age in Julia: Optimizing Method Dispatch in the Presence of Eval (Extended Version). arXiv:2010.07516Google Scholar
- Jef Bezanson, Jiahao Chen, Ben Chung, Stefan Karpinski, Viral B. Shah, Jan Vitek, and Lionel Zoubritzky. 2018. Julia: Dynamism and Performance Reconciled by Design. Proc. ACM Program. Lang. 2, OOPSLA ( 2018 ). https://doi.org/10. 1145/3276490 Google Scholar
Digital Library
- Jef Bezanson, Alan Edelman, Stefan Karpinski, and Viral B. Shah. 2017. Julia: A Fresh Approach to Numerical Computing. SIAM Rev. 59, 1 ( 2017 ). https://doi.org/10.1137/141000671 Google Scholar
Digital Library
- Daniel G. Bobrow, Kenneth Kahn, Gregor Kiczales, Larry Masinter, Mark Stefik, and Frank Zdybel. 1986. CommonLoops: Merging Lisp and Object-oriented Programming. In Conference on Object-Oriented Programming Systems, Languages and Applications (OOPSLA). https://doi.org/10.1145/28697.28700 Google Scholar
Digital Library
- Robert P. Cook and Insup Lee. 1983. DYMOS: A Dynamic Modification System. In Proceedings of the Symposium on High-Level Debugging. https://doi.org/10.1145/1006147.1006188 Google Scholar
Digital Library
- David Detlefs and Ole Agesen. 1999. Inlining of Virtual Methods. In European Conference on Object-Oriented Programming (ECOOP). https://doi.org/10.5555/646156.679839 Google Scholar
Digital Library
- Matthias Felleisen, Robert Bruce Findler, and Matthew Flatt. 2009. Semantics Engineering with PLT Redex. MIT Press. http://mitpress.mit.edu/catalog/item/default.asp? ttype=2&tid=11885Google Scholar
Digital Library
- Olivier Flückiger, Gabriel Scherer, Ming-Ho Yee, Aviral Goel, Amal Ahmed, and Jan Vitek. 2018. Correctness of speculative optimizations with dynamic deoptimization. Proc. ACM Program. Lang. 2, POPL ( 2018 ). https://doi.org/10.1145/3158137 Google Scholar
Digital Library
- Neal Glew. 2005. Method Inlining, Dynamic Class Loading, and Type Soundness. Journal of Object Technology 4, 8 ( 2005 ). https://doi.org/10.5381/jot. 2005. 4.8.a2 Google Scholar
Cross Ref
- Urs Hölzle, Craig Chambers, and David Ungar. 1992. Debugging Optimized Code with Dynamic Deoptimization, In Conference on Programming Language Design and Implementation (PLDI). https://doi.org/10.1145/143103.143114 Google Scholar
Digital Library
- Sheng Liang and Gilad Bracha. 1998. Dynamic class loading in the Java virtual machine. In Conference on Object-Oriented Programming, Systems, Languages, and Applications (OOPSLA). https://doi.org/10.1145/286936.286945 Google Scholar
Digital Library
- Jacob Matthews and Robert Bruce Findler. 2008. An operational semantics for Scheme. Journal of Functional Programming 18 ( 2008 ). Issue 1. https://doi.org/10.1017/S0956796807006478 Google Scholar
Digital Library
- John McCarthy. 1978. History of LISP. In History of programming languages (HOPL). https://doi.org/10.1145/960118.808387 Google Scholar
Digital Library
- Phung Hua Nguyen and Jingling Xue. 2005. Interprocedural side-efect analysis and optimisation in the presence of dynamic class loading. In Australasian Conference on Computer Science (ACSC). https://doi.org/10.5555/1082161.1082163 Google Scholar
Digital Library
- Joe Gibbs Politz, Matthew J. Carroll, Benjamin S. Lerner, Justin Pombrio, and Shriram Krishnamurthi. 2012. A Tested Semantics for Getters, Setters, and Eval in JavaScript. In Symposium on Dynamic Languages (DLS). https://doi.org/10. 1145/2384577.2384579 Google Scholar
Digital Library
- Gareth Stoyle, Michael Hicks, Gavin Bierman, Peter Sewell, and Iulian Neamtiu. 2007. Mutatis Mutandis: Safe and Predictable Dynamic Software Updating. ACM Trans. Program. Lang. Syst. 29, 4 ( 2007 ). https://doi.org/10.1145/1255450.1255455 Google Scholar
Digital Library
- Julia Language Manual v1. 2020. Redefining Methods. https://docs.julialang.org/en/v1/manual/methods/#RedefiningMethods-1Google Scholar
- Francesco Zappa Nardelli, Julia Belyakova, Artem Pelenitsyn, Benjamin Chung, Jef Bezanson, and Jan Vitek. 2018. Julia Subtyping: A Rational Reconstruction. Proc. ACM Program. Lang. 2, OOPSLA ( 2018 ). https://doi.org/10.1145/3276483 Google Scholar
Digital Library
Index Terms
World age in Julia: optimizing method dispatch in the presence of eval
Recommendations
Type stability in Julia: avoiding performance pathologies in JIT compilation
As a scientific programming language, Julia strives for performance but also provides high-level productivity features. To avoid performance pathologies, Julia users are expected to adhere to a coding discipline that enables so-called type stability. ...
What we eval in the shadows: a large-scale study of eval in R programs
Most dynamic languages allow users to turn text into code using various functions, often named <tt>eval</tt>, with language-dependent semantics. The widespread use of these reflective functions hinders static analysis and prevents compilers from ...
A domain-specific language for building self-optimizing AST interpreters
GPCE '14Self-optimizing AST interpreters dynamically adapt to the provided input for faster execution. This adaptation includes initial tests of the input, changes to AST nodes, and insertion of guards that ensure assumptions still hold. Such specialization ...






Comments