Skip to main content

Module specialize

Module specialize 

Source
Expand description

Generic function specialization pass.

This module provides the specialization pass that transforms CallGeneric instructions into regular Call instructions by:

  1. Collecting all CallGeneric instructions in the analyzed functions
  2. For each unique (func_name, type_args) combination, creating a specialized function
  3. Rewriting CallGeneric to Call with the specialized function name

§Architecture

The specialization pass runs after semantic analysis but before CFG building. It transforms the AIR in-place and adds new specialized functions to the output.

Structs§

SpecializationKey
A key for a specialized function: (base_function_name, type_arguments).
SpecializationRefs
Function/method references discovered while specializing — feed back into the lazy work queue so reachability stays closed under specialization.

Functions§

specialize
Perform the specialization pass on the analyzed-functions accumulator.

Type Aliases§

AnalyzedRow
One row in the analyzed-functions accumulator: an analyzed body plus its per-function string and byte literal pools (remapped to global tables later).