UNIVERSITAS SCIENTIARUM SZEGEDIENSIS UNIVERSITY OF SZEGED Department of

  • Slides: 28
Download presentation
UNIVERSITAS SCIENTIARUM SZEGEDIENSIS UNIVERSITY OF SZEGED Department of Software Engineering Static and Dynamic Execute

UNIVERSITAS SCIENTIARUM SZEGEDIENSIS UNIVERSITY OF SZEGED Department of Software Engineering Static and Dynamic Execute After Relationships as a replacement of dependence-based program slices Árpád Beszédes University of Szeged, Hungary, Department of Software Engineering with F. Fischer, T. Gergely, T. Gyimóthy, J. Jász, V. Rajlich COW , London, January 2011

UNIVERSITAS SCIENTIARUM SZEGEDIENSIS UNIVERSITY OF SZEGED Department of Software Engineering Introduction 4 Dependence analysis

UNIVERSITAS SCIENTIARUM SZEGEDIENSIS UNIVERSITY OF SZEGED Department of Software Engineering Introduction 4 Dependence analysis on source code 4 Some applications: ■ Maintenance, in general ■ Program comprehension, in general ■ Change impact analysis, specifically ■ Regression test selection, specifically ■ Debugging, specifically 4(Imprecise & incomplete for some applications like change impact analysis) 24 th January, 2011 10 th CREST Open Workshop on Program Analysis and Slicing 2

UNIVERSITAS SCIENTIARUM SZEGEDIENSIS UNIVERSITY OF SZEGED Department of Software Engineering SDG 4 System (Program)

UNIVERSITAS SCIENTIARUM SZEGEDIENSIS UNIVERSITY OF SZEGED Department of Software Engineering SDG 4 System (Program) Dependence Graph 4 Well understood technique ■ Since Horwitz, Reps and Binkley (1990) 4 Graph representation of the program ■ Nodes: program elements ■ Edges: dependencies (data & control) ■ Reachability program slicing 4 Forward slice: computing the impact set 4 We refer to it as Traditional Software Dependencies 24 th January, 2011 10 th CREST Open Workshop on Program Analysis and Slicing 3

UNIVERSITAS SCIENTIARUM SZEGEDIENSIS UNIVERSITY OF SZEGED Department of Software Engineering Performance of TSD algorithm

UNIVERSITAS SCIENTIARUM SZEGEDIENSIS UNIVERSITY OF SZEGED Department of Software Engineering Performance of TSD algorithm 4 Accurate and sound method ■ Imprecisions due to different reasons 4 Not very scalable ■ Millions of LOC out of question 4 Not useful for complex systems and complex maintenance problems 4 What can we do? ■ ■ Improve algorithms (? !) Trade off accuracy; two outcomes: 1. Lose soundness 2. Lose precision 4 Approximation, e. g. use call-graph 24 th January, 2011 10 th CREST Open Workshop on Program Analysis and Slicing 4

