Presentation is loading. Please wait.

Presentation is loading. Please wait.

Variability Mining Christian Kästner Carnegie Mellon University Joint work with P. Giarusso, T. Rendel, S. Erdweg, K. Ostermann, T. Berger, S. Nadi, S.

Similar presentations


Presentation on theme: "Variability Mining Christian Kästner Carnegie Mellon University Joint work with P. Giarusso, T. Rendel, S. Erdweg, K. Ostermann, T. Berger, S. Nadi, S."— Presentation transcript:

1

2 Variability Mining Christian Kästner Carnegie Mellon University Joint work with P. Giarusso, T. Rendel, S. Erdweg, K. Ostermann, T. Berger, S. Nadi, S. Haase, A. Dreiling, S. Apel, O. Lessenich, T. N. Nguyen; Supported by NSF

3 From Legacy Code to Disciplined Product-Line Implementations

4

5

6

7

8 Legacy System with Runtime Parameters Legacy System with #ifdef Variability Family of Similar Legacy Systems Legacy 1 Legacy 2b Legacy 2a Software Product Line dynamic variability extr. static variability extr. Delta Analysis Intermediate Format modular/disciplined implementation cross-language, unifies runtime and compile-time variability Legacy System without Variability Feature Mining Extraction Transformation Implementation Domain knowledge

9 Legacy System with Runtime Parameters Legacy System with #ifdef Variability Family of Similar Legacy Systems Legacy 1 Legacy 2b Legacy 2a Software Product Line dynamic variability extr. static variability extr. Delta Analysis Intermediate Format modular/disciplined implementation cross-language, unifies runtime and compile-time variability Legacy System without Variability Feature Mining Extraction Transformation Implementation Domain knowledge

10 10,000 features, 6 million lines of C code Lexical Preprocessors

11 apache, berkely db, cherokee, clamav, dia, emacs, freebsd, gcc, ghostscript, gimp, glibc, gnumeric, gnuplot, irssi, libxml, lighttpd, linux, lynx, minix, mplayer, mpsolve, openldap, opensolaris, openvpn, parrot, php, pidgin, postgresql, privoxy, python, sendmail, sqlite, subversion, sylpheed, tcl, vim, xfig, xine-lib, xorg-server, xterm [ICSE’10, AOSD‘11] 40 Open-Source C Projects variable code in C files (in %) Lines of code

12

13

14 TypeChef + * VAVA 2435 Variability-Aware Parser Refactoring/ Analysis https://github.com/ckaestne/TypeChef Variability-Aware Lexer ( 2 * 3 ) + 4A4A 5 ¬A [OOPSLA’11, OOPSLA‘12, FSE‘13]

15 3+4A4A 4 ¬A˄B + ¬A˄B 6 ¬A + 3 VAVA + 4 6 VBVB Variability-Aware Parsing (( ¬A ) ¬A ) 46

16 Analysis Consistency Type checking Data-flow analysis Model checking Locality, orthogonally, interactions … + * VAVA 2435

