-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathExercise6.ql
More file actions
38 lines (31 loc) · 1.2 KB
/
Exercise6.ql
File metadata and controls
38 lines (31 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import java
// Replace with the solution from exercise 1
class AllocationSite extends Expr {
AllocationSite() { none() }
}
predicate alloc(LocalScopeVariable variable, AllocationSite allocationSite, Callable callable) {
// Replace with the solution from exercise 2.
any()
}
predicate move(LocalScopeVariable dest, Variable src) {
// Exercise 3: Describe how a value in `src` is moved to `dest`
none()
}
predicate store(LocalScopeVariable qualifier, Field field, LocalScopeVariable src) {
// Replace with the solution from exercise 4.
any()
}
predicate fieldPointsTo(
AllocationSite qualifierAllocationSite, Field field, AllocationSite srcAllocationSite
) {
// Exercise 6: Associate the qualifier allocation site and the source allocation site with the field.
any()
}
predicate varPointsTo(LocalScopeVariable variable, AllocationSite allocationSite) {
alloc(variable, allocationSite, _)
or
exists(LocalScopeVariable src | move(variable, src) and varPointsTo(src, allocationSite))
}
from AllocationSite qualifierAllocationSite, Field field, AllocationSite srcAllocationSite
where fieldPointsTo(qualifierAllocationSite, field, srcAllocationSite)
select qualifierAllocationSite, field, srcAllocationSite