Repository navigation
feat: heap and aliasing - #48
Merged
Merged
Conversation
4 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
The heap and aliasing abstraction of
docs/architecture.md§22, coarse first as the document asks, and themutations/side_effectsfields of §19. Closes #35.test: define heap, aliasing and mutation behavior), implementation follows.abstract/heap.py: oneAbstractObjectper allocation site (containers and calls at their instruction, parameters, module globals and imported symbols by name, loaded fields by owner and field), anAliasSetper value from a flow-insensitive points-to fixpoint over the SSA form, and twoHeapLocationfields per object,elementsandattributes. A field of a field collapses onto itself, sonode = node.nextloops stay finite.SetItem,SetAttr), mutating method calls (append,extend,insert,add,update,setdefault,put) write the receiver's location; loads (GetItem,GetAttr, iteration) read it; call arguments and sink arguments carry the contents of what they point to. The issue's example,b = a; b.append(user_input); sink(a[0]), is a flow; unrelated containers and clean stores stay clean;TaintFacts.heap(location)exposes the heap taint.mutations(per parameter and field: the other parameters and the external sources stored into it) andside_effects(the module globals mutated). Callers apply callee mutations to their own heap, so mutations compose through calls and, through the project index, across files. The cache codec carries them (format 2, older entries miss).interproceduralaboveabstract, since summaries now consume an abstract domain; the layers above shift by one.self, and conditional expressions, which the HIR still rejects.Closes #35