4588774321.pdf

P01nter Ana1y515 0f Mu1t1threaded Java Pr09ram5
5. Rame5h
Dept. 0f c0mputer 5c1ence and En91neer1n9
1nd1an1n5t1tute0f 7echn0109y, 80m6ay, 1nd1a
rame5h•c5e.11t6.ac.1n
Man9a1a 60wr1 Nanda
18M, 1nd1aRe5earch La60rat0ry
117,New De1h1110016, 1nd1a
m90wr1•1n.16m.c0m
A857RAC7
Java ha5 a 51mp1e mem0ry m0de1: c0nceptua11y, a11 06ject5 are a110cated fr0m a 9ar6a9e-c011ected heap. Java d0e5
n0t a110w ne5ted 06ject5. An 1ntere5t1n9 re5u1t 0f th15 m0de1
15 t h a t any 06ject m a y 6e repre5ented a5 a tree w1th 0n1y
tw0 1eve15 [3]. At the r00t 0f the tree 15 the 06ject a110cated
fr0m the heap a n d the ch11dren 0f the r00t are the f1e1d5 0f
the 06ject. 1f we repre5ent each heap a110cated 06ject a5
01, then every f1e1d var1a61e can 6e repre5ented a5 0 1 . f . 1n
the examp1e a60ve, the 06ject5 a110cated 0n the heap 6y the
n e w 5tatement5 at 5X, 82 and 54 are 0 1 , 02 and 04 re5pect1ve1y. Further, we deduce t h a t a . n e x t and 6.next 60th refer
t0 0x.next. N0w, 1f we app1y reach1n9 def1n1t10n5 ana1y515
u51n9 the name5 0 1 . n e x t 1n5tead 0f a . n e x t and 6.next, we
9et the c0rrect d a t a dependenc1e5 f0r the f1e1d var1a61e5.
7 h e 6a51c 1dea 6eh1nd 0ur d a t a dependence ana1y515 15 t0
reduce every f1e1d var1a61e t0 the f0rm 0 1 . f 6ef0re app1y1n9
reach1n9 def1n1t10n5 ana1y515. Current 501ut10n5 [13, 3] have
the d15advanta9e t h a t they re4u1re p01nt5-t0 9raph5 at each
pr09ram p01nt and hence tend t0 6e 1mpract1ca1 f0r ana1y515
0f 1ar9e pr09ram5. A 5par5e repre5entat10n 15 1mp0rtant a5 1t
501ve5 the pr061em 0f the hu9e mem0ry/t1me c0n5umpt10n.
1n th15 paper we 91ve a new c0m61ned p01nt5-t0, e5cape ana1y515 and d a t a dependence a190r1thm t h a t
• c0mpute5 d a t a dependence acr055 thread5,
• hand1e5 f0rk-j01n c0n5truct5, 0pen-ended thread5, m0n1t0r5 and 5ynchr0n12at10n,
• 15 path-5en51t1ve and c0ntext-5en51t1ve,
• pr0Pa9ate5 path-5en51t1ve 1nf0rmat10n 6ey0nd mer9e p01nt5,
• 6u11d5 a C0mp1ete 55A 9raph
• u5e5 a 5par5e repre5entat10n
7h15 paper pre5ent5 a c0ntext-5en51t1ve and path-5en51t1ve,
1ntra-thread and 1nter-thread 501ut10n t0 c0m61ned p01nter
ana1y515, e5cape ana1y515 and d a t a dependence ana1y515 0f
mu1t1threaded Java pr09ram5 wh1ch u5e5 a 5par5e repre5entat10n. We 6u11d and ma1nta1n a c0mp1ete 5tat1c 51n91e
A5519nment (55A) f0rm even f0r f1e1d5 var1a61e5. We 5h0w
h0w t0 c0mpute 1nter-thread dependenc1e5 f0r mu1t1threaded
pr09ram5 w1th 5tructured f0rk-j01n c0n5truct5, 0pen-ended
thread5, recur51ve1y 9enerated thread5, m0n1t0r5, and wa1tn0t1fy 5ynchr0n12at10n. We have 1mp1emented 0ur a190r1thm
1n a 511cer f0r Java pr09ram5. 0 u r exper1menta1 re5u1t5 5h0w
t h a t a 5par5e repre5entat10n 1mpr0ve5 the ana1y515 t1me and
5tr0n9 update5 0n f1e1d var1a61e5 1mpr0ve5 the prec1510n.
Keyw0rd5
mu1t1threaded p01nter ana1y515, 55A, path-5en51t1ve
1.
1N7R0DUC710N
F0r 5ca1ar var1a61e5, d a t a dependence can 6e c0mputed
u51n9 reach1n9 def1n1t10n ana1y515 [1]. Determ1n1n9 d a t a dependence 1n the pre5ence 0f p01nter5 15 c0mparat1ve1y c0mp11cated a5 d1fferent acce55 path5 m a y refer t0 the 5ame mem0ry 10cat10n a5 5h0wn 6e10w.
51: a = new c1
52: a . n e x t = new c1
83: 6 = a
54: 6.next = new c1
55: x = a . n e x t
a = 0t
a --4 01
0 1 . n e x t = 02
6= a
0 1 . n e x t = 04
x = 01.next
0 1 . n e x t -+ 02
6--+01
0 1 . n e x t --~ 04
x ~ 04
F0r d a t a dependence ana1y515 0f 10ca1 var1a61e5 (a, 6 and x)
we can 5t111 u5e reach1n9 def1n1t10n ana1y515. H0wever, f0r
f1e1d var1a61e5 (a.next, 6.next), a d a t a dependence ana1y515 6a5ed 0n the 51mp1e name5 0f acce55 path5 9enerate5 an
1nc0rrect d a t a dependence fr0m 52 t0 55 and 15 una61e t0
detect the rea1 d a t a dependence fr0m 54 t0 55.
*part1a11y 5upp0rted 6y the 1nd0-U5 pr0ject t1t1ed •Pr09ramm1n9 Dynam1ca1 Rea1-t1me 5y5tem5•.
Perm15510n t0 make d191ta1 0r hard c0p1e5 0f a11 0r part 0f th15 w0rk f0r
per50na1 0r c1a55r00m u5e 15 9ranted w1th0ut fee pr0v1ded that c0p1e5 are
n0t made 0r d15tr16utedf0r pr0f1t 0r c0mmerc1a1advanta9e and that c0p1e5
6ear th15n0t1ce and the fu11c1tat10n0n the f1r5tpa9e. 70 c0py 0therw15e, t0
repu6115h, t0 p05t 0n 5erver50r t0 red15tr16utet0 115t5,re4u1re5pr10r 5pec1f1c
perm15510n and/0r a fee.
5AC 2003, Me160urne, F10r1da,U5A
• 2003 A C M 1-58113-624-2/03/03...$5.00.
C0n51der the pr0ducer-c0n5umer pr09ram 1n
F19ure 1. 7 h e ma1n meth0d create5 a 8 u f f e r 06ject and
pa55e5 1t t0 60th the P r 0 d u c e r t h r e a d and the C 0 n 5 u m e r
t h r e a d (wh1ch run 1n para11e1) re5u1t1n9 1n a dependence 6etween 6 u f f . put (1) 1n the P r 0 d u c e r thread and 6 u f f . 9 e t ()
1n the C0n5umer thread. We app1y 1nter-thread ana1y515 t0
c0mpute 1nterference dependence [9], where a 5tatement 51
15 1nterference dependent 0n a 5tatement 52 1f 52 def1ne5 a
var1a61e v, 51 u5e5 the var1a61e, and 51 and 52 execute 1n
para11e1.
Further, c0n51der the 5ame examp1e 0f F19ure 1, except
t h a t we pa55 tw0 d1fferent 06ject5 t0 the tw0 thread5.
M0t1vat10n
1 068
Pr0ducer p1 = n e w Pr0ducer
C0n5umer c1 = new C0n5umer
(new 8uffer (),1) ;
(new 8uffer 0 , 1 ) ;
1n th15 ca5e, 0ur ana1y515 w111 determ1ne t h a t there 15 n0 dependence 6etween 6 u f f . 9 e t 0 and 6 u f f . p u t (1). C1ear1y,
c0mput1n9 dependence acr055 thread5 cann0t 6e 501ved w1th
51mp1e var1a61e name5. We 6u11d 5tat1c 51n91e A5519nment
(55A) 9raPh5 t0 c a p t u r e a11 t h e nece55ary d e p e n d e n c e 1nf0rmat10n. F0r t h e examp1e 1n F19ure 1 0ur ana1y515 9enerate5
1nf0rmat10n 5h0wn 1n F19ure5 5 and 6.
2.
1N7RA-PR0CEDURAL
c1a55 P r 0 d u c e r extend5 7 h r e a d {
pr1vate 8 u f f e r 6 u f f ; pr1vate 1nt 1d;
pu611c Pr0ducer ( 8 u f f e r 6, 1nt 1d ) {
6 u f f = 6;
10.6uff = 11
th15.1d -~ 1d;
10.1d ----12
}
ANALY515
Each J a v a m e t h 0 d 15 repre5ented u51n9 a C0ntr01 F10w
6 r a p h ( C F 6 ) 1n wh1ch each n0de repre5ent5 a 5tatement
0r pred1cate and the ed9e5 repre5ent f10w 0f c0ntr01 [1]. F0r
51mp11c1ty we f1r5t exp1Mn p01nter ana1y515 f0r 10ca1 var1a61e5
and 10ca1 f1e1d var1a61e5 (5ect10n 3 dea15 w1th p a r a m e t e r and
5tat1c var1a61e5). 1 We create 0ne c0mp11e-t1me 06ject 0 f0r
each new 5 t a t e m e n t 1n the Pr09ram. We ca11 0 a5 an 0 6 j e c t
Var1a61e ( 0 V ) and 0 . f a5 a n 0 6 j e c t F1e1d Var1a61e ( 0 F V ) .
Let 5 6e a n0de 1n the C F 6 . Let 5 . U 5 E den0te t h e 5et 0f
var1a61e5 u5ed 6y t h e n0de and 5 . D E F den0te t h e 5et 0f var1a61e5 def1ned 6y the n0de. 7 h e 1n1t1a1 va1ue5 f0r 5 . D E F and
5 . U 5 E f0r any 5 t a t e m e n t 5 are 91ven 1n F19ure 2. F0r each
var1a61e d E 5 . D E F 1et d . P 7 5 = d --+ { 0 1 , . . . , 0 n } den0te
t h e 5et 0f 06ject5 0 1 , . •., 0 n t h a t d m a y p01nt t0 at 5. 7 h e r e
15 a 5eparate d . P 7 5 5et f0r each 10cat10n at wh1ch d 15 def1ned, thu5 en5ur1n9 t h a t t h e p01nt5-t0 1nf0rmat10n 15 ma1nta1ned 1n a path-5en51t1ve manner. Let R d P 0 1 n t ( v , 5 ) =
{ 0 1 d - ~ 0 and d reache5 v at 5}. 61ven t h e 5et 0f def1n1t10n5 t h a t m a y reach v at 5 , R d P 0 1 n t ( v , 5 ) 15 t h e un10n 0f
a11 0 V 5 t h a t any 0f the5e def1n1t10n5 m a y p01nt t0. F1na11y,
1et R d P 0 1 n t ( v , 5 ) . f = { 0 . f 1 0 C R 4 P 0 1 n t ( v , 5)} .
7 h e 6a51c 1dea 6eh1nd 0ur p01nter ana1y515 a190r1thm 15
a5 f0110w5: each 10ca1 var1a61e 1k wh1ch 15 a5519ned an 06ject
var1a61e, 0k 15 5a1d t0 p01nt t0 t h a t 06ject var1a61e, den0ted
a5 1~ -~ 0k. 1f 1k 15 further a5519ned t0 an0ther var1a61e 1j
t h e n 1j 15 a150 5et t0 p01nt t0 01 (1j --~ 0~). 1f the var1a61e
1k p01nt5 t0 0k, t h e n a var1a61e 1k.f can 6e c0nverted 1nt0
the f0rm 0 ~ . f . 7 h e p01nter ana1y515 a190r1thm 1terate5 0ver
t h e n0de5 1n the C F 6 1n t0p01091ca1 0rder and perf0rm5 the
f0110w1n9 0perat10n5
1. F0r a n0w 5tatement, v =
and 5et v . P 7 5 = {01 }
pu611C v01d run() {
1nt1=0;
wh11e (1 < 10) {
6uff.put(1);
1=1+1;
}
}
3. F0r a c0py 5 t a t e m e n t u = v, (where u and v m a y 6e
10ca1 var1a61e5 0r an 0 F V , 0 . f ) 5et u . P 7 5 = u . P 7 5 0
RdP01nt(v).
F19ure 3 111u5trate5 an examp1e 0f the a60ve ana1y515. N0t1ce
t h a t p01nter and d e p e n d e n c e ana1y515 15 p e r f 0 r m e d 0n1y 0n
10ca1 var1a61e5 and 0 F V 5 and n0t 0n f1e1d var1a61e5.
1n1t1a11y we c 0 m p u t e t h e 5 5 A f0rm f0r 10ca1 var1a61e5 [4]
1n a m e t h 0 d . We d0 n0t r e n a m e var1a61e5 6ut 0n1y c0n5truct
def-u5e ed9e5. 7 h e n we 1ncrementa11y u p d a t e the 5 5 A c0n5tructed 6y hand11n9 acce55e5 t0 f1e1d var1a61e5. 1n a 51n91e p05t0rder traver5a1 0f t h e d0m1nat0r tree, we determ1ne
and cache the d0m1nance fr0nt1er 0f each n0de. 7 h e n the
n0de5 1n t h e C F 6 are ana1y2ed 6y a pre0rder traver5a1 0f
t h e d0m1nat0r tree. W h e n an a5519nment t0 an 0 F V 0 k . f ,
15 d15c0vered at a n0de 5, we 1n5ert a ¢ - n 0 d e f0r 0 k . f 1n each
}
c1a55 C 0 n 5 u m e r extend5 7 h r e a d {
pr1vate 8 u f f e r 6uff; pr1vate 1nt 1d;
pu611c C 0 n 5 u m e r ( 8 u f f e r 6, 1nt 1d ) {
6 u f f : 6;
1 0 . 6 u f 1 = 1:
th15.1d : 1d;
10.1d = 12
}
pu611c v01d run() {
1nt 1 = 0 ;
1nt va1ue = 0;
wh11e (1 < 10) {
va1ue : 6uff.9et();
1:1+1;
}
}
11 = 0
12 : 0
wh11e(1/ < 10)
13 : 10.6uf f; 12 : 13.9et()
1:=11+1
}
c1a55 8 u f f e r {
pr1vate 1nt 5e4;
pr1vate 6001ean ava11 ----fa15e;
pr1vate 1nt dc ----0;
pu611c 5ynchr0n12ed 1nt 9et() {
wh11e ( ava11 : = fa15e ) {
wa1t();
}
}
ava11 = fa15e;
dc = dc - 1;
de = de - 1;
n0t1fy();
return 5e4;
wh11e(10.ava11 = : fa15e)
10.wa1t()
10.ava11 = fa15e
10.dc = 10.dc- 1
10.dc = 10.dc - 1
10.n0t1f y()
return10.5e4
pu611c 5ynchr0n12ed v01d put(1nt va1ue) {
wh11e ( ava11 =~- true ) {
wh11e(10.ava11 == true
}
wa1t();
10.wa1t0
5e4 = va1ue;
new c1, create an 0 V , 01
2. (a)F0r each var1a61e 1k.f u5ed at 5, 5et 5 . U 5 E
=
5 . U 5 E U R d P 0 1 n t ( 1 k , 5 ) . f . (6) F0r each var1a61e 1k.f
def1ned at 5, 5et 5 . D E F = 5 . D E F 0 R d P 0 1 n t ( 1 k ,
5).f .
11 = 0
wh11e(1/ < 10)
12 = 10.6uf f; 12.put(11)
11 = 1 1 + 1
}
}
10.5e4 = 1x
10.ava11 = true
"10.dc=10.dc+1
10.dc = 10.dc + 1
10.n0t1f y()
ava11 = true;
dc = dc +1;
dc = dc + 1;
n0t1fy();
c1a55 P r 0 d u c e r C 0 n 5 u m e r 7 e 5 t {
pu611c 5tat1c v01d ma1n(5tr1n9[]ar95) {
8 u f f e r 6 = new 8 u f f e r ( ) ;
11 : new 8 u f f e r
Pr0ducer p1 = new Pr0ducer(6, 1); 14 = new Pr0duCer
14.(1n1t)(1:, 1); 12 : 14
C 0 n 5 u m e r c1 = new C0n5umer(6, 1);15 = new C 0 n 5 u m e r
15.(1n1t)(1:, 1); 13 ---- 15
p1.5tart0;
12.5tart()
c1.5tart();
13.5tart()
}
} /* 7he Pr0ducer-C0n5umer examp1e w1th p5eud0 6ytec0de */
F 1 9 u r e 1: P r 0 d u c e r - C 0 n 5 u m e r
LH5
RH5
151nce we ana1y2e J a v a 6ytec0de, a11 mu1t1p1e-1eve1 reference
expre5510n5 axe 5p11t 1nt0 a 5e4uence 0f tw0 1eve1 reference5.
F0r 1n5tance, 1 . f . 9 . h = m 15 tran5f0rmed 1nt0 13 = 1: .f; 1a =
13.9; 14.h = m
7ype
10ca1
f1e1d
10ca1
f1e1d
new c1
var1a61e
1k
1k. f
1k
1k.f
DEF
11
1k. f
examp1e
U5E
1k
1k
1k, 1k.f
0k
F 1 9 u r e 2:1n1t1a1 Va1ue5 f0r U 5 E a n d D E F
1069
8 y t e c0de
51 : a = n e w c 1
52 : a . f = new c1
D
a
a.1
55 : X = a . f
D E F --+ P 7 5
U5E
a --r 01
a. f , 01 . f --1. 02
01
02
6
a
6.f
04
6 --r 01
6.f, 0 1 . f -+ 04
a
04
x
a.f
X -•1" 04
a.f, 0 1 . f
52:6=a
5•4 : 6.f = new c1
U
02
02
exp1anat10n
After ana1y515
8e16re
F19ure 3: 111u5trat1ve examp1e f0r c0mput1n9 D E F a n d U 5 E . D and U repre5ent def1n1t10n a n d u5e at 50urce
1eve1 (a5 def1ned 1n F19ure 2).
a ~ 01
5,
e6a
~01
"9~0503020104
52
~
53
~
54
55
02.9~ 06
5657
P0 t~4 ~03
{02.9, 0,.9} < ~
6~0~
~03
d~04
0~.9~ %
02.9~ %
04.f=40
14~
041:~"
02
5,,~
~
0
0,.9--% 02.9~04
[::::::::::
......~03
u5
{03.f, 04.f, 05.f} =20 517
t ~ 0~.9---. 05
20~) 03 .f=20 05 .f=20
5 1 5 ~ d ~ -.= 04.f
Path-5en51t1ve
mer9e
Path-1n5en51t1vemer9e
:]5,
(a)
~
CF6ed9e
/
...= 04.f ~
D0m1nat0red9e [I
F 1 9 u r e 4: P a t h 5en51t1ve m e r 9 e 5 (a) 7 h e C F 6
n0de 6e10n91n9 t0 the 1terated d0m1nance fr0nt1er 0f 5 [4].
70 determ1ne RdP01nt(v, 51) f0r a 10ca1 var1a61e, we f0110w
6ackward5 0ne 55A def-u5e ed9e. F0r 0ther var1a61e5, t0 determ1ne RdP01nt(v, 51) we wa1k 6ack up the d0m1nat0r tree
unt11 we c0me t0 a u5e 0r an a5519nment 0f v. 1f we reach
a u5e 0f v we u5e the 55A def-u5e ed9e t0 j u m p 5tra19ht t0
the c0rre5p0nd1n9 def1n1t10n 0f v. 5uch an a5519nment 0f v
ex15t5 6ecau5e we ana1y2e the n0de5 6y a pre0rder traver5a1
0f the d0m1nat0r tree.
1f we reach the meth0d entry w1th0ut f1nd1n9 an a5519nment we create a d u m m y 1n1t1a112at10n a5519nment. Fr0m
an a5519nment 0f v at 5j, we draw a def-u5e ed9e t0 5~.
Path-5en51t1ve Ana1y515. 1n F19ure 4(a), due t0 the mer9e
n0de 515.DEF = {01.9,02.9}; and 60th 01.9 and 02.9
p01nt t0 0 a and 04. A5 a re5u1t, at 516, t p01nt5 t0 e1ther
03, 04 0r 05, and at 51r, we 9et a fa15e def1n1t10n 0f 0 4 . f
re5u1t1n9 1n a fa15e d a t a dependence fr0m 51r t0 518. 70
(6)
5~8
a n d (6) 7 h e c0rre5p0nd1n9 d0m1nat0r t r e e
e11m1nate 5uch 1mprec1510n, f0r every def1n1t10n a.5 ----v, we
check whether the reach1n9 def1n1t10n5 0f a and v are ¢n0de5, and the C-n0de5 6e10n9 t0 the 5ame 6a51c 610ck. 1f 50,
we match the c0rre5p0nd1n9 reach1n9 def1n1t10n5 0f a . f w1th
th05e 0fv. At 515 1n F19ure 4(a), the a190r1thm 9enerate5 the
path-5en51t1ve 1nf0rmat10n t h a t 01.9 --~ 03 and 02.9 --~ 04.
7h15 e11m1nate5 the fa15e d a t a dependence fr0m 517 t0 515.
55A 6 r a p h f 0 r Weak Update5. A def1n1t10n 15 a weak
u p d a t e 1f 1t d0e5 n0t k111 0ther def1n1t10n5 reach1n9 1t. 1n
F19ure 4(a), at 516 there 15 a u5e 0f 01.9, and at 515 there 15
a def1n1t10n 0f 01.9. H0wever, the def1n1t10n 0f 01.9 at 515
5h0u1d n0t k111 the def1n1t10n 0f 01.9 at 55 a5 the def1n1t10n
0f 01.9 at 515 15 9enerated 0n1y a10n9 0ne 6ranch 0f the
1f 5tatement. We re4u1re a def-u5e ed9e fr0m 60th 55 and
515 t0 516. 7h15, h0wever, v101ate5 the ••51n91e a5519nment••
pr0perty 0f the 55A f0rm. 50 we 1ntr0duce 5pec1a1 ¢-n0de5,
ca11ed p-n0de5 t h a t mer9e the tw0 def1n1t10n5 0f 01.9 t h a t
1070
N0de
F0rma11n
F0rma10ut
F0rma11n
F0rma10ut
E5cape1n
E5cape0ut
E5cape1n
E5cape0ut
Var1a61e t y p e
Reference
Reference
Pr1m1t1ve
Pr1m1t1ve
Reference
Reference
Pr1m1t1ve
Pr1m1t1ve
D E F -+ P 7 5
U5E
1,
Y,
Y~
Examp1e. C0n51der F19ure 5(a) and the meth0d C0netmer.rtm.
At t20 there 15 a u5e 0f -~0.6uff. A traver5a1 up the d0m1nat0r
tree determ1ne5 that there 15 n0 reach1n9 def1n1t10n 0f Jc0.6uff 1n
the meth0d. 7heref0re we create an E5cape[n n0de at t3. 51nCe
.70.6~ff 15 a reference var1a61e, we 9enerate a new f0rma1 var1a61e
and name 1t .71. At t3, we 9et 5%.6uff ----- .F~1 and the p01nter
ana1y515 w111 9enerate the 1nf0rmat10n ~0.6uff --~ .7:1. At t12, the
u5e 0f .71.5e4 9enerate5 an E5cape1n n0de at t4. A new f0rma1
var1a61e 15 n0t created a5 J:1.5e4 15 n0t a reference var1a61e. 1n
F19ure 6 at x5 1n Pr0ducer.(1n1t), .70.6uff 15 def1ned. 7he c0rre5p0nd1n9 E8cape0ut n0de created at x7 15 . 7 : 0 . 6 ~ f f = Y : 0 . 6 u f f .
7he D E F e1ement 15 created 0n1y a5 a p1ace h01der f0r the p01nt5
t0 1nf0rmat10n. 7he p01nter ana1y515 9enerate5 the further 1nf0rmat10n ~0.6uff --~ ~1. 7he def1n1t10n 0f ~0.1d at x6 9enerate5 an
F19ure 7: F0rmaL1n, F 0 r m a 1 0 u t , E 5 c a p e 1 n a n d E5c a p e 0 u t n 0 d e 5 . ~ne~ 15 a n e w f0rma1 var1a61e t h a t
e 5 c a p e 5 t h r 0 u 9 h t h e 5 a m e 5et ¢ a n d r e p r e 5 e n t 5 t h e
actua1 0 6 j e c t c r e a t e d 0ut51de t h e m e t h 0 d .
E5cape0ut n0de • = ~0.1d ~ at x8.
reach 51~. 1n 9enera1, we need t0 9enerate a #-n0de at a n0de
where tw0 0r m0re var1a61e5 0f the f0rm 0 . 1 are def1ned. F0r
examp1e, 1n F19ure 4(6), at 515, tw0 0 F V 5 01.9 and 0~.9
are def1ned. 50 we create a #-n0de at 5~5 wh1ch ha5 tw0
reach1n9 def1n1t10n5 5~5 and 5~.
3.
Re1erence
Pr1m1t1ve
Reference
Pr1m1t1ve
5tat1c re1
5tat1c pr1m
1 N 7 E R - P R 0 C E D U R A L ANALY515
We traver5e the ca11 9raph 1n 60tt0m-up t0p01091ca1 0rder
5ummar121n9 each meth0d. F0r recur51ve ca115 we perf0rm
f1x p01nt 1terat10n. F0r each f0rma1 parameter we create an
1mp11c1t a5519nment 11 = ~-1. 6~1 15 termed a F0rma11n var1a61e. 1f 6v1 repre5ent5 a reference var1a61e, then ~1 15 treated
11ke an 0 V . We treat r e t u r n 5tatement5 a5 an a5519nment
t0 a 5pec1a1 var1a61e 9v~.
A var1a61e 0 f t h e f0rm ~1.f.9 15 ••v15161e•• 0ut51de the meth0d
thr0u9h ~-1. We ca11 ~1 an e5cape 9ateway. A var1a61e
t h a t 15 v15161e 0ut51de 1t5 meth0d 15 marked Meth0dE5cape
and a var1a61e t h a t 15 v15161e 0ut51de 1t5 thread 15 marked
7hreadE5cape. E5cape ana1y515 15 5ummar12ed 6e10w:
• A reference F0rma11n var1a61e e5cape5 the meth0d.
At every F0rma11n n0de, 11 = ~1, 1f 11 15 a reference
where the 5uper5cr1pt 1nd1var1a61e, we 5et 11 -+ ~
cate5 t h a t the 06ject var1a61e ~1 e5cape5 thr0u9h the
9ateway 5c1. We mark ~-[~ a5 Meth0dE5cape.
• F0r an a5519nment 0f the f0rm 9v~~. f = v, 1f v p01nt5
t0 02, then 02 e5cape5 w1th Y1 and 15 repre5ented a5
0 ~ ~. 1t 15 marked Meth0dE5cape.
• F0r a r e t u r n 5tatement 5rr = v, and v --~ 01, 01 e5;a~e;. theWecreatemeth0daF0rma10utthr0u9hthe n0dee5capef0r9atej~a5~-~5h0wn(1.e.,
1n F19ure 7.
• A u5e 0f 0 ~ . f e5cape5. H0wever, 51nce 01 wa5 c1ear1y
created w1th1n the meth0d, the f1e1d 0 ~ . f c0u1d n0t
have 6een a5519ned 1n the ca111n9 meth0d 6ut, 1t c0u1d
6e a5519ned 1n a para11e1 thread. 50 we create an
E5cape1n n0de f0r 1t and mark 0¢1 .f a5 7hreadE5cape.
Reference
Reference
Pr1m1t1ve
Pr1m1t1ve
5tat1c ref
5tat1c pr1m
Actua11n
11 = Y1
11 = Y1
•A1 ~ eXp
= exp
E5cape1n
Actua11n
~1.1 =2:j
A~ = A1.1
A~.f
.~ = ct. f
.7•1.f=
a.f=.rj
=
c1.f=
F0rma10ut
.r, ~ (.r~, 0k ) = .r,
= .r,
E5cape0ut
=
01.f
=y,.f
d . f - , 1Y~, 0k )
= e1.f
v, = 1 y ~ , 0 ~ )
V,, =
Actua10ut
01.f
=
A1.f =
d . f = (.A~, 0 ~ )
C1.f =
F19ure 8: A c t u a 1 1 n a n d A c t u a 1 0 u t n 0 d e 5
5tat1c var1a61e5, are treated ju5t 11ke parameter var1a61e5,
except that the e5cape 9ate type 15 7hreadE5cape rather
than Meth0dE5cape. F0r recur51ve 06ject5 that are created
0ut51de a meth0d, we u5e a 1-11m1ted 5cheme dur1n9 the creat10n 0f E5cape1n n0de. W h e n the a190r1thm detect5 tw0
u5e5 0r tw0 def1n1t10n5 0f the 5ame f1e1d at the 5ame pr09ram
p01nt 5uch that 60th e5cape thr0u9h the 5ame 9ateway parameter, 1t mer9e5 the tw0 var1a61e5.
Hand11n9 Actua1 Parameter5.
• F0r each def1n1t10n ~ . f 0r 0¢~.f we create an E5cape0ut
n0de a5 5h0wn 1n F19ure 7.
• F0r each u5e ~ . f
the p01nter ana1y515 5earche5 up
the d0m1nat0r tree f0r a c0rre5p0nd1n9 def1n1t10n. 1f
there 15 n0ne, we create an E5cape1n n0de a5 5h0wn
1n F19ure 7.
Reference
Pr1m1t1ve
F0rma11n
At a meth0d 1nv0cat10n
51te, we 9enerate 0ne Actua11n n0de f0r each F0rma11n
and E5cape1n n0de and we 9enerate 0ne Actua10ut n0de
f0r each F 0 r m a 1 0 u t and E5cape0ut n0de. F0r each f0rma1 reference var1a61e ~1, we create an ••actua1-1n••
var1a61e .A1 wh1ch 15 treated dur1n9 p01nter ana1y515 a5 a 10ca1 temp0rary var1a61e. 7 h e 5tructure 0f the Actua11n and
Actua10ut n0de5 15 5h0wn 1n F19ure 8 where exp 15 the actua1 expre5510n pa55ed a5 a parameter t0 the meth0d and
Vr 15 the var1a61e t0 wh1ch the return va1ue 15 a5519ned.
We 9enerate a P a r a m e t e r 1 n ed9e fr0m the Actua11n n0de
t0 the c0rre5p0nd1n9 F0rma11n 0r E5cape1n n0de and a
P a r a m e t e r 0 u t ed9e fr0m each F0rma10ut 0r E5cape0ut
n0de t0 the c0rre5p0nd1n9 Actua10ut n0de.
1071
t1[EntC0n5um~.
er )mn
u2
[ F0 .m0n1t0rent~ )
/u7.~w~t,
~1~~
11~F~1.1
~ F°..1,0,,.
( F..v.,
~ u,
.1.1.1.111~1~.
.1.1.1.111111111111~
1 ~ ))1uu12u14
13u16u15
u11u10
.1, ~
...................................................
11f
~0 .... ,0~0~1,j.1~
t16 1~""A01a~a11=~ ~~ --..~.~:ava~.~.................................11
1= 1=
(a)
v1(EntPr0duc¢r.
er ]run
[
1~2~1:............ ~2.~t;~---~0~,
w2 ~ F~ .m0.1t0~n~ )
t0~ F0
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
,
~,-F0
w6~-~4-........
........
........
111J
:: :~1111:
1:
~,~j,;~;0-,
~ F0.d~= F0.dc
1) w.
v9~
A012--F~F~ 1111
1)w12
V11
........
#.....:.......................................
-•,..11=F
1 rava11 •1 :............~:--~F0~.:5w14
~.-:3
F°•dc = ¢F0 "dc +
V12V14V13
~:~1~::1~1::~:~:F::,5:;¢4=
:/:~:1:1:11::::1•11:1"1::1:1:111
::1F01~111~1:
....•t0r¢X1tw17
w16w15
:1[
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::: F.rdc~:
..............................
put
Mapp1n9
.0VF ~011 v17:::::........
v15v16
•. . . . : . . {
.........
v18 ( ,,=t,+1
)
C0)
~......
~.~D01311nat
Param¢ted9e$
~111]
0r Para¢d~¢$
n1¢t¢~t0t1t
-~
~,
.....
j"-,,_~- ' F°rma11tdF°rma10ut
n°d¢5E5,ap01n/E~..ap¢0u~
tt0d¢5
"••.:::Actua11n]A¢tua10Utn0d*5
(:::) 0,h¢..0~¢.
F19ure 5: 7 h e d0m1nat0r tree f0r (a) C0n5umer.run 0 and 9et() and (6) Pr0ducer.run 0 and put().
1072
21 ( Enterma1n )
( EnterPr0dueer.<1n1t> ~ x1
• _
,0 -F0
22 ~11=new8uffer) 1 j ~ 0 1
1__ x2
=,2
.............
~ [ 0,.5e4=-1 )
.,0:17:,..:; .......... 1
.
0,avJ=, 15ej
225 1 ..........~....:......=
A t.ava11 1..... --0.1:ara~ ......... ~.~.v:5.3
226 1......A•{• ,.de 1...... -.0.,:d.e............ ~7~3
•27 [ h . m , 0
F0~6uff~F1 ~..F~a1~:~16:ff,./x7 ......................
~.....................29..~......,.....=<~>...~
.2.8.1.AL7.~, ..... ~ A , -
}
0,
229 1.A~.-.Q3..6.u.ff...--~7Q....~7~1~.,,,,
[ ~ A.0.:17uff.
1"..... :1,.A.
210 ~
h.<1n1t>(1,,<1>)
:
.)
0
232 1 r ~ , . ~
10 ~F0CEnterC0
er.<1n1t>210~F~0~,.a.y2...........
....
) y1
214(15
213 =new
C~C0n5umer)1215~03
~02
233[
~
7°,:d~ ........... ~ . / ,
6.5~rt ~ . . . ~
t1
Mapp1n9
Pr0ducer.<1n1t>.F0 ~ ma1n•02
F0.6uff~F ~ ~
y5
F~.6Uff--F, ( ~ ~ 1 1 1 1 7 . ~
............................
217 :...~=<1>~}~.}..~/j
:::2~9~:51~1111~:11;1:)>:~)=.
...........
...,......~)..~.,.A0..1d.=~03..0.311"d6uf~-~"
]
221 ~
1~ ~ 0 ~
..~...
1.,....222:
F 1 9 u r e 6: 7 h e d 0 m 1 n a t 0 r
".••..... Actua11n/Actua10utn0de5
Pr0ducer.run.F 1 ~
C~
n0de5
C0n5umer.run.F 0 ~ ma1n.03
C ~ 0ther n0de5
C0n5urner.run.F j ~ ma1n.01
F0rk
ma1n~01
t r e e f 0 r ma1n0, Pr0ducer.(1n1t) a n d C0n5umer.(1n1t)
Examp1e. C0n51der the ca11t0 Pr0ducer.(1n1t) 1n ma1n 1n F19ure 6.
F0r the F0rma11n n0de x2, we create an Actua11n n0de 27 and
any 0ther m e t h 0 d . H0wever, at the ca11 51te 0f a run m e t h 0 d
1n the C F 6 we 1n5ert a f 0 r k n0de t h a t ha5 tw0 5ucce550r5:
(1) the entry n0de 0f t h e run m e t h 0 d and (11) the 5 t a t e m e n t
t h a t 1ex1ca11y f0110w5 t h e f 0 r k n0de. F0r every t h r e a d 9enera t e d w1th1n a 100p 2, we 9enerate tw0 repre5entat1ve thread5
t h a t f0rk fr0m the 5ame f 0 r k n0de. We a55ume (c0n5ervat1ve1y) t h a t tw0 5tatement5 m a y execute 1n para11e1 1f the1r
c105e5t c 0 m m 0 n ance5t0r 1n t h e C F 6 15 a f 0 r k n0de. At the
f 0 r k n0de, we 1n5ert appr0pr1ate Actua11n n0de5 6ef0re t h e
ca11 t0 the run m e t h 0 d a5 exp1a1ned 1n 5ect10n 3. H0wever,
Actua10ut n0de5 are 1n5erted 0n1y at a j 0 1 n n0de, where a
j 0 1 n n0de 15 a n0de 1n t h e parent t h r e a d where 1t j01n5 the
ch11d t h r e a d (u51n9 the J a v a m e t h 0 d j 0 1 n ( ) ) .
1nter-thread ana1y515 ha5 tw0 pha5e5:mapp1n9 and p01nter
ana1y515. 7 h e mapp1n9 pha5e map5 an 06ject 0 created 1n a
parent t h r e a d t0 the p a r a m e t e r 06ject var1a61e 9r u5ed 1n a
ch11d thread. 7 h e effect 0f th15 15 t0 en5ure t h a t parameter5
0f tw0 pr0cedure5 m a p t0 t h e 5ame n a m e 1f t h e y m a y acce55 the 5ame 06ject (f0r examp1e, 1f a parent t h r e a d pa55e5
the 5ame 06ject 1nt0 tw0 ch11d thread5). 0 n c e the f0rma1
f0r the f0rma1 var1a61e .%0 we create an actua1-1n var1a61e .40. 7he
c0rre5p0nd1n9 actua1 parameter 15 24 and 50 we 9et 27 : A0 = /4.
F0r the F0rma11n n0de x3 : 12 = .72, we create 28 : A2 = 11.
F0r the F0rma11n n0de x4 : 12 : -7:2, we d0 n0t need t0 Create an
actua1-1n var1a61ea5 3~2 15 n0t a reference var1a61e. Hence we 9et the
Aetua11n n0de 29 : • = 11••, w1th an empty D E F 5et. 7here 15 n0
F0rma10ut n0de 1n Pr0ducer.(1n1t), 6ut there are tw0 E5cape0ut
n0de5. At the E5cape0u$ n0de x7, we have r10.6uff : r10.6uff
and .%0.6uff --) -%1. 7he C0rre5p0nd1n9 Actua10ut n0de 15 211 :
.40.6uff : A1. F0r the E5cape0ut n0de • : -%0.1d" we create
the Actua10ut n0de ".40.1d =~.
0nce, the5e n0de5 are created, the p01nter ana1y515 c0nt1nue5 a5
6ef0re. At 27, the reach1n9 def1n1t10n f0r 14 15 26 and th15 9enerate5
the 1nf0rmat10n A0 --~ 02- At 28, we 9et .A1 --~ 01. N0w, at 211,
the reach1n9 def1n1t10n f0r .40 15 at 27 and the reach1n9 def1n1t10n
f0r J[1 15 at 28. Hence at 211 the p01nter ana1y515 determ1ne5 that
02.6uff --~ 01. 51m11ar1y, at 212, the p01nter ana1y515 determ1ne5
that 02.1d 15 def1ned.
4.
Pr0ducer.<1n1t>.F1 ~ ma1n.01
..... ~. Parameter1n/Parameter0uted9e5 C0n5umer.<1n1t>.F0 ~ ma1n.0
D0m1nat0red9e5
C0n5umer.<1n1t>.F = ~ ma1n.0 1
~- "~1F0rma11n/F0rma10utn0de5
Pr0dueer.run.F 0 ~ ma1n~02
~...~..1
~
E5cape1n/E5cape0utn0de5
1 N 7 E R - 7 H R E A D ANALY515
F0r 1nter-thread ana1y515 t h e run m e t h 0 d 15 t r e a t e d 11ke
1073
2the f 0 r k n0de 15 (tran51t1ve1y) c0ntr01 d e p e n d e n t 0n a 100p
header.
7a61e
1: 8 e n c h m a r k
7a61e
Pr09ram5
na171e
na171e
511ce
v01an0
han01
mu1t1
raytracer
mande16r0t
javacup
e5pre550
j1ex
num6er
512e 0f meth0d5
0f c1a55e5 c1a55e5
257
563K
745
265
564K
540
752
587K
705
158
285K
496
251
543K
605
572
673K
786
193
430K
575
252
569K
637
167
367K
430
5tatement5
35209
27710
30947
18018
26227
35227
40219
48764
16192
511ce
v01an0
han01
mu1t1
raytracer
mande16r0t
javacup
e5pre550
j1ex
E x a m p 1 e ( P 0 1 n t e r ana1y515). 7he 9106a11ye5cap1n9 var1a61e
02.dc 15 def1ned and u5ed at u20 and u22 1n the c0n5umer thread
(F19ure 5(a)) and 1t 15 a150 def1ned and u5ed at w11 and w12 (F19ure 5(6)) 1n the pr0ducer thread. When pr0ce551n9 u20, the ana1y515
f1nd5 a u5e 0f 02.dc and determ1ne5 that the def1n1t10n5 at wH and
w12 execute 1n para11e1w1th u20. 1nterference dependence ed9e5 are
drawn fr0m each 0f w22 and w22 t0 u20.
M0n1t0r5 and wa1t/n0t1fy 5ynchr0n12at10n.
F0r p01nter5
enc105ed w1th1n m0n1t0r5 1t 15 p055161e t0 check whether a
def1n1t10n 15 ••d0wnward exp05ed•• (1. e., the def1n1t10n reache5
the end 0f the m0n1t0r) and the c0rre5p0nd1n9 u5e 15 ••upward exp05ed•• [10]. 7h15 may reduce the num6er 0f 1nterference dependence ed9e5. 7 h e wa1t/n0t1fy ed9e5 are ea511y detected a5 1nterference dependence ed9e5 6etween the
wr1te(0~.(10ck)) 5tatement at n0t1fy() and the read(0~.(10ek))
5tatement at wa1t().
:Examp1e. 7he 1nter-thread p01nter ana1y515 a190r1thm 9enerate5 an
1nterference dependence ed9e fr0m w11 (1n F19ure 5(6)) t0 u10 (1n
F19ure 5(a)). H0wever, wt2 15 1n51de a 5ynchr0n12ed meth0d and
the def1n1t10n at w12 15 k111ed 6y the def1n1t10n at w22. Hence th15
def1n1t10n cann0t reach e1ther u10 0r u12.
nan1e
511ce
v01an0
ha2101
mu1t1
raytracer
mande16r0t
t 1 m 1 n 9 1n 5 e c 0 n d 5
8u11d+DD+CD
wh01e
m1nu5
Pr09
116
37.86
0.29
212.36
1.01
99.29
4.07
3.74
0.15
49.37
0.14
305.04
0.31
439.12
96.14
579.57
38.8
230.28
1.56
7 a 6 1 e 3: D a t a
parameter ~- ha5 6een m a p p e d t0 50me 06ject 0 , every 0ccurrence 0f ~" 1n the meth0d 15 rep1aced 6y 0 . 7h15 pr0ce55
repeat5 tran51t1ve1y d0wn the ca11 9raph and hence 1n the
pre5ence 0f recur51ve1y 9enerated thread5 we need t0 repeat
th15 pr0ce55 1terat1ve1y unt11 we reach a f1xed p01nt. 0 n c e
the var1a61e5 0f each meth0d have 6een mapped, the p01nter
ana1y515 pha5e attempt5 t0 f1nd a def1n1t10n 0f a mem0ry 10cat10n t h a t 15 referenced 1n a para11e1 thread and perf0rm5
p01nter ana1y515 acr055 thread5.
E x a m p 1 e (Mapp1n9). 1n F19ure 6 227 15the ca1151tef0r Pr0ducer
.run. 222 15 an Actua11n n0de w1th .A0 --+ 02. 50 we 9enerate
the mapp1n9 Pr0ducer.run..70 ~-+ 02 (1n F19ure 5(6)). At 223,
A2 --~ 02 9enerate5 the mapP1n9 Pr0ducer.run.Yr1 ~ 01 (1n F19ure 5(a)). 7he 0ther Actua11n n0de5 d0 n0t 9enerate any mapp1n9.
02 and 02 are marked 6106a1E$Cape.
W1th1n, run, we rep1aCe a11 0Ccurrence5 0f .70 6y 02 and .71
6y 01. 7heref0re, at v20, -40 -~ .72 w111 6e rep1aced 6y ,40 ~:~
01. Further, 51nCe v10 15 an Actua10ut n0de f0r the ca11 t0 put,
we a150 9enerate the mapp1n9 put.~0 ~ 01. When the ana1y515,
enter5 the meth0d put, a11 0CCurrenCe5 0f put.:7•0 w111 6e rep1aCed
6y 01. 50, at w22 and w22, .70.dc : .70.dc -1- 1 w1116e rep1aced 6y
01.dc : 0 2 . d c + 1. 51m11ar1y,1n the meth0d 9et 1n F19ure 5(a) a150,
9et..70 ~-~ 02 and at u10 and u11, we 9et 01.dc = 01.dc - 1.
2:Ana1y515
DD
172800
236878
223270
56874
167939
327739
Map
1nter
thread
•16ta1
0.65
0.73
0.88
0.13
0.61
2.02
5.16
8.19
8.32
0.66
5.37
21.97
43.67
221.28
108.49
4.53
55.35
329.03
Dependence
Ana1y515
N0. 0f ed9e5
1D
DD(weak)
5382
176092
39
240325
5101
229733
3556
58378
4564
170450
5826
342479
1D(weak)
5382
39
5101
3580
4564
5826
482557543264538859
5.
EXPER1MEN7AL RE5UL75
We have 1mp1emented the a190r1thm 1n a 5tat1c 511cer f0r
c0ncurrent Java pr09ram5. 7e5t1n9 wa5 perf0rmed 0n a
un1pr0ce550r 770MH2 1nte1 Pent1um 111 w0rk5tat10n w1th
256M8 0f mem0ry runn1n9 under L1nux. 7 h e te5t pr09ram5
have 6een de5cr16ed 1n 7a61e 1. 7 h e mu1t1threaded pr09ram5 are 511ce, an app1et 06ta1ned fr0m Er1c Ruf•5 we6
pa9e [11], v01an0, a chat r00m 51mu1at0r, han01, an 18M
6enchmark, mu1t1, a pr09ram t h a t d0wn10ad5 a we6 51te,
r a y t r a c e r , a mu1t1threaded ray tracer and mande16r0t, an
app1et t0 exp10re the Mande16r0t 5et. 7 h e 51n91ethreaded
Pr09ram5 are j avacup, a Java c0n5truct0r 0f par5er5, e 5 p r e 5 5 0 ,
a javac c10ne, and j1ex, a 1exer 9enerat0r.
Ana1y515 t1me 7 h e Pr09ram5 were ana1y2ed w1th the 116rary
f11e5 pr0v1ded w1th the java 1n5ta11at10n and a11y add1t10na1
116rar1e5 re4u1red 6y the 5pec1f1c pr09ram. We 91ve tw0 5et5
0f a2m1y515 t1nm - the f1r5t 5et 91ve5 the t0ta1 ana1y515 t1me
1nc1ud1n9 ana1y515 0f a11 116rar1e5 and the 5ec0nd 5et 91ve5
the ana1y515 t1me 0f the pr09ram when the 5tandard java
116rary (rt.jar) ha5 6een pre-ana1y2ed. 7 h e t1me 0f ana1y515
1n 5ec0nd5 15 91ven 1n 7a61e 2. 7 h e ana1y515 t1me c0mpare5
fav0ra61y w1th 0ther path-5en51t1ve ana1y5e5 [13] (1t ha5 6een
rep0rted [11] that Wha1ey and R1nard•5 a190r1thm can take
an h0ur 0r m0re t0 ana1y2e pr09ram5 w1th 104 5tatement5).
Data dependence We 1nve5t19ated the effect 0f weak update5
0n heap a110cated var1a61e5. 7 h e r e wa5 a 0% t0 6% 1ncrea5e a5 5h0wn 1n 7a61e 3 1n the num6er 0f d a t a dependence and 1nterference dependence ed9e5 wh1ch re5u1ted 1n
a c0rre5p0nd1n9 decrea5e 1n the prec1510n 0f the 511ce5.
E5cape ana1y515 7a61e 4 91ve5 the percenta9e 0f 5tatement5
1074
1n a 511cer f0r c0ncurrent Java Pr09ram5, 6ut th15 a190r1thm
f1nd5 u5e 1n a var1ety 0f 5tat1c ana1y515 app11cat10n5.
7a61e 4: E5cape Ana1y515
name
511ce
v01an0
han01
mu1t1
raytracer
mande16r0t
% Marked
6106a1E5cape
40.9
32.2
40.3
35.9
40.6
41.1
% 1nterfer1n9
5tatement5
4.5
0.2
2.5
2.6
3.0
1.8
8.
C0nference 0n Pr09ramm1n9 Lan9ua9e De519n and
1mp1ementat10n, 1990.
[3] J.-D. Ch01, M. 6upta, V. C. 5reedhar, and 5. M1dk1ff.
E5cape ana1y515 f0r Java. 1n Pr0ceed1n95 0f the
1n the Pr09ram that are marked 6106a1E5cape and the percenta9e 0f 5tatement5 that may c0nf11ct 0n a read/wr1te 0r
wr1te/wr1te 0f a 5hared var1a61e. A1th0u9h the num6er 0f
n0de5 that are detected t0 e5cape 9106a11y 15 ar0und 40%,
the 5tatement5 that actua11y c0ntend f0r acce55 t0 5hared
re50urce5 turn5 0ut t0 6e 1e55 than 5% 0f the 5tatement5 1n
0ur 5amp1e pr09ram5. We 6e11eve that th15 k1nd 0f ana1y515
may 1mpr0ve the prec1510n 0f t0015 that u5e e5cape ana1y515
t0 e11m1nate unnece55ary 5ynchr0n12at10n.
6.
C0nference 0n 06ject- 0r1ented Pr09ramm1n9 5y5tem5,
Lan9ua9e5 and App11cat10n5, 1999.
[4] R. Cytr0n, J. Ferra21te, 8. K. R05en, M. N. We9man,
and F. K. 2adeck. Eff1c1ent1y c0mput1n9 the 5tat1c
51n91e a5519nment f0rm and the c0ntr01 dependence
9raph. A CM 7ran5act10n5 0n Pr09ramm1n9 Lan9ua9e5
and 5y5tem5, 13(4):451-490, 1991.
[5] R. Cytr0n and R. 6er5h6e1n. Eff1c1ent acc0m0dat10n
0f may-a11a5 1nf0rmat10n 1n 55a f0rm. 1n Pr0ceed1n95 0f
the C0nference 0n Pr09ramm1n9 Lan9ua9e De519n and
1mp1ementat10n, 1993.
RELA7ED W0RK
[6] R. 6h1ya and J. Hendren. C0nnect10n ana1y515: A
pract1ca1 1nterpr0cedura1 heap ana1y515 f0r C.
We d15cu55 here 0n1y 5uch w0rk that perta1n5 t0 path5en51t1ve and c0ntext-5en51t1ve ana1y515. W1150n and Lam [14]
a55ume that 10ca11y a110cated heap 610ck5 are never un14ue
and hence cann0t app1y 5tr0n9 update5 1n the pre5ence 0f
10ca1 heap a110cated var1a61e5. 6h1ya et a1 [6] u5e a f0rm 0f
c0nnect10n ana1y515 that d0e5 n0t d15t1n9u15h the f1e1d fr0m
1t5 06ject.
Ch01 et a1•5 [3] a190r1thm d0e5 n0t app1y 5tr0n9 update5 t0
f1e1d var1a61e5. 0ther5 u5e a k-11m1t1n95chemewh1ch 15 u5efu1
f0r 5hape ana1y515 [2]. Wha1ey and R1nard u5e a p01nt5-t0
9raph at each pr09ram p01nt.
L1ke W1150n and Lam [14] and Cha5e et a1 [2] we ma1nta1n
0n1y the p01nt5-t0 1nf0rmat10n re1evant t0 the n0de. H0wever, we a150 6u11d an 55A 9raph dynam1ca11y t0 9enerate
the p01nt5-t0 1nf0rmat10n. Cytr0n and 6er5h6e1n [5] 91ve
an a190r1thm f0r 9enerat1n9 the 55A f0rm 1n the pre5ence 0f
p01nter5 6ut they d0 n0t c0n51der f1e1d var1a61e5 and perf0rm
0n1y 1ntrapr0cedura1 ana1y515.
1nter-pr0cedura1 ana1y5e5 tend t0 6e e1ther t0p-d0wn [14]
0r 60tt0m-up [13, 3]. Any 0f the 5tandard 5cheme5 may 6e
app11ed. We u5e an exten510n 0f Rep5 et a~5 meth0d f0r
5ummar121n9 a meth0d [7]. 7he exten510n 11e5 1n determ1n1n9 a11 the var1a61e5 that e5cape the pr0cedure and add1n9
E5cape1n and E5cape0ut n0de5 f0r them.
50me 1nter-thread ana1y5e5 [8, 10] d0 n0t exp11c1t1y perf0rm p01nter ana1y515. 2hu et a1 [15] ana1y2e mu1t1threaded
pr09ram5 6a5ed 0n the c0n5ervat1ve c0nnect10n ana1y515 [6].
5a1c1anu and R1nard [12]•5 a190r1thm 15 51m11ar t0 0ur5 except that they d0 n0t u5e a 5par5e repre5entat10n.
7.
REFERENCE5
[1] A. Ah0, R. 5eth1, and J. U11man. C0mp11er5:
Pr1nc1p1e5, 7echn14ue5 and 70015. Add150n-We51ey.
[2] D. R. Cha5e, M. We9man, and F. K. 2adeck. Ana1y515
0f p01nter5 and 5tructure5. 1n Pr0ceed1n95 0f the
1nternat10na1 J0urna1 0f Para11e1 Pr09ramm1n9,
24(6):547-578, 1996.
[7] 5. H0rw1t2, 7.Rep5, and D.81nk1ey. 1nterpr0cedura1
511c1n9 u51n9 dependence 9raph5. ACM 7ran5act10n5
0n Pr09ramm1n9 Lan9ua9e5 and 5y5tem5, Jan 1990.
[8] J. Kn00p and 8. 5teffen. Para11e115m f0r free: eff1c1ent
and 0pt1ma1 61tvect0r ana1y5e5 f0r para11e1 pr09ram5.
A CM 7ran5act10n5 0n Pr09ramm1n9 Lan9ua9e5 and
5y5tem5, 18(3):268-299, May 1996.
[9] M. 6. Nanda and 5. Rame5h. 511c1n9 c0ncurrent
pr09ram5. 1n Pr0c. 0f the 1nternat10na1 5ymp051um 0n
50ftware 7e5t1n9 and Ana1y515, 2000.
[10] D. N0v1110, R. Unrau, and J. 5chaeffer. C0ncurrent 55a
f0rm 1n the pre5ence 0f mutua1 exc1u510n. 1n
Pr0ceed1n95 0f the 1nternat10na1 C0nference 0n
Para11e1 Pr0ce551n9, 1998.
[11] E. Ruf. Effect1ve 5ynchr0n12at10n rem0va1 f0r Java. 1n
Pr0ceed1n95 0f the C0nference 0n Pr09ramm1n9
Lan9ua9e De519n and 1mp1ementat10n, 2000.
[12] A. 5a1c1anu and M. R1nard. P01nter and e5cape
ana1y515 f0r mu1t1threaded Pr09ram5. 1n Pr0ceed1n95 0f
the ACM 516PLAN 5ymp051um 0n Pr1nc1p1e5 and
Pract1ce 0f Para11e1 Pr09ramm1n9, June 2001.
[13] J. Wha1ey and M. R1nard. C0mp051t10na1 p01nter and
e5cape ana1y515 f0r Java pr09ram5. 1n Pr0ceed1n95 0f
the C0nference 0n 06ject-0r1ented Pr09ramm1n9
5y5tem5, Lan9ua9e5 and App11cat10n5, 1999.
[14] R. W1150n and M. Lam. Eff1c1ent c0ntext-5en51t1ve
p01nter ana1y515 f0r c pr09ram5. 1n Pr0ceed1n95 0f the
C0NCLU510N
1n th15 paper we have pre5ented a f10w-5en51t1ve, c0ntext5en51t1ve, 1nterpr0cedura1, 1nter-thread data dependence a190r1thm f0r mu1t1threaded Java pr09ram5 that u5e5 a 5par5e
repre5entat10n. 7 h e u5e 0f 5par5e repre5entat10n f0r p01nt5t0 1nf0rmat10n 15 1mp0rtant a5 1t 501ve5 the pr061em 0f the
hu9e mem0ry/t1me c0n5umpt10n that make5 f10w-5en51t1ve
ana1y515 1mpract1ca1. We have 1mp1emented th15 a190r1thm
C0nference 0n Pr09ramm1n9 Lan9ua9e De519n and
1mp1ementat10n, 1995.
[15] Y. 2hu and L. J. Hendren. C0mmun1cat10n
0pt1m12at10n f0r para11e1 C Pr09ram5. 1n Pr0ceed1n95
1075
0f the C0nference 0n Pr09ramm1n9 Lan9ua9e De519n
and 1mp1ementat10n, pa9e5 199-211, 1998.