slicing unconditional jumps with unnecessary control
play

Slicing Unconditional Jumps with Unnecessary Control Dependencies - PowerPoint PPT Presentation

Slicing Unconditional Jumps with Unnecessary Control Dependencies Carlos Galindo Sergio P erez Josep Silva VRAIN Universitat Polit` ecnica de Val` encia, Spain 30th International Symposium on Logic-Based Program Synthesis and


  1. Slicing Unconditional Jumps with Unnecessary Control Dependencies Carlos Galindo Sergio P´ erez Josep Silva VRAIN Universitat Polit` ecnica de Val` encia, Spain 30th International Symposium on Logic-Based Program Synthesis and Transformation September 9th, 2020 C. Galindo et al. (UPV) Slicing Unconditional Jumps LOPSTR 2020 - September 9th 1 / 14

  2. Program slicing Program slicing A software analysis technique to extract the statements of a program that affect a given slicing criterion . 1 void main(int n) { 1 void main(int n) { int sum = 0; int sum = 0; 2 2 int prod = 0; int prod = 0; 3 3 int i = 0; int i = 0; 4 4 while (i < 10) { while (i < 10) { 5 5 sum += 1; sum += 1; 6 6 prod += n; prod += n; 7 7 i++; i++; 8 8 } } 9 9 log(sum); log(sum ); 10 10 log(prod ); log(prod ); 11 11 12 } 12 } C. Galindo et al. (UPV) Slicing Unconditional Jumps LOPSTR 2020 - September 9th 2 / 14

  3. Program slicing Program slicing A software analysis technique to extract the statements of a program that affect a given slicing criterion . 1 void main(int n) { 1 void main(int n) { int sum = 0; int sum = 0; 2 2 int prod = 0; int prod = 0; 3 3 int i = 0; int i = 0; 4 4 while (i < 10) { while (i < 10) { 5 5 sum += 1; sum += 1; 6 6 prod += n; prod += n; 7 7 i++; i++; 8 8 } } 9 9 log(sum); log(sum ); 10 10 log(prod ); log(prod ); 11 11 12 } 12 } C. Galindo et al. (UPV) Slicing Unconditional Jumps LOPSTR 2020 - September 9th 2 / 14

  4. Program slicing Program slicing A software analysis technique to extract the statements of a program that affect a given slicing criterion . 1 void main(int n) { 1 void main(int n) { int sum = 0; int sum = 0; 2 2 int prod = 0; int prod = 0; 3 3 int i = 0; int i = 0; 4 4 while (i < 10) { while (i < 10) { 5 5 sum += 1; sum += 1; 6 6 prod += n; prod += n; 7 7 i++; i++; 8 8 } } 9 9 log(sum); log(sum ); 10 10 log(prod ); log(prod ); 11 11 12 } 12 } C. Galindo et al. (UPV) Slicing Unconditional Jumps LOPSTR 2020 - September 9th 2 / 14

  5. Program slicing Example 1 public void f() { 1 public void f() { 1 public void f() { while (X) { while (X) { while (X) { 2 2 2 if (Y) { if (Y) { if (Y) { 3 3 3 if (Z) { if (Z) { if (Z) { 4 4 4 A; A; A; 5 5 5 break; break; break; 6 6 6 } } } 7 7 7 B; B; B; 8 8 8 break; break; break; 9 9 9 } } } 10 10 10 C; C; C; 11 11 11 } } } 12 12 12 D; D; D; 13 13 13 14 } 14 } 14 } (a) Original program (b) SDG slice (c) Minimal slice C. Galindo et al. (UPV) Slicing Unconditional Jumps LOPSTR 2020 - September 9th 3 / 14

  6. Program slicing Example 1 public void f() { 1 public void f() { 1 public void f() { while (X) { while (X) { while (X) { 2 2 2 if (Y) { if (Y) { if (Y) { 3 3 3 if (Z) { if (Z) { if (Z) { 4 4 4 A; A; A; 5 5 5 break; break; break; 6 6 6 } } } 7 7 7 B; B; B; 8 8 8 break; break; break; 9 9 9 } } } 10 10 10 C; C; C; 11 11 11 } } } 12 12 12 D; D; D; 13 13 13 14 } 14 } 14 } (a) Original program (b) SDG slice (c) Minimal slice C. Galindo et al. (UPV) Slicing Unconditional Jumps LOPSTR 2020 - September 9th 3 / 14

  7. Program slicing Example 1 public void f() { 1 public void f() { 1 public void f() { while (X) { while (X) { while (X) { 2 2 2 if (Y) { if (Y) { if (Y) { 3 3 3 if (Z) { if (Z) { if (Z) { 4 4 4 A; A; A; 5 5 5 break; break; break; 6 6 6 } } } 7 7 7 B; B; B; 8 8 8 break; break; break; 9 9 9 } } } 10 10 10 C; C; C; 11 11 11 } } } 12 12 12 D; D; D; 13 13 13 14 } 14 } 14 } (a) Original program (b) SDG slice (c) Minimal slice C. Galindo et al. (UPV) Slicing Unconditional Jumps LOPSTR 2020 - September 9th 3 / 14

  8. Program slicing The System Dependence Graph CDG CFG PDG SDG Slice DDG Figure: Sequence of graphs generated to produce a slice. Enter h() Enter h() 1 void h() { while (x < 10) while (x < 10) { 2 print(x); while (x < 10) 3 x++; 4 x++ print(x) } 5 print(x) x++ Exit h() 6 } PDG CFG Black: CDG, Red: DDG C. Galindo et al. (UPV) Slicing Unconditional Jumps LOPSTR 2020 - September 9th 4 / 14

  9. Program slicing The System Dependence Graph CDG CFG PDG SDG Slice DDG Figure: Sequence of graphs generated to produce a slice. Enter h() Enter h() 1 void h() { while (x < 10) while (x < 10) { 2 print(x); while (x < 10) 3 x++; 4 x++ print(x) } 5 print(x) x++ Exit h() 6 } PDG CFG Black: CDG, Red: DDG C. Galindo et al. (UPV) Slicing Unconditional Jumps LOPSTR 2020 - September 9th 4 / 14

  10. Program slicing The System Dependence Graph CDG CFG PDG SDG Slice DDG Figure: Sequence of graphs generated to produce a slice. Enter h() Enter h() 1 void h() { while (x < 10) while (x < 10) { 2 print(x); while (x < 10) 3 x++; 4 x++ print(x) } 5 print(x) x++ Exit h() 6 } PDG CFG Black: CDG, Red: DDG C. Galindo et al. (UPV) Slicing Unconditional Jumps LOPSTR 2020 - September 9th 4 / 14

  11. Program slicing The System Dependence Graph CDG CFG PDG SDG Slice DDG Figure: Sequence of graphs generated to produce a slice. Enter h() Enter h() 1 void h() { while (x < 10) while (x < 10) { 2 print(x); while (x < 10) 3 x++; 4 x++ print(x) } 5 print(x) x++ Exit h() 6 } PDG CFG Black: CDG, Red: DDG C. Galindo et al. (UPV) Slicing Unconditional Jumps LOPSTR 2020 - September 9th 4 / 14

  12. Program slicing Unconditional jumps ( break , return , goto ) in the CFG void main () { 1 x = 0; 2 while (true) { 3 x++; 4 if (x > 10) 5 break; 6 } 7 print(x); 8 } 9 C. Galindo et al. (UPV) Slicing Unconditional Jumps LOPSTR 2020 - September 9th 5 / 14

  13. Program slicing Unconditional jumps ( break , return , goto ) in the CFG void main () { 1 Enter main() x = 0; 2 while (true) { 3 x = 0 x++; 4 if (x > 10) 5 while (true) break; 6 break } 7 x++ if (x > 10) print(x) print(x); 8 } 9 Exit main() CFG: Jumps as arcs C. Galindo et al. (UPV) Slicing Unconditional Jumps LOPSTR 2020 - September 9th 5 / 14

  14. Program slicing Unconditional jumps ( break , return , goto ) in the CFG void main () { 1 Enter main() Enter main() x = 0; 2 while (true) { 3 x = 0 x++; 4 x = 0 while (true) print(x) if (x > 10) 5 while (true) break; 6 break } x++ if (x > 10) 7 x++ if (x > 10) print(x) print(x); 8 } 9 Exit main() CFG: Jumps as arcs C. Galindo et al. (UPV) Slicing Unconditional Jumps LOPSTR 2020 - September 9th 5 / 14

  15. Program slicing Unconditional jumps ( break , return , goto ) in the CFG void main () { 1 Enter main() Enter main() x = 0; 2 while (true) { 3 x = 0 x++; 4 x = 0 while (true) print(x) if (x > 10) 5 while (true) break; 6 break } x++ if (x > 10) 7 x++ if (x > 10) print(x) print(x); 8 } 9 Exit main() CFG: Jumps as arcs C. Galindo et al. (UPV) Slicing Unconditional Jumps LOPSTR 2020 - September 9th 5 / 14

  16. Program slicing Unconditional jumps ( break , return , goto ) in the CFG Enter main() void main () { 1 x = 0; 2 x = 0 while (true) { 3 x++; 4 while (true) if (x > 10) 5 break; 6 x++ if (x > 10) break print(x) } 7 print(x); 8 Exit main() } 9 CFG: Jumps as nodes C. Galindo et al. (UPV) Slicing Unconditional Jumps LOPSTR 2020 - September 9th 5 / 14

  17. Program slicing Unconditional jumps ( break , return , goto ) in the CFG Enter main() Enter main() void main () { 1 x = 0; 2 x = 0 while (true) { 3 x = 0 while (true) print(x) x++; 4 while (true) if (x > 10) 5 x++ if (x > 10) break; 6 x++ if (x > 10) break print(x) } 7 print(x); 8 break Exit main() } 9 CFG: Jumps as nodes C. Galindo et al. (UPV) Slicing Unconditional Jumps LOPSTR 2020 - September 9th 5 / 14

  18. Program slicing Unconditional jumps ( break , return , goto ) in the CFG Enter main() Enter main() void main () { 1 x = 0; 2 x = 0 while (true) { 3 x = 0 while (true) print(x) x++; 4 while (true) if (x > 10) 5 x++ if (x > 10) break; 6 x++ if (x > 10) break print(x) } 7 print(x); 8 break Exit main() } 9 CFG: Jumps as nodes C. Galindo et al. (UPV) Slicing Unconditional Jumps LOPSTR 2020 - September 9th 5 / 14

  19. Program slicing Unconditional jumps ( break , return , goto ) in the CFG void main () { Enter main() 1 x = 0; 2 while (true) { x = 0 3 x++; 4 if (x > 10) 5 while (true) break; 6 } 7 x++ if (x > 10) break print(x) print(x); 8 } 9 Exit main() ACFG: Adds non-exec. arcs to create control deps. C. Galindo et al. (UPV) Slicing Unconditional Jumps LOPSTR 2020 - September 9th 5 / 14

  20. Program slicing Unconditional jumps ( break , return , goto ) in the CFG Enter main() void main () { Enter main() 1 x = 0 while (true) x = 0; 2 while (true) { 3 x = 0 x++; 4 x++ if (x > 10) if (x > 10) 5 while (true) break; 6 } 7 x++ if (x > 10) break print(x) break print(x); 8 } 9 Exit main() print(x) ACFG: Adds non-exec. arcs to create control deps. C. Galindo et al. (UPV) Slicing Unconditional Jumps LOPSTR 2020 - September 9th 5 / 14

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend