Memory and references
Platform spec node
Memory and references
Spec standingStandard
No architecture decision records under adr/ for this feature yet. Standard features must
publish at least one ADR or keep a ## Decisions summary on the hub.
0 revisions (git unavailable at build; counts may be empty)
No commits recorded for this path.
| Section id | Required | Found |
|---|---|---|
scope | yes | yes |
features | yes | yes |
Full tree: run pnpm verify:platform-spec-layout (writes src/generated/platform-spec-layout-report.json).
Normative specification
Section titled “Normative specification”Defines local storage, ref/out parameters, GC-managed heap objects, arrays, and cross-fiber sharing at the language level. Collector algorithms and write barriers must match execution platform-spec; the /execution/ doc tree is informative only.
Locals and assignment
Section titled “Locals and assignment”- Locals live in function activation records unless captured by closures (see Lambdas and closures).
- Assignment to immutable bindings must error (E1214).
muton locals and parameters must be present to allow reassignment where required by the reference compiler.
ref and out
Section titled “ref and out”- Parameters may use
ref Torout Tmodifiers (ParameterModifier). refpasses an alias to existing storage;outrequires definite assignment before read on callee entry.refin type expressions (ref T) denotes reference types in signatures distinct from by-valueT.
Arrays
Section titled “Arrays”T[]values use the fat-pointer layout (BeskidArray) described in execution ABI material.- Element access must respect bounds checks in safe builds (lowering inserts checks unless proven).
Heap and garbage collection
Section titled “Heap and garbage collection”- Reference-bearing values that escape their defining frame must live on the GC heap traced by the runtime collector (concurrent tri-color mark-sweep in the reference implementation).
- User code must not expose manual
freeor untracked pointers in v0.1. - Pointer stores to heap objects must execute write barriers when required by the active GC phase (see execution memory contracts).
nullmust not appear as a value; optional absence usesOption<T>per Types.
Fibers and sharing
Section titled “Fibers and sharing”- Values must not be shared across fibers by alias unless immutability is proven or synchronization uses
Channel<T>per Fibers and spawn. - Capturing mutable shared state in
spawnclosures should be rejected when detectable.
Dynamic semantics
Section titled “Dynamic semantics”- Stack frames are tied to call/return;
returnends the frame and invalidates temporaries. - Closure environments must outlive uses tracked by the compiler’s capture analysis.
Diagnostics
Section titled “Diagnostics”Immutability E1214; member access E1211–E1213. Registry: Diagnostic code registry.
Conformance
Section titled “Conformance”Memory rules enforced in beskid_analysis must be preserved in codegen for L3 claims.
Decisions
Section titled “Decisions”- D-LM-MEM-001 — Channel-only fiber sharing: Language law forbids ad hoc shared mutable globals across fibers.
- D-LM-MEM-002 — Fat-pointer arrays: All
T[]share one ABI representation per target unless a profile documents otherwise. - D-LM-MEM-003 — GC by default: Heap objects are collector-managed; escape analysis may stack-allocate but must not skip tracing when pointers escape.
- D-LM-MEM-004 — No
nulladdresses: References are non-null at the type level;Option<T>models absence.
Platform view
Section titled “Platform view”Locals, ref T, GC-traced heap objects, and channel-mediated sharing. Runtime barrier and phase details live under platform-spec execution; /execution/ pages are a legacy bridge only.