Loading in 2 Seconds...
Loading in 2 Seconds...
Intraprocedural Dataflow Analysis for Software 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
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.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.
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ársisTolêdo
Universidade Federal de Pernambuco
[ twt@cin.ufpe.br ]
=
=
=
1x CAR
1x CELL PHONE
1x APPLICATION
CARS
CELL PHONES
APPLICATIONS
customize
SPL:
(Family ofPrograms)
(e.g.: ψFM ≡ VIDEO COLOR)
Ø
Family of
Programs:
customize
{ Color}
COLOR
VIDEO
2F
COLORVIDEO
{ Video }
VIDEO
Features:
F = { COLOR, VIDEO }
{ Color, Video }
Configurations:
Ø,{Color},{Video},{Color,Video}
2F
VALID
Conditional compilation:
Family of
s:
Program
COLOR
VIDEO
#ifdef( )
...
#endif
Alternatively,via Aspects(as in AOSD)
COLORVIDEO
VIDEO
*** uninitialized variable!in configurations: {Ø, {COLOR}}
Logo logo;
...
...
use(logo);
#ifdef (VIDEO)
logo = new Logo();
#endif
Similarly for; e.g.:
■nullpointers
■unused variables
■undefined variables
Example:
0100101
1110110
1010011
1110111
compile
run
result
ERROR!
ANALYZE!
0100101
1110110
1010011
1110111
0100101
1110110
1010011
1110111
run
customize
compile
0100101
1110110
1010011
1110111
run
compile
run
compile
result
result
result
2F
ANALYZE!
ERROR!
ERROR!
ANALYZE!
ERROR!
ANALYZE!
Featuresensitivedataflow analysis !
L
Example:
"signofxanalysis"
L
void m() {
int x=0;
ifdef(A) x++;
ifdef(B) x;
}
ψ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/+
+

L
void m() {
int x=0;
ifdef(A) x++;
ifdef(B) x;
}
ψFM = A∨B
_
_
_



c = {A}:
c = {B}:
c = {A,B}:
c  [[true]]
c  [[true]]
c  [[true]]
int x= 0;
int x= 0;
int x= 0;
✓
✓
✓
[[true]]
[[true]]
[[true]]
0
0
0
c  [[A]]
c  [[A]]
c  [[A]]
x++;
x++;
x++;
✓
✓
✗
[[A]]
[[A]]
[[A]]
+
+
0
c  [[B]]
c  [[B]]
c  [[B]]
✓
✗
✓
[[B]]
[[B]]
[[B]]
x;
x;
x;
0/+
+

L
void m() {
int x=0;
ifdef(A) x++;
ifdef(B) x;
}
ψFM = A∨B
_
_
_



∀c∈ {{A},{B},{A,B}}:
({A} = , {B} = , {A,B} = )
✓
✓
✓
∀c  [[true]]
int x= 0;
[[true]]
0
0
0
({A} = , {B} = , {A,B} = )
✗
✓
✓
∀c  [[A]]
x++;
[[A]]
+
+
0
({A} = , {B} = , {A,B} = )
✗
✓
✓
∀c  [[B]]
[[B]]
x;
0/+
+

({A} = , {B} = , {A,B} = )
L
void m() {
int x=0;
ifdef(A) x++;
ifdef(B) x;
}
ψFM = A∨B
_

ψFM = A∨B:
( [[ψ]] = )
int x= 0;
[[true]]
0
( [[ψ]] = )
…using BDD
representation!
(compact+efficient)
x++;
[[A]]
(A∨B)∧¬A∧¬B ≡ false
i.e., invalid given wrt.the feature model, ψ!
0
+
( [[ψ∧¬A]] = , [[ψ∧A]] = )
[[B]]
x;

