160 likes | 282 Views
Amorphous Program Slicing through Partial Evaluation. David Binkley & Kyle Sluder Loyola College in Maryland 4501 N. Charles St. Baltimore, MD 21210. Agenda. Background Fundamentals Method Results Conclusions & Future Work. Traditional slicing Projection of program given criterion
E N D
Amorphous Program Slicing through Partial Evaluation David Binkley & Kyle Sluder Loyola College in Maryland4501 N. Charles St.Baltimore, MD 21210
Agenda • Background • Fundamentals • Method • Results • Conclusions & Future Work
Traditional slicing Projection of program given criterion Criterion: (line #, {variables}) Preserves syntax int foo() { int x, y, z; x = 20; y = x + 10; z = 30; return x + y + z; } Background Criterion: (6, {z})
Background • Traditional slicing domains • Static • Not concerned with program’s input • Dynamic • Modifies slice based on input
Amorphous slicing Not syntax-preserving (biggest advantage) No distinction between static and dynamic int foo() { int x, y, z; x = 20; y = x + 10; z = 30; return x + y + z; } Background • int foo() • { • int z = 30; • return z; • }
Background Specialized for input All 1 Traditional static slicing Traditional dynamic slicing Yes Syntax Preservation Amorphous slicing (N/A) No
Background • Applications of Slicing • Debugging: original use • Program proving • Refactoring • Program/algorithm analysis
Background • What is partial evaluation? • Applications • Optimization • Program (pre)compilation • Refactoring • Program proving/analysis
Fundamentals • Based on similarity of partial evaluation and amorphous slicing • Foundation (Harman et al.) • Application (Silva and Vidal) • Applied to C • No longer in the realm of functional programming • A lot harder to do successfully
Pre-processing Use TXL to extract variables to global scope Partially evaluate Prepare configuration file (provide criterion) Run Tempo Slice Use CodeSurfer Post-process Use TXL for cleanup Method
Computation example Program needs to compute statistics on array of integers Program exhibits bug in average Results
Results • Traditional slice not helpful • Syntactic-preservation constraint inhibits efficacy • Only shows what is already known: biggest is not involved in computation of average • Amorphous slice helpful • Shows that average is not built correctly: does not rely on sum, despite its presence in original program • Sum must therefore not be receiving the right value
Results • Safety slicing • Array bounds safety • Artificially insert assignments to variable “safe” before array access • Assert safe = T at end
Conclusions and Future Work • Amorphous slicing is possible for C • Partial evaluation is very viable method for achieving that goal • Need more examples of efficacy • Explore relationship between conditioned slicing and “static” variables from P.E. perspective This work is supported by National Science Founda- tion grant CCR0305330. Kyle Sluder is supported by the Loyola College in Maryland Hauber Fellowship.