What happens inside Ruby when you type

$ ruby program.rb

About this model

Based on CRuby 3.4 and 4.0 with default settings (Prism parser; YJIT off unless the case uses --yjit) on a 64-bit computer. The basic case's bytecode matches real Ruby 4.0.7 output. The Spinel case follows the pipeline in Spinel's README; its generated C is a simplified sketch. Addresses, sizes, register values and cache results are simplified examples; hardware figures are typical x86-64 values. Facts were checked against the sources listed at the bottom of the page (September 2026).

    Source

    program.rb, on disk

    Syntax tree

    Bytecode

    Inside the ruby program

    Active now Loaded, but unused in this case
    Components inside the ruby program Components grouped into front door, execution, built-in features, core runtime and foundation, with the operating system on the left. Numbered arrows show the messages of the current step.

    Hardware typical x86-64 values, simplified

    Used in this step (numbers match the messages)
    Hardware RAM regions, the CPU with its registers and caches, the disk and the screen, highlighted when each message uses them.

    Messages in this step

    References

    Facts on this page were checked against these sources in September 2026. Where they disagree with the page, trust the sources.

    CRuby and YARV bytecode

    Prism parser

    GC and memory

    YJIT and ZJIT

    Spinel

    Spotted a mistake? This page is a learning tool and simplifies many details, so parts of it may be wrong or out of date. If you find an error, please ping me on X @ervinismu or on Mastodon at @ervinismu@ruby.social.