Our Experience Porting the YJIT Ruby Compiler to Rust - Shopify
May 11, 2022

Summary
This post details the experience of porting the YJIT Ruby compiler from C99 to Rust. It highlights the challenges of managing complexity in C, such as lack of modules, namespaces, and standard container types, and contrasts this with Rust's features like pattern matching, macros, and strong type safety. Specific challenges encountered include integrating with the CRuby codebase via FFI using bindgen, difficulties with Cargo's offline build capabilities and the reliance on the `libc` crate from `crates.io`, and issues with bindgen's allowlist filtering. The team adopted a direct translation strategy for the port and explored Zig as an alternative before settling on Rust.