YJIT: a basic block versioning JIT compiler for CRuby | Proceedings of the 13th ACM SIGPLAN International Workshop on Virtual Machines and Intermediate Languages (2024)

YJIT: a basic block versioning JIT compiler for CRuby | Proceedings of the 13th ACM SIGPLAN International Workshop on Virtual Machines and Intermediate Languages (2)

Advanced Search

splash

research-article

Open Access

  • Authors:
  • Maxime Chevalier-Boisvert Shopify, Canada

    Shopify, Canada

    View Profile

    ,
  • Noah Gibbs Shopify, UK

    Shopify, UK

    View Profile

    ,
  • Jean Boussier Shopify, France

    Shopify, France

    View Profile

    ,
  • Si Xing (Alan) Wu Shopify, Canada

    Shopify, Canada

    View Profile

    ,
  • Aaron Patterson Shopify, USA

    Shopify, USA

    View Profile

    ,
  • Kevin Newton Shopify, USA

    Shopify, USA

    View Profile

    ,
  • John Hawthorn GitHub, Canada

    GitHub, Canada

    View Profile

VMIL 2021: Proceedings of the 13th ACM SIGPLAN International Workshop on Virtual Machines and Intermediate LanguagesOctober 2021Pages 25–32https://doi.org/10.1145/3486606.3486781

Published:19 October 2021Publication HistoryYJIT: a basic block versioning JIT compiler for CRuby | Proceedings of the 13th ACM SIGPLAN International Workshop on Virtual Machines and Intermediate Languages (3)

  • 4citation
  • 2,923
  • Downloads

Metrics

Total Citations4Total Downloads2,923

Last 12 Months952

Last 6 weeks72

  • eReader
  • PDF

VMIL 2021: Proceedings of the 13th ACM SIGPLAN International Workshop on Virtual Machines and Intermediate Languages

YJIT: a basic block versioning JIT compiler for CRuby

Pages 25–32

PreviousChapterNextChapter

YJIT: a basic block versioning JIT compiler for CRuby | Proceedings of the 13th ACM SIGPLAN International Workshop on Virtual Machines and Intermediate Languages (4)

ABSTRACT

Ruby is a dynamically typed programming language with a large breadth of features which has grown in popularity with the rise of the modern web, and remains at the core of the implementation of many widely-used websites.

CRuby, the default implementation of the language, features a JIT compiler known as MJIT, but developers often do not enable it in production environments, because it does not always yield performance improvements on real-world software. Attempts to independently reimplement the Ruby language, such as JRuby and TruffleRuby have shown impressive performance results on benchmarks, but often lag behind CRuby when it comes to supporting new additions to the language, which limits their adoption.

We introduce YJIT, a new JIT compiler built inside CRuby based on a Lazy Basic Block Versioning (LBBV) architecture. We show that while our compiler does not match the peak performance of TruffleRuby, it offers near-100% compatibility with existing Ruby code, impressively fast warmup, and speedups from 15% to 19% on sizeable benchmarks based on real-world software.

Skip Supplemental Material Section

Supplemental Material

splashws21vmilmain-p1-p-video.mp4

mp4

33.7 MB

Download

