Skip to content

refactor(interpreter): consolidate environment storage and generalize fact access - #732

Open
zhenrongliew wants to merge 2 commits into
dl/ir-callable-bodyfrom
dl/env-store
Open

refactor(interpreter): consolidate environment storage and generalize fact access#732
zhenrongliew wants to merge 2 commits into
dl/ir-callable-bodyfrom
dl/env-store

Conversation

@zhenrongliew

Copy link
Copy Markdown
Collaborator

Stacked on #729.

Problem

Facts stored differently: forward values in an environment,
sparse demand in a solver summary map, dense liveness split between block
summaries and a scope-qualified store.

Fix

Unify all interpreters into a shared storage pipeline:

`context key K → EnvStore::get_or_allocate(K) → EnvIndex → Anchor → Value`

EnvStore<K, A, V> replaces EnvStackStore<V>. One container owns context identity (K → EnvIndex) and per-environment FactStore<A, V> maps.

FactStore<A, F> is a anchor→payload map.

Env is anchor-generic (type Anchor: LatticeAnchor). SSA positional binding lives on SSABinding: Env<Anchor = SSAValue> (blanket); dense/ProgramPoint engines implement Env without it.

Activation lifetime stays on CallServices, sibling to Env. CallFrame needs only CallServices + Env<Anchor = SSAValue>.

Context-insensitive keying: ContextInsensitive::Key = LinkTarget; ConstPropContext::Key = (LinkTarget, CallCtx).

@zhenrongliew
zhenrongliew added this pull request to stack #725 September 10, 2026 13:43
@zhenrongliew
zhenrongliew force-pushed the dl/env-store branch 2 times, most recently from 73a56f6 to c557998 Compare September 11, 2026 13:49
- Introduced `EnvStore` and `Env` traits to manage environment storage and access.
- Updated the environment model to use `EnvStore<K, SSAValue, V>` instead of `EnvStackStore<V>`.
- Enhanced the `Env` trait with methods for reading, writing, and binding values.
- Modified the interpreter's core to reflect changes in environment handling.
- Updated documentation to clarify the new environment model and its components.
- Added tests for the new environment storage and access patterns.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant