Parametric Shape Parametric Shape Analysis via 3 Analysis via 3-
- Valued
Parametric Shape Parametric Shape Analysis via 3- -Valued Valued - - PowerPoint PPT Presentation
Parametric Shape Parametric Shape Analysis via 3- -Valued Valued Analysis via 3 Logic Logic Mooly Sagiv Sagiv, Thomas Reps, , Thomas Reps, Mooly Reinhard Wilhelm Wilhelm Reinhard Motivation Motivation Many shape analysis
Define abstraction, give transfer function, prove, implement
Choose predicate, define update formula for instrumentation predicates, prove correctness of the formulae predicates, prove correctness of the formulae
The rest is automatically done by the system
S=<U, ι ι> >
U: individuals
ι: maps p(u : maps p(u1
1,
, … …u uk
k) to 0, 1 or 1/2
) to 0, 1 or 1/2
Constituents of shape invariants that can be used to characterize a data structure characterize a data structure
Core Predicates:
Tracking Pointer Variables and Pointer-
valued fields
Common to all the shape analysis
Eg: : x(v x(v), n(v1, v2), ), n(v1, v2), sm(v sm(v) )
Properties derived from core semantics, not explicitly part
Different algorithms use different sets of instrumentation
Eg: : is(v is(v) ) (sharing), (sharing), r rx
x(v
(v) ) ( (reachability reachability) )
Defining formulae:
Questions about properties of stores can be answered by evaluating formulae: 1=>hold, 0=>doesn evaluating formulae: 1=>hold, 0=>doesn’ ’t hold t hold
A formulae can evaluate to 1, 0, or ½ ½. .
1=>hold
0=>doesn’ ’t hold t hold
½ => don => don’ ’t know t know
A way to relate 2-
valued and 3-
valued structures
S can be embedded in S’ ’: :
Surjective function f: U function f: US
S
U US
S’ ’
If S can be embedded in S’ ’, every piece of information , every piece of information extracted from S extracted from S’ ’ via a formula is a conservative via a formula is a conservative approximation of the information extracted from S. approximation of the information extracted from S.
pst st : Define the new
Trivial update formula: usually unsatisfactory
User supplied formula: need to prove it maintains correct instrumentation. instrumentation.
f.b(v
b.f(v
false => false false
true => may be true/ may be false
true => true true
false => may be true/ may be false
unbiased