Expand description
ENV-RESOLVE M0 flag + per-source resolution-table plumbing (the
tree-walker’s consume side of the sui-resolve side-table).
ENV-RESOLVE M0 — the tree-walker’s consume side of the sui-resolve
parse-time variable-resolution side-table.
This module owns three things:
- The
SUI_RESOLVE=1env flag (read once via aOnceLock, default off) — mirrorsperf::enabled()’s one-way latch. - A thread-local resolution table keyed by
(source_id, text_offset)— the identical key shapevalue::intern_cacheduses for the ident symbol cache, so a resolution recorded duringbind_varson one parse tree never collides with an ident at the same offset in a different (imported) parse tree. - The hot-path lookup
resolution_for(offset)that the evalIdentarm consults, pluspopulate/clearlifecycle hooks wired intoeval_with_file.
§Parity by construction
Enabling this flag only changes the tree-walker’s hot Ident arm: on a
Resolution::Lexical{sym} it probes the environment’s lexical bindings
with the precomputed Symbol and returns on a hit — the byte-identical
value the unchanged lookup_fast returns (which probes the same lexical
map, by the same Symbol, first). On ANY miss (blackhole / unrecorded /
Dynamic) it falls back to today’s exact runtime path. See
sui-resolve’s crate docs.
Functions§
- clear
- Clear the thread-local resolution table. Called at the top-level
(
nesting == 0) re-entry ofeval_with_file, alongsideclear_ident_cache(), so offsets from previous top-level evals don’t persist. No-op when the flag is off. - enabled
- Whether the ENV-RESOLVE M0 fast path is enabled (
SUI_RESOLVE=1). - populate
- Merge a freshly-computed
ResolveTable(for the parse tree taggedsource_id) into the thread-local table. No-op when the flag is off. - resolution_
for - Resolution recorded for the ident at
(source_id, text_offset). ReturnsResolution::Dynamicfor any unrecorded key — the fail-safe path (the caller then takes today’s exact runtime lookup).