refactor(interpreter): unify callable roots - #724
Open
zhenrongliew wants to merge 2 commits into
Open
Conversation
…ody to be function definition. Actual body terminology remains unchanged for CFG, Block, graphs, Function.body, Lambda.body, and CallableBody.body.
… functionality - Updated the `FunctionEntry` trait to remove the argument passing, simplifying callable statement handling. - Refactored the `function_cfg` method to streamline the retrieval of function bodies and their corresponding CFGs. - Enhanced the `analyze_classic_liveness` and `analyze_dense_toy` functions to utilize the new `Callee` structure for function calls. - Adjusted test cases to align with the new callable structure, ensuring consistent analysis across various scenarios. - Removed unnecessary complexity in the interpreter's handling of function entries and CFG retrieval, promoting cleaner code and better maintainability. - Deleted redundant code and improved documentation for clarity on the new structure and its implications for future development.
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 #723. Unify callable entry across forward and backward interpreters: separate body discovery from forward argument binding, route backward roots through linkers, honor
FunctionTarget.stage.Three problems:
FunctionEntrywas parameterised on the engine and took a value product:This made it inherently incompatible with backward interpreters, the signature permitted argument-sensitive body selection — so a backward interpreters could not discover structure without fabricating a dummy
Product<LiveSet>.analyze(stage, body: impl Into<Body>)skipped symbol/specialization resolution, target-stage selection, and linker policy entirely.Both backward engines now take
Lk = SameStageLinker, hold a linker field, and exposewith_linker, matching the concrete and forward engines:Every engine root now shares one validated prefix, through a single
resolve_callable:DirectBodyBlocksin returnedVec::new()for DiGraph/UnGraph, so the solver ran to completion over an empty owner set and reported success having done no work.Tests now assert that both demand and classic liveness reject graph bodies explicitly.