UNIVERSITAS SCIENTIARUM SZEGEDIENSIS UNIVERSITY OF SZEGED Department of Software Engineering Example texts[] = {.

UNIVERSITAS SCIENTIARUM SZEGEDIENSIS UNIVERSITY OF SZEGED Department of Software Engineering Example texts[] = {. . . } procedure get. Index(out index){ read(index); } Procedure print. Last print. Param depends on: main procedure print. Param(in index){ get. Index write(texts[index]); } print. Last procedure print. Last(){ write(texts[texts. length-1]); print. Param } procedure main(){ i = MAX_LENGTH-1; while (i >= texts. length) get. Index(i); if (i > 0) print. Param(i); print. Last(); } 24 th January, 2011 ( ) ( ) TSD CG TSD – Traditional Software Dependencies (Slice) CG - Call Graph 10 th CREST Open Workshop on Program Analysis and Slicing 5

UNIVERSITAS SCIENTIARUM SZEGEDIENSIS UNIVERSITY OF SZEGED Department of Software Engineering Approach 4 Missing dependencies

UNIVERSITAS SCIENTIARUM SZEGEDIENSIS UNIVERSITY OF SZEGED Department of Software Engineering Approach 4 Missing dependencies in call-graph based method? ■ Typically due to data dependencies 4 A data dependency requires flow 4 Compute reachability on the Interprocedural Control Flow Graph (ICFG) 4 Replace data- and control dependencies by flow dependencies ■ This is a sound approximation 24 th January, 2011 10 th CREST Open Workshop on Program Analysis and Slicing 6

UNIVERSITAS SCIENTIARUM SZEGEDIENSIS UNIVERSITY OF SZEGED Department of Software Engineering SEA and SEB 4

UNIVERSITAS SCIENTIARUM SZEGEDIENSIS UNIVERSITY OF SZEGED Department of Software Engineering SEA and SEB 4 Static Execute After (SEA) relation (SEB is similar): Entity B depends on entity A B is executed after A in some of the possible executions of the program 4 Possible flow-based dependencies: 24 th January, 2011 10 th CREST Open Workshop on Program Analysis and Slicing 7

UNIVERSITAS SCIENTIARUM SZEGEDIENSIS UNIVERSITY OF SZEGED Department of Software Engineering Example (cont’d) main Interprocedural

UNIVERSITAS SCIENTIARUM SZEGEDIENSIS UNIVERSITY OF SZEGED Department of Software Engineering Example (cont’d) main Interprocedural Component Interprocedural Control Flow Graph (ICCFG) Control Flow Graph 24 th January, 2011 Strongly Connected Component i = MAX_LENGTH-1 i >= texts. length call get. Index(i) … i>0 … call print. Param(i) call print. Last() 10 th CREST Open Workshop on Program Analysis and Slicing … 8

UNIVERSITAS SCIENTIARUM SZEGEDIENSIS UNIVERSITY OF SZEGED Department of Software Engineering Example (cont’d) 24 th

UNIVERSITAS SCIENTIARUM SZEGEDIENSIS UNIVERSITY OF SZEGED Department of Software Engineering Example (cont’d) 24 th January, 2011 Procedure main print. Last depends on: get. Index print. Last print. Param depends on: ( ) ( ) print. Param TSD CG ( ) ( ) SEA TSD 10 th CREST Open Workshop on Program Analysis and Slicing CG SEA 9

UNIVERSITAS SCIENTIARUM SZEGEDIENSIS UNIVERSITY OF SZEGED Department of Software Engineering Research goals 4 What

UNIVERSITAS SCIENTIARUM SZEGEDIENSIS UNIVERSITY OF SZEGED Department of Software Engineering Research goals 4 What is to be expected: very imprecise 4 What we claim here: not much worse 4 Compare SEA/SEB to TSD (slice) as the golden standard ■ RQ 1: What is the difference in precision? ■ RQ 2: What is the difference in efficiency? 4 Dynamic variant 4 Applications 24 th January, 2011 10 th CREST Open Workshop on Program Analysis and Slicing 10

UNIVERSITAS SCIENTIARUM SZEGEDIENSIS UNIVERSITY OF SZEGED Department of Software Engineering Precision 4 Average size

UNIVERSITAS SCIENTIARUM SZEGEDIENSIS UNIVERSITY OF SZEGED Department of Software Engineering Precision 4 Average size of dependence sets compared to the program size (procedure level): 24 th January, 2011 Recall Difference: is always ~4% 100% 10 th CREST Open Workshop on Program Analysis and Slicing 11

UNIVERSITAS SCIENTIARUM SZEGEDIENSIS UNIVERSITY OF SZEGED Department of Software Engineering Relation components 24 th

UNIVERSITAS SCIENTIARUM SZEGEDIENSIS UNIVERSITY OF SZEGED Department of Software Engineering Relation components 24 th January, 2011 Using call graph only is not a good idea 10 th CREST Open Workshop on Program Analysis and Slicing 12

UNIVERSITAS SCIENTIARUM SZEGEDIENSIS UNIVERSITY OF SZEGED Department of Software Engineering Analysis at different levels

UNIVERSITAS SCIENTIARUM SZEGEDIENSIS UNIVERSITY OF SZEGED Department of Software Engineering Analysis at different levels 4 Statement ■ Flow reachability starting from statements 4 Procedure ■ Flow reachability taking into account only call-sites and summary of flow information (ICCFG) ■ Heuristics to improve precision (e. g. black&white methods) 4 Class ■ (A, B) SEA A: : f B: : g (f, g) SEA ■ Handling of field and global accesses: artificial wrapper procedures 24 th January, 2011 10 th CREST Open Workshop on Program Analysis and Slicing 13

UNIVERSITAS SCIENTIARUM SZEGEDIENSIS UNIVERSITY OF SZEGED Department of Software Engineering Difference in precision 24

UNIVERSITAS SCIENTIARUM SZEGEDIENSIS UNIVERSITY OF SZEGED Department of Software Engineering Difference in precision 24 th January, 2011 10 th CREST Open Workshop on Program Analysis and Slicing 14

UNIVERSITAS SCIENTIARUM SZEGEDIENSIS UNIVERSITY OF SZEGED Department of Software Engineering Summary of analyses Program

UNIVERSITAS SCIENTIARUM SZEGEDIENSIS UNIVERSITY OF SZEGED Department of Software Engineering Summary of analyses Program SEA/SEB TSD Precise slice 24 th January, 2011 Imprecision of SEA/SEB (small) Imprecision of TSD (big): e. g. PTA, executability, … Control dep. Call dep. 10 th CREST Open Workshop on Program Analysis and Slicing 15

UNIVERSITAS SCIENTIARUM SZEGEDIENSIS UNIVERSITY OF SZEGED Department of Software Engineering Experimental implementation 4 Code.

UNIVERSITAS SCIENTIARUM SZEGEDIENSIS UNIVERSITY OF SZEGED Department of Software Engineering Experimental implementation 4 Code. Surfer for the common front end ■ Common IR ■ Different analysis settings 4 TSD and SEA/SEB from SDG and ICCFG, respectively 4 C programs for precision measurements ■ 29 programs; 595 k. LOC total 4 C/C++ programs for efficiency measurements ■ 4 programs; 4, 14 MLOC total 4 Calculations for all possible criteria 24 th January, 2011 10 th CREST Open Workshop on Program Analysis and Slicing 16

UNIVERSITAS SCIENTIARUM SZEGEDIENSIS UNIVERSITY OF SZEGED Department of Software Engineering Scalability 4 Properties of

UNIVERSITAS SCIENTIARUM SZEGEDIENSIS UNIVERSITY OF SZEGED Department of Software Engineering Scalability 4 Properties of the graph representations: System logical LOC valgrind 141 k gdb 303 k gcc 725 k mozilla 1. 4 M 24 th January, 2011 10 th CREST Open Workshop on Program Analysis and Slicing 17

UNIVERSITAS SCIENTIARUM SZEGEDIENSIS UNIVERSITY OF SZEGED Department of Software Engineering Scalability (cont’d) 4 Analysis

UNIVERSITAS SCIENTIARUM SZEGEDIENSIS UNIVERSITY OF SZEGED Department of Software Engineering Scalability (cont’d) 4 Analysis times: 24 th January, 2011 10 th CREST Open Workshop on Program Analysis and Slicing 18

UNIVERSITAS SCIENTIARUM SZEGEDIENSIS UNIVERSITY OF SZEGED Department of Software Engineering Dynamic Execute After Trace

UNIVERSITAS SCIENTIARUM SZEGEDIENSIS UNIVERSITY OF SZEGED Department of Software Engineering Dynamic Execute After Trace g f h, i… (but not g) Dynamic EA of f is h, i… 4 Limiting the dependency based on the ‘closeness’ of the functions in the trace: 24 th January, 2011 10 th CREST Open Workshop on Program Analysis and Slicing 19

UNIVERSITAS SCIENTIARUM SZEGEDIENSIS UNIVERSITY OF SZEGED Department of Software Engineering Dynamic EA – measurements

UNIVERSITAS SCIENTIARUM SZEGEDIENSIS UNIVERSITY OF SZEGED Department of Software Engineering Dynamic EA – measurements 24 th January, 2011 10 th CREST Open Workshop on Program Analysis and Slicing 20

UNIVERSITAS SCIENTIARUM SZEGEDIENSIS UNIVERSITY OF SZEGED Department of Software Engineering Applications 4 Dependencies in

UNIVERSITAS SCIENTIARUM SZEGEDIENSIS UNIVERSITY OF SZEGED Department of Software Engineering Applications 4 Dependencies in database-intensive systems 4 Heterogeneous system: Host language, SQL queries, Stored procedures, Database schemas 4 SEA/SEB relations on the source code combined with ‘CRUD’ relations ■ Uses the CRUD matrix and looks for table accesses ■ Disjoint parts are similar in size and the intersection is small ■ Which means that SEA/SEB itself is not sound 24 th January, 2011 10 th CREST Open Workshop on Program Analysis and Slicing 21

UNIVERSITAS SCIENTIARUM SZEGEDIENSIS UNIVERSITY OF SZEGED Department of Software Engineering Another implementation 4 By

UNIVERSITAS SCIENTIARUM SZEGEDIENSIS UNIVERSITY OF SZEGED Department of Software Engineering Another implementation 4 By Front. End. ART ■ Based on the Columbus technology 4 New implementation and enhancement of the algorithms 4 In the Source. Inventory framework ■ For architecture analysis 4 In Eclipse ■ For Impact analysis and test case selection 24 th January, 2011 10 th CREST Open Workshop on Program Analysis and Slicing 22

UNIVERSITAS SCIENTIARUM SZEGEDIENSIS UNIVERSITY OF SZEGED Department of Software Engineering Source. Inventory 24 th

UNIVERSITAS SCIENTIARUM SZEGEDIENSIS UNIVERSITY OF SZEGED Department of Software Engineering Source. Inventory 24 th January, 2011 10 th CREST Open Workshop on Program Analysis and Slicing 23

UNIVERSITAS SCIENTIARUM SZEGEDIENSIS UNIVERSITY OF SZEGED Department of Software Engineering Eclipse 24 th January,

UNIVERSITAS SCIENTIARUM SZEGEDIENSIS UNIVERSITY OF SZEGED Department of Software Engineering Eclipse 24 th January, 2011 10 th CREST Open Workshop on Program Analysis and Slicing 24

UNIVERSITAS SCIENTIARUM SZEGEDIENSIS UNIVERSITY OF SZEGED Department of Software Engineering Conclusion 4 Use SEA/SEB

UNIVERSITAS SCIENTIARUM SZEGEDIENSIS UNIVERSITY OF SZEGED Department of Software Engineering Conclusion 4 Use SEA/SEB instead of TSD in some applications 4 But not at all levels! Procedure level is the most useful 4 SDG based dependencies as the golden standard? ■ How far are we from the ‘real’ dependencies, i. e. precise slices? 24 th January, 2011 10 th CREST Open Workshop on Program Analysis and Slicing 25

UNIVERSITAS SCIENTIARUM SZEGEDIENSIS UNIVERSITY OF SZEGED Department of Software Engineering Summary of analyses Program

UNIVERSITAS SCIENTIARUM SZEGEDIENSIS UNIVERSITY OF SZEGED Department of Software Engineering Summary of analyses Program SEA/SEB TSD Precise slice 24 th January, 2011 Imprecision of SEA/SEB (small) Imprecision of TSD (big): e. g. PTA, executability, … Control dep. Call dep. 10 th CREST Open Workshop on Program Analysis and Slicing 26

UNIVERSITAS SCIENTIARUM SZEGEDIENSIS UNIVERSITY OF SZEGED Department of Software Engineering Summary (cont. ) size

UNIVERSITAS SCIENTIARUM SZEGEDIENSIS UNIVERSITY OF SZEGED Department of Software Engineering Summary (cont. ) size 24 th January, 2011 SEA SMALL BIG Static slice Precise impact Union slice Execute After Dynamic slice executions 10 th CREST Open Workshop on Program Analysis and Slicing 27

24 th January, 2011 10 th CREST Open Workshop on Program Analysis and Slicing

24 th January, 2011 10 th CREST Open Workshop on Program Analysis and Slicing 28 UNIVERSITAS SCIENTIARUM SZEGEDIENSIS UNIVERSITY OF SZEGED Department of Software Engineering