0/+
+
0
( [[ψ∧¬A∧¬B]] = , [[ψ∧A∧¬B]] = , [[ψ∧¬A∧B]] = , [[ψ∧A∧B]] = )
2F
2F
2F
Feature sensitive (avg. gain factor):
A2 (3x), A3 (4x), A4 (5x)
(Reaching Definitions)
1x
1x
1x
2x
2x
2½x
3x
3x
5x
6x
8x
14x
A2
2F
A3
vs
On average (A2 vs A3):
TIME(A4) : Depends ondegree of sharing in SPL !
A3 (1.5x) faster
(Reaching Definitions)
(caching!)
A2
A3
vs
2F
SPACE(A4) : Depends ondegree of sharing in SPL !
Average
6.3 : 1
(Reaching Definitions)
“Constant Propagation with Conditional Branches”
( Wegman and Zadeck ) TOPLAS 1991
“Predicated Array DataFlow Analysis for Runtime Parallelization”
( Moon, Hall, and Murphy ) ICS 1998
Our work:Automatically lift anyDFA to SPLs (with ψFM) ⇒featuresensitive analysis for analyzing entire program family
Model checks all SPLs at the same time (3.5x faster) than one by one! (similar goal, diff techniques)
Model Checking Lots of Systems: Efﬁcient Veriﬁcation of Temporal Properties in Software Product Lines”
( Classen, Heymans, Schobbens, Legay, and Raskin ) ICSE 2010
Type checking ↔ DFA (similar goals, diff techniques)
Our: auto lift any DFA (uninitvars, null pointers, ...)
“TypeChecking Software Product Lines  A Formal Approach”
( Kastnerand Apel ) ASE 2008
“Type Safety for FeatureOriented Product Lines”
( Apel, Kastner, Grösslinger, and Lengauer) ASE 2010
(similar techniques, diff goal):
Split and merging parsing (~A4) and also uses instrumentation
“VariabilityAware 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
Compute E.I. to flag dependencies and howedit in one place affect feature(s) elsewhere
“Emergent Feature Modularization”
( Ribeiro, Pacheco, Teixeira, and Borba ) Onward! 2010
“EMERGO: A Tool for Improving Maintainability of PreprocessorBased PLs”
( Ribeiro, Tolêdo, Winther, Brabrand, and Borba ) AOSD Tool Demo 2012
TOOL DEMO
“EMERGO:
A Tool for Improving Maintainability
of PreprocessorBased Product Lines”
Thursday at 14:00
and Friday at 16:00
AOSD 2012
6.3 : 1
*)Thanks
INTERprocedural
dataflow analysis
In progress...!
?!
A2
(caching!)
Nx1 ≠ 1xN
2F
A3
2F
vs
On average (A2 vs A3):
TIME(A4) : Depends ondegree of sharing in SPL !
A3 (1.5x) faster
(Reaching Definitions)
A2
A3
vs
*) we flush the L2 cache, by traversing an8MB “bogus array” to invalidate cache!
1)Program
2)Build CFG
3)Make Equations
4)Solveequations: fixedpoint computation(iteration)
5) SOLUTION (least fixed point):
Note:
 [[FM]] = 3<32 = 2F 
F = {Car, Engine, 1.0, 1.4, Air}
[[
]] =
FM Car Engine (1.01.4) Air1.4
{ {Car, Engine, 1.0}, {Car, Engine, 1.4}, {Car, Engine, 1.4, Air} }
*** uninitialized variable "logo"
=
F(A,B,C)=
A(BC)
A
A
BDD
minimized BDD
B
B
B
C
C
C
C
C
F
[[ BA]]
= { {A}, {B}, {A,B} }
F = {A,B}
[[ A(BC)]]
F = {A,B,C}
= { {A,B}, {A,C}, {A,B,C} }
CBSoft 2011:
*** Best Tool Award ***
"A Tool for Improving Maintainability of Preprocessorbased Product Lines"
( MárcioRibeiro, TársisTolêdo, Paulo Borba, Claus Brabrand )
Logo logo;
use(logo);
#ifdef (VIDEO)
logo = new Logo();
#endif
Logo logo;
logo.use();
#ifdef (VIDEO)
logo = new Logo();
#endif
*** nullpointer exception!in configurations: {Ø, {COLOR}}
Logo logo;
...
#ifdef (VIDEO)
logo = new Logo();
#endif