amorphous program slicing through partial evaluation
DESCRIPTION
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 - PowerPoint PPT PresentationTRANSCRIPT
Amorphous Program Slicing Amorphous Program Slicing through Partial Evaluationthrough Partial Evaluation
David Binkley & Kyle SluderDavid Binkley & Kyle SluderLoyola College in MarylandLoyola College in Maryland
4501 N. Charles St.4501 N. Charles St.Baltimore, MD 21210Baltimore, MD 21210
AgendaAgenda
BackgroundBackground
FundamentalsFundamentals
MethodMethod
ResultsResults
Conclusions & Future WorkConclusions & Future Work
BackgroundBackground
Traditional slicingTraditional slicing Projection of program Projection of program
given criteriongiven criterion Criterion: (line #, Criterion: (line #,
{variables}){variables}) Preserves syntaxPreserves syntax
1.1. int foo()int foo()
2.2. {{
3.3. int x, y, z;int x, y, z;
4.4. x = 20;x = 20;
5.5. y = x + 10;y = x + 10;
6.6. z = 30;z = 30;
7.7. return x + y + z;return x + y + z;
8.8. }}
Criterion: (6, {z})
BackgroundBackground
Traditional slicing domainsTraditional slicing domains StaticStatic
Not concerned with program’s inputNot concerned with program’s input DynamicDynamic
Modifies slice based on inputModifies slice based on input
BackgroundBackground
Amorphous slicingAmorphous slicing Not syntax-preserving Not syntax-preserving
(biggest advantage)(biggest advantage) No distinction between No distinction between
static and dynamicstatic and dynamic
1.1. int foo()int foo()
2.2. {{
3.3. int x, y, z;int x, y, z;
4.4. x = 20;x = 20;
5.5. y = x + 10;y = x + 10;
6.6. z = 30;z = 30;
7.7. return x + y + z;return x + y + z;
8.8. }}
1.1. int foo()int foo()
2.2. {{
3.3. int z = 30;int z = 30;
4.4. return z;return z;
5.5. }}
BackgroundBackgroundS
ynta
x P
rese
rvat
ion
Specialized for input
Traditional static slicing Traditional dynamic slicing
Amorphous slicing (N/A)
All 1
No
Yes
BackgroundBackground
Applications of SlicingApplications of Slicing Debugging: original useDebugging: original use Program provingProgram proving RefactoringRefactoring Program/algorithm analysisProgram/algorithm analysis
BackgroundBackground
What is partial evaluation?What is partial evaluation?
ApplicationsApplications OptimizationOptimization Program (pre)compilationProgram (pre)compilation RefactoringRefactoring Program proving/analysisProgram proving/analysis
FundamentalsFundamentals
Based on similarity of partial evaluation Based on similarity of partial evaluation and amorphous slicingand amorphous slicing Foundation (Harman et al.)Foundation (Harman et al.) Application (Silva and Vidal)Application (Silva and Vidal)
Applied to CApplied to C No longer in the realm of functional No longer in the realm of functional
programmingprogramming A lot harder to do successfullyA lot harder to do successfully
MethodMethod
1.1. Pre-processingPre-processing Use TXL to extract Use TXL to extract
variables to global variables to global scopescope
2.2. Partially evaluatePartially evaluate Prepare configuration Prepare configuration
file (provide criterion)file (provide criterion) Run TempoRun Tempo
3.3. SliceSlice Use CodeSurferUse CodeSurfer
4.4. Post-processPost-process Use TXL for cleanupUse TXL for cleanup
ResultsResults
Computation exampleComputation example Program needs to Program needs to
compute statistics on compute statistics on array of integersarray of integers
Program exhibits bug Program exhibits bug in averagein average
ResultsResults
ResultsResults
Traditional slice not helpfulTraditional slice not helpful Syntactic-preservation constraint inhibits efficacySyntactic-preservation constraint inhibits efficacy Only shows what is already known: biggest is not Only shows what is already known: biggest is not
involved in computation of averageinvolved in computation of average
Amorphous slice helpfulAmorphous slice helpful Shows that average is not built correctly: does not rely Shows that average is not built correctly: does not rely
on sum, despite its presence in original programon sum, despite its presence in original program Sum must therefore not be receiving the right valueSum must therefore not be receiving the right value
ResultsResults
Safety slicingSafety slicing Array bounds safetyArray bounds safety Artificially insert assignments to variable Artificially insert assignments to variable
“safe” before array access“safe” before array access Assert safe = T at endAssert safe = T at end
ResultsResults
Conclusions and Future WorkConclusions and Future Work
Amorphous slicing is possible for CAmorphous slicing is possible for C
Partial evaluation is very viable method for Partial evaluation is very viable method for achieving that goalachieving that goal
Need more examples of efficacyNeed more examples of efficacy
Explore relationship between conditioned Explore relationship between conditioned slicing and “static” variables from P.E. slicing and “static” variables from P.E. perspectiveperspective
This work is supported by National Science Founda-tion grant CCR0305330. Kyle Sluder is supported bythe Loyola College in Maryland Hauber Fellowship.