Download presentation

Presentation is loading. Please wait.

Published byScott Payne Modified about 1 year ago

1
CS590F Software Reliability What is a slice? S: …. = f (v) Slice of v at S is the set of statements involved in computing v’s value at S. [Mark Weiser, 1982] Data dependence Control dependence Void main ( ) { int I=0; int sum=0; while (I

2
CS590F Software Reliability Static Slicing Static slice is the set of statements that COULD influence the value of a variable for ANY input. Construct static dependence graph Control dependences Data dependences Traverse dependence graph to compute slice Transitive closure over control and data dependences

3
CS590F Software Reliability Dynamic Slicing Dynamic slice is the set of statements that DID affect the value of a variable at a program point for ONE specific execution. [Korel and Laski, 1988] Execution trace control flow trace -- dynamic control dependences memory reference trace -- dynamic data dependences Construct a dynamic dependence graph Traverse dynamic dependence graph to compute slices Smaller, more precise, slices are more helpful

4
CS590F Software Reliability Slice Sizes: Static vs. Dynamic ProgramStatements Avg. of 25 slicesStatic / Dynamic StaticDynamic 126.gcc 099.go 134.perl 130.li 008.espresso 585,491 95,459 116,182 31,829 74,039 51,098 16,941 5,242 2,450 2,353 6,614 5,382 765 206 350 7.72 3.14 6.85 11.89 6.72 Static slice can be much larger than the dynamic slice

5
CS590F Software Reliability Applications of Dynamic Slicing Debugging [Korel & Laski - 1988] Detecting Spyware [Jha - 2003] Installed without users’ knowledge Software Testing [Duesterwald, Gupta, & Soffa - 1992] Dependence based structural testing - output slices. Module Cohesion [N.Gupta & Rao - 2001] Guide program structuring Performance Enhancing Transformations Instruction criticality [Ziles & Sohi - 2000] Instruction isomorphism [Sazeides - 2003] Others…

6
CS590F Software Reliability Dynamic Slicing Example - background 1: b=0 2: a=2 3: for i= 1 to N do 4: if ((i++)%2==1) then 5: a = a+1 else 6: b = a*2 endif done 7: z = a+b 8: print(z) For input N=2, 1 1 : b=0 [b=0] 2 1 : a=2 3 1 : for i = 1 to N do [i=1] 4 1 : if ( (i++) %2 == 1) then [i=1] 5 1 : a=a+1 [a=3] 3 2 : for i=1 to N do [i=2] 4 2 : if ( i%2 == 1) then [i=2] 6 1 : b=a*2 [b=6] 7 1 : z=a+b [z=9] 8 1 : print(z) [z=9]

7
CS590F Software Reliability Issues about Dynamic Slicing Precision – perfect Running history – very big ( GB ) Algorithm to compute dynamic slice - slow and very high space requirement.

8
CS590F Software Reliability Efficiency How are dynamic slices computed? Execution traces control flow trace -- dynamic control dependences memory reference trace -- dynamic data dependences Construct a dynamic dependence graph Traverse dynamic dependence graph to compute slices

9
CS590F Software Reliability The Graph Size Problem Program Statements Executed (Millions) Dynamic Dependence Graph Size(MB) 300.twolf 256.bzip2 255.vortex 197.parser 181.mcf 164.gzip 134.perl 130.li 126.gcc 099.go 140 67 108 123 118 71 220 124 131 138 1,568 1,296 1,442 1,816 1,535 835 1,954 1,745 1,534 1,707 Graphs of realistic program runs do not fit in memory.

10
CS590F Software Reliability Conventional Approaches [Agrawal &Horgan, 1990] presented three algorithms to trade-off the cost with precision. Static Analysis Precise dynamic analysis Algo.IAlgo.IIAlgo.III Cost: low high Precision: lowhigh

11
CS590F Software Reliability Algorithm One This algorithm uses a static dependence graph in which all executed nodes are marked dynamically so that during slicing when the graph is traversed, nodes that are not marked are avoided as they cannot be a part of the dynamic slice. Limited dynamic information - fast, imprecise (but more precise than static slicing)

12
CS590F Software Reliability 8181 7171 5151 4141 3131 1 2121 Algorithm I Example 1: b=0 2: a=2 3: 1 <=i <=N 4: if ((i++)%2= =1) 5: a=a+16: b=a*2 7: z=a+b 8: print(z) TF T F For input N=1, the trace is: 3232

13
CS590F Software Reliability Algorithm I Example 1: b=0 2: a=2 3: 1 <=i <=N 4: if ((i++)%2= =1) 5: a=a+16: b=a*2 7: z=a+b 8: print(z) DS={1,2,5,7,8} Precise!

14
CS590F Software Reliability Imprecision introduced by Algorithm I 4 9 7 Input N=2: for (a=1; a

15
CS590F Software Reliability Algorithm II A dependence edge is introduced from a load to a store if during execution, at least once, the value stored by the store is indeed read by the load (mark dependence edge) No static analysis is needed.

16
CS590F Software Reliability 1 2121 5151 7171 8181 3131 4141 Algorithm II Example 1: b=0 2: a=2 3: 1 <=i <=N 4: if ((i++)%2= =1) 5: a=a+16: b=a*2 7: z=a+b 8: print(z) TF T F For input N=1, the trace is:

17
CS590F Software Reliability Algorithm II – Compare to Algorithm I More precise x=… …=x Algo. I x=… …=x Algo. II

18
CS590F Software Reliability Efficiency: Summary For an execution of 130M instructions: space requirement: reduced from 1.5GB to 94MB (I further reduced the size by a factor of 5 by designing a generic compression technique [MICRO’05]). time requirement: reduced from >10 Mins to <30 seconds.

19
CS590F Software Reliability Algorithm III First preprocess the execution trace and introduces labeled dependence edges in the dependence graph. During slicing the instance labels are used to traverse only relevant edges.

20
CS590F Software Reliability Dynamic Dep. Graph Representation 3: while ( i

21
CS590F Software Reliability Dynamic Dep. Graph Representation 3: while ( i

22
CS590F Software Reliability Infer: Local Dependence Labels: Full Elimination X = Y= X X = Y= X (10,10) (20,20) (30,30) X = Y= X 10,20,30 =Y 21 (20,21)... (...,20)...

23
CS590F Software Reliability Transform: Local Dependence Labels: Elimination In Presence of Aliasing X = *P = Y= X X = *P = Y= X (10,10) (20,20) X = *P = Y= X 10,20 =Y 11,21 (20,21)...

24
CS590F Software Reliability Transform: Local Dependence Labels: Elimination In Presence of Aliasing X = *P = Y= X X = *P = Y= X (10,10) (20,20) X = *P = Y= X 10,20 X = *P = Y= X 2010 11,21 (10,11) (20,21) =Y 11,21 =Y (20,21) (10,11)

25
CS590F Software Reliability 1 2 3 45 6 78 9 10 1 2 3 4 5 6 7 2 1 3467934679 3567935679 3468934689 3568935689 1 2 3 2 1 3467934679 1 2 3 3 45 6 78 9 Transform: Coalescing Multiple Nodes into One

26
CS590F Software Reliability Group: Labels Across Non-Local Dependence Edges X = Y = = Y = X X = Y = X = Y = = Y = X X = Y = (10,21) (20,11) X = Y = = Y = X X = Y = (20,11) (10,21) 11,21 10 20

Similar presentations

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google