MIR JIT Aiming For First Release Later This Year By Red Hat Developer
Written by Michael Larabel in Programming on 25 August 2020 at 07:29 AM EDT. 7 Comments
PROGRAMMING --
Vladimir Makarov of Red Hat spoke at this week's Linux Plumbers Conference during the GNU Tools Track on lightweight JIT compilers and the effectiveness (or not) of GCC's JIT implementation as well as LLVM's JIT in the context of just-in-time support for Ruby. But following those shortcomings with GCC/LLVM JIT, he's been working on MIR as a lightweight JIT compiler.

We first covered MIR at the start of the year as the Medium Internal Representation and aims to be a lightweight JIT inspired by shortcomings off GCC and LLVM JIT support. MIR so far remains catered towards Ruby usage though there is work on going from LLVM IR to MIR.

While Makarov found Ruby with GCC or LLVM JIT to be around 3x faster than CRuby 2.0, GraalVM was much faster due to very aggressive speculation/deoptimization and inlining of Ruby standard methods. But the disadvantages of GCC/LLVM-based JIT are that they are quite big in size, compilation speed can take longer in some instances, difficulties for handling optimizations, some people uncomfortable with the GNU Assembler / libgccjit / GCC on their systems in a production environment, and there was found to be lots of TLB misses for small objects generated by GCC/libgccjit.

The CRuby 2.6 binary size is 3.5MB while the GCC binary size for its JIT was 25MB and then 63MB for LLVM. Makarov believes GCC/LLVM-based JITs are not good for tier 1 JIT compilation but can be much better as tier two compilers.

Makarov is hoping that his lightweight JIT compiler can work well as a tier one JIT compiler and could potentially be a good solution for MRuby JIT in opening Ruby up to mobile and IoT markets.

His lightweight JIT compiler right now is yielding around 70% of the generated code speed of GCC (at -O2 optimization level) while being "100 times" faster for compilation speed and start-up and 100 times smaller for code size. His JIT code has no external dependencies but is pure C code.

The first release of MIR is aiming to be out before the end of the calendar year. Coming up the Red Hat compiler expert hopes to work on prototyping a MIR-based JIT compiler for MRuby, speculation support on MIR and C level, and porting MIR to 64-bit MIPS and RISC-V.

The latest MIR code can be found on GitHub. Those interested in the LPC 2020 presentation can check out the PDF slide deck for those interested in lightweight just-in-time compilation.
Related News
About The Author
Author picture

Michael Larabel is the principal author of Phoronix.com and founded the site in 2004 with a focus on enriching the Linux hardware experience. Michael has written more than 20,000 articles covering the state of Linux hardware support, Linux performance, graphics drivers, and other topics. Michael is also the lead developer of the Phoronix Test Suite, Phoromatic, and OpenBenchmarking.org automated benchmarking software. He can be followed via Twitter or contacted via MichaelLarabel.com.

Popular News This Week