feat: Add typed lambda registry to Optimizer

The Optimizer now accepts a typed lambda registry, allowing it to
perform more aggressive inlining and beta-reduction on globally defined
functions. This is a significant step towards optimizing recursive and
globally defined lambdas more effectively.
This commit is contained in:
Michael Schimmel
2026-02-22 02:31:55 +01:00
parent 8e8d85c06c
commit 2123f1d279
4 changed files with 197 additions and 77 deletions
@@ -1,6 +1,6 @@
---
source: src/ast/compiler/optimizer.rs
assertion_line: 720
assertion_line: 844
expression: dump
---
Lambda (Upvalues: 0) <Metadata: Metadata { ty: Function(Signature { params: Tuple([]), ret: Int }), is_tail: true }>
@@ -11,4 +11,4 @@ Lambda (Upvalues: 0) <Metadata: Metadata { ty: Function(Signature { params: Tupl
Constant: 10 <Metadata: Metadata { ty: Int, is_tail: false }>
Set: Local(0) <Metadata: Metadata { ty: Int, is_tail: false }>
Constant: 20 <Metadata: Metadata { ty: Int, is_tail: false }>
Constant: 20 <Metadata: Metadata { ty: Int, is_tail: true }>
Get: x (Local(0)) <Metadata: Metadata { ty: Int, is_tail: true }>