Skip to content

Combine STG free variable traversals.

Currently we traverse the STG AST twice looking for free variables.

Once in annTopBindingsDeps which considers top level and imported ids free.
It's output is used to put bindings in dependency order.

Once in annTopBindingsFreeVars which only considers non-top level ids free.
It's output is used by the code generator to compute offsets into closures.

Sorting the bindings happens right before annTopBindingsFreeVars so they both operate over the same AST. It would be more efficient to combine these two operations into a single traversal.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information