Repository navigation
feat: call graph and function summaries - #28
Merged
Merged
Conversation
5 tasks done
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.
Summary
Opens Phase 6 of
docs/architecture.mdwith §20 Call Graph and §19 Function Summaries.test: define call graph and function summary behavior), implementation follows.interprocedural/callgraph.py:CallGraphAnalysis(interprocedural.callgraph) resolves every call site of every analysable function through the SSA form to aKnownFunctiondefined at module level, anExternalSymbolreached through imports or builtins, orUnknownTarget. Local aliases and later definitions resolve; shadowed names do not. Functions outside the lowering subset are listed asunsupportedinstead of failing the graph.interprocedural/summaries.py:SummaryAnalysis(interprocedural.summaries) computes aFunctionSummaryper function: which parameters the return value depends on, and which external symbols the parameters reach, directly or through calls to other known functions (eachExternalCallkeeps the sink location and the call site it went through). Computed as a dependence data-flow problem over the SSA form, iterated to a fixpoint over the call graph so recursion converges to the least solution. Unsupported functions get a conservative summary.Runner().go(input())style flows cross function boundaries.qualified_nameis shared by lowering and the call graph (Class.methodfor methods).Not in this PR:
ModuleGraphand cross-file analysis, method and attribute targets (need type inference and framework models), heap and aliasing.Part of #27