A History of the Rubinius Ruby JIT

Rubinius began as a metacircular implementation of Ruby and was billed as Ruby in Ruby. Today the core and much of the standard library, parser, bytecode compiler, and other components are implemented in Ruby, but the interpreter, runtime, GC and other components, are written in C++.

Rubinius removed their JIT in 2016, due to a lack of experienced developers and bugs in the implementation. Several possible replacements have been proposed and a private proof-of-concept was apparently implemented, but none has been realised yet and today any public Rubinius development in general has stalled. In this survey we discuss the JIT as it was in the final release before it was removed.

The Rubinius JIT is written in C++ and emits LLVM IR using the C++ API, and then LLVM compiles that IR to native code. Rubinius includes a couple of simple extra phases that plug into LLVM’s optimisations and are specific to the code they generate.

Rubinius does not have any form of intermediate representation for optimisations beyond the same bytecode that the intepreter uses, and the LLVM IR which it can manipulate with custom LLVM passes. Rubinius is essentially a template compiler, running a linear scan and translating bytecode instructions to LLVM IR through a peephole.

Rubinius possibly had a larger deployment in production in the past, but it’s likely there were very few users at the time of the JIT being removed as there was almost no public note of the change in performance which would have been extremely significant for them.

The Rubinius JIT was originally written by Evan Phoenix, with contributions from Dirkjan Bussink, Brian Shirai (né Ford), and others.

Read in full here:

https://ruby-compilers.com/rubinius/

This thread was posted by one of our members via one of our news source trackers.

1 Like