Lesson 244

Code Generation & the Runtime

Back end · registers · GC · JIT

1:00

How the compiler back end turns IR into machine code — instruction selection, register allocation, stack frames, and the four execution models including JIT and garbage collection.

By the end, you can

  • Sequence the five stages of the compiler back-end pipeline in order.
  • Explain how instruction selection tiles an IR tree with instruction patterns.
  • Describe what an interference graph is and how graph coloring assigns registers.
  • Explain why spilling occurs and what the allocator does when it runs out of registers.
  • State why SSA form makes register allocation solvable in linear time.
  • Describe what a stack frame contains and distinguish the prologue from the epilogue.
  • Contrast the four execution models (AOT, interpreter, bytecode VM, JIT) and give examples of each.
  • Explain the JIT warmup cost and when AOT outperforms JIT.
  • Trace the mark-and-sweep algorithm and explain why GC frees the unreachable rather than the unused.
  • Identify the key limitation of reference counting with respect to cycles.
Up next in Theory of Computation & Compilers
Questions or feedback?