revert caching of some large predicates that caused the DB size to increase too much

This commit is contained in:
Erik Krogh Kristensen
2021-12-08 21:34:49 +01:00
parent 0da80f90d3
commit 4089788629
4 changed files with 2 additions and 21 deletions

View File

@@ -18,11 +18,7 @@ abstract class AstNode extends AstNode_ {
* NOTE: For some statements and other purely syntactic elements,
* there may not be a `ControlFlowNode`
*/
cached
ControlFlowNode getAFlowNode() {
Stages::AST::ref() and
py_flow_bb_node(result, this, _, _)
}
ControlFlowNode getAFlowNode() { py_flow_bb_node(result, this, _, _) }
/** Gets the location for this AST node */
cached
@@ -58,11 +54,7 @@ abstract class AstNode extends AstNode_ {
}
/** Whether this contains `inner` syntactically */
cached
predicate contains(AstNode inner) {
Stages::AST::ref() and
this.getAChildNode+() = inner
}
predicate contains(AstNode inner) { this.getAChildNode+() = inner }
pragma[noinline]
private predicate containsInScope(AstNode inner, Scope scope) {

View File

@@ -194,9 +194,7 @@ class ControlFlowNode extends @py_flow_node {
BasicBlock getBasicBlock() { result.contains(this) }
/** Gets the scope containing this flow node */
cached
Scope getScope() {
Stages::AST::ref() and
if this.getNode() instanceof Scope
then
/* Entry or exit node */

View File

@@ -76,10 +76,6 @@ module Stages {
or
exists(any(AstExtended::AstNode n).getParentNode())
or
any(AstExtended::AstNode n).contains(_)
or
exists(any(AstExtended::AstNode n).getAFlowNode())
or
exists(any(PyFlow::BasicBlock b).getImmediateDominator())
or
any(PyFlow::BasicBlock b).strictlyDominates(_)
@@ -170,8 +166,6 @@ module Stages {
exists(any(Flow::ControlFlowNode c).toString())
or
exists(any(ObjectInternal::ObjectInternal o).toString())
or
exists(any(ObjectAPI::Value::named(_)))
}
}

View File

@@ -10,7 +10,6 @@ private import semmle.python.pointsto.PointsTo
private import semmle.python.pointsto.PointsToContext
private import semmle.python.pointsto.MRO
private import semmle.python.types.Builtins
private import semmle.python.internal.CachedStages
/*
* Use the term `ObjectSource` to refer to DB entity. Either a CFG node
@@ -264,9 +263,7 @@ module Value {
* object of that name.
* For example `Value::named("len")` is the `Value` representing the `len` built-in function.
*/
cached
Value named(string name) {
Stages::DataFlow::ref() and
exists(string modname, string attrname | name = modname + "." + attrname |
result = Module::named(modname).attr(attrname)
)