lean4-htt/src/Lean/Compiler
Henrik Böving c3d753640a
feat: use static initializers where possible (#12082)
This PR makes the compiler produce C code that statically initializes
close terms when possible. This change reduces startup time as the terms
are directly stored in the binary instead of getting computed at
startup.

The set of terms currently supported by this mechanism are:
- string literals
- ctors called with other statically initializeable arguments
- `Name.mkStrX` and other `Name` ctors as they require special support
due to their computed field and occur frequently due to name literals.

In core there are currently 152,524 closed terms and of these 103,929
(68%) get initialized statically with this PR. The remaining 48585 ones
are not extracted because they use (potentially transitively) various
non trivial pieces of code like `stringToMessageData` etc. We might
decide to add special support for these in the future but for the moment
this feels like it's overfitting too much for core.
2026-01-26 11:22:12 +00:00
..
IR feat: use static initializers where possible (#12082) 2026-01-26 11:22:12 +00:00
LCNF chore: don't extract standalone constants as closed terms (#12027) 2026-01-16 14:52:14 +00:00
BorrowedAnnotation.lean refactor: module-ize Lean (#9330) 2025-07-25 12:02:51 +00:00
ClosedTermCache.lean fix: closed term cache (#12024) 2026-01-16 12:41:54 +00:00
CSimpAttr.lean chore: remove redundant imports in core (#10750) 2025-10-16 20:27:46 +00:00
ExportAttr.lean chore: rename Substring to Substring.Raw (#11154) 2025-11-16 09:30:04 +00:00
ExternAttr.lean chore: rename String.ValidPos to String.Pos (#11240) 2025-11-24 16:40:21 +00:00
FFI.lean refactor: use String.split instead of String.splitOn or String.splitToList (#11250) 2025-11-19 09:35:19 +00:00
ImplementedByAttr.lean chore: remove redundant imports in core (#10750) 2025-10-16 20:27:46 +00:00
InitAttr.lean fix: symbol clashes between packages (#11082) 2025-11-19 02:24:44 +00:00
InlineAttrs.lean refactor: use isRecursiveDefinition when validating macro_inline (#12106) 2026-01-22 16:31:34 +00:00
IR.lean feat: use static initializers where possible (#12082) 2026-01-26 11:22:12 +00:00
LCNF.lean feat: split up the compiler SCC after lambda lifting (#12003) 2026-01-14 18:36:25 +00:00
Main.lean refactor: module-ize Lean (#9330) 2025-07-25 12:02:51 +00:00
MetaAttr.lean chore: shake: fix handling of meta structure etc (#11701) 2025-12-16 16:28:39 +00:00
ModPkgExt.lean fix: symbol name for native boxed declarations in the interpreter (#12095) 2026-01-21 20:38:29 +00:00
NameMangling.lean fix: symbol name for native boxed declarations in the interpreter (#12095) 2026-01-21 20:38:29 +00:00
NeverExtractAttr.lean chore: remove redundant imports in core (#10750) 2025-10-16 20:27:46 +00:00
NoncomputableAttr.lean refactor: module-ize Lean (#9330) 2025-07-25 12:02:51 +00:00
Old.lean refactor: use String.Slice in String.take and variants (#11180) 2025-11-18 16:13:48 +00:00
Options.lean chore: do not set unused Option.Decl.group (#11307) 2025-11-21 16:44:38 +00:00
Specialize.lean chore: remove redundant imports in core (#10750) 2025-10-16 20:27:46 +00:00