17 class Stack { int[] data; #ifdef UNDO int backup; void undo() { /*...*/ } #endif #ifdef TOP int top() { /*...*/ } #endif void push(int o) { #ifdef UNDO backup = top(); #endif /*...*/ } int pop() { /*...*/ } } class Stack { int[] data; #ifdef UNDO int backup; void undo() { /*...*/ } #endif #ifdef TOP int top() { /*...*/ } #endif void push(int o) { #ifdef UNDO backup = top(); #endif /*...*/ } int pop() { /*...*/ } } class Stack { int[] data; void push(int o) { … } int pop() { /*...*/ } } class Stack { int[] data; void push(int o) { … } int pop() { /*...*/ } } refines class Stack { int top() { /*...*/ } } refines class Stack { int top() { /*...*/ } } refines class Stack { int backup; void undo() { /*...*/ } void push(int o) { backup = top(); original(v); } refines class Stack { int backup; void undo() { /*...*/ } void push(int o) { backup = top(); original(v); } Base Top Undo Automated Transformation [GPCE’09]

18 apache, berkely db, cherokee, clamav, dia, emacs, freebsd, gcc, ghostscript, gimp, glibc, gnumeric, gnuplot, irssi, libxml, lighttpd, linux, lynx, minix, mplayer, mpsolve, openldap, opensolaris, openvpn, parrot, php, pidgin, postgresql, privoxy, python, sendmail, sqlite, subversion, sylpheed, tcl, vim, xfig, xine-lib, xorg-server, xterm [ICSE’10, AOSD‘11] 40 Open-Source C Projects variable code in C files (in %) Lines of code

19 Legacy System with Runtime Parameters Legacy System with #ifdef Variability Family of Similar Legacy Systems Legacy 1 Legacy 2b Legacy 2a Software Product Line dynamic variability extr. static variability extr. Delta Analysis Intermediate Format modular/disciplined implementation cross-language, unifies runtime and compiletime variability Legacy System without Variability Feature Mining Extraction Transformation Implementation Domain knowledge

20

21 Forward Slicing Interprocedural static analysis classifies into (a)belongs to feature (b)does not belong to f. (c)unsure Technically: IFDS-based taint analysis with soot Prior Work: Steffen Haase Joint Work: Max Lillack & Eric Bodden

22

23

24 + 3 VAVA + 4 6 VBVB 46 bool A, B; 3 + ( A ? 4 : ( B ? 4+6 : 6 ))

25

26 Symbolic / Variability-Aware GNU Make In collaboration with Tien N. Nguyen … arch/x86/kernel/paravirt.c: ((PARAVIRT == "y") || (PARAVIRT == "m")) arch/x86/kernel/pci-calgary_64.c: (((CALGARY_IOMMU == "y") || (CALGARY_IOMMU == "m")) && (X86_64 == "y")) arch/x86/kernel/pci-dma.c: [TRUE] arch/x86/kernel/pci-gart_64.c: (((GART_IOMMU == "y") || (GART_IOMMU == "m")) && (X86_64 == "y")) arch/x86/kernel/pci-nommu.c: [TRUE] arch/x86/kernel/pci-swiotlb.c: ((SWIOTLB == "y") || (SWIOTLB == "m")) arch/x86/kernel/pcspeaker.c: ((PCSPKR_PLATFORM == "y") || (PCSPKR_PLATFORM == "m")) arch/x86/kernel/pmtimer_64.c: (((X86_PM_TIMER == "y") || (X86_PM_TIMER == "m")) && (X86_64 == "y")) …

27 Legacy System with Runtime Parameters Legacy System with #ifdef Variability Family of Similar Legacy Systems Legacy 1 Legacy 2b Legacy 2a Software Product Line dynamic variability extr. static variability extr. Delta Analysis Intermediate Format modular/disciplined implementation cross-language, unifies runtime and compiletime variability Legacy System without Variability Feature Mining Extraction Transformation Implementation Domain knowledge

28

29 seed based on Impact Analysis / Concern Location

30 seed Consistency Criteria Granularity Type System calls, references Topology Analysis call hierarchy Information Retrieval name similarity based on Impact Analysis / Concern Location [TSE’13]

31 LEADT (Location, Expansion, And Documentation Tool) [TSE’13]

32 Domain Knowledge Exclude code from mutually exclusive features Include code from implied features

33 Experience Qualitative HyperSQL ArgoUmL Quantiative Prevayler MobileMedia Lampiro Sudoku [TSE’13]

34 Legacy System with Runtime Parameters Legacy System with #ifdef Variability Family of Similar Legacy Systems Legacy 1 Legacy 2b Legacy 2a Software Product Line dynamic variability extr. static variability extr. Delta Analysis Intermediate Format modular/disciplined implementation cross-language, unifies runtime and compiletime variability Legacy System without Variability Feature Mining Extraction Transformation Implementation Domain knowledge

35 Clone and Own © Slawomir Duszynski (Fraunhofer IESE)

36 n-way diff Slawomir Duszynski (Fraunhofer IESE) int a = 3; int b =4; int x = a + b; int a = 3; int b =2; int x = a + b; int a = 1; int b =2; int x = a + b; v1 v2 v3

37 n-way diff int a = 3; int b =4; int x = a + b; int a = 3; int b =2; int x = a + b; int a = 1; int b =2; int x = a + b; #ifdef v1 || v2 int a = 3; #else int a = 1 #endif #ifdef v1 int b =4; #else int b =2; #endif int x = a + b; v1 v2 v3 variability-aware parser + 3 VAVA + 4 6 VBVB 46

38 n-way diff Slawomir Duszynski (Fraunhofer IESE) int a = 3; #ifdef A int b =4; #else int b =3; #endif int x = a + b; int a = 3; #ifdef v1 #ifdef A #else #ifdef B #endif int b =4; #else int b =3; #endif int x = a + b; v1 v2 variability-aware parser int a = 3; #ifdef B int b =4; #else int b =3; #endif int x = a + b;

39 Legacy System with Runtime Parameters Legacy System with #ifdef Variability Family of Similar Legacy Systems Legacy 1 Legacy 2b Legacy 2a Software Product Line (forward slicing) (variability-aware parser) (n-way diff) Intermediate Format Legacy System without Variability (impact analysis) Extraction Transformation Implementation Domain knowledge + 3 VAVA + 4 6 VBVB 46


Download ppt "Variability Mining Christian Kästner Carnegie Mellon University Joint work with P. Giarusso, T. Rendel, S. Erdweg, K. Ostermann, T. Berger, S. Nadi, S."

Similar presentations


Ads by Google