mirror of
https://github.com/github/codeql.git
synced 2025-12-20 02:44:30 +01:00
Python: Prevent bad joins
Adds a few unbinds to prevent bad joins from occurring. Firstly, we never want to join `StepSummary::step` with `TypeTracker::append` on `summary` as the first join, as the resulting relation is absolutely massive. So we decouple the two occurrences of `summary` by unbinding each of them. Secondly, in some cases the node we're stepping to (`nodeTo` for type trackers, `nodeFrom` for type backtrackers) will get joined eagerly with the typetracker one is defining, and again this produces an uncomfortably large intermediate join. A bit of unbinding prevents this as well.
This commit is contained in:
@@ -227,8 +227,8 @@ class TypeTracker extends TTypeTracker {
|
||||
pragma[inline]
|
||||
TypeTracker step(LocalSourceNode nodeFrom, LocalSourceNode nodeTo) {
|
||||
exists(StepSummary summary |
|
||||
StepSummary::step(nodeFrom, nodeTo, summary) and
|
||||
result = this.append(summary)
|
||||
StepSummary::step(nodeFrom, pragma[only_bind_out](nodeTo), pragma[only_bind_into](summary)) and
|
||||
result = this.append(pragma[only_bind_into](summary))
|
||||
)
|
||||
}
|
||||
|
||||
@@ -370,8 +370,8 @@ class TypeBackTracker extends TTypeBackTracker {
|
||||
pragma[inline]
|
||||
TypeBackTracker step(LocalSourceNode nodeFrom, LocalSourceNode nodeTo) {
|
||||
exists(StepSummary summary |
|
||||
StepSummary::step(nodeFrom, nodeTo, summary) and
|
||||
this = result.prepend(summary)
|
||||
StepSummary::step(pragma[only_bind_out](nodeFrom), nodeTo, pragma[only_bind_into](summary)) and
|
||||
this = result.prepend(pragma[only_bind_into](summary))
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user