Upload
licia
View
70
Download
0
Embed Size (px)
DESCRIPTION
Graph-Less Dynamic Dependence-Based Dynamic Slicing Algorithms. Árpád Beszédes , T amás Gergely and Tibor Gyimóthy University of Szeged , Hungary. SCAM ’06, Philadelphia, PA, USA. Dynamic Slicing. Algorithms need to read the execution trace - PowerPoint PPT Presentation
Citation preview
Software Engineering Department
Graph-Less Dynamic Dependence-Based
Dynamic Slicing Algorithms
Árpád Beszédes, Tamás Gergelyand Tibor Gyimóthy
University of Szeged, Hungary
SCAM’06, Philadelphia, PA, USA
6th International Workshop on Source Code Analysis and Manipulation, SCAM'06 227-29 September 2006
University of Szeged – Software Engineering Department
Dynamic Slicing Algorithms need to read the execution trace
For an accurate result, it needs to be fine-grained This implies Gigabytes for its size An algorithm with proportional space requirements is bad!
Dynamic Dependence Graph Size of the DDG: number of statements executed Global preprocessing prior to slicing
For different purposes, specialized data structures can be used instead of the DDG More efficient algorithms based on the same (syntactic)
dependences We give 6 new algorithms that compute the same slices
6th International Workshop on Source Code Analysis and Manipulation, SCAM'06 327-29 September 2006
University of Szeged – Software Engineering Department
Algorithm Framework
Program Def-use Tracefor input a=1
1. read(a) 2. y=0 3. x=1 4. while(a>0)5. y=x 6. x=2 7. a=a-1 8. z=y
a : y : x : p : {a}y : {x,p}x : {p}a : {a,p}z : y
11 read(a)22 y=033 x=144 while(a>0)55 y=x66 x=277 a=a-148 while(a>0)89 z=y
control dependence
Two inputs, 6 different algorithms
6th International Workshop on Source Code Analysis and Manipulation, SCAM'06 427-29 September 2006
University of Szeged – Software Engineering Department
Demand-Driven AlgorithmsTrace+D/U → DDG
11 read(a) a:22 y=0 y:33 x=1 x:44 while(a>0) p:{a}55 y=x y:{x,p}66 x=2 x:{p}77 a=a-1 a:{a,p}48 while(a>0) p:{a}89 z=y z:y
Backward demand-driven slicing Go backward Maintain not yet processed
actions in a worklist
Forward demand-driven slicing Go forward Mark & unmark live variables
Trace traversal: Action-by-action (inefficient) Jumping to relevant actions
Backward slicing criterion: (89, y)Forward slicing criterion: (11, a)
6th International Workshop on Source Code Analysis and Manipulation, SCAM'06 527-29 September 2006
University of Szeged – Software Engineering Department
More slices simultaneously? When we traverse the trace for demand-driven slicing,
Many dependences are visited that could be “reused” More demand-driven slicing? The same dependences are traversed
multiple times This is a “no preprocessing” approach. Improvements:
Compressing the trace Not going action-by-action, but by skipping to relevant trace points Why not compute more (all) slices?
Naïve method: executing many demand-driven algorithms, virtually “in parallel” Need to store all slices in the memory until the end/start of trace See later…
6th International Workshop on Source Code Analysis and Manipulation, SCAM'06 627-29 September 2006
University of Szeged – Software Engineering Department
Global Algorithms A better approach: computing all slices globally
By traversing the trace in a reverse way than the slicing direction Dual algorithms:
Backward slices: use “historical data” forward processing
Forward slices: use “future data” backward processing
trace123…
Slices may by outputted instantly!
trace123… Slices may by outputted instantly!
6th International Workshop on Source Code Analysis and Manipulation, SCAM'06 727-29 September 2006
University of Szeged – Software Engineering Department
Global and Parallel Algorithms Global for backward slices
Dynamic dependence set (of instruction numbers) for each variable Global for forward slices
Live set (of instruction numbers) for each variable Slices can be outputted instantly All slices are produced a.k.a. full preprocessing
Parallel for forward slices Similar to global for backward slices, but stores actions in the sets
Parallel for backward slices Similar to global for forward slices, but stores actions in the sets
Slices can be outputted at the end only
6th International Workshop on Source Code Analysis and Manipulation, SCAM'06 827-29 September 2006
University of Szeged – Software Engineering Department
Summary of AlgorithmsNo. Global / Demand-
drivenSlice direction
Processing direction
Useful?
0 Demand-driven Backward Backward Practical
1 Demand-driven Backward Forward Unfeasible
2 Demand-driven Forward Backward Unfeasible
3 Demand-driven Forward Forward Practical
4 Global Backward Backward Parallel
5 Global Backward Forward Practical
6 Global Forward Backward Practical
7 Global Forward Forward Parallel
C
C, Java, GCC/GDB
Java
6th International Workshop on Source Code Analysis and Manipulation, SCAM'06 927-29 September 2006
University of Szeged – Software Engineering Department
Discussion and Open Issues Our implementation for C (src instrumentation & GDB) :
Global and Demand-driven for backward slices For Java (VM instrumentation):
Global for backward and parallel for forward slices Parallel algorithms only with some relaxation Which one to use, and when?
Difficult to answer According to our experiments: if at least 10-20 slices are needed, the
global method is more appropriate (trace-to-iteration ratio) Global algorithms are good for e.g. experimentation with Union slices
To-do: Elaboration on complexities Possibilities for enhancement (for real languages) Implementation and empirical investigation