1 / 55

Statically Analyzing Software Product Lines in Minutes instead of Years

- PLDI 2013 -. SPL LIFT. Statically Analyzing Software Product Lines in Minutes instead of Years. Eric Bodden Technische Universität Darmstadt [ bodden@acm.org ]. Társis Tolêdo Universidade Federal de Pernambuco [ twt@ cin.ufpe.br ]. Márcio Ribeiro

phuc
Download Presentation

Statically Analyzing Software Product Lines in Minutes instead of Years

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. - PLDI 2013 - SPLLIFT StaticallyAnalyzingSoftware Product Linesin Minutes instead of Years Eric Bodden TechnischeUniversität Darmstadt [ bodden@acm.org] TársisTolêdo UniversidadeFederal de Pernambuco [ twt@cin.ufpe.br ] • MárcioRibeiro • UniversidadeFederal de Alagoas • [ mmr3@cin.ufpe.br ] • Claus Brabrand • IT University of Copenhagen • [ brabrand@itu.dk] Paulo Borba Universidade Federal de Pernambuco [ phmb@cin.ufpe.br ] Mira Mezini TechnischeUniversität Darmstadt [ mira.mezini@cased.de]

  2. - AOSD 2012 - DFA-4-SPL IntraproceduralDataflow Analysis forSoftware Product Lines Claus Brabrand IT University of Copenhagen Universidade Federal de Pernambuco [ brabrand@itu.dk ] Márcio Ribeiro Universidade Federal de Alagoas Universidade Federal de Pernambuco [ mmr3@cin.ufpe.br ] Paulo Borba Universidade Federal de Pernambuco [ phmb@cin.ufpe.br ] Társis Toledo Universidade Federal de Pernambuco [ twt@cin.ufpe.br ]

  3. - TAOSD 2013 - IntraproceduralDataflow Analysis forSoftware Product Lines • Claus Brabrand • IT University of Copenhagen • [ brabrand@itu.dk] TársisTolêdo UniversidadeFederal de Pernambuco [ mmr3@cin.ufpe.br ] • MárcioRibeiro • UniversidadeFederal de Alagoas • [ twt@cin.ufpe.br ] Johnni Winter Aarhus University [ jw@cs.au.dk] Paulo Borba Universidade Federal de Pernambuco [ phmb@cin.ufpe.br ]

  4. < Outline > • Introduction: • Dataflow Analysis and Software Product Lines • DFA-4-SPL: • A0 (brute force): (feature in-sensitive) • A1(consecutive): (feature sensitive) • A2(simultaneous): (feature sensitive) • A3(sharedsimultaneous): (feature sensitive) • Evaluation and Results • SPLLIFT (graphencoding): • Related Work • Conclusion

  5. Introduction • Traditional Software Development: • One program = One product • Product Line: • A ”family” of products (of N ”similar” products): = = = 1x CAR 1x CELL PHONE 1x APPLICATION CARS CELL PHONES APPLICATIONS customize SPL: (Family ofPrograms)

  6. Software Product Line • SPLsbased on ConditionalCompilation:  : fF |  |  #ifdef(  ) ... #endif Logo logo; ... ... logo.use(); #ifdef (VIDEO) logo = new Logo(); #endif Example (SPL fragment)

  7. Software Product Line • SPL: • Feature Model: (e.g.: ψFM ≡ VIDEO  COLOR) Ø Family of Programs: customize { Color} COLOR VIDEO 2F COLORVIDEO { Video } VIDEO Set of Features: F = { COLOR, VIDEO } { Color, Video } Configurations: Ø,{Color},{Video},{Color,Video} 2F VALID

  8. Software Product Line • SPLsbased on ConditionalCompilation:  : fF |  |  #ifdef(  ) ... #endif *** null-pointer exception!in configurations: {Ø, {COLOR}} Logo logo; ... ... logo.use(); #ifdef (VIDEO) logo = new Logo(); #endif Example (SPL fragment)

  9. Analysis of SPLs • The CompilationProcess: • ...and for Software Product Lines: 0100101 1110110 1010011 1110111 compile run result ERROR! ANALYZE! 0100101 1110110 1010011 1110111 0100101 1110110 1010011 1110111 run generate compile 0100101 1110110 1010011 1110111 run compile run compile result result result 2F ANALYZE! ERROR! ERROR! ANALYZE! ERROR! ANALYZE! Feature-sensitivedata-flow analysis !

  10. Dataflow Analysis L • Dataflow Analysis: • 1)Control-flow graph • 2)Lattice(finiteheight) • 3)Transfer functions(monotone) Example: "sign-of-xanalysis"

  11. Analyzing a Program 1)Program 2)Build CFG 3)Make Equations Annotated with program points 4)Solveequations: fixed-point computation(iteration) 5) SOLUTION (least fixed point):

  12. < Outline > • Introduction: • Dataflow Analysis and Software Product Lines • DFA-4-SPL: • A0 (brute force): (feature in-sensitive) • A1 (consecutive): (feature sensitive) • A2 (simultaneous): (feature sensitive) • A3 (sharedsimultaneous): (feature sensitive) • Evaluation and Results • SPLLIFT(graphencoding): • RelatedWork • Conclusion

  13. A0 L feature in-sensitive! void m() { int x=0; ifdef(A) x++; ifdef(B) x--; } • A0 (brute force): N = O(2F)compilations! ψFM = A∨B _ _ _ | | | c = {A}: c = {B}: c = {A,B}: int x= 0; int x= 0; int x= 0; 0 0 0 x++; x++; x++; + x--; x--; x--; 0/+ + -

  14. A1 L feature sensitive! void m() { int x=0; ifdef(A) x++; ifdef(B) x--; } • A1 (consecutive): ψFM = A∨B _ _ _ | | | c = {A}: c = {B}: c = {A,B}: int x= 0; int x= 0; int x= 0; ✓ ✓ ✓ 0 0 0 0 x++; x++; x++; ✓ ✓ ✗ A: A: A: + + + ✓ ✗ ✓ B: B: B: x--; x--; x--; 0/+ -

  15. A2 L feature sensitive! void m() { int x=0; ifdef(A) x++; ifdef(B) x--; } • A2 (simultaneous): ψFM = A∨B _ _ _ | | | ∀c∈ {{A},{B},{A,B}}: ({A} = , {B} = , {A,B} = ) ✓ ✓ ✓ int x= 0; 0 0 0 0 ({A} = , {B} = , {A,B} = ) ✗ ✓ ✓ x++; A: + + + ({A} = , {B} = , {A,B} = ) ✗ ✓ ✓ B: x--; 0/+ - ({A} = , {B} = , {A,B} = )

  16. A3 L feature sensitive! void m() { int x=0; ifdef(A) x++; ifdef(B) x--; } • A3 (shared): ψFM = A∨B _ | ψFM = A∨B: ( [[ψ]] = ) int x= 0; can use BDD representation ! (compact+efficient) 0 0 ( [[ψ]] = ) x++; A: (A∨B)∧¬A∧¬B ≡ false i.e., invalid given wrt.the feature model, ψ! + 0 + ( [[ψ]] = , [[ψ]] = ) ∧A ∧¬A B: x--; - 0/+ ( [[ψ∧¬A ]] = , [[ψ∧A ]] = , [[ψ∧¬A ]] = , [[ψ∧A ]] = ) ∧¬B ∧B ∧B ∧¬B

  17. < Outline > • Introduction: • Dataflow Analysis and Software Product Lines • DFA-4-SPL: • A0 (brute force): (feature in-sensitive) • A1 (consecutive): (feature sensitive) • A2 (simultaneous): (feature sensitive) • A3 (sharedsimultaneous): (feature sensitive) • Evaluation and Results • SPLLIFT(graphencoding): • RelatedWork • Conclusion

  18. Evaluation • Five (qualitatively different)SPL benchmarks:

  19. Results (intra) • In practice: Feature sensitive (A1, A2, and A3)all faster than A0 (Reaching Definitions) (Total time, incl. compile) (no re-compile!) 4x 7x 1x 1x 3x

  20. Overview TAOSD2013 A*(combo) combo! (intra-procedural) A3 (shared) AOSD 2012 sharing! A2 (simultaneous) FASTER caching! A1 (consecutive) no re-compile! A0 (brute force)

  21. Beyond the Sum of all Methods • For a method with Kvalid configurations, which of analyses A1vsA2vsA3 is fastest? # K Statistically significant differences between A1, A2, and A3 for all N,except between A2 and A3 for N=4 (underlined above).

  22. Combo Analysis Strategy: A* • Intraprocedurally combinedanalysis strategy, A*: A* consistently fastest (combo!)

  23. Overview (cont'd) PLDI 2013 SPLLIFT TAOSD2013 A*(combo) A3+BDD (esp. inter- procedural) combo! (intra-procedural) repr! A3 (shared) AOSD 2012 sharing! A2 (simultaneous) IFDS (graph repr) FASTER caching! A1 (consecutive) graph encoding! no re-compile! A0 (brute force)

  24. SPLLIFT A0: IFDS: {x} y x 0 • Reps • Horwitz • Sagiv • λS . (S – {x}) ∪ {y} graph reachability fixed-point iteration x y ➔ 0 {y} LIFT: A2: SPLLIFT: true true A∧B ({A} = {x},{B} = {x} ,{A,B} = {x,y}) y x 0 #ifdef (A) ¬A A • λS . (S – {x}) ∪ {y} ¬A A: ¬A A x y 0 ({A} = {y},{B} = {x} ,{A,B} = {y}) true true∧¬A = ¬A [ (A∧B)∧¬A] ∨ [true∧A]= A

  25. Example SPL Conventional Program: Software Product Line: config= {G} (¬F∧G∧¬H) customize (instantiate) (preprocess)

  26. Exploded Super Graph ...for Program:

  27. Lifted Exploded Super Graph ...for SPL:

  28. Results (inter) • Results for SPLLIFT(interprocedural analysis): • In fact, analyzing all valid configurations is only slightly slower than analyzing oneconfiguration! Conclusion: • Analyze SPLs in Minutes instead of Years!

  29. < Outline > • Introduction: • Dataflow Analysis and Software Product Lines • DFA-4-SPL: • A0 (brute force): (feature in-sensitive) • A1 (consecutive): (feature sensitive) • A2 (simultaneous): (feature sensitive) • A3 (sharedsimultaneous): (feature sensitive) • Evaluation and Results • SPLLIFT(graphencoding): • RelatedWork • Conclusion

  30. Related Work (DFA) • Path-sensitive DFA: • Idea of “conditionally executed statements” • Compute different analysis info along different paths (~ A1, A2, A3) to improve precision or to optimize “hot paths” • Predicated DFA: • Guard lattice values by propositional logic predicates (~ A3), yielding “optimistic dataflow values” that are kept distinct during analysis (~ A2 and A3) “Constant Propagation with Conditional Branches” ( Wegman and Zadeck ) TOPLAS 1991 “Predicated Array Data-Flow Analysis for Run-time Parallelization” ( Moon, Hall, and Murphy ) ICS 1998 Our work:Automatically lift anyDFA to SPLs (with ψFM) ⇒feature-sensitive analysis for analyzing entire program family

  31. Related Work (Lifting for SPLs) • Model Checking: • Type Checking: • Parsing: • Testing: Model checks all SPLs at the same time (3.5x faster) than one by one! (similar goal, diff techniques) Model Checking Lots of Systems: Efficient Verification of Temporal Properties in Software Product Lines” ( Classen, Heymans, Schobbens, Legay, and Raskin ) ICSE 2010 Type checking ↔ DFA (similar goal, diff techniques) Our: auto lift any DFA (uninitvars, null pointers, ...) “Type-Checking Software Product Lines - A Formal Approach” ( Kastnerand Apel ) ASE 2008 “Type Safety for Feature-Oriented Product Lines” ( Apel, Kastner, Grösslinger, and Lengauer) ASE 2010 (similar techniques, diff goal): Split and merging parsing (~A3) and also uses instrumentation “Variability-Aware Parsing in the Presence of Lexical Macros & C.C.” ( Kastner, Giarrusso, Rendel, Erdweg, Ostermann, and Berger )OOPSLA 2011 Select relevant feature combinations for a given test case Uses (hardwired) DFA (w/o FM) to compute reachability “Reducing Combinatorics in Testing Product Lines” ( Hwan, Kim, Batory, and Khurshid) AOSD 2011

  32. Emerging Interfaces

  33. Emerging Interfaces CBSoft 2011: *** Best Tool Award *** "A Tool for Improving Maintainability of Preprocessor-based Product Lines" ( MárcioRibeiro, TársisTolêdo, Paulo Borba, Claus Brabrand )

  34. < Outline > • Introduction: • Dataflow Analysis and Software Product Lines • DFA-4-SPL: • A0 (brute force): (feature in-sensitive) • A1 (consecutive): (feature sensitive) • A2 (simultaneous): (feature sensitive) • A3 (sharedsimultaneous): (feature sensitive) • SPLLIFT (graphencoding): • Evaluation and Results • Related Work • Conclusion

  35. Conclusion Statically Analyze SPLs in Minutes instead of Years Scalable!

  36. < Obrigado*> *)Thanks

  37. BONUS SLIDES

  38. Errors Logo logo; logo.use(); #ifdef (VIDEO) logo = new Logo(); #endif • *** null-pointer exception!in configurations: {Ø, {COLOR}} Logo logo; print(logo); #ifdef (VIDEO) logo = new Logo(); #endif *** uninitialized variable!in configurations: {Ø, {COLOR}} Logo logo; ... • *** unused variable!in configurations: {Ø, {COLOR}} #ifdef (VIDEO) logo = new Logo(); #endif

  39. Summary A1 A0 A3 Analyzing program: void m() { int x=0; ifdef(A) x++; ifdef(B) x--; } A2 ψFM = A∨B

  40. Specification: A0, A1, A2, A3 A0 A1 A2 A3

  41. Analysis Time (excl. compile) A2 faster than A1 • In practice: (caching!) (Reaching Definitions) A3 faster than A2 (sharing!)

  42. Analysis Time (excl. compile) • In theory: • In practice: TIME(A3) : Depends ondegree of sharing in SPL ! (Reaching Definitions) A2 faster than A1 (caching!) A3 faster than A2 (sharing!)

  43. Memory Usage • In theory: • In practice: SPACE(A3) : Depends ondegree of sharing in SPL ! (Reaching Definitions)

  44. Analysis Time (excl. compile) Nx1 ≠ 1xN ?! • In practice: (Reaching Definitions) A2 faster than A1 Caching!

  45. Caching(A1 vs A2) • Cache misses(A1vsA2): • Cache enabled: • This is the "normal condition" (for reference) • Cache disabled*: • As hypothesized, this indeed affects A1more than A2 • i.e.,A2has better cache properties thanA1 *) we flush the L2 cache, by traversing an8MB “bogus array” to invalidate cache!

  46. IFDEF normalization • Refactor"undisciplined"(lexical) ifdefs into "disciplined"(syntactic) ifdefs: • Normalize "ifdef"s (by transformation):

  47. Lexical#ifdef Syntacticifdef • Simple transformation: • We do not handle non-syntactic '#ifdef's: Nestedifdef'salso give rise to a conj. of formulas Fair assumption (also in CIDE)

  48. BDD (Binary Decision Diagram) =  F(A,B,C)= A(BC) A A BDD minimized BDD B B B C C C C C           • Compact and efficientrepresentation forboolean functions (aka., set of set of names) • FAST: negation, conjunction, disjunction, equality ! 

  49. Formula ~ Set of Configurations • Definitions (given F, set of feature names): • f Ffeature name • c 2Fconfiguration(set of feature names) cF • X  22set of config's (set of set of feature names)X 2F • Exampleifdefs: F [[ BA]] = { {A}, {B}, {A,B} } F = {A,B} [[ A(BC)]] F = {A,B,C} = { {A,B}, {A,C}, {A,B,C} }

  50. Feature Model (Example) Note: | [[FM]]| = 3<32 = |2F| • Feature Model: • Feature set: • Formula: • Set of configurations: Engine Air Air 1.0 1.4 F= {Car, Engine, 1.0, 1.4, Air} [[ ]] = FM  Car  Engine  (1.01.4)  Air1.4 { {Car, Engine, 1.0}, {Car, Engine, 1.4}, {Car, Engine, 1.4, Air} }

More Related