Mt Exuto Hstors o Prorm Vrsos Xyu Z Rv Gupt Dprtmt o Computr S T Uvrsty o Arzo Tuso, Arzo 85721 {xyz,upt}@s.rzo.u ABSTRACT W vlop mto or mt ym stors o prorm xutos o two prorm vrsos. T mts prou usul my ppltos lu sotwr pry tto svrl u sros. Ul som stt ppros or mt prorm vrsos, our ppro os ot rqur ss to sour o o t two prorm vrsos us ym stors ollt y ru strumt vrsos o prorm rs. W s our mt lortm o omprso o r prorm xuto stors w lu: otrol low t, vlus prou, rsss rr, s wll s t ps xrs. I vlop mt lortm w two ols: prou urt mt prou t quly. By us r xuto story, w r l to ompr t prorm vrsos ross my vorl msos. T rsult s st ly prs mt lortm. Our lortm rst uss vul stors o strutos to ty multpl pottl mts t t rs t st o mts y mt t t p strutur stls y t mt strutos. To tst our lortm w ttmpt mt o xuto stors o uoptmz optmz prorm vrsos. Our rsults sow tt our lortm prous ly urt mts w r ly tv w us omprso ppro to u optmz o. Ctors Sut Dsrptors D.3.4 [Prormm Lus]: Prossors Durs; D.2.5 [Sotwr Er]: Tst Du Du s, Tr Grl Trms Alortms, Msurmt, Rllty Kywors xuto trs, ym lyss, u, pry tto Support y rts rom IBM, Itl, Mrosot, NSF rts CCR-0324969, CCR-0220262, CCR-0208756, EIA-0080123 to t Uv. o Arzo. Prmsso to m tl or r ops o ll or prt o ts wor or prsol or lssroom us s rt wtout prov tt ops r ot m or strut or prot or ommrl vt tt ops r ts ot t ull tto o t rst p. To opy otrws, to rpuls, to post o srvrs or to rstrut to lsts, rqurs pror sp prmsso /or. ESEC-FSE 05, Sptmr 5 9, 2005, Lso, Portul. Copyrt 2005 ACM 1-59593-014-0/05/0009...$5.00. 1. INTRODUCTION I my pplto rs, lu t rs o sotwr u, mt pry tto, stutos rs w tr s or ompr two vrsos o prorm. A xst lss o lortms tt ompr two prorm vrsos r stt r lortms [1, 3, 8, 9]. Wl ts lortms rport stt rs tw o squs, stutos wr t two prorm vrsos orrspo to orl trsorm vrsos o prorm, t s srl to mt o squs tt ymlly v t sm v tou ty sttlly ppr to rt. I ts ppr w sr t s mplmtto o lortm or mt rs o two vrsos o prorm us tr ym xuto stors. Lt us osr t ppltos su s sotwr pry tto u o optmz o. I ts two ppltos o prorm vrso s rt y trsorm t otr vrso. I t rst pplto o ousto trsormtos my v prorm to pry [2, 13]. I t so pplto trsormtos r ppl to rt optmz vrso rom t uoptmz vrso. By prorm mt s upo xuto stors, w mt orrspo omputtos y ompr t rsults prou y tm. Stt r ppros, o t otr r m t pprt rs tus r ot sutl or ov ppltos. I s o sotwr pry tto w wll ot v ss to t sour or trmt o o t prt vrso tus mt soul prorm us rs. Our rl soluto to mt xuto stors rls oly o t vllty o rs s ym xuto stors ollt y ru strumt prorm rs [7, 11]. A Grl Mt Alortm. I vlop lortm or mt xuto stors o two vrsos o prorm w v two ols: vlop lortm tt s st,.. prs or s o mts trm quly wtout xssv sr; urt mts r ou,.. tru mts r rport vry w mts r mss. To rss ts ols w us t ollow ppro. W y osrvtvly ty pottl mts so tt rl mts r ot mss. By us r xuto story, w r l to ompr t prorm vrsos ross my vorl msos. Ts ls to mostly tru mts ou. Morovr, t umr o possl mts tt w to osr rtly rus w multpl s o ormto s us try rsult st mt lortm. Tus, y s our lortm o prorm my rt smpl mts, st o wr vry omplt mts, w ot xuto story mt lortm tt s ot st prs.
Mt or Comprso C. Wl mt s my ppltos, ts ppr w mostrt t ts o our mt lortm otxt o omprso [4, 5], tqu tt trms wtr rroous vor o optmz vrso s us y u t orl uoptmz vrso tt ws ums y optmz trsormtos or wtr t s u to u tt ws trou u to rror t optmzr. Comprso wors y ompr t vlus omput y orrspo xuto sts o sttmts t uoptmz optmz prorm vrsos. I o msmt vlus s ou, t t rror must prst t orl uoptmz prorm. A msmt o vlus o t otr ts tt t rror must v trou y t optmzr. I orr to prorm omprso, t omplr wrtr must wrt tol o tt rts mpp tw xuto sts o sttmts t uoptmz optmz vrsos. Moy t omplr to rt t mpps s tous tm osum ts t som stutos ts my ot vl opto. I prtulr, ommrl optmz omplr s us, w wll ot l to moy t to rt su mpps. I s o mpps /or omplr sour, t lortm w prst ts ppr us to mt t xutos o uoptmz optmz vrsos. I omplt mt s ou t t u must v prst t uoptmz prorm. I omplt mt s ot ou, t t prts o t xuto stors tt ot mt xm y t prormmr to ty t lly sour o t u. It s mportt to ot tt t stt ppros or ompr prorm vrsos wll ot tv or ts pplto wr w wt to ompr sp xutos. W tst our mt lortm y mt t xuto stors o uoptmz optmz prorm vrsos. Our rsults sow tt our lortm s vry tv s t prous urt mts tt r rly omplt (.., tr r w ls or mss mts). T rmr o t ppr s orz s ollows. I sto 2 w sr t orm o ym xuto stors us ts wor. Our mt lortm s sr tl sto 3. T rsults o our xprmts r prst sto 4. Rlt wor s suss sto 5. Colusos r v sto 6. 2. PROGRAM EXECUTION TRACES W rtly propos t Wol Exuto Tr (WET) [16] rprstto tt stors omprsv xuto story o prorm ly ompt orm s ottos to t stt rprstto o xutl o. W mostrt tt xuto stors o rlstlly lo prorm rus (w llo strutos) pt mmory. Blow w rly sr t ormto ot t xuto story ow t s usul mt prorm vrsos. T ym ormto torz roly to two tors: lol - vlus rsss volv xuto o sp struto; lol - rltv xuto orr ps tw rt strutos. Oly t summry o som o t ov ormto s y our mt lortm. Tror, xuto stors o v lor rus sly ollt stor or mt. Vlus prou (Lol). A strm o rsults prou y struto ur prorm xuto r ptur. I two prorm vrsos r xpt to prou t sm rsults o prorm put, t strms o vlus or vst morty o strutos r xpt to t sm t two vrsos. Tror ts strms o vlus ompr to mt strutos. Arsss rr (Lol). For mmory rr struto strm o rsss rr y t struto ur prorm xuto r ptur. Wl t tul rsss outr ur xutos o orrspo strutos o t two prorm vrsos my vry, t rltv rss osts xt smlr pttrs. Tror ts pttrs prov yt otr ms or mt strutos. Cotrol low (Glol). T wol prorm pt ollow ur xuto s ptur. Ts story ls tmporl orr o ll trst vts (.., I/O oprtos). Ts orrs prov oo strt pot or sr w vts o v typ rom t xuto stors o two prorm vrsos r mt wt otr. Dps xrs (Glol). For xuto o struto ts t otrol p story s ptur us outo wt t vlu rss stors to prou urt mts. Not tt vlu rss stors sstlly prorm mt o vul strutos tr s tt som otl or ls mts wll prou. By mt t ym t p rps, w orm wt mu rtr rtty tt t strutos truly orrspo to otr. Mt o ym t p rps orms t olltv orrtss o t mts or roup o strutos. Tus, t tvly rus ls mts. Otr. Systm lls, I/O oprtos, mmory lloto lloto oprtos r xmpls o spl vts tt r ptur. S ts vts r lly to lttl rom o prorm vrso to otr, mt tm us t tmporl orr s qut usul. From t susso t soul lr tt mt o prorm vrsos s s upo omprso o prorm vor lo my vorl msos. Ts s y to t suss o our ppro s t prvts urt mts rom ourr. 3. MATCHING EXECUTION HISTORIES T ol o t mt pross s to utomtlly stls orrspo tw xut strutos rom t two prorm vrsos. W ssum tt t two vrsos o t prorm rsult tr o vrso ws trsorm to otr trou smts prsrv prorm trsormtos. I mt t s our ol to prou ly urt mts. Aury s two msos: ompltss - w woul l to sovr s my tru mts s possl; orrtss - w woul l to sovr oly tru mts. Gv pr o xuto stors or two vrsos o prorm, w stls orrspo tw t xut strutos y xm t ym t p rps (DDGs) o t two vrsos s wll s t stors o vul strutos t DDGs. A DDG ots o or struto tt s xut t lst o or t p tt s xrs t lst o ur t prorm xuto. T mt pross ossts o tr m lortms: Sturs. Bs upo t lol xuto story o v struto, stur s omput. T sturs o strutos r ompr to trm pottl mts or xlu mts trouout t two lortms t xt. Root Nos. W y mt t roots o t ym t p rps o two prorm vrsos. T mt s ssst y lol ormto orm o t tmporl orr w t root os r xut lol ormto orm o sturs o vul strutos.
Dpt Nos. Gv t mt o t roots, trtv lortm s us to mt t rm os t ym t p rps. For struto o p rp, t lortm s st o mt t strutos t otr t p rp trou trtv rmt us t strutur o t ym t p rp. Nxt w suss t tls o t root mt pt o mt lortms. Dur ts lortms w wll ssum tt sturs r lry vll. Flly w suss t tls o stur rto mt. 3.1 Mt Root Nos Bor w prst t root mt lortm, w m t ollow osrvtos. Frst root o o DDG my om rom y pot t prorm s otrol low rp. Ts s us root os orrspo to strutos su s vrl tlztos, rs, mmory llotos t. ll o w ppr y wr prorm. So smt prsrv prorm trsormtos tt my v us to rt otr vrso o t prorm v st ts o ts strutos. I prtulr, struto my or lt, t my mr wt otr struto or splt to two strutos, t my rorr wt rspt to otr strutos, or t my v smply mov us ts xuto rquy to. 0 1 m Vrso Vrso 0 1 At Trsormto A Dlt m Mov rq() Mov rq() Mr & Rorr (,( 0, 1)) (, ) Rorr & Splt (, ) (( 0, 1), ) Fur 1: Mt roots o prorm vrsos. A xmpl Fur 1, llustrts t ov osrvtos. Frst ll strutos sow, w r t y lttrs, r ssum to root os tt r spr trouout t otrol low rp. T ott s tw t two vrsos ts t orrspo tw ts strutos. T tl t ur sows t trsormtos tt rsult rto o Vrso rom Vrso. To stus tw orrspo struto t two vrsos w us t otto ī. W multpl strutos o vrso orrspo to o struto t otr vrso, susrpts r us. Nxt w prst root mt lortm tt s s t to out t ov osrvtos. Gv two vrsos o prorm, Vrso Vrso, w y rst rt tmporlly orr lsts o t root os, Roots Roots, s ollows. E root o pprs o t lst. T orr w os ppr orrspos to t orr w tr rst xutos too pl. Ts orr s trm rom t ull otrol low tr. Gv t two lsts, ll to uto Mt(Roots,Roots) Fur 2 prous mt o t root os. T outom o t mt pross s tto o prs o os rom Roots Roots tt mt st o os UMt UMt tt ot t os tt o ot v orrspo mts. Mt(Roots,Roots) { Mt UMt UMt φ; rst(roots); rst(roots); wl Roots φ o s( ) = s( ) t Mt Mt {(, )}; rq( ) = rq( ) t xt(roots); xt(roots); Roots Roots { }; Roots Roots { }; ls rq( ) < rq( ) t xt(roots); Roots Roots { }; rq( ) rq( ) rq( ); ls rq( ) > rq( ) t xt(roots); Roots Roots { }; rq( ) rq( ) rq( ); ls xt(roots); = l t UMt UMt { }; rst(roots); rst(roots); wl Roots φ t or Roots o (, ) Mt t UMt UMt {}; or rtur(mt,umt,umt) } Fur 2: Mt tmporlly orr roots. Our lortm ts o struto rom Roots t tm (ot s ) s t struto(s) rom Roots tt mt ts struto. To mt, t stur o, s( ), s ompr wt t sturs o strutos Roots o t tm. I mt s ou wt struto Roots, umr o ss rs. I rquy o t mt strutos s t sm, w osr mt o ot to omplt ty r rmov rom t lsts. I t rquy o s lowr, t w osr t mt o to omplt ut ot tt o tus, s rmov ut ot. I t rquy o s lowr, t w osr t mt o to omplt ut ot tt o. Us t ov lortm w l o struto o vrso to mt wt multpl strutos t otr vrso. Also, ll strutos vrso tt o ot mt y struto t otr vrso r lso t.
Wl t ov lortm pprs to qut smpl, t s vry tv prt. W pply t ov lortm to t xmpl o Fur 1 sow ow our lortm ts t orrt mt. Lt us rst osr xutos o t two vrsos o t prorm o t sm put. Lt us ssum tt t xuto pt ollow ur ts xutos s s ollows: Vrso : m 0 1. Vrso : ā ē ē ī 0 ḡ ī 1. From t ov otrol low pts w orr lst o t root os s upo w t strutos wr xut t rst tm t ov tr. I to, w lso omput t umr o tms struto s xut. Blow w v t orr rquy o t xut strutos. Roots ( struto rq. ): m 1 Roots ( struto rq. 01 11 1 2 2 2 2 2 2 2 2 1 ): ā ē 01 ḡ 11 1 2 2 1 2 2 2 2 1 1 1 Now lt us osr t mt o t ov lsts. W strt wt mt m rom Roots ut o mt s ou v tr trvrs t tr Roots lst. Tror t s put to UMt. r sussully mt wt ā s tr rqus mt, ty r rmov rom t lsts. T st Mt s upt to rlt t ou mts. Nxt 0 s mt wt. Howvr, s s r rquy t s ot rmov rom t Roots lst.,, r mt xt wt, ē,. s mt wt ī 0 ī 1. s mt wt. 1 s mt wt ts tm s rmov rom Roots.,, r mt wt, ḡ,. Now Roots s mpty s Roots ots, t s mov to UMt. Mt = {(, ā), (, ), ( 0, ), (, ), (, ē), (, ), (, ī 0), (, ī 1), (, ), ( 1, ), (, ), (,ḡ), (, )} UMt = {m} UMt = { } Tus, w s tt spt t umrous pprt rs tw t two prorm vrsos, ll roots v xtly mt or t ov xmpl. 3.2 Mt Dpt Nos Atr mt t root os w pro to t mt o t pt os,.. t trl os t l os t DDGs o t two vrsos. I ts stp o t mt pross w v mor ormto vll t t root mt stp. For pt os ot oly o w v t lol sturs o vul strutos tt r us mt; to, t p strutur o t DDG s lso mt. For trl o o DDG vrso to mt trl o t otr DDG vrso, t ollow otos must ol: sturs o must mt; sturs o ll orrspo prts o must mt s t prts supply t opr vlus; sturs o som orrspo lr o o-l os must mt s t rsults must v smlr uss. T p strutur mt ot oly ls mor urt mt, s ot t sturs t ps o orrspo strutos must mt, t lso ls str mt s t stur o struto o vrso oly ompr wt sturs o lmt umr o struto sturs rom t otr vrso. T lttr s tru us t mt s rv y t p strutur. T mt w sr xt ossts o multpl psss ur w or struto t DDG o o vrso, Mt st ot t orrspo mt strutos t otr vrso r trm. T Mt sts r osrvtvly ovrstmt t trtv pross otus to r ts sts tll vtully o mor rmt ours. T rmt s rr out y rptly pply two psss, orwr pss wr pss. Gv struto DDG, t my rtly ot y s to two typs o os, ts prt os ts l os. Dur t orwr pss, or v struto DDG o o vrso, pottl mt ts rom t DDG o t otr vrso r t y osr t mt rltosps o prt os o. Ts stmt s urtr r y osr t mt rltosps o l os o t wr pss. T rmt pross s trtvly ppl y rpt t orwr wr psss tll o urtr rmt s possl. s() = s(ā); s() = s( ) = s(ī); s() = s( ) = s(ḡ); s() = s( ) = s( ); s() = s(ē); s( ) o mt Fur 3: Itl root mts. W rst llustrt t mt pross us smpl xmpl t prst tl lortm. Cosr t two DDGs sow Fur 3 t rltosps tw sturs o strutos rom t two vrsos. Aor to t sturs v, t p strutur, os,,,, mt wt os ā,,,, ē rsptvly. Now w llustrt ow t mt pross s rr out. Frst t root mt s prorm us t lortm sr t pr sto. Lt us ssum tt t prous t rsult sow ov,.. Mt() = {ā} Mt() = {, ī}. T orwr pss s mts or rm os s ollows. It xms t os orr osstt wt t topolol sort orr o t os t DDG. Frst t xms o. To orrspo strutos t rst s t st. S s o prt,, Mt() = {ā}, t lr o ā,.. {, ḡ}, t pottl mts or tus ty orm t t st. Now t stur o s ompr wt sturs o ḡ. S t sturs mt, t rst pproxmto o Mt() s {, ḡ}. Smlrly w trm tt Mt() = {, }. Nxt w xm o w s two prts. T mt os o r xm w tt tr r two os t t st ts tm, ē. Ts s us ot ts os lso v two prts l w om rom sts Mt() Mt() rsptvly. Howvr, ts tm w w mt sturs, wl w tt ē rms vl mt, s ot mt or. Tus t t o t orwr pss, t Mt sts r s sow Fur 4.
tt s() = s( ), t,, wll mt prs o os {, ḡ}, {, }, {ē, } rsptvly. T xmpl osr so r s llustrt t y s our mt lortm. Howvr, t xmpl osr ws smpl o rspt. T DDG o t rst vrso ws ot ts xt sm orm t orrspo lrr DDG o t otr vrso. Howvr, s mto ur t vlopmt o t root mt lortm, t so vrso my rt rom t rst ts orm u to prorm trsormtos us to rv t so vrso rom t rst. Lts osr otr xmpl to llustrt tt t sm s lortm tt ws sr ov wt som smpl ut mportt motos lso wors or mor rl stutos. Vrso Fur 4: Forwr pss: Mt DDGs. 0 1 Now lt us prorm t wr pss. I ts pss w m us o t Mt st or t oly l o to r t Mt sts o ts prt os vtully t root os. I otr wors t os r xm t rvrs topolol orr ts tm. Lts osr o rst. No s o l o su tt Mt() = {ē}. T mt ts or r os s ty r t two prts o ē. Howvr, tr mt t sturs, s lmt wl rms. By trst ts wr stmt or Mt() wt t rlr orwr stmt w olu tt Mt() = { }. Smlrly Mt() ts r to { }. W w otu t ov pross to t roots, w tt wl Mt() = {ā} rms t sm, Mt() s r to { }. Not tt t Mt sts t ts pot rprst t sr rsults (s Fur 5). 2 3 At Trsormto A (opy/mov) ( 0, ē 1 ) Dlt (spll/st-l) ( 2, 3 ) Mr (ruy) ( 0, 1 ) Splt (rmtrlzto) ( 0, 1 ) Smt (rssoto) ((( 1, ), )) ( (, ( 1, ē 1 )) Vrso 0 0 1 1 Vrso 0 o 1 2 3 0 1 1 Fur 5: Bwr pss: Mt DDGs. Wl t ov xmpl w prorm t orwr pss o wr pss o, rl w my v to pply tm rptly tll t Mt sts stlz. T umr o rpt ppltos s ou y t pt o t DDG. Howvr, prt rpt pplto s lmost vr rqur. Altou t ov xmpl struto t rst DDG mt wt xtly o struto t so DDG, rl ts my ot t s. For xmpl, w t xmpl su Dsr Mt Fur 6: Aotr xmpl o mt DDGs. I Fur 6 two vrsos o DDG r sow tt r rt tr strutur u to t trsormtos ppl to rv vrso o t prorm rom vrso. Lts loo t ow t trsormtos v t rp. Drs rstr lloto sos or xmpl, rsult to lto o os. Corrspo to o w v two os ē 0 ē 1
t vrso ē 1 orrspos to MOV struto tt movs t rsult o ē 0 rom o rstr to otr us t to o o. Nos 2 3 orrspo to spll o 2 stors t rsult o 0 wl 3 rlos ts vlu or us y. Bttr rstr lloto my lmt ts spll l to vrso o t rp. I vrso 0 1 prorm t sm omputto tus ty r mr ur ruy lmto. Tus, vrso ots sl o orrspo to os 0, 1, 2, 3 t vrso. No s splt to 0 1 u to rmtrlzto. Rssoto s prorm us trmt omputto vrso to rpl y rt trmt omputto vrso. 0 1 Vrso p() mp() p() mp() 1 2 Forwr Pss 3 3 () m() Bwr Pss () 2 m() 1 2 Fur 8: Mt ts. 3 1 1 2 2 Vrso 3 3 0 0 1 1 Fur 7: Sps o mt portos. T orrt mt or ts xmpl s lso sow Fur 6 t mt portos o t two vrsos r sow ptorlly Fur 7. T mportt t to ot r s tt, ul t prvous xmpl suss, ts s t orrspo mt portos o t DDGs o ot v tl sz or strutur. Lt us ow osr ow su mts sovr. Cosr t orwr pss s llustrt rlr. Gv o o vrso o t DDG, orrspo o t otr DDG tt s t or mt wt ws rlt to s ollows. Tr ws prt o, sy p(), su tt p() mt mp() ws l o mp(). O ours tr my my os tt stsy ts rtr ty ll r osr s mt ts. Ts rul s rlz s ollows. Frst p() ot mmt prt o ut rtr t s t losst stor o tt s o-mpty mt st. Ts rul s to t ross os tt o ot v y orrspo mts. Not tt su os my trou y trsormtos. So o mp() s ow, t ts or mt tt r osr must lu mp() ll rt or rt sts o mp(). Ts rul s us tr trsormtos v ppl, w my v s o os o vrso tt mt sl o otr vrso. T mo rltosp tw s llustrt Fur 8. Smlr s r m to t wr pss. Dur t wr pss, v o orrspo o tt s t or mt wt ws rlt to s ollows. Tr ws l o, sy (), su tt () mt m() ws prt o m(). Ts rul s rlz s ollows. Frst () ot mmt l o ut rtr t s t losst st o tt s o-mpty mt st. A ts rul s to t ross os tt o ot v y orrspo mts. So o m() s ow, t ts or mt tt r osr must lu m() ll rt or rt stors o m(). A, ts rul s us s o os o vrso my mt sl o otr vrso. Ts mo rltosp tw ur t wr pss s llustrt Fur 8. I w rosr t xmpl Fur 7, w s ow t ov rlz ruls wll l t mt sow to sovr. W t surp 1 s mt to 1, rst w r l to mt t 0. 2. 3 to. So v tou t mmt l o 1,.. s mpty mt st, w r l ross ovr mt wt t mmt l o. Tus 1 s lso sussully mt wt. For smlr rsos w r l to sussully mt to { 0, 1, 2} to {ē 0, ē 1}. W olu y prst t tl mt lortm. Bor prst ts lortm w v t prs tos o mmt stors/sts (A/Ds) ll stors/ sts (A/Ds). Ts tos r y to t sts ur mt orport t ruls ust suss. Lt us ot DDG s G(N, E), wr N s t st o os E s t st o s. Furtrmor lts ot E to t sust o s E su tt G (N, E ) orms yl rp. T tos o ll mmt stors sts r v Fur 9. Not tt t omputto o mmt stors/sts ps upo t Mt sts mpty or ot. T tl mt lortm s v Fur 9 w w v two DDGs, DDG = G(A, E ) DDG = G(B, E ), omputs t Mt st or o A to t sust o os B tt r ou to mt. As lry suss, ollow tlzto t lortm trts ovr orwr wr psss. Dur t omputto o C st or o t orwr pss t s sur trou t us o t trsto oprtor tt o Vrso uss two oprs, t mt
o Vrso lso uss two oprs. O t otr, ur t omputto o C st or o t wr pss t s sur trou t us o uo oprtor tt t umr uss o vlu omput y o vry tw t two vrsos. T lortm trmts w ll Mt sts stlz. Follow ts, t umt os DDG r t os wos Mt sts r mpty t umt os DDG r tos tt o ot lo to Mt st o y o A. S A() := {} A(p) (p ) E S Ds() := {} Ds() ( ) E A() := ( Ds() := ( S ( ) E Mt() φ ( S {} ) ( ) E Mt()=φ S ( ) E Mt() φ ( S {} ) ( ) E Mt()=φ A() ) Ds() ) MtDtDpGrps(DDG,DDG ) { Gv: Lt DDG = G(A, E ); DDG = G(B, E ); Itlzto o Mt sts. or o A o s root o t Mt() s ou y t root mt lortm. ls Mt() B or Itrtv rmt o Mt sts. Wl Mt sts otu to o Forwr Pss: Lt topoa t topolol sort orr o A or o TtopoA xlu S roots o C = ( Ds( ) ) A() Mt() Mt() = Mt() { : C s( ) = s()} or Bwr Pss: Lt topoa 1 t rvrs topo. sort orr o A or o StopoA 1 xlu S lvs o C = ( A( ) ) Ds() Mt() Mt() = Mt() { : C s( ) = s()} or wl } Fur 9: Mt t p rps. 3.3 Stur Mt Now w sr ow t lol stors o strutos r us to orm tr sturs ow stur mt s prorm. W w mt t lol stors o two strutos, w sstlly mt t strm o rsults prou y t strutos. T rsults prou y struto tr rprst strm o t vlus or strm o rsss. T most ovous ppro s to loo or xt mt tw t strm o vlus. Howvr, ts s ot oo wy to mt strutos. Rll tt prorm trsormtos my ltr t orr w struto sts r xut lso t umr o tms struto s xut my rs or rs. Tus, t lst o rsults or my strutos r ully to mt xtly. O rso or t umr o xutos s u to lmto o sts. By lmt ll sts rom ot vrsos o t ym stors w vo ts prolm. Howvr, rmovl o sts s ot t oly rso. Svrl otr optmztos, ruy lmto spultv o moto, lso us su s. Tror w rv smplr sturs rom xt lst o rsults su tt t rv sturs sly mt v prorm trsormtos v t t orrspo strutos. For strutos wt lo xuto stors su smpltos r ully to us sturs o strutos tt o ot orrspo to otr to mt. I s xuto stors or som strutos r vry smll, tr s posslty o otl mts. Howvr, su ss t mt o p strutur s lly to vo ls mts. Mt Dt Vlu Strms. A orr strm o t vlus s ovrt to smplr rprstto osst o vtor o uqu vlus (U). W mt xuto stors, w smply loo or ossty ot qulty. Gv two strutos I 1 I 2, w osr tr vlu vtors U 1 U 2 to mt tr U 1 U 2 ot t sm st o vlus or ll vlus ot U 1 (U 2) r ot U 2 (U 1). I vlus U 1 r sust o vlus U 2, w osr struto I 1 to ully mt I 2 to prtly mt. Mt Arss Strms. W osr rss strms w ot smply mt t uqu rsss us t rsss wll vry v ty orrspo to otr. For l mt o rsss, w rst ovrt tm to osts. I s o p rss t ost s msur rom t s rss o mmory lo llot rom t p. I s o st rss t ost s msur wt rspt to t rst ss v t st potr. O ts ovrso s rr out, t omprso o rss strms prorm t sm so s tt or vlu strms. Ts ppro s tv us ssum tt rssv mmory lyout optmztos r ot prorm. 4. EXPERIMENTAL RESULTS Mt s mplmt t Trmr systm [17]. Our mplmtto rs rom t prst lortm tt t prorms xustv omprsos ur root mt st o us tmporl orr to spup root mt. W rt two vrsos o VLIW m o support ur t Trmr systm y rt uoptmz optmz vrso o prorms. W r t two vrsos o t sm put, ollt tr tl wol xuto trs. T xuto stors o orrspo utos wr t ompr. T IMPACT systm o w Trmr s s supports w r o optmztos. To l uto y uto omprso o ym stors, w tur o uto l. To vlut our mt lortm w rr out two sts o xprmts. Frst w us t to mt uoptmz optmz vrsos wr o rrors wr prst t optmzr. Ts xprmt ws out to s ow tv (st urt) s our mt lortm mts w ty xst. So xprmt ws rr out to vlut t tvss o mt ur omprso wr rrors wr trou t optmz o. Bor prst t rsults o xprmts w sr t mrs us ts stuy. 4.1 Bmr Crtrsts T prorm vrsos us ts vluto r summrz Tl 1. For prorm rtrsts o two vrsos, uop-
tmz (.U) optmz (.O), r v. T umr o xut utos (utos prst) prorm r v. T stt umr o strutos vrso t umr o strutos xut ur prorm rus r v. As w s, t stt o sz t umr o strutos xut rs stly or t two vrsos. Ts s us o rssv optmztos rr out y IMPACT. Optmzto lvl O = 4 ws us w prorms ostt propto, opy propto, ommo suxprsso lmto, ostt om, ostt ol, o moto, strt ruto, o rmovl, loop optmztos t. Tl 1: Prorm rtrsts. Prorm Futos Istrutos U/O Ex. (Exst) Stt Num. Ex. (mllos) l.u/o 118 (357) 37491/29637 64.7/65.1 m88sm.u/o 25 (252) 68349/53522 62.0/61.8 twol.u/o 51 (191) 125260/92807 64.0/63.3 o.u/o 277 (372) 123702/92918 61.7/62.4 vortx.u/o 307 (923) 307526/243678 61.7/60.8 prsr.u/o 32 (324) 56526/47560 61.9/62.1 S t omprso s rr out tw optmz uoptmz vrsos o prorm, our lortm s tv, t soul mt vry prt o strutos rom t optmz vrso wt orrspo strutos t uoptmz vrso. T umr o strutos uoptmz o tt mt somt t optmz o s xpt to lowr us my sttmts r lmt y t optmztos (.., ruy lmto, o rmovl, opy propto). Flly w xpt som strutos optmz o ot to mt yt t uoptmz vrso u to spl turs (strutos) o t VLIW m tt r xplot y IMPACT oly ur rto optmz o (.., r rmt strutos us sotwr ppl o, lo spult lo vry strutos). I Tl 2 w prst t rtrsts o t DDGs o uoptmz optmz vrsos o t xut utos. T vr umr o xut root os, l os, trl os ross ll xut utos prorm r lso v. As w s, t vrsos r stly ot oly t umr o os ty xut ut lso t sps o t ym p rps s ll tr typs o os r tr umr. Ts s us t IMPACT systm prorms ot m pt m pt optmztos vry rssvly. Tl 2: DDG rtrsts. Prorm. Av. Ex. Num. Aross Fus U/O Vrso Roots Lvs Itrl Nos l.u/o 17.2/15.1 8.7/7.5 22.5/14.0 m88sm.u/o 20.7/18.3 14.4/10.8 40.1/268.0 twol.u/o 67.1/57.7 28.1/25.0 150.3/102.0 o.u/o 38.8/34.8 29.9/22.5 105.4/65.4 vortx.u/o 53.0/45.4 26.2/21.8 66.9/39.0 prsr.u/o 17.7/16.0 12.3/10.2 29.2/19.1 4.2 Aury Cost o Mt Now w prst rsults w uoptmz vrso ws mt wt optmz vrso tt o rrors trou t y t optmzr. T ol o ts xprmt s to stuy t ury ost o our mt lortm. I Tl 3 w summrz t xtt to w t xuto stors o prorm vrsos wr mt. T totl umr o sttlly stt os tt wr xut t lst o r v or prorm vrso. Ts umr o xut os orrspos to t totl umr o xut os mt ll o t utos om. Ts r lso t os tt our lortm ttmpts to mt wt otr. T prt o ts os vrso or w mts wr ou t otr vrso r v. O vr, or ovr 95% o t os t optmz o, o or mor orrspo mts wr ou. For t uoptmz o ts umr s lowr s xpt. Ts s us, tr rssv optmzto, t vr umr o strutos t uoptmz vrso s rly 25% lss t t uoptmz vrso (12909 vs. 17292). My o ts strutos v o orrspo struto t optmz o. Tl 3: Nos mt. Prorm Optmz Uoptmz Nos Mt (%) Nos Mt (%) l 4325 97.0 4989 82.1 m88sm 1398 95.1 1882 81.9 twol 9419 94.2 12517 86.8 o 28701 91.0 40753 76.9 vortx 32583 97.7 44857 81.7 prsr 1450 96.1 1893 84.8 Avr 12909 95.2 17292 82.4 Altou som o t strutos wr ot mt y our mt lortm, ts os ot ssrly m tt t mts soul v ou ut wr mss y our mt lortm. Som strutos r ot mt u to t turs o t VLIW m us oly y t optmz vrso optmztos su s strt ruto w trou omputtos tt prou rt trmt rsults t two vrsos. Tror, to trm t ompltss o t ov mts w xm t os t mts rt. S ts pross to prorm mully, w oul ot prorm t or ll t utos. W rst loo t my smll utos ou tt tr mts wr lmost lwys 100% omplt. T or prorm w slt xut uto s upo ts omplxty: w slt t lrst uto or w t umr o stt xut strutos t two vrsos r t most. T umr o stt strutos xut t optmz (Ex.O) uoptmz (Ex.U) vrsos o slt utos r v Tl 4. W mully ou t tul totl umr o mt prs o strutos y osr ll xut strutos rom t optmz o. By ompr ts mt prs wt tos ou y our lortm, w trm t umr o prs tt r mss t umr tt r ls mts. T rsults o ts xprmt v Tl 4 sow tt w mss vry w Tl 4: Mt ury. F.Prorm. Ex.O Ex.U Mts Vrso Atul Mss Fls l 78 131 112 0 37 m88sm 313 426 823 4 72 twol 765 989 1067 0 220 o 596 939 1362 0 69 vortx 399 677 840 21 336 prsr 194 257 243 0 29 prs ltou w o som mor ls mts. Ts s ot surprs s our stur mt s osrvtv tus w r lss lly to mss mts mor lly to som ls mts. Howvr, v som ls mts s ot srous prolm or two rsos. Frst, or vry struto tt w ou ls mt, w lso ou t tru mts. So, w lv
tt ls mts urtr ru wtout t propos lortm. Lor /or multpl rus o t two prorm vrsos us to r t mts ou y sl ru. Flly w lm tt mss mts r mor rmul tt ls mts us usr xm t mts ou lmt ls mts ut mss mts s r mor tous. Tror w v s our lortm to o t osrvtv s, mor mts r ou t truly xst. Tl 5 vs t totl sp ( MByts) tm ( sos) ost o mt. T sp ost mly rss u to t ym story us wl t tm rprsts t ort t ts to mt ll o t xuto utos. As w s t tm sp osts r rsol to mt xutos o rly lr prorms volv xuto o urs o stt utos. Tl 5: Cost: Sp, tm, trtos (vrs). Prorm Sp Tm Itrtos (MB) (s.) DDG Num. Atr Fl Dpt Itr. 1 Itr. Itr. l 4.5 302 5.13 1.81 3.75 1.61 m88sm 29.3 289 5.96 1.88 5.66 2.50 twol 52.0 362 12.61 2.06 7.15 2.74 o 18.0 387 12.07 1.93 7.42 3.10 vortx 7.8 467 5.89 1.96 7.11 1.89 prsr 5.1 265 5.53 2.00 2.93 2.04 W lso stu ow quly our trtv mt lortm stlzs. I Tl 5 t vr pt o t DDGs ross ll utos s v (DDG Dpt). T vr umr o trtos (Num. Itr.) t tully too or sts to stlz s lso v. As w s, ltou t pts o t rps lr, t umr o trtos rqur or t Mt sts stlz s smll. T vr mt st szs tr rst trto (Atr 1 Itr.) tr lortm stlz (Fl) r lso v to sow tt ty r ru stly y our trtv lortm. 4.3 Mt or Comprso C Nxt w vlut mt otxt o omprso. W t tr rt rrors to t rst tr mrs. Ts rrors smult t t o rroous t low rsults or ommo suxprsso lmto, opy propto o lmto. Dur omprso mt s us to mt s my strutos s possl tw t xut uoptmz optmz vrsos t rulr trvls (xuto o 8 mllo strutos). T strutos tt o ot mt r rport to t usr or xmto s ty my ot rror. W plott t umr o stt rport strutos s prt o stt xut strutos ovr tm two stutos: w optmz prorm o rror w t ot rror (s Fur 10). T pots t rp r lso ott wt t tul umr o strutos rport. T trvl ur w rror pot s outr ur xuto s mr. As w s, ompr to t optmz prorms wtout rrors, t umr o rport strutos rss srply tr t rror trvl pot s outr. For two out o t tr mrs, t rss r srp 6% to 14% or m88sm 3% to 35% or twol. I t w w loo t t tul umr o strutos rport mmtly or tr t xuto trvl ur w rror s rst outr, t umr rport rss y orr o mtu. For l t rror s su tt rroous rsults r ot propt r tus w s smllr rs. Usr xm t rport strutos rly quly ous o rroous strutos s t umr o rport strutos s smll l. I otr ss wr t umr s lr, y xm t strutos t orr ty r xut, rroous strutos quly solt. Otr rport strutos r mrly pt upo t strutos tt r t root uss o t rrors. For xmpl, twol, out o t ovr 2000 rport strutos t t o so trvl, w oly to xm t rst 15 rport strutos tmporl orr to rroous struto. Not tt v w o rrors r outr, som strutos t optmz vrso r vrtlss rport. T rport o som strutos s uvol v wt prt mt lortm us tr s o orrspo mt or tm t uoptmz vrso. Rport rto Rport Rport rto 0.16 0.14 0.12 0.1 0.08 0.06 0.04 0.02 0 0.4 0.35 0.3 0.25 0.2 0.15 0.1 0.05 0 0.03 0.025 0.02 0.015 0.01 0.005 m88sm w/o ERROR 189 189 189 189 189 189 189 189 78 78 78 78 78 78 78 78 rror trvl w/error 0 10 20 30 40 50 60 70 Exuto lt(mllos) 3 2128 twol w/o ERROR 2417 3334 3354 3364 3371 3381 rror trvl 192 211 278 293 293 293 293 w/ ERROR 3 0 10 20 30 40 50 60 70 Exuto Lt (mllos) 54 54 73 73 92 76 l 107 86 w/o ERROR 0 0 10 20 30 40 50 60 70 107 86 rror trvl 107 86 Exuto lt(mllos) 107 86 w/ ERROR Fur 10: Sttmts rport or. From t rsults o t ov xprmt w s tt rroous vor s ut vry tvly y our mt lortm. Tus, w olu tt our mt lortm ms t ts o mplmt omprso smpl s t os ot rqur t omplr wrtr to rt mpps tw uoptmz optmz strutos. Morovr, t omplr os ot prov su mpps o sour or t omplr s vll (.., t s ommrl omplr), w stll mplmt omprso us our mt lortm. 107 86
5. RELATED WORK Stt r lortms. A xst lss o lortms tt ompr two prorm vrsos r stt r lortms [1, 3, 8, 9]. Ts lortms prorm r t rt lvls: [9] s rs us l y l omprso, [1, 8] rs y ompr otrol low rps, [3] omprs put/output ps o prours. Wt t xpto o [3], ts lortms rport sttmts tt ppr to rt s rt. Morovr, ts lortms wor wt sour or trmt o rprsttos o t prorm vrsos. I otrst our mt lortms wor t ry lvl ty mt strutos tt ymlly v t sm v tou ty sttlly ppr to rt. Dr ym stors. Rsr s rr out o r ym stors o prorm xutos. T ts o su lortms or sotwr mt v roz. I [10] Rps t l. m us o pt prols to roz Y2K us prorms. Wl [14] s vlop systm tt ls prormmr to vsulz t s t ym vor o prorm. Howvr, ts wors ym stors o rt xutos, orrspo to two rt puts, o sl vrso o prorm r ompr. I otrst, our wor osrs mt o ym stors o two prorm vrsos o t sm put. Exst mt tqus. Tr r som xst tqus or mt: prour xtrto [6] rqurs sour or trmt o mts wl BMAT [12] wors o rs. BMAT mts rs to l propto o prol t ollt y xut o ry to trsorm ry so tt rxuto o t lttr oul vo. Gv t tur o ts pplto, t m ss to mt rs sttlly. O t otr, ppltos su s omprso sotwr pry tto w r trst mt t ym vors o two vrsos t xuto prols o t two vrsos r lry vll. 6. CONCLUSIONS I ts ppr w prst lortm or mt xuto stors o two prorm vrsos. S rsults prou y strutos r us to prorm t mt, w r l to mt strutos tt ppr to rt ut omput t sm rsults. I ts wy w ovrom t prolm o mt strutos prs o rt prorm trsormtos tt my v ppl rt t two vrsos. To vo ls mts w strutos otlly prou t sm rsults, w lso mt t ym t p struturs o t omputtos. A our lortm or mt t p strutur sus mt p rps tt v t sm ut ppr to rt. W mostrt tt us mt w l mplmtto o omprso v t s o sour o o t optmz omplr. Our oo wor s xplor t us o mt sotwr pry tto. 7. REFERENCES [1] T. Apwttpo, A. Orso, M.J. Hrrol, A Dr Alortm or Ot-Ort Prorms, IEEE Itrtol Co. o Automt Sotwr Er, ps 2-13, 2004. [2] C. Collr, C. Tomorso, D. Low, Br Astrtos Ustrutur Dt Struturs, IEEE Itrtol Cor o Computr Lus, ps 28-38, Co, IL, 1998. [3] D. Jso D.A. L, Smt D: A Tool or Summrz t Ets o Motos, IEEE Cor o Sotwr Mt, ps 243-252, Nov. 1994. [4] C. Jrmllo, R. Gupt, M.L. So, Comprso C: A Appro to Avo Du o Optmz Co, 7t Europ Sotwr Er Cor ACM SIGSOFT 7t Symposum o Foutos o Sotwr Er, LNCS 1687, Sprr Vrl, ps 268-284, Toulous, Fr, Sptmr 1999. [5] C. Jrmllo, R. Gupt, M.L. So, Du Tst Optmzrs trou Comprso C, Itrtol Worsop o Complr Optmzto Mts Complr Vrto, Eltro Nots Tortl Computr S 65 No. 2 (2002), l outo wt ETAPS, Grol, Fr, Aprl 2002. [6] R. Komooor S. Horwtz, Smts-Prsrv Prour Extrto, 27t ACM SIGPLAN-SIGACT o Prpls o Prormm Lus, ps 155-169, 2000. [7] J.R. Lrus E. Srr, EEL: M-Ipt Exutl Et, SIGPLAN Cor o Prormm Lu Ds Implmtto, ps 291-300, 1995. [8] J. Ls W. Szrmr, Itto o Prorm Motos ts Appltos to Sotwr Mt, IEEE Cor o Sotwr Mt, ps 282-290, Nov. 1992. [9] E.W. Myrs, A O(ND) Dr Alortm ts Vrtos, Alortm, 1(2):251-266, 1986. [10] T. Rps, T. Bll, M. Ds, J. Lrus, T Us o Prorm Prol or Sotwr Mt wt Appltos to t Yr 2000 Prolm, 6t Europ Sotwr Er Cor ACM SIGSOFT 5t Symposum o Foutos o Sotwr Er, ps 432-449, 1997. [11] A. Srvstv A. Eust, ATOM - A Systm or Bul Customz Prorm Alyss Tools, SIGPLAN Cor o Prormm Lu Ds Implmtto, ps 196-205, 1994. [12] Z. W, K. Pr, S. MFrl, BMAT - A Bry Mt Tool or Stl Prol Propto, T Jourl o Istruto Lvl Prlllsm, 2, My 2000. [13] C. W, J. Dvso, J. ll, J. Kt, Protto o Sotwr-s Survvlty Msms, Itrtol Cor o Dpl Systms Ntwors, ps 193-202, Gotor, Sw, July 2001. [14] N. Wl, Fstr Rus Mt Us Sotwr Ross, Tl Rport SERC-TR-75F, SERC, Uv. o Flor, CIS Dprtmt, Gsvll, FL, July 1994. [15] A. Zllr, Isolt Cus-Et Cs rom Computr Prorms, ACM SIGSOFT 10t Itrtol Symposum o t Foutos o Sotwr Er, Crlsto, Sout Crol, Novmr 2002. [16] X. Z R. Gupt, Wol Exuto Trs, IEEE/ACM 37t Itrtol Symposum o Mrorttur, Portl, Or, Dmr 2004. [17] T Trmr Complr Rsr Irstrutur. Nov. 1997. [18] S.S. Mu. Av Complr Ds Implmtto, Mor Kum, 1997.