skip to main content
research-article
Open Access

World age in Julia: optimizing method dispatch in the presence of eval

Published:13 November 2020Publication History
Skip Abstract Section

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.

Skip Supplemental Material Section

Supplemental Material

Auxiliary Presentation Video

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.

References

  1. 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 ScholarGoogle Scholar
  2. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  3. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  4. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  5. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  6. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  7. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  8. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  9. 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 ScholarGoogle ScholarCross RefCross Ref
  10. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  11. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  12. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  13. John McCarthy. 1978. History of LISP. In History of programming languages (HOPL). https://doi.org/10.1145/960118.808387 Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  15. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  16. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  17. Julia Language Manual v1. 2020. Redefining Methods. https://docs.julialang.org/en/v1/manual/methods/#RedefiningMethods-1Google ScholarGoogle Scholar
  18. 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 ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. World age in Julia: optimizing method dispatch in the presence of eval

        Recommendations

        Comments

        Login options

        Check if you have access through your login credentials or your institution to get full access on this article.

        Sign in

        Full Access

        • Published in

          cover image Proceedings of the ACM on Programming Languages
          Proceedings of the ACM on Programming Languages  Volume 4, Issue OOPSLA
          November 2020
          3108 pages
          EISSN:2475-1421
          DOI:10.1145/3436718
          Issue’s Table of Contents

          Copyright © 2020 Owner/Author

          Publisher

          Association for Computing Machinery

          New York, NY, United States

          Publication History

          • Published: 13 November 2020
          Published in pacmpl Volume 4, Issue OOPSLA

          Permissions

          Request permissions about this article.

          Request Permissions

          Check for updates

          Qualifiers

          • research-article

        PDF Format

        View or Download as a PDF file.

        PDF

        eReader

        View online with eReader.

        eReader
        About Cookies On This Site

        We use cookies to ensure that we give you the best experience on our website.

        Learn more

        Got it!