Provisional API: This reference documents current compiler behavior. Compatibility is not yet promised.
src/collect.x
Source-ordered shallow symbol collection and replay.
Functions
| Function | Summary |
|---|---|
header_symbols_active | Returns whether the active source-collection artifact has indexed rows. |
header_symbols_begin_generated | Enables recording of generated public protocol callables. |
header_symbols_initialize | Initializes the process-wide source-collection cache. |
header_symbols_open | Opens a compatible source-collection artifact for lazy replay. |
header_symbols_write | Writes the portable source-collection cache to output. |
Compiler.collect_package | Collects a package once and installs its public surface in the current unit. |
Compiler.collect_symbols | Collects the current translation unit’s declarations into globs. |
Compiler.record_generated_header_symbol | Records one generated public callable in its source file’s cached surface. |
Functions
header_symbols_active
int header_symbols_active(void)
Returns whether the active source-collection artifact has indexed rows. Translation depfiles use this result because every unit translated while the artifact is active depends on it, even if the unit reads no row.
Source: src/collect.x:867
header_symbols_begin_generated
void header_symbols_begin_generated(void)
Enables recording of generated public protocol callables. Recording remains enabled for subsequent translations in this process.
Source: src/collect.x:199
header_symbols_initialize
void header_symbols_initialize(void)
Initializes the process-wide source-collection cache.
Source: src/collect.x:192
header_symbols_open
int header_symbols_open(String path, int gensym_base)
Opens a compatible source-collection artifact for lazy replay.
Returns the number of indexed rows, or zero when the file is absent,
unreadable, empty, or incompatible. A nonnegative gensym_base must match
the artifact header; compatibility also requires the current symbol
snapshot hash. Raw rows remain indexed until fetched, rejected, or replaced
by a later open; materialized rows move to the process-wide cache.
Source: src/collect.x:827
header_symbols_write
int header_symbols_write(File output, int gensym_base)
Writes the portable source-collection cache to output.
The versioned Lisp artifact records repository-relative paths, the supplied
generated-name base, and the current symbol-snapshot hash. Entries with an
out-of-root part or dependency are omitted. Returns nonzero when output
has no error and leaves it open.
Source: src/collect.x:744
Compiler
Compiler.collect_package
void Compiler.collect_package(Compiler c, String name, Token token)
Collects a package once and installs its public surface in the current
unit.
name resolves through the compiler’s registered package roots. A cold
entry include closure is parsed in package mode; cached entries replay
their previously collected declarations. Public declarations and
protocol rows enter the current symbol state, and dependencies enter the
importing compiler. Cold collection and in-memory replay also merge
recorded function definitions; persisted artifact entries carry no
function-definition list. token locates lookup and public-surface errors.
Source: src/collect.x:680
Compiler.collect_symbols
Map Compiler.collect_symbols(Compiler c, Map globs)
Collects the current translation unit’s declarations into globs.
The compiler must have its filename, text, and include paths prepared.
globs is the base symbol map and is mutated; a null value starts from an
empty map. The source and raw-include closure merge in source order, and
the returned map is globs. Collection also updates dependencies,
function definitions, macro state, and the generated-name count. Keyword
alias maps and seen-name state are file-local and restored when each file
walk ends.
Source: src/collect.x:532
Compiler.record_generated_header_symbol
void Compiler.record_generated_header_symbol( Compiler compiler, String name, Type signature)
Records one generated public callable in its source file’s cached surface.
The operation has no effect until generated-symbol recording is enabled.
The compiler’s current file must already have a collected contribution;
the cache retains signature.
Source: src/collect.x:414
Design notes
Raw collection scans includes without running cpp. Each cold walk records declaration maps and included paths at their source positions; cache and artifact replay consume that same order so declaration precedence and generated-name counters do not depend on whether a file was already collected.