References

  1. Davide Ancona, Massimo Ancona, Antonio Cuni, and Nicholas D. Matsakis. 2007. RPython: A Step towards Reconciling Dynamically and Statically Typed OO Languages. In Proceedings of the 2007 Symposium on Dynamic Languages (DLS ’07). Association for Computing Machinery, New York, NY, USA. 53–64. isbn:9781595938688 https://doi.org/10.1145/1297081.1297091 Google ScholarYJIT: a basic block versioning JIT compiler for CRuby | Proceedings of the 13th ACM SIGPLAN International Workshop on Virtual Machines and Intermediate Languages (5)Digital Library
  2. Carl Friedrich Bolz, Antonio Cuni, Maciej Fijał kowski, Michael Leuschel, Samuele Pedroni, and Armin Rigo. 2011. Runtime Feedback in a Meta-Tracing JIT for Efficient Dynamic Languages. In Proceedings of the 6th Workshop on Implementation, Compilation, Optimization of Object-Oriented Languages, Programs and Systems (ICOOOLPS ’11). Association for Computing Machinery, New York, NY, USA. Article 9, 8 pages. isbn:9781450308946 https://doi.org/10.1145/2069172.2069181 Google ScholarYJIT: a basic block versioning JIT compiler for CRuby | Proceedings of the 13th ACM SIGPLAN International Workshop on Virtual Machines and Intermediate Languages (7)Digital Library
  3. Carl Friedrich Bolz, Antonio Cuni, Maciej Fijalkowski, and Armin Rigo. 2009. Tracing the Meta-Level: PyPy’s Tracing JIT Compiler. In Proceedings of the 4th Workshop on the Implementation, Compilation, Optimization of Object-Oriented Languages and Programming Systems (ICOOOLPS ’09). Association for Computing Machinery, New York, NY, USA. 18–25. isbn:9781605585413 https://doi.org/10.1145/1565824.1565827 Google ScholarYJIT: a basic block versioning JIT compiler for CRuby | Proceedings of the 13th ACM SIGPLAN International Workshop on Virtual Machines and Intermediate Languages (9)Digital Library
  4. Stefan Brunthaler. 2010. Efficient Interpretation Using Quickening. SIGPLAN Not., 45, 12 (2010), Oct., 1–14. issn:0362-1340 https://doi.org/10.1145/1899661.1869633 Google ScholarYJIT: a basic block versioning JIT compiler for CRuby | Proceedings of the 13th ACM SIGPLAN International Workshop on Virtual Machines and Intermediate Languages (11)Digital Library
  5. C. Chambers, D. Ungar, and E. Lee. 1989. An Efficient Implementation of SELF a Dynamically-Typed Object-Oriented Language Based on Prototypes. In Conference Proceedings on Object-Oriented Programming Systems, Languages and Applications (OOPSLA ’89). Association for Computing Machinery, New York, NY, USA. 49–70. isbn:0897913337 https://doi.org/10.1145/74877.74884 Google ScholarYJIT: a basic block versioning JIT compiler for CRuby | Proceedings of the 13th ACM SIGPLAN International Workshop on Virtual Machines and Intermediate Languages (13)Digital Library
  6. Maxime Chevalier-Boisvert and Marc Feeley. 2015. Simple and Effective Type Check Removal through Lazy Basic Block Versioning. In 29th European Conference on Object-Oriented Programming, ECOOP 2015, July 5-10, 2015, Prague, Czech Republic, John Tang Boyland (Ed.) (LIPIcs, Vol. 37). Schloss Dagstuhl - Leibniz-Zentrum für Informatik, 101–123. https://doi.org/10.4230/LIPIcs.ECOOP.2015.101 Google ScholarYJIT: a basic block versioning JIT compiler for CRuby | Proceedings of the 13th ACM SIGPLAN International Workshop on Virtual Machines and Intermediate Languages (15)Cross Ref
  7. Maxime Chevalier-Boisvert and Marc Feeley. 2016. Interprocedural Type Specialization of JavaScript Programs Without Type Analysis. In 30th European Conference on Object-Oriented Programming, ECOOP 2016, July 18-22, 2016, Rome, Italy, Shriram Krishnamurthi and Benjamin S. Lerner (Eds.) (LIPIcs, Vol. 56). Schloss Dagstuhl - Leibniz-Zentrum für Informatik, 7:1–7:24. https://doi.org/10.4230/LIPIcs.ECOOP.2016.7 Google ScholarYJIT: a basic block versioning JIT compiler for CRuby | Proceedings of the 13th ACM SIGPLAN International Workshop on Virtual Machines and Intermediate Languages (17)Cross Ref
  8. Igor Costa, Péricles Alves, Henrique Nazaré Santos, and Fernando Magno Quintão Pereira. 2013. Just-in-time value specialization. In Proceedings of the 2013 IEEE/ACM International Symposium on Code Generation and Optimization (CGO). 1–11. https://doi.org/10.1109/CGO.2013.6495006 Google ScholarYJIT: a basic block versioning JIT compiler for CRuby | Proceedings of the 13th ACM SIGPLAN International Workshop on Virtual Machines and Intermediate Languages (19)Digital Library
  9. Benoit Daloze, Stefan Marr, Daniele Bonetta, and Hanspeter Mössenböck. 2016. Efficient and Thread-Safe Objects for Dynamically-Typed Languages. In Proceedings of the 2016 ACM SIGPLAN International Conference on Object-Oriented Programming, Systems, Languages, and Applications (OOPSLA 2016). Association for Computing Machinery, New York, NY, USA. 642–659. isbn:9781450344449 https://doi.org/10.1145/2983990.2984001 Google ScholarYJIT: a basic block versioning JIT compiler for CRuby | Proceedings of the 13th ACM SIGPLAN International Workshop on Virtual Machines and Intermediate Languages (21)Digital Library
  10. L. Peter Deutsch and Allan M. Schiffman. 1984. Efficient Implementation of the Smalltalk-80 System. In Proceedings of the 11th ACM SIGACT-SIGPLAN Symposium on Principles of Programming Languages (POPL ’84). Association for Computing Machinery, New York, NY, USA. 297–302. isbn:0897911253 https://doi.org/10.1145/800017.800542 Google ScholarYJIT: a basic block versioning JIT compiler for CRuby | Proceedings of the 13th ACM SIGPLAN International Workshop on Virtual Machines and Intermediate Languages (23)Digital Library
  11. Kevin Menard, Chris Seaton, and Benoit Daloze. 2018. Specializing Ropes for Ruby. In Proceedings of the 15th International Conference on Managed Languages & Runtimes (ManLang ’18). Association for Computing Machinery, New York, NY, USA. Article 10, 7 pages. isbn:9781450364249 https://doi.org/10.1145/3237009.3237026 Google ScholarYJIT: a basic block versioning JIT compiler for CRuby | Proceedings of the 13th ACM SIGPLAN International Workshop on Virtual Machines and Intermediate Languages (25)Digital Library
  12. Gregor Richards, Ellen Arteca, and Alexi Turcotte. 2017. The VM already knew that: leveraging compile-time knowledge to optimize gradual typing. Proc. ACM Program. Lang., 1, OOPSLA (2017), 55:1–55:27. https://doi.org/10.1145/3133879 Google ScholarYJIT: a basic block versioning JIT compiler for CRuby | Proceedings of the 13th ACM SIGPLAN International Workshop on Virtual Machines and Intermediate Languages (27)Digital Library
  13. Armin Rigo. 2004. Representation-Based Just-in-Time Specialization and the Psyco Prototype for Python. In Proceedings of the 2004 ACM SIGPLAN Symposium on Partial Evaluation and Semantics-Based Program Manipulation (PEPM ’04). Association for Computing Machinery, New York, NY, USA. 15–26. isbn:1581138350 https://doi.org/10.1145/1014007.1014010 Google ScholarYJIT: a basic block versioning JIT compiler for CRuby | Proceedings of the 13th ACM SIGPLAN International Workshop on Virtual Machines and Intermediate Languages (29)Digital Library
  14. Baptiste Saleil and Marc Feeley. 2017. Interprocedural Specialization of Higher-Order Dynamic Languages Without Static Analysis. In 31st European Conference on Object-Oriented Programming, ECOOP 2017, June 19-23, 2017, Barcelona, Spain, Peter Müller (Ed.) (LIPIcs, Vol. 74). Schloss Dagstuhl - Leibniz-Zentrum für Informatik, 23:1–23:23. https://doi.org/10.4230/LIPIcs.ECOOP.2017.23 Google ScholarYJIT: a basic block versioning JIT compiler for CRuby | Proceedings of the 13th ACM SIGPLAN International Workshop on Virtual Machines and Intermediate Languages (31)Cross Ref
  15. Baptiste Saleil and Marc Feeley. 2018. Building JIT compilers for dynamic languages with low development effort. In Proceedings of the 10th ACM SIGPLAN International Workshop on Virtual Machines and Intermediate Languages, VMIL@SPLASH 2018, Boston, MA, USA, November 4, 2018, Stephen Kell and Stefan Marr (Eds.). ACM, 36–46. https://doi.org/10.1145/3281287.3281294 Google ScholarYJIT: a basic block versioning JIT compiler for CRuby | Proceedings of the 13th ACM SIGPLAN International Workshop on Virtual Machines and Intermediate Languages (33)Digital Library
  16. Aibek Sarimbekov, Andrej Podzimek, Lubomir Bulej, Yudi Zheng, Nathan Ricci, and Walter Binder. 2013. Characteristics of Dynamic JVM Languages. In Proceedings of the 7th ACM Workshop on Virtual Machines and Intermediate Languages (VMIL ’13). Association for Computing Machinery, New York, NY, USA. 11–20. isbn:9781450326018 https://doi.org/10.1145/2542142.2542144 Google ScholarYJIT: a basic block versioning JIT compiler for CRuby | Proceedings of the 13th ACM SIGPLAN International Workshop on Virtual Machines and Intermediate Languages (35)Digital Library
  17. Koichi Sasada. 2005. YARV: Yet Another RubyVM: Innovating the Ruby Interpreter. In Companion to the 20th Annual ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages, and Applications (OOPSLA ’05). Association for Computing Machinery, New York, NY, USA. 158–159. isbn:1595931937 https://doi.org/10.1145/1094855.1094912 Google ScholarYJIT: a basic block versioning JIT compiler for CRuby | Proceedings of the 13th ACM SIGPLAN International Workshop on Virtual Machines and Intermediate Languages (37)Digital Library
  18. Chris Seaton. 2015. Specialising Dynamic Techniques for Implementing the Ruby Programming Language. Ph.D. Dissertation. University of Manchester.Google ScholarYJIT: a basic block versioning JIT compiler for CRuby | Proceedings of the 13th ACM SIGPLAN International Workshop on Virtual Machines and Intermediate Languages (39)
  19. Pat. Shaughnessy. 2013 - 2014. Ruby under a microscope : An illustrated guide to ruby internals (1st edition ed.). No Starch Press, San Francisco. isbn:1-59327-561-7 Google ScholarYJIT: a basic block versioning JIT compiler for CRuby | Proceedings of the 13th ACM SIGPLAN International Workshop on Virtual Machines and Intermediate Languages (40)Digital Library
  20. Andreas Wöß, Christian Wirth, Daniele Bonetta, Chris Seaton, Christian Humer, and Hanspeter Mössenböck. 2014. An Object Storage Model for the Truffle Language Implementation Framework. In Proceedings of the 2014 International Conference on Principles and Practices of Programming on the Java Platform: Virtual Machines, Languages, and Tools (PPPJ ’14). Association for Computing Machinery, New York, NY, USA. 133–144. isbn:9781450329262 https://doi.org/10.1145/2647508.2647517 Google ScholarYJIT: a basic block versioning JIT compiler for CRuby | Proceedings of the 13th ACM SIGPLAN International Workshop on Virtual Machines and Intermediate Languages (42)Digital Library
  21. Thomas Würthinger, Christian Wimmer, Andreas Wöß, Lukas Stadler, Gilles Duboscq, Christian Humer, Gregor Richards, Doug Simon, and Mario Wolczko. 2013. One VM to Rule Them All. In Proceedings of the 2013 ACM International Symposium on New Ideas, New Paradigms, and Reflections on Programming & Software (Onward! 2013). Association for Computing Machinery, New York, NY, USA. 187–204. isbn:9781450324724 https://doi.org/10.1145/2509578.2509581 Google ScholarYJIT: a basic block versioning JIT compiler for CRuby | Proceedings of the 13th ACM SIGPLAN International Workshop on Virtual Machines and Intermediate Languages (44)Digital Library
  22. Thomas Würthinger, Andreas Wöß, Lukas Stadler, Gilles Duboscq, Doug Simon, and Christian Wimmer. 2012. Self-Optimizing AST Interpreters. In Proceedings of the 8th Symposium on Dynamic Languages (DLS ’12). Association for Computing Machinery, New York, NY, USA. 73–82. isbn:9781450315647 https://doi.org/10.1145/2384577.2384587 Google ScholarYJIT: a basic block versioning JIT compiler for CRuby | Proceedings of the 13th ACM SIGPLAN International Workshop on Virtual Machines and Intermediate Languages (46)Digital Library
  23. Shijie Xu, David Bremner, and Daniel Heidinga. 2017. Fusing Method Handle Graphs for Efficient Dynamic JVM Language Implementations. In Proceedings of the 9th ACM SIGPLAN International Workshop on Virtual Machines and Intermediate Languages (VMIL 2017). Association for Computing Machinery, New York, NY, USA. 18–27. isbn:9781450355193 https://doi.org/10.1145/3141871.3141874 Google ScholarYJIT: a basic block versioning JIT compiler for CRuby | Proceedings of the 13th ACM SIGPLAN International Workshop on Virtual Machines and Intermediate Languages (48)Digital Library

