refactor(interpreter): invert frame composition ownership - #723
Open
zhenrongliew wants to merge 2 commits into
Open
refactor(interpreter): invert frame composition ownership#723zhenrongliew wants to merge 2 commits into
zhenrongliew wants to merge 2 commits into
Conversation
Make each composition root own conversion of reusable member frames into its private stack-item enum. Remove FrameBuild, StandardFrame, UnGraphEntry, the FrameBuild derive, and the concrete SCF injection traits. Replace member-side factory calls with narrow From<Member> conversions while keeping callable-body walker selection in CallBodyTraversal and DefaultCallBodyTraversal. This reverses the dependency from member to factory to total enum to member, without changing concrete execution semantics.
…engines Extend the concrete ownership rule to sparse-forward, sparse-backward, dense-backward, SCF, and the shared fixpoint adapters. Each private stack-item enum now owns its From<Member> conversions and wraps member effects at the dispatch boundary. Reusable frames no longer name or construct the total enum that contains them. The fixpoint and liveness changes are mechanical adaptations to the corrected Frame and FrameEffect contracts; their analysis equations are unchanged.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #684. Make each interpreter engine's private stack enum own conversion from reusable member frames.
Problem:
Concrete member frames depended on the total enum that stores them. BlockFrame required
F: FrameBuild<V, E>and re-wrapped itself withF::from_block(self), so the dependency ran:BlockFrame -> FrameBuild -> total enum -> BlockFrameThe cause was in the frame protocol itself.
Frame<I, F>'s three methods all returnedFrameEffect<F, C>— overF, never overSelf. A reusable frame was therefore obliged to construct the enclosing enum's variant for itself, which it could only do through a construction trait the enum had to implement. That forced a chain of scaffolding: aFrameBuildderive per engine family, aBuild*construction trait per dialect frame.Fix:
Split the parent from the child in
FrameEffect:A member continuation now returns itself for
Continueand as the suspended parent ofPush. A private closed stack-item enum is the composition root: it owns theFrom<Member>conversions, dispatches exhaustively, and lifts member state into its own variant with the newFrameEffect::map_next.