90 likes | 109 Views
Explore efficient dynamic slicing algorithms based on dynamic dependence graph for source code analysis. Learn about demand-driven and global algorithms to compute slices effectively, enhancing software comprehension.
E N D
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
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
Two inputs, 6 different algorithms control dependence Algorithm Framework 6th International Workshop on Source Code Analysis and Manipulation, SCAM'06
Demand-Driven Algorithms • 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
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
trace 1 2 3 … Slices may by outputted instantly! trace 1 2 3 … Slices may by outputted instantly! 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 6th International Workshop on Source Code Analysis and Manipulation, SCAM'06
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
Summary of Algorithms C C, Java, GCC/GDB Java 6th International Workshop on Source Code Analysis and Manipulation, SCAM'06
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 6th International Workshop on Source Code Analysis and Manipulation, SCAM'06