Cited By

View all

YJIT: a basic block versioning JIT compiler for CRuby | Proceedings of the 13th ACM SIGPLAN International Workshop on Virtual Machines and Intermediate Languages (50)

    Index Terms

    1. YJIT: a basic block versioning JIT compiler for CRuby

      1. Software and its engineering

        1. Software notations and tools

          1. Compilers

            1. Just-in-time compilers

      Recommendations

      • Evaluating YJIT’s Performance in a Production Context: A Pragmatic Approach

        MPLR 2023: Proceedings of the 20th ACM SIGPLAN International Conference on Managed Programming Languages and Runtimes

        Ruby is a dynamically-typed programming language with a large breadth of features which has grown in popularity with the rise of the modern web, and remains at the core of the implementation of widely-used online platforms such as Shopify, GitHub, ...

      • From bytecode to JavaScript: the Js_of_ocaml compiler

        We present the design and implementation of a compiler from OCaml bytecode to JavaScript. The compiler first translates the bytecode into a static single-assignment intermediate representation on which optimizations are performed, before generating ...

        Read More

      • An experimental study of the influence of dynamic compiler optimizations on Scala performance

        SCALA '13: Proceedings of the 4th Workshop on Scala

        Java Virtual Machines are optimized for performing well on traditional Java benchmarks, which consist almost exclusively of code generated by the Java source compiler (javac). Code generated by compilers for other languages has not received nearly as ...

        Read More

      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

      Get this Publication

      • Information
      • Contributors
      • Published in

        YJIT: a basic block versioning JIT compiler for CRuby | Proceedings of the 13th ACM SIGPLAN International Workshop on Virtual Machines and Intermediate Languages (51)

        VMIL 2021: Proceedings of the 13th ACM SIGPLAN International Workshop on Virtual Machines and Intermediate Languages

        October 2021

        32 pages

        ISBN:9781450391092

        DOI:10.1145/3486606

        • General Chairs:
        • Gregor Richards

          University of Waterloo, Canada

          ,
        • Manuel Rigger

          ETH Zurich, Switzerland

        Copyright © 2021 Owner/Author

        This work is licensed under a Creative Commons Attribution International 4.0 License.

        Sponsors

          In-Cooperation

            Publisher

            Association for Computing Machinery

            New York, NY, United States

            Publication History

            • Published: 19 October 2021

            Permissions

            Request permissions about this article.

            Request Permissions

            Check for updates

            YJIT: a basic block versioning JIT compiler for CRuby | Proceedings of the 13th ACM SIGPLAN International Workshop on Virtual Machines and Intermediate Languages (54)

            Author Tags

            • bytecode
            • compiler
            • dynamically typed
            • just-in-time
            • optimization
            • ruby

            Qualifiers

            • research-article

            Conference

            Acceptance Rates

            Overall Acceptance Rate4of4submissions,100%

            Upcoming Conference

            SPLASH '24

            • Sponsor:
            • sigplan

            ACM SIGPLAN International Conference on Systems, Programming, Languages, and Applications: Software for Humanity

            October 20 - 25, 2024

            Pasadena , CA , USA

            Funding Sources

            • YJIT: a basic block versioning JIT compiler for CRuby | Proceedings of the 13th ACM SIGPLAN International Workshop on Virtual Machines and Intermediate Languages (55)

              Other Metrics

              View Article Metrics

            • Bibliometrics
            • Citations4
            • Article Metrics

              • 4

                Total Citations

                View Citations
              • 2,923

                Total Downloads

              • Downloads (Last 12 months)952
              • Downloads (Last 6 weeks)72

              Other Metrics

              View Author Metrics

            • Cited By

              View all

              PDF Format

              View or Download as a PDF file.

              PDF

              eReader

              View online with eReader.

              eReader

              Digital Edition

              View this article in digital edition.

              View Digital Edition

              • Figures
              • Other

                Close Figure Viewer

                Browse AllReturn

                Caption

                View Table of Contents

                Export Citations

                  Your Search Results Download Request

                  We are preparing your search results for download ...

                  We will inform you here when the file is ready.

                  Download now!

                  Your Search Results Download Request

                  Your file of search results citations is now ready.

                  Download now!

                  Your Search Results Download Request

                  Your search export query has expired. Please try again.

                  YJIT: a basic block versioning JIT compiler for CRuby | Proceedings of the 13th ACM SIGPLAN International Workshop on Virtual Machines and Intermediate Languages (2024)

                  References

                  Top Articles
                  Latest Posts
                  Article information

                  Author: Margart Wisoky

                  Last Updated:

                  Views: 5889

                  Rating: 4.8 / 5 (78 voted)

                  Reviews: 93% of readers found this page helpful

                  Author information

                  Name: Margart Wisoky

                  Birthday: 1993-05-13

                  Address: 2113 Abernathy Knoll, New Tamerafurt, CT 66893-2169

                  Phone: +25815234346805

                  Job: Central Developer

                  Hobby: Machining, Pottery, Rafting, Cosplaying, Jogging, Taekwondo, Scouting

                  Introduction: My name is Margart Wisoky, I am a gorgeous, shiny, successful, beautiful, adventurous, excited, pleasant person who loves writing and wants to share my knowledge and understanding with you.