cache the remainder of the pointsto layer

This commit is contained in:
Erik Krogh Kristensen
2021-12-10 21:30:46 +01:00
parent 79da0970cc
commit 88e896992e

View File

@@ -274,7 +274,6 @@ module PointsToInternal {
}
/** Holds if `var` refers to `(value, origin)` given the context `context`. */
pragma[noinline]
cached
predicate variablePointsTo(
EssaVariable var, PointsToContext context, ObjectInternal value, CfgOrigin origin
@@ -924,6 +923,7 @@ private module InterModulePointsTo {
}
}
cached
module InterProceduralPointsTo {
cached
predicate call(CallNode call, PointsToContext caller, ObjectInternal value) {
@@ -938,7 +938,7 @@ module InterProceduralPointsTo {
PointsToInternal::pointsTo(call.getFunction(), caller, value, _)
}
pragma[noinline]
cached
predicate call_points_to(
CallNode f, PointsToContext context, ObjectInternal value, ControlFlowNode origin
) {
@@ -987,7 +987,7 @@ module InterProceduralPointsTo {
}
/** Points-to for parameter. `def foo(param): ...`. */
pragma[noinline]
cached
predicate parameter_points_to(
ParameterDefinition def, PointsToContext context, ObjectInternal value, ControlFlowNode origin
) {
@@ -1034,6 +1034,7 @@ module InterProceduralPointsTo {
)
}
cached
predicate selfMethodCall(
SelfCallsiteRefinement def, PointsToContext caller, Function func, PointsToContext callee
) {
@@ -1104,6 +1105,7 @@ module InterProceduralPointsTo {
* that the number of position arguments (including expansion of `*` argument) exceeds the number of positional arguments by
* `length` and that the excess arguments start at `start`.
*/
cached
predicate varargs_tuple(
CallNode call, PointsToContext caller, Function scope, PointsToContext callee, int start,
int length
@@ -1117,7 +1119,7 @@ module InterProceduralPointsTo {
}
/** Holds if for function scope `func` in context `callee` the `*` parameter will hold the empty tuple. */
predicate varargs_empty_tuple(Function func, PointsToContext callee) {
private predicate varargs_empty_tuple(Function func, PointsToContext callee) {
exists(CallNode call, PointsToContext caller, int parameter_offset |
callsite_calls_function(call, caller, func, callee, parameter_offset) and
func.getPositionalParameterCount() - parameter_offset >=
@@ -1136,6 +1138,7 @@ module InterProceduralPointsTo {
* Holds if the `n`th argument in call `call` with context `caller` points-to `value` from `origin`, including values in tuples
* expanded by a `*` argument. For example, for the call `f('a', *(`x`,`y`))` the arguments are `('a', 'x', y')`
*/
cached
predicate positional_argument_points_to(
CallNode call, int n, PointsToContext caller, ObjectInternal value, ControlFlowNode origin
) {
@@ -1163,7 +1166,7 @@ module InterProceduralPointsTo {
}
/** Holds if the parameter definition `def` points-to `value` from `origin` given the context `context` */
predicate positional_parameter_points_to(
private predicate positional_parameter_points_to(
ParameterDefinition def, PointsToContext context, ObjectInternal value, ControlFlowNode origin
) {
exists(CallNode call, int argument, PointsToContext caller, Function func, int offset |
@@ -1312,7 +1315,7 @@ module InterProceduralPointsTo {
* `var = ...; foo(); use(var)`
* Where var may be redefined in call to `foo` if `var` escapes (is global or non-local).
*/
pragma[inline]
cached
predicate callsite_points_to(
CallsiteRefinement def, PointsToContext context, ObjectInternal value, CfgOrigin origin
) {