Constraint based analysis Flashcards

1
Q

Benefits of constraint based analysis

A

Separates analysis specs from implementation. Hence analysis writer focuses on what rather than on how.

Another benefit of constraint-based analysis is that it yields natural program
specifications: just like types in a type system, constraints are usually defined locally,
and solving their conjunction captures global properties about the program.
Finally, the modularization of the program analysis task into a specification and an
implementation sub-problem allows the specification to be agnostic of the
implementation. In other words, we can leverage powerful, off-the-shelf constraint
solvers in a “plug-and-play” manner, giving us flexibility that would otherwise not be
available.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Datalog

A

a constraint language.

Datalog is a declarative logic programming language.
It is not a Turing-complete language: it can be viewed as a subset of Prolog, or as
SQL with recursion. Efficient algorithms exist to evaluate programs in these
languages, so there exist efficient algorithms to evaluate Datalog programs.
Datalog originated as a query language for deductive databases. It was later applied in
many other domains, including software analysis, data mining, networking, security,
knowledge representation, and cloud computing among others.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Two static analyses in Datalog

A

an intra-procedural analysis in Datalog, that is, an
analysis that is restricted to a single procedure. How to
specify computing reaching definitions.

an inter-procedural analysis in Datalog, that is, an
analysis of a program involving multiple procedures. How
to specify computing points-to information.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

intra-procedural dataflow analysis

A

The specification of reaching definitions analysis is as follows:
OUT[n] = (IN[n] - KILL[n]) ∪ GEN[n]
IN[n] = U n’ ∈ predecessors[n] OUT[n’]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

KILL[n]

A

set of definitions killed at program point n

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

GEN[n]

A

the set of
definitions generated at program point n

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

predecessors(n)

A

the set of program
points that immediately precede program point n in the input procedure’s control-flow
graph.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

define the relation kill(n:N, d:D)

A

the definition d is in the KILL set
of program point n …
the relation gen(n:N, d:D) to mean that the definition d is in the GEN set of program
point n …

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

the relation gen(n:N, d:D)

A

the definition d is in the GEN set of program
point n …

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

next(n:N, m:N)

A

that program point m is an immediate
successor of program point n, or equivalently, that program point n is an immediate
predecessor of program point m.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

in(n:P, d:D)

A

the relation that asserts that the
definition d is a member of the IN set of program point n—that is, definition d may
reach the program point just before n …

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

out(n:P, d:D)

A

definition d is a member of the OUT
set of program point n—that is, definition d may reach the program point just after n.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

rules of inference to compute the IN and OUT sets.

A

out(n, d) :- gen(n, d).
out(n, d) :- in(n, d), !kill(n, d).
in(m, d) :- out(n, d), next(n, m).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly