Skip to content

Commit 1fc95a6

Browse files
committed
Python: Add more type tracking QL doc
1 parent f63c1d2 commit 1fc95a6

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

python/ql/src/experimental/typetracking/TypeTracker.qll

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,21 @@ class StepSummary extends TStepSummary {
5555

5656
/** Provides predicates for updating step summaries (`StepSummary`s). */
5757
module StepSummary {
58+
/**
59+
* Gets the summary that corresponds to having taken a forwards
60+
* heap and/or intra-procedural step from `nodeFrom` to `nodeTo`.
61+
*
62+
* Steps contained in this predicate should _not_ depend on the call graph.
63+
*/
5864
cached
5965
private predicate stepNoCall(LocalSourceNode nodeFrom, LocalSourceNode nodeTo, StepSummary summary) {
6066
exists(Node mid | nodeFrom.flowsTo(mid) and smallstepNoCall(mid, nodeTo, summary))
6167
}
6268

69+
/**
70+
* Gets the summary that corresponds to having taken a forwards
71+
* inter-procedural step from `nodeFrom` to `nodeTo`.
72+
*/
6373
cached
6474
private predicate stepCall(LocalSourceNode nodeFrom, LocalSourceNode nodeTo, StepSummary summary) {
6575
exists(Node mid | nodeFrom.flowsTo(mid) and smallstepCall(mid, nodeTo, summary))
@@ -68,6 +78,12 @@ module StepSummary {
6878
/**
6979
* Gets the summary that corresponds to having taken a forwards
7080
* heap and/or inter-procedural step from `nodeFrom` to `nodeTo`.
81+
*
82+
* This predicate is inlined, which enables better join-orders when
83+
* the call graph construction and type tracking are mutually recursive.
84+
* In such cases, non-linear recursion involving `step` will be limited
85+
* to non-linear recursion for the parts of `step` that involve the
86+
* call graph.
7187
*/
7288
pragma[inline]
7389
predicate step(LocalSourceNode nodeFrom, LocalSourceNode nodeTo, StepSummary summary) {

0 commit comments

Comments
 (0)