YJIT: A Basic Block Versioning JIT Compiler for CRuby
Maxime Chevalier-Boisvert 
, Noah Gibbs

, Jean Boussier, Si Xing (Alan) Wu

, Aaron Patterson

, Kevin Newton, and John Hawthorn
(Shopify, Canada; Shopify, UK; Shopify, France; Shopify, USA; GitHub, Canada)
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.
@InProceedings{VMIL21p25,
author = {Maxime Chevalier-Boisvert and Noah Gibbs and Jean Boussier and Si Xing (Alan) Wu and Aaron Patterson and Kevin Newton and John Hawthorn},
title = {YJIT: A Basic Block Versioning JIT Compiler for CRuby},
booktitle = {Proc.\ VMIL},
publisher = {ACM},
pages = {25--32},
doi = {10.1145/3486606.3486781},
year = {2021},
}
Publisher's Version