-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Ruby: more type-tracking steps #10650
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
37 commits
Select commit
Hold shift + click to select a range
ab672de
Ruby: strip trailing whitespace in calls.rb test
asgerf 1c484d8
Ruby: add some calls to .each in call graph test
asgerf a4d4e40
Ruby: Summarize level steps in type tracking
asgerf 0000a7d
Ruby: Summarize load-store steps in type-tracking
asgerf fbab0f5
Ruby: Evaluate longer summary component stacks
asgerf 5b2d8b0
Ruby: make Array.each a simple summary
asgerf f75f27d
Ruby: update test
asgerf c06743a
Ruby: update benign test updates
asgerf 74c3886
Ruby: use getACallSimple in more Array methods
asgerf 8b389fe
Ruby: use getACallSimple in more Hash methods
asgerf 8c43ab6
Ruby: go to local source in load-store steps
asgerf a7d764d
Ruby: Improve join order when generating edges
asgerf 323abf4
Ruby: Speed up evaluateSummaryComponentStackLocal
asgerf bd11946
Ruby: support WithoutContent steps in restricted cases
asgerf 9302271
Ruby: Hack special-casing of hash literals
asgerf 00e52ad
Ruby: add type-tracking variant of hash-flow test
asgerf fd9c1e4
Ruby: filter out obvious module 'prepend' calls
asgerf ff4ce4a
Ruby: use Element[n..] tokens in inject and reduce
asgerf c220f4e
Ruby: prune unusable summaries earlier
asgerf 6e7aea8
Ruby: update benign test output
asgerf 96711b2
Ruby: improve join order in trackInstanceRec
asgerf 94d41b9
Ruby: add hook for adding type-tracking steps
asgerf 3ccc3a2
Ruby: move special treatment of Hash.[] into Hash.qll
asgerf b6231e8
Ruby: do not treat WithoutElement[0..!] as a type filter
asgerf 28f4dff
Python: sync
asgerf 9485940
Ruby: share type-tracking test with array test
asgerf 4c19d2d
Ruby: make getAStaticHashCall private again
asgerf a9a99c5
Ruby: nomagic on unary hasAdjacentTypeCheckedReads
asgerf f5f351e
Ruby: make flowsToLoadStoreStep private
asgerf 93e8434
Ruby: fix content restriction in type trackers
asgerf 8b7ec20
Merge branch 'main' into rb/summarize-more
asgerf 6f74a52
Merge branch 'main' into rb/summarize-more
asgerf 7cf969f
Ruby: remove mention of PairValueContent
asgerf f664a77
Ruby: ensure Hash flow works again
asgerf ab6e488
Python: sync
asgerf c9c3698
Ruby: address review comments
asgerf decd4c9
Ruby: update type tracking test
asgerf File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -366,8 +366,7 @@ private module Cached { | |
|
||
cached | ||
predicate isLocalSourceNode(Node n) { | ||
n instanceof ParameterNode and | ||
not n instanceof SynthHashSplatParameterNode | ||
n instanceof ParameterNode | ||
or | ||
// Expressions that can't be reached from another entry definition or expression | ||
n instanceof ExprNode and | ||
|
@@ -381,7 +380,7 @@ private module Cached { | |
n instanceof SynthReturnNode | ||
or | ||
// Needed for stores in type tracking | ||
TypeTrackerSpecific::postUpdateStoreStep(_, n, _) | ||
TypeTrackerSpecific::storeStepIntoSourceNode(_, n, _) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I belive we should remove
above as well. |
||
} | ||
|
||
cached | ||
|
@@ -1010,6 +1009,31 @@ private ContentSet getKeywordContent(string name) { | |
) | ||
} | ||
|
||
/** | ||
* Subset of `storeStep` that should be shared with type-tracking. | ||
*/ | ||
predicate storeStepCommon(Node node1, ContentSet c, Node node2) { | ||
// Wrap all key-value arguments in a synthesized hash-splat argument node | ||
exists(CfgNodes::ExprNodes::CallCfgNode call | node2 = TSynthHashSplatArgumentNode(call) | | ||
// symbol key | ||
exists(ArgumentPosition keywordPos, string name | | ||
node1.asExpr().(Argument).isArgumentOf(call, keywordPos) and | ||
keywordPos.isKeyword(name) and | ||
c = getKeywordContent(name) | ||
) | ||
or | ||
// non-symbol key | ||
exists(CfgNodes::ExprNodes::PairCfgNode pair, CfgNodes::ExprCfgNode key, ConstantValue cv | | ||
node1.asExpr() = pair.getValue() and | ||
pair = call.getAnArgument() and | ||
key = pair.getKey() and | ||
cv = key.getConstantValue() and | ||
not cv.isSymbol(_) and | ||
c.isSingleton(TKnownElementContent(cv)) | ||
) | ||
) | ||
} | ||
|
||
/** | ||
* Holds if data can flow from `node1` to `node2` via an assignment to | ||
* content `c`. | ||
|
@@ -1040,25 +1064,7 @@ predicate storeStep(Node node1, ContentSet c, Node node2) { | |
or | ||
FlowSummaryImpl::Private::Steps::summaryStoreStep(node1, c, node2) | ||
or | ||
// Wrap all key-value arguments in a synthesized hash-splat argument node | ||
exists(CfgNodes::ExprNodes::CallCfgNode call | node2 = TSynthHashSplatArgumentNode(call) | | ||
// symbol key | ||
exists(ArgumentPosition keywordPos, string name | | ||
node1.asExpr().(Argument).isArgumentOf(call, keywordPos) and | ||
keywordPos.isKeyword(name) and | ||
c = getKeywordContent(name) | ||
) | ||
or | ||
// non-symbol key | ||
exists(CfgNodes::ExprNodes::PairCfgNode pair, CfgNodes::ExprCfgNode key, ConstantValue cv | | ||
node1.asExpr() = pair.getValue() and | ||
pair = call.getAnArgument() and | ||
key = pair.getKey() and | ||
cv = key.getConstantValue() and | ||
not cv.isSymbol(_) and | ||
c.isSingleton(TKnownElementContent(cv)) | ||
) | ||
) | ||
storeStepCommon(node1, c, node2) | ||
} | ||
|
||
/** | ||
|
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.