amorphous program slicing through partial evaluation

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

Upload: september-middleton

Post on 03-Jan-2016

30 views

Category:

Documents


1 download

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 Presentation

TRANSCRIPT

Page 1: Amorphous Program Slicing through Partial Evaluation

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

Page 2: Amorphous Program Slicing through Partial Evaluation

AgendaAgenda

BackgroundBackground

FundamentalsFundamentals

MethodMethod

ResultsResults

Conclusions & Future WorkConclusions & Future Work

Page 3: Amorphous Program Slicing through Partial Evaluation

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})

Page 4: Amorphous Program Slicing through Partial Evaluation

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

Page 5: Amorphous Program Slicing through Partial Evaluation

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. }}

Page 6: Amorphous Program Slicing through Partial Evaluation

BackgroundBackgroundS

ynta

x P

rese

rvat

ion

Specialized for input

Traditional static slicing Traditional dynamic slicing

Amorphous slicing (N/A)

All 1

No

Yes

Page 7: Amorphous Program Slicing through Partial Evaluation

BackgroundBackground

Applications of SlicingApplications of Slicing Debugging: original useDebugging: original use Program provingProgram proving RefactoringRefactoring Program/algorithm analysisProgram/algorithm analysis

Page 8: Amorphous Program Slicing through Partial Evaluation

BackgroundBackground

What is partial evaluation?What is partial evaluation?

ApplicationsApplications OptimizationOptimization Program (pre)compilationProgram (pre)compilation RefactoringRefactoring Program proving/analysisProgram proving/analysis

Page 9: Amorphous Program Slicing through Partial Evaluation

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

Page 10: Amorphous Program Slicing through Partial Evaluation

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

Page 11: Amorphous Program Slicing through Partial Evaluation

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

Page 12: Amorphous Program Slicing through Partial Evaluation

ResultsResults

Page 13: Amorphous Program Slicing through Partial Evaluation

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

Page 14: Amorphous Program Slicing through Partial Evaluation

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

Page 15: Amorphous Program Slicing through Partial Evaluation

ResultsResults

Page 16: Amorphous Program Slicing through Partial Evaluation

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.