ADR-0003: Allocation and Identity Observability
Status: accepted
Date: 2026-07-25
Context
Region allocation, scalar replacement, object fusion, and RC elimination need freedom to change physical representation. Mutable aliases still require a stable logical identity contract.
Options considered
| Option | Benefit | Cost |
|---|---|---|
| Physical address observable | Low-level control | Prevents movement and many eliminations |
| Reference equality in v0.1 | Direct identity query | Constrains allocation removal |
| Identity observable through behavior | Maximum optimizer freedom | No direct identity test |
Decision
Core-N0 v0.1 has fresh opaque logical locations but no numeric address
observation and no same_identity primitive.
Observable:
- freshness as reflected by program behavior;
- alias-visible mutation;
- effect order;
- explicit resource lifecycle.
Not observable:
- physical address or placement;
- RC traffic;
- internal reclamation time;
- movement or scalar replacement.
No implicit destructor, finalizer, or weak-reference observation exists in v0.1.
Rationale
Mutation already protects the alias relation needed for correctness. Omitting direct identity equality leaves room for aggressive allocation elimination and representation changes.
Trade-offs
- Programs cannot directly ask whether two references are identical.
- Identity-oriented data structures require a later explicit facility.
Consequences
Backend transformations must preserve alias-observable behavior, not host pointer values or allocation counts.
Revisit trigger
A future identity-sensitive domain may propose same_identity in a new ADR
with explicit scalar-replacement and serialization consequences.