pub struct FnResolution {
pub local_count: u16,
pub local_slots: Arc<HashMap<String, u16>>,
pub local_slot_types: Arc<Vec<Type>>,
pub aliased_slots: Arc<Vec<bool>>,
}Expand description
Compile-time resolution metadata for a function body.
Produced by resolver::resolve_fn — maps local variable names to slot indices
so the VM can use Vec<Value> instead of HashMap lookups.
Fields§
§local_count: u16Total number of local slots needed (params + bindings in body).
local_slots: Arc<HashMap<String, u16>>Map from local variable name → slot index in the local Slots frame.
local_slot_types: Arc<Vec<Type>>Aver type per slot index. Length == local_count. Built post-
typecheck so each entry pulls from the matching Spanned::ty()
stamp on the producer expression, plus pattern-binding shape
rules (Result.Ok → T, Cons head → list element, tuple item
→ tuple element, …). Backends that need a typed local table
(the wasm-gc lowering uses one to declare each local with a
concrete ValType) consume this directly instead of re-deriving
the same information from patterns.
Default Type::Invalid for unreachable / unstamped slots — every
real binding gets overwritten during the slot-types pass, so an
Invalid reaching the backend means the slot was never the
target of a binding (resolver counted but no expression
produced into it; usually a wildcard slot the backend skips).
aliased_slots: Arc<Vec<bool>>Whether each slot may share an arena entry with another slot.
Length == local_count. Set by ir::alias::annotate_program_alias_slots
post-last_use. Backends that have a mem::take-style fast path
for Vector.set / Map.set (the VM’s CALL_BUILTIN_OWNED mask
plus the fused VECTOR_SET_OR_KEEP) must NOT take the fast path
on a flagged slot — rewriting the shared arena entry would
mutate the other binding too. Wasm-gc may use it to skip
clone-on-write when the slot is provably non-aliased; otherwise
it falls back to array.copy + array.set on the copy.
Default false for slots the analysis hasn’t reached (anything
pre-last_use, REPL, partial pipelines), which is the safe-but-
slow choice everywhere except the VM fast path.
Trait Implementations§
Source§impl Clone for FnResolution
impl Clone for FnResolution
Source§fn clone(&self) -> FnResolution
fn clone(&self) -> FnResolution
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for FnResolution
impl Debug for FnResolution
Source§impl PartialEq for FnResolution
impl PartialEq for FnResolution
Source§fn eq(&self, other: &FnResolution) -> bool
fn eq(&self, other: &FnResolution) -> bool
self and other values to be equal, and is used by ==.