Understanding Programs Using Graphs - Shopify
Jun 2, 202010 min read
Opens shopify.engineeringWhat the post covers
This post introduces the concept of sea-of-nodes graphs as an intermediate representation used by the TruffleRuby JIT compiler.
- It explains the structure of these graphs, differentiating between control flow (red arrows) and data flow (green arrows), and between imperative (red boxes) and pure (green boxes) operations.
- It demonstrates how these graphs enable optimizations like de-duplication of common expressions (global value numbering) and floating expressions, and how they represent loops.
- The post also discusses the challenges of programming directly with graphs and highlights Shopify's efforts to build tools for visualizing and decompiling these graphs back to Ruby code to aid developer understanding of compiler optimizations.
More from the YJIT Compiler for Ruby trail
Contributing support for a Wasm instruction to Winch - Shopify
Ruby 3.2’s YJIT is Production-Ready - Shopify
Year in Review 2022: Tenderlove's Ruby and Rails Reflections and Predictions - Shopify
Our Experience Porting the YJIT Ruby Compiler to Rust - Shopify
Code Ranges: A Deeper Look at Ruby Strings - Shopify