Title: Effective Slicing
1Anne Mulhern Computer Sciences Department Universi
ty of Wisconsin-Madison Madison, WI
USA mulhern_at_cs.wisc.edu www.cs.wisc.edu/mulhern
2Two Correct Dynamic Slices
full slice n ? 1
read(n)
if (n 1)
x 3
?x
full slice n ? 2
y 2
if (y 2)
x 2
?x
program
read(n)
x 1
y 2
if (n 1)
x 3
y 1
if (y 2)
x 2
?x
?
?
3Union of Slices is Incorrect
full slice n ? 1,2
read(n)
y 2
if (n 1)
x 3
if (y 2)
x 2
?x
program
read(n)
x 1
y 2
if (n 1)
x 3
y 1
if (y 2)
x 2
?x
n p/s x p/s y p/s
? 1 ? ? ?
? 1 1/ ? ?
? 1 1/ ? 2 ?
? ?
? 1 3 2 ?
? 1 3 1/2
?
1 3/2 1/2 ?
3/2
4Why is This a Problem?
- Given a set of inputs that cause program failure
- Want the correct slice for all failures
- Given a flag that takes multiple values
- Want the correct slice for whenever the flag is
set, regardless of its value
5Two Correct Relevant Slices
relevant slice n ? 2
read(n)
y 2
if (n 1)
if (y 2)
x 2
?x
relevant slice n ? 1
read(n)
if (n 1)
x 3
y 1
if (y 2)
?x
program
read(n)
x 1
y 2
if (n 1)
x 3
y 1
if (y 2)
x 2
?x
?
?
6Union of Relevant Slices is Correct
relevant slice n ? 1,2
read(n)
y 2
if (n 1)
x 3
y 1
if (y 2)
x 2
?x
program
read(n)
x 1
y 2
if (n 1)
x 3
y 1
if (y 2)
x 2
?x
7We Can Slice Twice
- If we take the union of slices as our program and
slice again on the same inputs - we may get a smaller program
- Example the union of relevant slices for inputs
2 and 3
8Fixpoint Computation
relevant slice n ? 3
y 2
if (y 2)
x 2
?x
relevant slice n ? 2
y 2
if (y 2)
x 2
?x
relevant slice n ? 2,3
read(n)
y 2
if (n 1)
if (y 2)
x 2
?x
?
?
So long as n in 2,3 choice of n is unimportant
9Effective Slicing
- Dynamic slicing algorithms - two arguments
- P - the program
- s - the initial state
- Effective slicing algorithm - an additional
argument - ?? - the nodes to consider when calculating
potential dependence - effective(P, s, Ø ) full(P, s)
- effective(P, s, P) relevant(P, s)
10Effective Slicing for Approximation
- Potential dependence need only be taken into
account when the potential statement is in the
union of slices - Choose ?? to be all nodes in the union of
execution slices
11Two Correct Effective Slices
effective slice n ? 3
y 2
if (y 2)
x 2
?x
effective slice n ? 2
y 2
if (y 2)
x 2
?x
program
read(n)
x 1
y 2
if (n 1)
x 3
y 1
if (y 2)
x 2
?x
?
?
12Summary
- Unions of relevant slices are correct
- Take into account potential dependences
- Relevant slicing can be used in a fixpoint
computation - Semantic information can be extracted from the
result - Effective slicing generalizes full and relevant
slicing - Possibly potential statements are an explicit
parameter - Effective slicing can be used to find an
approximation of the fixpoint
13Future Work
- Theoretical
- How many steps to reach fixpoint?
- Practical
- How big are unions of relevant slices?
- How good an approximation can effective slicing
give? - How many dynamic semantic facts can be extracted?
- eg., what choices of initial state are irrelevant
for this subset?
14Anne Mulhern Computer Sciences Department Universi
ty of Wisconsin-Madison Madison, WI
USA mulhern_at_cs.wisc.edu www.cs.wisc.edu/mulhern