930 likes | 1.2k Views
University of Saarland Department of Computer Science. Impact Analysis. Yury Chebiryak urriy@wjpserver.cs.uni-sb.de. Impact Analysis. is often used to assess the effects of a change after change has been made is rarely used to predict the effect of change before it is instantiated.
E N D
University of SaarlandDepartment of Computer Science Impact Analysis Yury Chebiryak urriy@wjpserver.cs.uni-sb.de
Impact Analysis • is often used to assess the effects of a change after change has been made • is rarely used to predict the effect of change before it is instantiated
Whole Program Path-Based Dynamic Impact Analysis James Law Gregg Rothermel
PathImpact • Dynamic • Call-based • Works on binaries • Relatively low cost • Relatively low overhead
Call Graph B is changed
Call Graph Assumption: change in B has a potential impact on nodes reachable from B
Execution Traces (ET) Run M() ET: M
Execution Traces Run B() ET: MB
Execution Traces Return ET: MBr
Execution Traces Run A() ET: MBrA
Execution Traces Run C() ET: MBrAC
Execution Traces Run D() ET: MBrACD
Execution Traces Return ET: MBrACDr
Execution Traces Run E() ET: MBrACDrE
Execution Traces Return ET: MBrACDrEr
Execution Traces Return ET: MBrACDrErr
Execution Traces Return ET: MBrACDrErrr
Execution Traces Return ET: MBrACDrErrrrx
Execution Traces II • Single • Multiple MBrACDrErrrrx MBrACDrErrrrxMBGrrrrxMBCFrrrrx Programs with loops => very long trace
SEQUITUR algorithm Data compression algorithm by Larus: • Online • Created grammar reproduces trace exactly • O(N) running time • O(N) size in the worst case • O(log N) size in the best case • e.g. 2GB trace → 100 MB
SEQUITUR algorithm algorithm SEQUITUR( S ) input Execution Trace S output Grammar G Grammar G Rule T 1. for each token in S 2. append token to end of production for T 3. if duplicate digram appears 4. if other occurrence is a rule g in G 5. replace new digram with non-terminal of g. 6. else 7. form a new rule and replace duplicate 8. digrams with the new non-terminal. 9. if any rule in G is used only once 10. remove the rule by substituting the production. 11. return G
SEQUITUR: example ET: MBrACDrErrrrxMBGrrrrxMBCFrrrrx
SEQUITUR: example ET:MBrACDrErrrrxMBGrrrrxMBCFrrrrx T → MBrACDrErrrrx
SEQUITUR: example ET:MBrACDrErrrrxMBGrrrrxMBCFrrrrx T → MBrACDrE x 1 → rr 1 1
SEQUITUR: example ET:MBrACDrErrrrxMBGrrrrxMBCFrrrrx T → MBrACDrE11x 1 → rr
SEQUITUR: example ET:MBrACDrErrrrxMBGrrrrxMBCFrrrrx T → MBrACDrE11xM 1 → rr
SEQUITUR: example ET:MBrACDrErrrrxMBGrrrrxMBCFrrrrx T → rACDrE11x 1 → rr MB MB
SEQUITUR: example ET:MBrACDrErrrrxMBGrrrrxMBCFrrrrx T → rACDrE11x 1 → rr 2 → MB 2 2
SEQUITUR: example ET:MBrACDrErrrrxMBGrrrrxMBCFrrrrx T → 2rACDrE11x2 1 → rr 2 → MB
SEQUITUR: example ET:MBrACDrErrrrxMBGrrrrxMBCFrrrrx T → 2rACDrE113G43CF4rx 1 → rr 2 → MB 3 → x2 4 → 1r grammar => whole path DAG
PathImpact PathImpact(E): I {E} Returns=0 I = {}
PathImpact PathImpact(E): up(T, E) Returns=0 I = {E}
PathImpact PathImpact(E): forward(1) Returns=0 I = {E}
PathImpact PathImpact(E): forward(r) Returns=0 I = {E}
PathImpact PathImpact(E): Returns++ Returns=0 I = {E}
PathImpact PathImpact(E): forward(r) Returns=1 I = {E}
PathImpact PathImpact(E): Returns++ Returns=1 I = {E}
PathImpact PathImpact(E): after forward(1) Returns=4 I = {E}
PathImpact PathImpact(E): forward(3) -> x Returns=4 I = {E}
PathImpact PathImpact(E): backward(r) Returns=4 I = {E} Skip=0
PathImpact PathImpact(E): Skip++ Returns=4 I = {E} Skip=0
PathImpact PathImpact(E): backward(D)->Skip-- Returns=4 I = {E} Skip=1
PathImpact PathImpact(E): backward(C)-> I := I U {C}, Returns-- Returns=4 I = {E} Skip=0
PathImpact PathImpact(E): backward(A)-> I := I U {A}, Returns-- Returns=3 I = {E, C} Skip=0