Skip to content

Commit ed794f4

Browse files
authored
Python: Soft revert TypeTrackingNode
Temporarily instates `TypeTrackingNode` as an alias of `LocalSourceNode` as having it as a separate class lead to performance regressions. In the hopes that this will be resolved in the near future, I have left the current `TypeTrackingNode` implementation in situ, but hidden inside a `FutureWork` private module.
1 parent 7fdac2a commit ed794f4

File tree

1 file changed

+41
-41
lines changed

1 file changed

+41
-41
lines changed

python/ql/src/semmle/python/dataflow/new/internal/LocalSources.qll

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -104,67 +104,67 @@ class LocalSourceNode extends Node {
104104
}
105105

106106
/**
107-
* DEPRECATED. Use `TypeTrackingNode::track` instead.
108-
*
109107
* Gets a node that this node may flow to using one heap and/or interprocedural step.
110108
*
111109
* See `TypeTracker` for more details about how to use this.
112110
*/
113111
pragma[inline]
114-
deprecated LocalSourceNode track(TypeTracker t2, TypeTracker t) { t = t2.step(this, result) }
112+
LocalSourceNode track(TypeTracker t2, TypeTracker t) { t = t2.step(this, result) }
115113

116114
/**
117-
* DEPRECATED. Use `TypeTrackingNode::backtrack` instead.
118-
*
119115
* Gets a node that may flow into this one using one heap and/or interprocedural step.
120116
*
121117
* See `TypeBackTracker` for more details about how to use this.
122118
*/
123119
pragma[inline]
124-
deprecated LocalSourceNode backtrack(TypeBackTracker t2, TypeBackTracker t) {
125-
t2 = t.step(result, this)
126-
}
120+
LocalSourceNode backtrack(TypeBackTracker t2, TypeBackTracker t) { t2 = t.step(result, this) }
127121
}
128122

129123
/**
130124
* A node that can be used for type tracking or type back-tracking.
131125
*
132126
* All steps made during type tracking should be between instances of this class.
133127
*/
134-
class TypeTrackingNode extends Node {
135-
TypeTrackingNode() {
136-
this instanceof LocalSourceNode
137-
or
138-
this instanceof ModuleVariableNode
128+
class TypeTrackingNode = LocalSourceNode;
129+
130+
/** Temporary holding ground for the `TypeTrackingNode` class. */
131+
private module FutureWork {
132+
class FutureTypeTrackingNode extends Node {
133+
FutureTypeTrackingNode() {
134+
this instanceof LocalSourceNode
135+
or
136+
this instanceof ModuleVariableNode
137+
}
138+
139+
/**
140+
* Holds if this node can flow to `nodeTo` in one or more local flow steps.
141+
*
142+
* For `ModuleVariableNode`s, the only "local" step is to the node itself.
143+
* For `LocalSourceNode`s, this is the usual notion of local flow.
144+
*/
145+
pragma[inline]
146+
predicate flowsTo(Node node) {
147+
this instanceof ModuleVariableNode and this = node
148+
or
149+
this.(LocalSourceNode).flowsTo(node)
150+
}
151+
152+
/**
153+
* Gets a node that this node may flow to using one heap and/or interprocedural step.
154+
*
155+
* See `TypeTracker` for more details about how to use this.
156+
*/
157+
pragma[inline]
158+
TypeTrackingNode track(TypeTracker t2, TypeTracker t) { t = t2.step(this, result) }
159+
160+
/**
161+
* Gets a node that may flow into this one using one heap and/or interprocedural step.
162+
*
163+
* See `TypeBackTracker` for more details about how to use this.
164+
*/
165+
pragma[inline]
166+
TypeTrackingNode backtrack(TypeBackTracker t2, TypeBackTracker t) { t2 = t.step(result, this) }
139167
}
140-
141-
/**
142-
* Holds if this node can flow to `nodeTo` in one or more local flow steps.
143-
*
144-
* For `ModuleVariableNode`s, the only "local" step is to the node itself.
145-
* For `LocalSourceNode`s, this is the usual notion of local flow.
146-
*/
147-
predicate flowsTo(Node node) {
148-
this instanceof ModuleVariableNode and this = node
149-
or
150-
this.(LocalSourceNode).flowsTo(node)
151-
}
152-
153-
/**
154-
* Gets a node that this node may flow to using one heap and/or interprocedural step.
155-
*
156-
* See `TypeTracker` for more details about how to use this.
157-
*/
158-
pragma[inline]
159-
TypeTrackingNode track(TypeTracker t2, TypeTracker t) { t = t2.step(this, result) }
160-
161-
/**
162-
* Gets a node that may flow into this one using one heap and/or interprocedural step.
163-
*
164-
* See `TypeBackTracker` for more details about how to use this.
165-
*/
166-
pragma[inline]
167-
TypeTrackingNode backtrack(TypeBackTracker t2, TypeBackTracker t) { t2 = t.step(result, this) }
168168
}
169169

170170
cached

0 commit comments

Comments
 (0)