Post on 16-Dec-2015
1
Precise Dynamic Slicing Precise Dynamic Slicing AlgorithmsAlgorithms
Xiangyu Zhang, Rajiv Gupta and Xiangyu Zhang, Rajiv Gupta and Youtao ZhangYoutao Zhang
Presented By: Krishna BalasubramanianPresented By: Krishna Balasubramanian
2
SlicingSlicing TechniquesTechniques??
Dynamic SlicingDynamic Slicing Isolates unique statements computing variable
for given inputs Criteria: <i, v, n>Criteria: <i, v, n>
Static Slicing Static Slicing Isolates all possible statements computing a
particular variable Criteria: <v, n>
3
Example – Data dependencesExample – Data dependences
Static Slice <10, z> = {1, 2, 3, 4, 7, 8, 9, 10}Static Slice <10, z> = {1, 2, 3, 4, 7, 8, 9, 10} Dynamic Slice <input, variable, execution point>Dynamic Slice <input, variable, execution point>
<N=1, z, 10<N=1, z, 1011> = {3, 4, 9, 10}> = {3, 4, 9, 10}
4
Slice Sizes: Static vs DynamicSlice Sizes: Static vs Dynamic
ProgramProgram StatementStatementss
StaticStatic DynamicDynamic Static/Static/DynamicDynamic
126.gcc126.gcc 585,491585,491 51,098 51,098 6,6146,614
7.727.72
099.go099.go 95,45995,459 16,941 16,941 5,3825,382
3.143.14
134.perl134.perl 116,182116,182 5,242 5,242 765765
6.856.85
130.li130.li 31,82931,829 2,450 2,450 206206
11.8911.89
008.express008.expressoo
74,03974,039 2,353 2,353 350350
6.726.72 Static slicing gives huge slicesStatic slicing gives huge slices On an average, static slices much largerOn an average, static slices much larger
5
Precise Dynamic SlicingPrecise Dynamic Slicing
Data dependences exercised during program Data dependences exercised during program execution captured precisely and savedexecution captured precisely and saved
Only dependences occurring in a Only dependences occurring in a specific specific execution of program are consideredexecution of program are considered
Dynamic slices constructed upon users requests Dynamic slices constructed upon users requests by traversing captured dynamic dependence by traversing captured dynamic dependence informationinformation
Limitation : Costly to computeLimitation : Costly to compute
6
Imprecise Dynamic SlicingImprecise Dynamic Slicing
Reduces cost of slicing Reduces cost of slicing
Found to greatly increase slice sizesFound to greatly increase slice sizes
Reduces effectivenessReduces effectiveness
Worthwhile to use precise algorithmsWorthwhile to use precise algorithms
7
Precise vs Imprecise: Slice SizePrecise vs Imprecise: Slice Size
Implemented two imprecise algorithms: Algorithm Implemented two imprecise algorithms: Algorithm I and Algorithm III and Algorithm II
Imprecise increases the Slice SizeImprecise increases the Slice Size Algorithm II better than Algorithm IAlgorithm II better than Algorithm I
8
Precise Dynamic Slicing - Precise Dynamic Slicing - ApproachApproach
Program executedProgram executed
Execution trace collectedExecution trace collected
PDS involves:PDS involves: Preprocessing:Preprocessing:
Builds dependence graph by recovering dynamic Builds dependence graph by recovering dynamic dependences from program’s execution tracedependences from program’s execution trace
SlicingSlicing Computes slices for given slicing requests by Computes slices for given slicing requests by
traversing dynamic dependence graphtraversing dynamic dependence graph
9
3 Algorithms Proposed3 Algorithms Proposed
Full preprocessing (FP) – Builds entire Full preprocessing (FP) – Builds entire dependence graph before slicingdependence graph before slicing
No preprocessing (NP)No preprocessing (NP) No preprocessing performedNo preprocessing performed Does demand driven analysis during slicing Does demand driven analysis during slicing Caches the recovered dependenciesCaches the recovered dependencies
Limited preprocessing (LP)Limited preprocessing (LP) Adds summary info to execution traceAdds summary info to execution trace Uses demand driven analysis to recover dynamic Uses demand driven analysis to recover dynamic
dependences from compacted execution tracedependences from compacted execution trace
What do you think is better and What do you think is better and why?why?
10
ComparisonComparison
FP algorithm impractical for real programsFP algorithm impractical for real programs Runs out of memory during preprocessing Runs out of memory during preprocessing
phasephase Dynamic dependence graphs extremely largeDynamic dependence graphs extremely large
NP algorithm does not run out of memory NP algorithm does not run out of memory but is slowbut is slow
LP algorithm is practicalLP algorithm is practical Never runs out of memoryNever runs out of memory FastFast
11
1)1) Full PreprocessingFull Preprocessing
Edges corresponding to data dependences Edges corresponding to data dependences extracted from execution trace extracted from execution trace
Added to statement level control flow graphAdded to statement level control flow graph
Execution instances labeled on graphExecution instances labeled on graph
Uses instance labels during slicingUses instance labels during slicing
Only relevant edges traversedOnly relevant edges traversed
12
FP - ExampleFP - Example Load to store edge on left Load to store edge on left
labeled (1,1)labeled (1,1)
Load to store edge on right Load to store edge on right labeled (2,1)labeled (2,1)
11stst/2/2ndnd instance of load’s instance of load’s execution gets value from 1execution gets value from 1stst instance of execution of store instance of execution of store on the left/righton the left/right
When load included in When load included in dynamic slice, not necessary dynamic slice, not necessary to include both stores in to include both stores in dynamic slice.dynamic slice.
Instance LabelsInstance Labels
13
FP - Example
14
FP - ExampleFP - Example Dynamic data dependence edges shownDynamic data dependence edges shown
Edges labeled with execution instances of statements Edges labeled with execution instances of statements involved in data dependencesinvolved in data dependences
Data dependence edges traversed during slice computation Data dependence edges traversed during slice computation of Z used in the only execution of statement 16 is:of Z used in the only execution of statement 16 is:
(16(1611, 14, 1433), (14), (1433, 13, 1322), (13), (1322, 12, 1222), (13), (1322, 15, 1533),),
(15(1533, 3, 311), (15), (1533, 15, 1522), (15), (1522, 3, 311), (15), (1522, 15, 1511),),
(15(1511, 3, 311), (15), (1511, 4, 411) )
Precise dynamic slice computed is:Precise dynamic slice computed is:
DS<x=6, z, 16DS<x=6, z, 1611> = {16,14,13,12,4,15,3}> = {16,14,13,12,4,15,3}
Compute the slice corresponding to the value of x used Compute the slice corresponding to the value of x used during the first execution of statement 15 ?? during the first execution of statement 15 ??
DS <x=6, x, 15DS <x=6, x, 1511> = Slice {4,15}> = Slice {4,15}
15
2) No Preprocessing2) No Preprocessing
Demand driven analysis to recover dynamic Demand driven analysis to recover dynamic dependencesdependences
Requires less storage compared to FPRequires less storage compared to FP
Takes more timeTakes more time
Caching used to avoid repetitive computationsCaching used to avoid repetitive computations
Cost of maintaining cache vs repeated Cost of maintaining cache vs repeated recovery of same dependences from tracerecovery of same dependences from trace
16
NP ExampleNP Example
No dynamic data dependence No dynamic data dependence edges present initiallyedges present initially
To compute slice for z at only To compute slice for z at only execution of st 16:execution of st 16: single backward traversal of trace single backward traversal of trace
(16(1611, 14, 1433), (14), (1433, 13, 1322), (13), (1322, 12, 1222), (13), (1322, 15, 1533),),
(15(1533, 3, 311), (15), (1533, 15, 1522), (15), (1522, 3, 311), (15), (1522, 15, 1511),),
(15(1511, 3, 311), (15), (1511, 4, 411) extracted) extracted
17
NP with CacheNP with Cache
Data dependence edges added to program Data dependence edges added to program flow graphflow graph
Compute slice for use of x in 3rd instance Compute slice for use of x in 3rd instance of st 14of st 14 All dependences required already present in graph All dependences required already present in graph Trace not reexaminedTrace not reexamined
Compute slice for use of x by 2nd instance Compute slice for use of x by 2nd instance of st 10of st 10 Trace traversed againTrace traversed again Additional dynamic data dependences extractedAdditional dynamic data dependences extracted
18
3) Limited Preprocessing3) Limited Preprocessing
LP strikes a balance b/w preprocessing & LP strikes a balance b/w preprocessing & slicing costsslicing costs Limited preprocessing of traceLimited preprocessing of trace Augments trace with summary informationAugments trace with summary information Faster traversal of augmented traceFaster traversal of augmented trace Demand driven analysis to compute slice using Demand driven analysis to compute slice using
augmented traceaugmented trace
Addresses Addresses Space problems of FPSpace problems of FP Time problems of NPTime problems of NP
19
LP – ApproachLP – Approach Trace divided into trace blocksTrace divided into trace blocks
Each trace block of fixed Each trace block of fixed sizesize
Store summary of all downward exposed Store summary of all downward exposed definitions of variable names & memory definitions of variable names & memory addresses addresses
Look for variable definition in summary of Look for variable definition in summary of downward exposed definitionsdownward exposed definitions
If definition found, traverse trace block to locate If definition found, traverse trace block to locate itit
Else, use Else, use sizesize information to skip to start of trace information to skip to start of trace blockblock
20
EvaluationEvaluation
Execution traces on 3 different input sets for Execution traces on 3 different input sets for each benchmark computedeach benchmark computed
Computed 25 different slices for each Computed 25 different slices for each execution traceexecution trace
Slices computed wrt end of program’s Slices computed wrt end of program’s execution (@ End)execution (@ End)
Computed 25 slices at an additional point in Computed 25 slices at an additional point in program’s execution (@ midpoint) for 1program’s execution (@ midpoint) for 1stst input input
21
Results – Slice sizesResults – Slice sizes
PDS Sizes for additional InputPDS Sizes for additional Input
PDS sizes for 2PDS sizes for 2ndnd & 3 & 3rdrd program inputs for @ End are shown program inputs for @ End are shown
No. of statements in dynamic slice is small fraction of statements No. of statements in dynamic slice is small fraction of statements executedexecuted
Different inputs give similar observationsDifferent inputs give similar observations
Thus, Dynamic slicing is effective across different inputsThus, Dynamic slicing is effective across different inputs
22
Evaluation - Slice computation timesEvaluation - Slice computation times
Compared FP, NPwoC, NPwC, and LP Compared FP, NPwoC, NPwC, and LP
Cumulative execution time in seconds as slices Cumulative execution time in seconds as slices are computed one by one is shownare computed one by one is shown
Graphs include both preprocessing times & Graphs include both preprocessing times & slice computation timesslice computation times
23
Execution TimesExecution Times
24
ObservationsObservations FP rarely runs to completionFP rarely runs to completion
Mostly runs out of memoryMostly runs out of memory
NPwoC, NPwC and LP successfulNPwoC, NPwC and LP successful
Makes computation of PDS feasibleMakes computation of PDS feasible
NPwoC shows linear increase in cumulative NPwoC shows linear increase in cumulative exec time with no. of slicesexec time with no. of slices
LP cumulative exec time rises much more LP cumulative exec time rises much more slowly than NPwoC and NPwCslowly than NPwoC and NPwC
25
ObservationsObservations
Exec times of LP are Exec times of LP are 1.13 to 3.43 times < 1.13 to 3.43 times < than NPthan NP
Due to % of trace Due to % of trace blocks skipped by LPblocks skipped by LP
Shows that limited Shows that limited preprocessing does preprocessing does pay offpay off
Cumulative times: NP vs Cumulative times: NP vs LPLP
Trace Blocks skipped by Trace Blocks skipped by LPLP
26
LP (Precise) vs Algorithm II LP (Precise) vs Algorithm II (Imprecise)(Imprecise)
Slice Sizes:Slice Sizes: Slices computed by LP 1.2 to 17.33 times Slices computed by LP 1.2 to 17.33 times
smaller than imprecise data slices of smaller than imprecise data slices of Algorithm IIAlgorithm II
Relative performance was similarRelative performance was similar
Execution Times:Execution Times: @ End, total time taken by LP 0.55 to 2.02 @ End, total time taken by LP 0.55 to 2.02
times Algorithm IItimes Algorithm II @ Midpoint, total time taken by LP is 0.51 to @ Midpoint, total time taken by LP is 0.51 to
1.86 times Algorithm II1.86 times Algorithm II
27
ResultsResults
Both have no memory problemsBoth have no memory problems
Smaller slice sizes for LPSmaller slice sizes for LP
For large slices, execution time greater than For large slices, execution time greater than impreciseimprecise
For small slices, execution time less than For small slices, execution time less than impreciseimprecise
28
SummarySummary
Precise LP algorithm performs the bestPrecise LP algorithm performs the best
Imprecise dynamic slicing algorithms are too Imprecise dynamic slicing algorithms are too imprecise, hence not an attractive optionimprecise, hence not an attractive option
LP algorithm is practicalLP algorithm is practical
Provides Precise Dynamic Slices at reasonable Provides Precise Dynamic Slices at reasonable space and time costsspace and time costs
29
Thank you!Thank you!