Representing local variables in compiler IRs

August 9, 2026

It's useful to lift local variables into SSA nodes in a compiler

But local variables can be observed/reified by explicit runtime reflection (incl. locals(), eval(), ...), exceptions, debuggers

Local variables also have nonlocal things sometimes like Ruby blocks

LLVM

PyPy

JavaScriptCore

Cinder

ZJIT

Graal