# Amorphous Program Slicing through Partial Evaluation David Binkley & Kyle Sluder Loyola College in Maryland 4501 N. Charles St. Baltimore, MD 21210.

## Presentation on theme: "Amorphous Program Slicing through Partial Evaluation David Binkley & Kyle Sluder Loyola College in Maryland 4501 N. Charles St. Baltimore, MD 21210."— Presentation transcript:

Amorphous Program Slicing through Partial Evaluation David Binkley & Kyle Sluder Loyola College in Maryland 4501 N. Charles St. Baltimore, MD 21210

Agenda BackgroundFundamentalsMethodResults Conclusions & Future Work

Background Traditional slicing Projection of program given criterion Projection of program given criterion Criterion: (line #, {variables}) Criterion: (line #, {variables}) Preserves syntax Preserves syntax 1.int foo() 2.{ 3. int x, y, z; 4. x = 20; 5. y = x + 10; 6. z = 30; 7. return x + y + z; 8.} Criterion: (6, {z})

Background Traditional slicing domains Static Static Not concerned with program’s input Dynamic Dynamic Modifies slice based on input

Background Amorphous slicing Not syntax-preserving (biggest advantage) Not syntax-preserving (biggest advantage) No distinction between static and dynamic No distinction between static and dynamic 1.int foo() 2.{ 3. int x, y, z; 4. x = 20; 5. y = x + 10; 6. z = 30; 7. return x + y + z; 8.} 1.int foo() 2.{ 3. int z = 30; 4. return z; 5.}

Background Syntax Preservation Specialized for input Traditional static slicingTraditional dynamic slicing Amorphous slicing(N/A) All1 No Yes

Background Applications of Slicing Debugging: original use Debugging: original use Program proving Program proving Refactoring Refactoring Program/algorithm analysis Program/algorithm analysis

Background What is partial evaluation? Applications Optimization Optimization Program (pre)compilation Program (pre)compilation Refactoring Refactoring Program proving/analysis Program proving/analysis

Fundamentals Based on similarity of partial evaluation and amorphous slicing Foundation (Harman et al.) Foundation (Harman et al.) Application (Silva and Vidal) Application (Silva and Vidal) Applied to C No longer in the realm of functional programming No longer in the realm of functional programming A lot harder to do successfully A lot harder to do successfully

Method 1.Pre-processing Use TXL to extract variables to global scope Use TXL to extract variables to global scope 2.Partially evaluate Prepare configuration file (provide criterion) Prepare configuration file (provide criterion) Run Tempo Run Tempo 3.Slice Use CodeSurfer 4.Post-process Use TXL for cleanup

Results Computation example Program needs to compute statistics on array of integers Program needs to compute statistics on array of integers Program exhibits bug in average Program exhibits bug in average

Results

Results Traditional slice not helpful Syntactic-preservation constraint inhibits efficacy Syntactic-preservation constraint inhibits efficacy Only shows what is already known: biggest is not involved in computation of average 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 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 Sum must therefore not be receiving the right value

Results Safety slicing Array bounds safety Array bounds safety Artificially insert assignments to variable “safe” before array access Artificially insert assignments to variable “safe” before array access Assert safe = T at end Assert safe = T at end

Results

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.

Download ppt "Amorphous Program Slicing through Partial Evaluation David Binkley & Kyle Sluder Loyola College in Maryland 4501 N. Charles St. Baltimore, MD 21210."

Similar presentations