BT /F41 8.9664 Tf 54 712.0299 Td[(6.5)-1000(Calling)-250(Exter)15(nal)-250(Functions)]TJ/F42 8.9664 Tf 0 -13.9477 Td[(Lik)10(e)-254(most)-254(interpreters,)-254(SpiderMonk)10(e)15(y)-254(has)-254(a)-254(foreign)-254(function)-254(inter)20(-)]TJ 0 -9.9626 Td[(f)10(ace)-231(\050FFI\051)-232(that)-231(allo)25(ws)-232(it)-231(to)-232(call)-231(C)-232(b)20(uiltins)-231(and)-232(host)-231(system)-232(functions)]TJ 0 -9.9627 Td[(\050e.g.,)-301(web)-301(bro)25(wser)-301(control)-301(and)-300(DOM)-301(access\051.)-301(The)-301(FFI)-301(has)-301(a)-301(stan-)]TJ 0 -9.9626 Td[(dard)-225(signat)1(ure)-225(for)-225(JS-callable)-224(functions,)-225(the)-224(k)10(e)15(y)-225(ar)18(gument)-224(of)-225(which)]TJ 0 -9.9627 Td[(is)-313(an)-313(array)-313(of)-313(box)15(ed)-312(v)25(alues.)-313(External)-313(functions)-313(called)-313(through)-313(the)]TJ 0 -9.9626 Td[(FFI)-214(interact)-215(with)-214(the)-214(program)-215(state)-214(through)-215(an)-214(interpreter)-214(API)-215(\050e.g.,)]TJ 0 -9.9626 Td[(to)-280(read)-279(a)-280(property)-279(from)-280(an)-279(ar)18(gument\051.)-280(There)-279(are)-280(also)-279(certain)-280(inter)20(-)]TJ 0 -9.9627 Td[(preter)-223(b)20(uiltins)-224(that)-223(do)-224(not)-223(use)-223(the)-224(FFI,)-223(b)20(ut)-224(interact)-223(with)-223(the)-224(program)]TJ 0 -9.9626 Td[(state)-369(i)1(n)-369(the)-369(same)-368(w)10(ay)65(,)-369(such)-368(as)-369(the)]TJ/F33 8.9664 Tf 130.5975 0 Td[(CallIteratorNext)]TJ/F42 8.9664 Tf 78.6212 0 Td[(function)]TJ -209.2187 -9.9627 Td[(used)-325(with)-325(it)1(erator)-325(objects.)-325(T)35(raceMonk)10(e)15(y)-325(must)-324(support)-325(this)-325(FFI)-325(in)]TJ 0 -9.9626 Td[(order)-218(to)-218(speed)-217(up)-218(code)-218(that)-218(interacts)-218(with)-217(the)-218(host)-218(system)-218(inside)-218(hot)]TJ 0 -9.9626 Td[(loops.)]TJ 11.9552 -9.9627 Td[(Calling)-225(e)15(xternal)-226(functions)-225(from)-226(T)35(raceMonk)10(e)15(y)-225(is)-226(potentially)-225(dif-)]TJ -11.9552 -9.9626 Td[(\002cult)-330(because)-330(trac)1(es)-330(do)-330(not)-330(update)-330(the)-329(interpreter)-330(state)-330(until)-330(e)15(xit-)]TJ 0 -9.9627 Td[(ing.)-268(In)-268(particular)40(,)-268(e)15(xternal)-269(functions)-268(may)-268(need)-268(the)-268(call)-268(stack)-269(or)-268(the)]TJ 0 -9.9626 Td[(global)-250(v)25(ariables,)-250(b)20(ut)-250(the)15(y)-250(may)-250(be)-250(out)-250(of)-250(date.)]TJ 11.9552 -9.9626 Td[(F)15(or)-340(the)-340(out-of-date)-340(call)-340(stack)-340(problem,)-340(we)-340(re)1(f)10(actored)-340(some)-340(of)]TJ -11.9552 -9.9627 Td[(the)-302(interpreter)-303(API)-302(implementation)-302(functions)-302(to)-302(re-materialize)-303(the)]TJ 0 -9.9626 Td[(interpreter)-250(call)-250(stack)-250(on)-250(demand.)]TJ 11.9552 -9.9627 Td[(W)80(e)-311(de)26(v)14(e)1(loped)-311(a)-310(C++)-311(static)-310(analysis)-311(and)-310(annotated)-311(some)-310(inter)20(-)]TJ -11.9552 -9.9626 Td[(preter)-361(funct)1(ions)-361(in)-361(order)-360(to)-361(v)15(erify)-360(that)-361(the)-360(call)-361(stack)-360(is)-361(refreshed)]TJ 0 -9.9626 Td[(at)-327(an)15(y)-327(point)-327(it)-326(needs)-327(to)-327(be)-327(used.)-327(In)-327(order)-326(to)-327(access)-327(the)-327(call)-327(stack,)]TJ 0 -9.9627 Td[(a)-470(function)-469(must)-470(be)-469(annotated)-470(as)-469(either)-495(F)]TJ/F42 7.1731 Tf 157.6439 0 Td[(O)-62(R)-61(C)-62(E)-62(S)]TJ/F42 8.9664 Tf 25.3297 0 Td[(S)]TJ/F42 7.1731 Tf 5.4335 0 Td[(T)31(A)-22(C)-61(K)]TJ/F42 8.9664 Tf 24.3304 0 Td[(or)-495(R)]TJ/F42 7.1731 Tf 18.3321 0 Td[(E)]TJ/F42 8.9664 Tf 4.8238 0 Td[(-)]TJ/F42 7.1731 Tf -235.6693 -9.9626 Td[(Q)-52(U)-61(I)-62(R)-62(E)-62(S)]TJ/F42 8.9664 Tf 28.4857 0 Td[(S)]TJ/F42 7.1731 Tf 5.4336 0 Td[(T)31(A)-22(C)-61(K)]TJ/F42 8.9664 Tf 20.1202 0 Td[(.)-232(These)-233(annotations)-232(are)-233(also)-232(required)-233(i)1(n)-233(order)-232(to)-233(call)]TJ -54.0395 -9.9627 Td[(R)]TJ/F42 7.1731 Tf 6.4288 0 Td[(E)-61(Q)-52(U)-62(I)-62(R)-62(E)-61(S)]TJ/F42 8.9664 Tf 33.3095 0 Td[(S)]TJ/F42 7.1731 Tf 5.4336 0 Td[(T)31(A)-22(C)-61(K)]TJ/F42 8.9664 Tf 22.1792 0 Td[(functions,)-230(which)-229(are)-230(presumed)-229(to)-230(access)-230(the)-229(call)]TJ -67.5752 -9.9626 Td[(stack)-345(transi)1(ti)25(v)15(ely)65(.)-370(F)]TJ/F42 7.1731 Tf 71.9106 0 Td[(O)-62(R)-61(C)-62(E)-62(S)]TJ/F42 8.9664 Tf 25.3297 0 Td[(S)]TJ/F42 7.1731 Tf 5.4336 0 Td[(T)31(A)-22(C)-61(K)]TJ/F42 8.9664 Tf 23.2098 0 Td[(is)-345(a)-344(trusted)-345(annotation,)-344(applied)]TJ -125.8837 -9.9626 Td[(to)-223(only)-222(5)-223(functions,)-222(that)-223(means)-223(the)-222(function)-223(refreshes)-222(the)-223(call)-223(stack.)]TJ 0.2241 -9.9627 Td[(R)]TJ/F42 7.1731 Tf 6.4288 0 Td[(E)-61(Q)-52(U)-62(I)-62(R)-62(E)-61(S)]TJ/F42 8.9664 Tf 33.3096 0 Td[(S)]TJ/F42 7.1731 Tf 5.4335 0 Td[(T)31(A)-22(C)-61(K)]TJ/F42 8.9664 Tf 22.8303 0 Td[(is)-302(an)-302(untrusted)-303(annotation)-302(that)-302(means)-302(the)-303(func-)]TJ -68.2263 -9.9626 Td[(tion)-234(may)-235(only)-234(be)-235(called)-234(if)-234(the)-235(call)-234(stack)-235(has)-234(already)-234(been)-235(refreshed.)]TJ 11.9551 -9.9627 Td[(Similarly)65(,)-435(we)-436(detect)-435(when)-436(host)-435(functions)-436(attem)1(pt)-436(to)-435(directly)]TJ -11.9551 -9.9626 Td[(read)-234(or)-234(write)-234(global)-233(v)25(ariables,)-234(and)-234(force)-234(the)-234(currently)-234(running)-234(trace)]TJ 0 -9.9626 Td[(to)-388(side)-388(e)15(xit.)-388(This)-389(is)-388(necessary)-388(since)-388(we)-388(cache)-388(and)-389(unbox)-388(global)]TJ 0 -9.9627 Td[(v)25(ariables)-250(into)-250(the)-250(acti)25(v)25(ation)-250(record)-250(during)-250(trace)-250(e)15(x)15(ecution.)]TJ 11.9551 -9.9626 Td[(Since)-504(both)-504(call-stack)-504(access)-504(and)-504(global)-504(v)25(ariable)-504(access)-504(are)]TJ -11.9551 -9.9627 Td[(rarely)-198(performed)-199(by)-198(host)-199(functions,)-198(performance)-199(is)-198(not)-199(signi\002cantly)]TJ 0 -9.9626 Td[(af)25(fected)-250(by)-250(these)-250(safety)-250(mechanisms.)]TJ 11.9551 -9.9626 Td[(Another)-233(problem)-233(is)-233(that)-233(e)15(xternal)-233(functions)-233(can)-233(ree)1(nter)-233(the)-233(inter)20(-)]TJ -11.9551 -9.9627 Td[(preter)-287(by)-287(calling)-287(scripts,)-287(which)-287(in)-287(turn)-287(ag)5(ain)-288(m)1(ight)-288(w)10(ant)-287(to)-287(access)]TJ 0 -9.9626 Td[(the)-217(call)-217(stack)-217(or)-217(global)-217(v)25(ariables.)-217(T)80(o)-217(address)-217(this)-218(problem,)-217(we)-217(made)]TJ 0 -9.9627 Td[(the)-203(VM)-203(set)-203(a)-203(\003ag)-203(whene)25(v)15(er)-203(the)-203(interpreter)-203(is)-204(r)1(eentered)-204(while)-203(a)-203(com-)]TJ 0 -9.9626 Td[(piled)-250(trace)-250(is)-250(running.)]TJ 11.9551 -9.9626 Td[(Ev)15(ery)-232(call)-232(to)-231(an)-232(e)15(xternal)-232(function)-232(then)-231(checks)-232(this)-232(\003ag)-232(and)-231(e)15(xits)]TJ -11.9551 -9.9627 Td[(the)-206(trace)-206(immediately)-206(after)-206(returning)-206(from)-206(the)-207(e)15(xternal)-206(function)-206(call)]TJ 0 -9.9626 Td[(if)-282(it)-281(is)-282(set.)-282(There)-282(are)-281(man)15(y)-282(e)15(xternal)-282(functions)-282(t)1(hat)-282(seldom)-282(or)-282(ne)25(v)15(er)]TJ 0 -9.9627 Td[(reenter)40(,)-395(and)-395(the)15(y)-395(can)-395(be)-395(called)-395(without)-395(problem,)-395(and)-395(will)-395(cause)]TJ 0 -9.9626 Td[(trace)-250(e)15(xit)-250(only)-250(if)-250(necessary)65(.)]TJ 11.9551 -9.9626 Td[(The)-423(FFI')55(s)-422(box)15(ed)-423(v)25(alue)-422(array)-423(requirement)-422(has)-423(a)-422(performance)]TJ -11.9551 -9.9627 Td[(cost,)-369(so)-370(we)-369(de\002ned)-370(a)-369(ne)25(w)-370(FFI)-369(that)-370(allo)25(w)1(s)-370(C)-369(functions)-370(to)-369(be)-370(an-)]TJ 0 -9.9626 Td[(notated)-320(with)-320(their)-321(ar)18(gument)-320(types)-320(so)-320(that)-321(the)-320(tracer)-320(can)-320(call)-321(them)]TJ 0 -9.9627 Td[(directly)65(,)-250(without)-250(unnecessary)-250(ar)18(gument)-250(con)40(v)15(ersions.)]TJ 11.9551 -9.9626 Td[(Currently)65(,)-258(we)-258(do)-258(not)-258(support)-258(calling)-258(nati)25(v)15(e)-258(property)-258(get)-258(and)-258(set)]TJ -11.9551 -9.9626 Td[(o)15(v)15(erride)-299(functions)-300(or)-299(DOM)-300(functions)-299(directly)-300(from)-299(trace.)-300(Support)]TJ 0 -9.9627 Td[(is)-250(planned)-250(future)-250(w)10(ork.)]TJ/F41 8.9664 Tf 0 -17.9327 Td[(6.6)-1000(Corr)18(ectness)]TJ/F42 8.9664 Tf 0 -13.9477 Td[(During)-482(de)25(v)15(elopment,)-481(we)-482(had)-482(access)-482(to)-481(e)15(xisting)-482(Ja)20(v)25(aScript)-482(test)]TJ 0 -9.9627 Td[(suites,)-363(b)20(ut)-363(most)-363(of)-363(them)-363(were)-363(not)-363(designed)-363(with)-364(tracing)-363(VMs)-363(in)]TJ 0 -9.9626 Td[(mind)-250(and)-250(contained)-250(fe)25(w)-250(loops.)]TJ 11.9551 -9.9626 Td[(One)-346(tool)-346(that)-346(helped)-346(us)-346(greatly)-346(w)10(as)-346(Mozilla')55(s)-346(Ja)20(v)25(aScript)-346(fuzz)]TJ -11.9551 -9.9627 Td[(tester)40(,)]TJ/F42 7.1731 Tf 24.6182 0 Td[(J)-62(S)-62(F)-61(U)-62(N)-62(F)-61(U)-62(Z)-61(Z)]TJ/F42 8.9664 Tf 42.8138 0 Td[(,)-345(which)-344(generates)-345(random)-345(Ja)20(v)25(aScript)-344(programs)]TJ -67.432 -9.9626 Td[(by)-378(nesting)-377(random)-378(language)-378(elements.)-377(W)80(e)-378(modi\002ed)]TJ/F42 7.1731 Tf 196.2896 0 Td[(J)-62(S)-62(F)-61(U)-62(N)-62(F)-61(U)-62(Z)-61(Z)]TJ/F42 8.9664 Tf -196.2896 -9.9627 Td[(to)-311(generate)-311(loops,)-310(and)-311(also)-311(to)-311(test)-310(more)-311(hea)20(vily)-311(certain)-311(constructs)]TJ 0 -9.9626 Td[(we)-236(suspected)-237(w)10(ould)-236(re)25(v)15(eal)-236(\003a)15(ws)-236(in)-237(our)-236(implementation.)-236(F)15(or)-237(e)15(xam-)]TJ 0 -9.9626 Td[(ple,)-195(we)-194(suspected)-195(b)20(ugs)-194(in)-195(T)35(raceMonk)10(e)15(y')55(s)-195(handling)-194(of)-195(type-unstable)]TJ ET 1 0 0 1 317.0137 506.1815 cm q .55 0 0 .55 0 0 cm q 1 0 0 1 -55.1171 -332.1152 cm /Im7 Do Q Q 1 0 0 1 0 -11.2876 cm q []0 d 0 J 0.3288 w 0 0.1644 m 239.1034 0.1644 l S Q 1 0 0 1 -317.0137 -494.8939 cm BT /F41 8.9664 Tf 317.0137 484.731 Td[(Figur)18(e)-377(11.)-500(Fraction)-378(of)-377(dynamic)-378(bytecodes)-377(executed)-377(by)-378(inter)37(-)]TJ 0 -9.9626 Td[(pr)18(eter)-257(and)-257(on)-256(nati)10(v)10(e)-257(traces.)]TJ/F42 8.9664 Tf 107.5414 0 Td[(The)-257(speedup)-257(vs.)-256(interpreter)-257(is)-257(sho)25(wn)]TJ -107.5414 -9.9627 Td[(in)-408(parentheses)-408(ne)15(xt)-408(to)-408(each)-408(test.)-408(The)-408(fraction)-408(of)-408(bytecodes)-408(e)15(x)15(e-)]TJ 0 -9.9626 Td[(cuted)-444(whil)1(e)-444(recording)-444(is)-443(too)-444(small)-443(to)-444(see)-443(in)-444(this)-443(\002gure,)-444(e)15(xcept)]TJ 0 -9.9626 Td[(for)]TJ/F33 8.9664 Tf 12.9821 0 Td[(crypto-md5)]TJ/F42 8.9664 Tf 47.073 0 Td[(,)-282(where)-282(fully)-282(3%)-281(of)-282(bytecodes)-282(are)-282(e)15(x)15(ecuted)-282(while)]TJ -60.0551 -9.9627 Td[(recording.)-357(In)-356(most)-357(of)-357(the)-357(test)1(s,)-357(almost)-357(all)-357(the)-356(bytecodes)-357(are)-357(e)15(x)15(e-)]TJ 0 -9.9626 Td[(cuted)-304(by)-303(compiled)-304(traces.)-303(Three)-304(of)-303(the)-304(benchmarks)-304(are)-303(not)-304(traced)]TJ 0 -9.9627 Td[(at)-250(all)-250(and)-250(run)-250(in)-250(the)-250(interpreter)55(.)]TJ 0 -29.4951 Td[(loops)-267(and)-266(hea)20(vily)-267(branching)-266(code,)-267(and)-266(a)-267(specialized)-267(fuzz)-266(tester)-267(in-)]TJ 0 -9.9627 Td[(deed)-193(re)25(v)15(ealed)-194(se)25(v)15(eral)-193(re)15(gressions)-194(which)-193(we)-193(subsequently)-194(corrected.)]TJ/F41 10.9589 Tf 0 -24.1524 Td[(7.)-1000(Ev)10(aluation)]TJ/F42 8.9664 Tf 0 -13.9477 Td[(W)80(e)-430(e)25(v)25(aluated)-430(our)-431(Ja)20(v)25(aScript)-430(tracing)-430(implementation)-430(using)-431(Sun-)]TJ 0 -9.9626 Td[(Spider)40(,)-290(the)-291(indus)1(try)-291(standard)-290(Ja)20(v)25(aScript)-290(benchmark)-290(suite.)-291(SunSpi-)]TJ 0 -9.9627 Td[(der)-322(consists)-322(of)-323(26)-322(short-running)-322(\050less)-322(than)-322(250ms,)-323(a)20(v)15(era)1(ge)-323(26ms\051)]TJ 0 -9.9626 Td[(Ja)20(v)25(aScript)-298(programs.)-299(This)-299(is)-298(in)-299(stark)-298(contrast)-299(to)-298(benchmark)-299(suites)]TJ 0 -9.9627 Td[(such)-328(as)-329(SpecJVM98)-328(\0503\051)-328(used)-328(to)-329(e)25(v)25(aluate)-328(desktop)-328(and)-328(serv)15(er)-329(Ja)20(v)25(a)]TJ 0 -9.9626 Td[(VMs.)-268(Man)15(y)-267(programs)-268(in)-268(those)-267(benchmarks)-268(use)-268(lar)18(ge)-267(data)-268(sets)-268(and)]TJ 0 -9.9626 Td[(e)15(x)15(ecute)-220(for)-220(minutes.)-220(The)-220(SunSpider)-220(programs)-220(carry)-220(out)-220(a)-220(v)25(ariety)-220(of)]TJ 0 -9.9627 Td[(tasks,)-232(primarily)-232(3d)-232(rendering,)-232(bit-bashing,)-233(cryptographic)-232(encoding,)]TJ 0 -9.9626 Td[(math)-250(k)10(ernels,)-250(and)-250(string)-250(processing.)]TJ 11.9552 -9.9627 Td[(All)-363(e)15(xperiments)-363(were)-364(performed)-363(on)-363(a)-364(MacBook)-363(Pro)-363(with)-363(2.2)]TJ -11.9552 -9.9626 Td[(GHz)-250(Core)-250(2)-250(processor)-250(and)-250(2)-250(GB)-250(RAM)-250(running)-250(MacOS)-250(10.5.)]TJ/F41 8.9664 Tf 11.9552 -9.9626 Td[(Benchmark)-380(r)18(esults.)]TJ/F42 8.9664 Tf 79.1263 0 Td[(The)-380(main)-380(question)-380(is)-380(whether)-380(programs)]TJ -91.0815 -9.9627 Td[(run)-240(f)10(aster)-240(with)-240(tracing.)-240(F)15(or)-240(this,)-240(we)-240(ran)-240(the)-240(standard)-240(SunSpider)-240(test)]TJ 0 -9.9626 Td[(dri)25(v)15(er)40(,)-389(which)-390(starts)-389(a)-390(Ja)20(v)25(aScript)-389(interpreter)40(,)-389(loads)-390(and)-389(runs)-390(each)]TJ 0 -9.9627 Td[(program)-349(once)-349(for)-349(w)10(armup,)-348(then)-349(loads)-349(and)-349(runs)-349(each)-349(program)-349(10)]TJ 0 -9.9626 Td[(times)-281(and)-281(reports)-281(the)-281(a)20(v)15(erage)-281(time)-281(tak)10(en)-281(by)-281(each.)-281(W)80(e)-282(ran)-281(4)-281(dif)25(fer)20(-)]TJ 0 -9.9626 Td[(ent)-271(con\002gurations)-272(for)-271(comparison:)-272(\050a\051)-271(SpiderMonk)10(e)15(y)65(,)-271(the)-272(baseline)]TJ 0 -9.9627 Td[(interpreter)40(,)-274(\050b\051)-275(T)35(raceMonk)10(e)15(y)65(,)-274(\050d\051)-275(SquirrelFish)-274(Extreme)-274(\050SFX\051,)-275(the)]TJ 0 -9.9626 Td[(call-threaded)-380(Ja)20(v)25(aScript)-380(interpreter)-379(used)-380(in)-380(Apple')55(s)-380(W)80(ebKit,)-380(and)]TJ 0 -9.9627 Td[(\050e\051)-250(V8,)-250(the)-250(method-compiling)-250(Ja)20(v)25(aScript)-250(VM)-250(from)-250(Google.)]TJ 11.9552 -9.9626 Td[(Figure)-197(10)-198(sho)25(ws)-197(the)-197(relati)25(v)15(e)-197(speedups)-198(achie)25(v)15(ed)-197(by)-197(tracing,)-197(SFX,)]TJ -11.9552 -9.9626 Td[(and)-267(V8)-268(ag)5(ainst)-267(the)-267(baseline)-268(\050SpiderMonk)10(e)15(y\051.)-267(T)35(racing)-267(achie)25(v)15(es)-268(the)]TJ 0 -9.9627 Td[(best)-257(speedups)-256(in)-257(inte)15(ger)20(-hea)20(vy)-257(be)1(nchmarks,)-257(up)-257(to)-256(the)-257(25x)-257(speedup)]TJ 0 -9.9626 Td[(on)]TJ/F33 8.9664 Tf 11.208 0 Td[(bitops-bitwise-and)]TJ/F42 8.9664 Tf 84.7313 0 Td[(.)]TJ -83.9841 -9.9627 Td[(T)35(raceMonk)10(e)15(y)-435(is)-435(the)-436(f)10(astest)-435(VM)-435(on)-435(9)-436(of)-435(the)-435(26)-435(benchmarks)]TJ -11.9552 -9.9626 Td[(\050)]TJ/F33 8.9664 Tf 2.9858 0 Td[(3d-morph)]TJ/F42 8.9664 Tf 37.6583 0 Td[(,)]TJ/F33 8.9664 Tf 7.4374 0 Td[(bitops-3bit-bits-in-byte)]TJ/F42 8.9664 Tf 112.9751 0 Td[(,)]TJ/F33 8.9664 Tf 7.4374 0 Td[(bitops-bitwise-)]TJ -168.494 -9.9626 Td[(and)]TJ/F42 8.9664 Tf 14.1219 0 Td[(,)]TJ/F33 8.9664 Tf 4.4651 0 Td[(crypto-sha1)]TJ/F42 8.9664 Tf 51.7802 0 Td[(,)]TJ/F33 8.9664 Tf 4.4652 0 Td[(math-cordic)]TJ/F42 8.9664 Tf 51.7802 0 Td[(,)]TJ/F33 8.9664 Tf 4.4652 0 Td[(math-partial-sums)]TJ/F42 8.9664 Tf 80.0239 0 Td[(,)]TJ/F33 8.9664 Tf 4.4652 0 Td[(math-)]TJ -215.5669 -9.9627 Td[(spectral-norm)]TJ/F42 8.9664 Tf 61.1948 0 Td[(,)]TJ/F33 8.9664 Tf 6.3166 0 Td[(string-base64)]TJ/F42 8.9664 Tf 61.1948 0 Td[(,)]TJ/F33 8.9664 Tf 6.3166 0 Td[(string-validate-input)]TJ/F42 8.9664 Tf 98.8532 0 Td[(\051.)]TJ ET 1 0 0 1 138.0918 452.7684 cm q 0.97 0 0 0.97 0 0 cm q 1 0 0 1 -104.7432 -498.0109 cm /Im6 Do Q Q 1 0 0 1 -84.0918 -11.2877 cm q []0 d 0 J 0.3288 w 0 0.1644 m 502.1171 0.1644 l S Q 1 0 0 1 -54 -441.4807 cm BT /F41 8.9664 Tf 54 431.3179 Td[(Figur)18(e)-311(10.)]TJ/F42 8.9664 Tf 43.7208 0 Td[(Speedup)-311(vs.)-311(a)-311(baseline)-311(Ja)20(v)25(aScript)-311(interpreter)-311(\050SpiderMonk)10(e)15(y\051)-311(for)-312(our)-311(trace-based)-311(JIT)-311(compiler)40(,)-311(Apple')55(s)-311(SquirrelFish)-311(Extreme)]TJ -43.7208 -9.9627 Td[(inline)-205(threading)-205(interpreter)-205(and)-205(Google')55(s)-205(V8)-205(JS)-205(compiler)55(.)-205(Our)-205(system)-205(generates)-205(particularly)-205(ef)25(\002cient)-205(code)-205(for)-205(programs)-205(that)-205(bene\002t)-205(most)-205(from)]TJ 0 -9.9626 Td[(type)-269(specialization,)-270(which)-269(includes)-269(SunSpider)-270(Benchmark)-269(programs)-270(that)-269(perform)-269(bit)-270(manipulation.)-269(W)80(e)-270(type-s)1(pecialize)-270(the)-269(code)-270(in)-269(question)]TJ 0 -9.9626 Td[(to)-313(use)-313(inte)15(ger)-313(arithmet)1(ic,)-313(which)-313(substantially)-313(impro)15(v)15(es)-313(performance.)-313(F)15(or)-313(one)-312(of)-313(the)-313(benchmark)-313(programs)-313(we)-313(e)15(x)15(ecute)-312(25)-313(times)-313(f)10(aster)-313(than)]TJ 0 -9.9627 Td[(the)-250(SpiderMonk)10(e)15(y)-251(interpre)1(ter)40(,)-251(and)-250(almost)-250(5)-251(times)-250(f)10(aster)-250(than)-250(V8)-251(and)-250(SFX.)-250(F)15(or)-251(a)-250(lar)18(ge)-250(number)-250(of)-251(benchmarks)-250(all)-250(three)-250(VMs)-251(produce)-250(similar)]TJ 0 -9.9626 Td[(results.)-249(W)80(e)-250(perform)-249(w)10(orst)-249(on)-250(benchmark)-249(programs)-249(that)-250(we)-249(do)-249(not)-250(trace)-249(and)-249(instead)-250(f)10(a)1(ll)-250(back)-249(onto)-249(the)-250(interpreter)55(.)-249(This)-249(includes)-250(the)-249(recursi)25(v)15(e)]TJ 0 -9.9627 Td[(benchmarks)]TJ/F33 8.9664 Tf 45.5667 0 Td[(access-binary-trees)]TJ/F42 8.9664 Tf 91.6802 0 Td[(and)]TJ/F33 8.9664 Tf 15.189 0 Td[(control-flow-recursive)]TJ/F42 8.9664 Tf 103.5604 0 Td[(,)-250(for)-250(which)-250(we)-250(currently)-250(don')18(t)-250(generate)-250(an)15(y)-250(nati)25(v)15(e)-250(code.)]TJ -255.9963 -29.8879 Td[(In)-278(particular)40(,)-277(the)]TJ/F33 8.9664 Tf 62.1391 0 Td[(bitops)]TJ/F42 8.9664 Tf 30.7344 0 Td[(benchmarks)-278(are)-277(short)-278(programs)-278(that)-278(per)20(-)]TJ -92.8735 -9.9626 Td[(form)-299(man)15(y)-300(bitwise)-299(operations,)-300(so)-299(T)35(raceMonk)10(e)15(y)-299(can)-300(co)15(v)15(er)-299(the)-300(en-)]TJ 0 -9.9627 Td[(tire)-245(program)-245(with)-245(1)-245(or)-245(2)-245(traces)-245(that)-246(opera)1(te)-246(on)-245(inte)15(gers.)-245(T)35(raceMon-)]TJ 0 -9.9626 Td[(k)10(e)15(y)-265(runs)-265(all)-265(the)-265(other)-265(progr)1(ams)-265(in)-265(this)-265(set)-265(almost)-265(entirely)-265(as)-265(nati)25(v)15(e)]TJ 0 -9.9627 Td[(code.)]TJ/F33 8.9664 Tf 11.9552 -9.9626 Td[(regexp-dna)]TJ/F42 8.9664 Tf 51.7706 0 Td[(is)-524(dominated)-524(by)-524(re)15(gular)-524(e)15(xpression)-524(ma)1(tching,)]TJ -63.7258 -9.9626 Td[(which)-251(is)-250(implemented)-251(in)-250(all)-251(3)-250(VMs)-251(by)-250(a)-251(special)-250(re)15(gular)-251(e)15(xpression)]TJ 0 -9.9627 Td[(compiler)55(.)-313(Thus,)-313(performance)-313(on)-313(this)-313(benchmark)-313(has)-313(little)-313(relation)]TJ 0 -9.9626 Td[(to)-250(the)-250(trace)-250(compilation)-250(approach)-250(discussed)-250(in)-250(this)-250(paper)55(.)]TJ 11.9552 -9.9627 Td[(T)35(raceMonk)10(e)15(y')55(s)-287(smaller)-287(speedups)-288(on)-287(the)-287(other)-287(benchmarks)-287(can)]TJ -11.9552 -9.9626 Td[(be)-250(attrib)20(uted)-250(to)-250(a)-250(fe)25(w)-250(speci\002c)-250(causes:)]TJ/F26 7.9701 Tf 5.2303 -25.2391 Td[(\017)]TJ/F42 8.9664 Tf 7.7211 -0.8982 Td[(The)-552(implementation)-552(does)-553(not)-552(currently)-552(trace)-552(recursion,)-552(so)]TJ 0 -9.9626 Td[(T)35(raceMonk)10(e)15(y)-534(achie)25(v)15(es)-534(a)-534(small)-534(speedup)-534(or)-534(no)-534(speedup)-534(on)]TJ 0 -9.9627 Td[(benchmarks)-593(that)-593(use)-593(recursion)-593(e)15(xtensi)25(v)15(ely:)]TJ/F33 8.9664 Tf 171.5197 0 Td[(3d-cube)]TJ/F42 8.9664 Tf 32.951 0 Td[(,)]TJ/F33 8.9664 Tf 7.5594 0 Td[(3d-)]TJ -212.0301 -9.9626 Td[(raytrace)]TJ/F42 8.9664 Tf 37.6584 0 Td[(,)]TJ/F33 8.9664 Tf 5.1661 0 Td[(access-binary-trees)]TJ/F42 8.9664 Tf 89.4385 0 Td[(,)]TJ/F33 8.9664 Tf 5.1661 0 Td[(string-tagcloud)]TJ/F42 8.9664 Tf 70.6094 0 Td[(,)-326(and)]TJ/F33 8.9664 Tf -208.0385 -9.9627 Td[(controlflow-recursive)]TJ/F42 8.9664 Tf 98.8532 0 Td[(.)]TJ/F26 7.9701 Tf -106.5743 -13.0495 Td[(\017)]TJ/F42 8.9664 Tf 7.7211 -0.8982 Td[(The)-384(implementation)-384(does)-383(not)-384(currently)-384(trace)]TJ/F33 8.9664 Tf 168.5649 0 Td[(eval)]TJ/F42 8.9664 Tf 22.2705 0 Td[(and)-384(some)]TJ -190.8354 -9.9626 Td[(other)-483(functions)-482(implemented)-483(in)-483(C.)-483(Because)]TJ/F33 8.9664 Tf 169.6644 0 Td[(date-format-)]TJ -169.6644 -9.9626 Td[(tofte)]TJ/F42 8.9664 Tf 27.0327 0 Td[(and)]TJ/F33 8.9664 Tf 16.4436 0 Td[(date-format-xparb)]TJ/F42 8.9664 Tf 83.5202 0 Td[(use)-390(such)-390(functions)-390(in)-390(their)]TJ -126.9965 -9.9627 Td[(main)-250(loops,)-250(we)-250(do)-250(not)-250(trace)-250(them.)]TJ/F26 7.9701 Tf -7.7211 -13.0495 Td[(\017)]TJ/F42 8.9664 Tf 7.7211 -0.8982 Td[(The)-400(implementation)-399(does)-400(not)-399(currently)-400(trace)-400(through)-399(re)15(gular)]TJ 0 -9.9626 Td[(e)15(xpression)]TJ/F33 8.9664 Tf 41.7528 0 Td[(replace)]TJ/F42 8.9664 Tf 36.4895 0 Td[(operations.)-395(The)-394(replace)-395(function)-394(can)-395(be)]TJ -78.2423 -9.9627 Td[(passed)-271(a)-270(function)-271(object)-271(used)-270(to)-271(compute)-271(the)-271(replacement)-270(te)15(xt.)]TJ 0 -9.9626 Td[(Our)-374(implementation)-373(currently)-374(does)-373(not)-374(trace)-374(functions)-373(called)]TJ 0 -9.9626 Td[(as)-239(replace)-240(functions.)-239(The)-239(run)-239(time)-240(of)]TJ/F33 8.9664 Tf 133.2945 0 Td[(string-unpack-code)]TJ/F42 8.9664 Tf 86.877 0 Td[(is)]TJ -220.1715 -9.9627 Td[(dominated)-250(by)-250(such)-250(a)]TJ/F33 8.9664 Tf 76.2046 0 Td[(replace)]TJ/F42 8.9664 Tf 35.1927 0 Td[(call.)]TJ/F26 7.9701 Tf 143.8953 274.109 Td[(\017)]TJ/F42 8.9664 Tf 7.7211 -0.8982 Td[(T)80(w)10(o)-405(programs)-406(trace)-405(well,)-405(b)20(ut)-406(ha)20(v)15(e)-405(a)-406(long)-405(compilation)-405(time.)]TJ/F33 8.9664 Tf 0 -9.9626 Td[(access-nbody)]TJ/F42 8.9664 Tf 58.1911 0 Td[(forms)-190(a)-190(lar)18(ge)-190(number)-190(of)-190(traces)-190(\05081\051.)]TJ/F33 8.9664 Tf 127.5367 0 Td[(crypto-md5)]TJ/F42 8.9664 Tf -185.7278 -9.9627 Td[(forms)-297(one)-297(v)14(e)1(ry)-298(long)-297(trace.)-297(W)80(e)-298(e)15(xpec)1(t)-298(to)-297(impro)15(v)15(e)-297(performance)]TJ 0 -9.9626 Td[(on)-273(this)-274(programs)-273(by)-274(impro)15(ving)-273(the)-274(compilation)-273(speed)-274(of)-273(nano-)]TJ 0 -9.9626 Td[(jit.)]TJ/F26 7.9701 Tf -7.7211 -13.0495 Td[(\017)]TJ/F42 8.9664 Tf 7.7211 -0.8982 Td[(Some)-450(programs)-450(trace)-449(v)15(ery)-450(well,)-450(and)-450(speed)-450(up)-449(compared)-450(to)]TJ 0 -9.9626 Td[(the)-360(interpreter)40(,)-361(b)20(ut)-360(are)-360(not)-361(as)-360(f)10(ast)-360(as)-360(SFX)-361(and/or)-360(V8,)-360(namely)]TJ/F33 8.9664 Tf 0 -9.9627 Td[(bitops-bits-in-byte)]TJ/F42 8.9664 Tf 89.4386 0 Td[(,)]TJ/F33 8.9664 Tf 9.5155 0 Td[(bitops-nsieve-bits)]TJ/F42 8.9664 Tf 84.7313 0 Td[(,)]TJ/F33 8.9664 Tf 9.5155 0 Td[(access-)]TJ -193.2009 -9.9626 Td[(fannkuch)]TJ/F42 8.9664 Tf 37.6584 0 Td[(,)]TJ/F33 8.9664 Tf 5.113 0 Td[(access-nsieve)]TJ/F42 8.9664 Tf 61.1948 0 Td[(,)-320(and)]TJ/F33 8.9664 Tf 20.9319 0 Td[(crypto-aes)]TJ/F42 8.9664 Tf 47.0729 0 Td[(.)-320(The)-320(reason)-321(is)]TJ -171.971 -9.9627 Td[(not)-452(clear)40(,)-451(b)20(ut)-452(all)-451(of)-452(these)-451(programs)-452(ha)20(v)15(e)-451(nested)-452(loops)-451(with)]TJ 0 -9.9626 Td[(small)-259(bodies,)-258(so)-259(we)-259(suspec)1(t)-259(that)-259(the)-258(implementation)-259(has)-259(a)-258(rela-)]TJ 0 -9.9626 Td[(ti)25(v)15(ely)-242(high)-243(cost)-242(for)-242(calling)-242(nested)-243(traces.)]TJ/F33 8.9664 Tf 146.5825 0 Td[(string-fasta)]TJ/F42 8.9664 Tf 58.6602 0 Td[(traces)]TJ -205.2427 -9.9627 Td[(well,)-226(b)20(ut)-226(its)-226(run)-227(time)-226(is)-226(dominated)-226(by)-226(string)-226(processing)-226(b)20(uiltins,)]TJ 0 -9.9626 Td[(which)-258(are)-257(unaf)25(fected)-258(by)-258(tracing)-257(and)-258(seem)-258(to)-257(be)-258(less)-258(ef)25(\002cient)-257(in)]TJ 0 -9.9627 Td[(SpiderMonk)10(e)15(y)-250(than)-250(in)-250(the)-250(tw)10(o)-250(other)-250(VMs.)]TJ/F41 8.9664 Tf -0.9963 -20.1597 Td[(Detailed)-232(perf)25(ormance)-231(metrics.)]TJ/F42 8.9664 Tf 117.8007 0 Td[(In)-232(Figure)-231(11)-232(we)-232(sho)25(w)-232(the)-231(frac-)]TJ -129.7558 -9.9626 Td[(tion)-257(of)-257(instructions)-257(interprete)1(d)-257(and)-257(the)-257(fraction)-257(of)-257(instructions)-257(e)15(x)15(e-)]TJ 0 -9.9627 Td[(cuted)-225(as)-225(nati)25(v)15(e)-225(code.)-225(This)-224(\002gure)-225(sho)25(ws)-225(that)-225(for)-225(man)15(y)-225(programs,)-225(we)]TJ 0 -9.9626 Td[(are)-250(able)-250(to)-250(e)15(x)15(ecute)-250(almost)-250(all)-250(the)-250(code)-250(nati)25(v)15(ely)65(.)]TJ 11.9551 -9.9627 Td[(Figure)-281(12)-280(breaks)-281(do)25(wn)-280(the)-281(total)-280(e)15(x)15(ecution)-281(time)-280(into)-281(four)-280(acti)25(v-)]TJ -11.9551 -9.9626 Td[(ities:)-330(interpreting)-330(bytecodes)-330(while)-330(not)-330(recording,)-331(recording)-330(traces)]TJ 0 -9.9626 Td[(\050including)-394(time)-394(tak)10(en)-395(to)-394(interpret)-394(the)-394(recorded)-394(trace\051,)-395(compiling)]TJ 0 -9.9627 Td[(traces)-250(to)-250(nati)25(v)15(e)-250(code,)-250(and)-250(e)15(x)15(ecuting)-250(nati)25(v)15(e)-250(code)-250(traces.)]TJ 11.9551 -9.9626 Td[(These)-405(detailed)-404(metrics)-405(allo)25(w)-404(us)-405(to)-405(estimate)-404(parameters)-405(for)-404(a)]TJ -11.9551 -9.9627 Td[(simple)-358(model)-358(of)-359(tracing)-358(performance.)-358(These)-358(estimates)-358(should)-359(be)]TJ 0 -9.9626 Td[(considered)-395(v)15(ery)-395(rough,)-396(as)-395(the)-395(v)25(alues)-395(observ)15(ed)-395(on)-396(the)-395(indi)25(vidual)]TJ 0 -9.9626 Td[(benchmarks)-423(ha)20(v)15(e)-423(lar)18(ge)-423(standard)-423(de)25(viations)-423(\050on)-423(the)-423(order)-423(of)-423(the)]TJ ET BT /F42 8.9664 Tf 166.5633 713.0262 Td[(Loops)-1333(T)35(rees)-1334(T)35(races)-1333(Aborts)-1333(Flushes)-1334(T)35(re)1(es/Loop)-1334(T)35(races/T)35(ree)-1333(T)35(races/Loop)-1333(Speedup)]TJ ET 1 0 0 1 65.4416 709.6388 cm q []0 d 0 J 0.3985 w 0 0.1992 m 479.2339 0.1992 l S Q 1 0 0 1 -65.4416 -709.6388 cm BT /F42 8.9664 Tf 71.4192 702.665 Td[(3d-cube)-8890(25)-2519(27)-2964(29)-3555(3)-3889(0)-4659(1.1)-4788(1.1)-5102(1.2)-2527(2.20x)]TJ 0 -9.9626 Td[(3d-morph)-8667(5)-3019(8)-3464(8)-3555(2)-3889(0)-4659(1.6)-4788(1.0)-5102(1.6)-2527(2.86x)]TJ 0 -9.9627 Td[(3d-raytrace)-7558(10)-2519(25)-2464(100)-3055(10)-3889(1)-4659(2.5)-4788(4.0)-4602(10.0)-2527(1.18x)]TJ 0 -9.9626 Td[(access-binary-trees)-4948(0)-3019(0)-3464(0)-3555(5)-3889(0)-5576(-)-5705(-)-6019(-)-2527(0.93x)]TJ 0 -9.9626 Td[(access-f)10(annkuch)-5513(10)-2519(34)-2964(57)-3055(24)-3889(0)-4659(3.4)-4788(1.7)-5102(5.7)-2527(2.20x)]TJ 0 -9.9627 Td[(access-nbody)-7224(8)-2519(16)-2964(18)-3555(5)-3889(0)-4659(2.0)-4788(1.1)-5102(2.3)-2527(4.19x)]TJ 0 -9.9626 Td[(access-nsie)25(v)15(e)-7209(3)-3019(6)-3464(8)-3555(3)-3889(0)-4659(2.0)-4788(1.3)-5102(2.7)-2527(3.05x)]TJ 0 -9.9627 Td[(bitops-3bit-bits-in-byte)-3333(2)-3019(2)-3464(2)-3555(0)-3889(0)-4659(1.0)-4788(1.0)-5102(1.0)-2028(25.47x)]TJ 0 -9.9626 Td[(bitops-bits-in-byte)-5222(3)-3019(3)-3464(4)-3555(1)-3889(0)-4659(1.0)-4788(1.3)-5102(1.3)-2528(8.67x)]TJ 0 -9.9626 Td[(bitops-bitwise-and)-5167(1)-3019(1)-3464(1)-3555(0)-3889(0)-4659(1.0)-4788(1.0)-5102(1.0)-2028(25.20x)]TJ 0 -9.9627 Td[(bitops-nsie)25(v)15(e-bits)-5540(3)-3019(3)-3464(5)-3555(0)-3889(0)-4659(1.0)-4788(1.7)-5102(1.7)-2528(2.75x)]TJ 0 -9.9626 Td[(control\003o)25(w-recursi)25(v)15(e)-4067(0)-3019(0)-3464(0)-3555(1)-3889(0)-5576(-)-5705(-)-6019(-)-2528(0.98x)]TJ 0 -9.9627 Td[(crypto-aes)-7946(50)-2519(72)-2964(78)-3055(19)-3889(0)-4659(1.4)-4788(1.1)-5102(1.6)-2527(1.64x)]TJ 0 -9.9626 Td[(crypto-md5)-7945(4)-3019(4)-3464(5)-3555(0)-3889(0)-4659(1.0)-4788(1.3)-5102(1.3)-2527(2.30x)]TJ 0 -9.9626 Td[(crypto-sha1)-7890(5)-3019(5)-2964(10)-3555(0)-3889(0)-4659(1.0)-4788(2.0)-5102(2.0)-2527(5.95x)]TJ 0 -9.9627 Td[(date-format-tofte)-5780(3)-3019(3)-3464(4)-3555(7)-3889(0)-4659(1.0)-4788(1.3)-5102(1.3)-2527(1.07x)]TJ 0 -9.9626 Td[(date-format-xparb)-5336(3)-3019(3)-2964(11)-3555(3)-3889(0)-4659(1.0)-4788(3.7)-5102(3.7)-2527(0.98x)]TJ 0 -9.9627 Td[(math-cordic)-7779(2)-3019(4)-3464(5)-3555(1)-3889(0)-4659(2.0)-4788(1.3)-5102(2.5)-2527(4.92x)]TJ 0 -9.9626 Td[(math-partial-sums)-5334(2)-3019(4)-3464(4)-3555(1)-3889(0)-4659(2.0)-4788(1.0)-5102(2.0)-2528(5.90x)]TJ 0 -9.9626 Td[(math-spectral-norm)-4224(15)-2519(20)-2964(20)-3555(0)-3889(0)-4659(1.3)-4788(1.0)-5102(1.3)-2528(7.12x)]TJ 0 -9.9627 Td[(re)15(ge)15(xp-dna)-8143(2)-3019(2)-3464(2)-3555(0)-3889(0)-4659(1.0)-4788(1.0)-5102(1.0)-2527(4.21x)]TJ 0 -9.9626 Td[(string-base64)-7223(3)-3019(5)-3464(7)-3555(0)-3889(0)-4659(1.7)-4788(1.4)-5102(2.3)-2527(2.53x)]TJ 0 -9.9627 Td[(string-f)10(asta)-8122(5)-2519(11)-2964(15)-3555(6)-3889(0)-4659(2.2)-4788(1.4)-5102(3.0)-2527(1.49x)]TJ 0 -9.9626 Td[(string-tagcloud)-6556(3)-3019(6)-3464(6)-3555(5)-3889(0)-4659(2.0)-4788(1.0)-5102(2.0)-2527(1.09x)]TJ 0 -9.9626 Td[(string-unpack-code)-4891(4)-3019(4)-2964(37)-3555(0)-3889(0)-4659(1.0)-4788(9.3)-5102(9.3)-2527(1.20x)]TJ 0 -9.9627 Td[(string-v)25(alidate-input)-4470(6)-2519(10)-2964(13)-3555(1)-3889(0)-4659(1.7)-4788(1.3)-5102(2.2)-2528(1.86x)]TJ ET 1 0 0 1 54 439.3225 cm q []0 d 0 J 0.3288 w 0 0.1644 m 502.1171 0.1644 l S Q 1 0 0 1 -54 -439.3225 cm BT /F41 8.9664 Tf 161.4547 429.1597 Td[(Figur)18(e)-250(13.)]TJ/F42 8.9664 Tf 43.1729 0 Td[(Detailed)-250(trace)-250(recording)-250(statistics)-250(for)-250(the)-250(SunSpider)-250(benchmark)-250(set.)]TJ -150.6276 -29.8366 Td[(mean\051.)-315(W)80(e)-316(e)15(xclude)]TJ/F33 8.9664 Tf 72.6115 0 Td[(regexp-dna)]TJ/F42 8.9664 Tf 49.9011 0 Td[(from)-315(the)-316(follo)25(wing)-315(calculations,)]TJ -122.5126 -9.9626 Td[(because)-247(most)-246(of)-247(its)-246(time)-247(is)-247(spent)-246(in)-247(the)-247(r)1(e)15(gular)-247(e)15(xpression)-247(matcher)40(,)]TJ 0 -9.9626 Td[(which)-473(has)-473(much)-473(dif)25(ferent)-473(performance)-473(characteristics)-473(from)-473(the)]TJ 0 -9.9627 Td[(other)-351(programs.)-352(\050Note)-351(that)-351(this)-351(only)-352(mak)10(es)-351(a)-351(dif)25(ference)-351(of)-352(about)]TJ 0 -9.9626 Td[(10%)-286(in)-287(the)-286(results.\051)-286(Di)25(viding)-286(the)-287(total)-286(e)15(x)15(ecution)-286(time)-286(in)-287(processor)]TJ 0 -9.9627 Td[(clock)-461(c)15(ycles)-460(by)-461(the)-461(number)-460(of)-461(bytecodes)-461(e)15(x)15(ecuted)-460(in)-461(the)-461(base)]TJ 0 -9.9626 Td[(interpreter)-415(sho)25(ws)-415(that)-415(on)-415(a)20(v)15(erage,)-415(a)-415(bytecode)-416(e)15(x)15(ecute)1(s)-416(in)-415(about)]TJ 0 -9.9626 Td[(35)-344(c)15(ycles.)-344(Nati)25(v)15(e)-343(traces)-344(tak)10(e)-344(about)-344(9)-344(c)15(ycle)1(s)-344(per)-344(bytecode,)-344(a)-344(3.9x)]TJ 0 -9.9627 Td[(speedup)-250(o)15(v)15(er)-250(the)-250(interpreter)55(.)]TJ 11.9552 -9.9626 Td[(Using)-311(similar)-310(computations,)-311(we)-311(\002nd)-310(that)-311(trace)-311(recording)-310(tak)10(es)]TJ -11.9552 -9.9627 Td[(about)-316(3800)-315(c)15(ycles)-316(per)-316(bytecode,)-315(and)-316(compilation)-315(3150)-316(c)15(ycles)-316(per)]TJ 0 -9.9626 Td[(bytecode.)-309(Hence,)-309(during)-310(recording)-309(and)-309(compiling)-309(the)-309(VM)-309(runs)-310(at)]TJ 0 -9.9626 Td[(1/200)-302(the)-303(s)1(peed)-303(of)-302(the)-302(interpreter)55(.)-302(Because)-303(it)-302(costs)-302(6950)-302(c)15(ycles)-303(to)]TJ 0 -9.9627 Td[(compile)-303(a)-304(bytecode,)-303(and)-303(we)-304(sa)20(v)15(e)-303(26)-303(c)15(ycles)-303(each)-304(time)-303(that)-303(code)-304(is)]TJ 0 -9.9626 Td[(run)-250(nati)25(v)15(ely)65(,)-250(we)-250(break)-250(e)25(v)15(en)-250(after)-250(running)-250(a)-250(trace)-250(270)-250(times.)]TJ 11.9552 -9.9627 Td[(The)-317(other)-317(VMs)-317(we)-318(compared)-317(with)-317(achie)25(v)15(e)-317(an)-317(o)15(v)15(erall)-317(speedup)]TJ -11.9552 -9.9626 Td[(of)-398(3.0x)-399(relati)25(v)15(e)-398(to)-398(our)-399(baseline)-398(interpreter)55(.)-398(Our)-398(estimated)-399(nati)25(v)15(e)]TJ 0 -9.9626 Td[(code)-463(speedup)-463(of)-463(3.9x)-463(is)-463(signi\002cantly)-463(better)55(.)-464(This)-463(suggests)-463(that)]TJ 0 -9.9627 Td[(our)-238(compilation)-238(techniques)-238(can)-238(generate)-238(more)-239(ef)25(\002)1(cient)-239(nati)25(v)15(e)-238(code)]TJ 0 -9.9626 Td[(than)-250(an)15(y)-250(other)-250(current)-250(Ja)20(v)25(aScript)-250(VM.)]TJ 11.9552 -9.9627 Td[(These)-202(estimates)-202(also)-202(indicate)-202(that)-202(our)-202(startup)-202(performance)-202(could)]TJ -11.9552 -9.9626 Td[(be)-270(substantially)-270(better)-271(if)-270(we)-270(impro)15(v)15(ed)-271(the)-270(speed)-270(of)-270(trace)-271(recording)]TJ 0 -9.9626 Td[(and)-288(compilation.)-288(The)-288(estimated)-288(200x)-288(slo)25(wdo)25(wn)-288(for)-288(recording)-288(and)]TJ 0 -9.9627 Td[(compilation)-217(is)-216(v)14(e)1(ry)-217(rough,)-217(and)-217(may)-217(be)-216(in\003uenced)-217(by)-217(startup)-217(f)10(actors)]TJ 0 -9.9626 Td[(in)-285(the)-285(interpreter)-285(\050e.g.,)-285(caches)-285(that)-285(ha)20(v)15(e)-285(not)-285(w)10(armed)-285(up)-285(yet)-285(during)]TJ 0 -9.9627 Td[(recording\051.)-389(One)-389(observ)25(ation)-389(supporting)-389(this)-389(conjecture)-389(is)-389(that)-389(in)]TJ 0 -9.9626 Td[(the)-249(tracer)40(,)-248(interpreted)-249(bytecodes)-249(tak)10(e)-248(about)-249(180)-249(c)15(ycles)-248(to)-249(run.)-249(Still,)]TJ 0 -9.9626 Td[(recording)-282(and)-281(compilation)-282(are)-281(clearly)-282(both)-281(e)15(xpensi)25(v)15(e,)-282(and)-281(a)-282(better)]TJ 0 -9.9627 Td[(implementation,)-409(possibly)-409(including)-409(redesign)-409(of)-409(the)-409(LIR)-409(abstract)]TJ 0 -9.9626 Td[(syntax)-250(or)-250(encoding,)-250(w)10(ould)-250(impro)15(v)15(e)-250(startup)-250(performance.)]TJ 11.9552 -9.9627 Td[(Our)-302(performance)-302(results)-303(con\002rm)-302(that)-302(type)-302(specialization)-302(using)]TJ -11.9552 -9.9626 Td[(trace)-476(trees)-477(substantially)-476(impro)15(v)15(es)-477(performance.)-476(W)80(e)-477(are)-476(able)-477(to)]TJ 0 -9.9626 Td[(outperform)-326(the)-325(f)10(astest)-326(a)20(v)25(ailable)-326(Ja)20(v)25(aScript)-326(com)1(piler)-326(\050V8\051)-326(and)-326(the)]TJ 263.0137 318.8045 Td[(f)10(astest)-319(a)20(v)25(ailable)-318(Ja)20(v)25(aScript)-319(inline)-319(threaded)-319(interpret)1(er)-319(\050SFX\051)-319(on)-319(9)]TJ 0 -9.9627 Td[(of)-250(26)-250(benchmarks.)]TJ/F41 10.9589 Tf 0 -37.9782 Td[(8.)-1000(Related)-250(W)75(ork)]TJ/F41 8.9664 Tf 0 -13.9477 Td[(T)74(race)-336(optimization)-335(f)25(or)-336(dynamic)-336(languages.)]TJ/F42 8.9664 Tf 169.3258 0 Td[(The)-336(closest)-335(area)-336(of)]TJ -169.3258 -9.9626 Td[(related)-370(w)10(ork)-370(is)-370(on)-369(applying)-370(trace)-370(optimization)-370(to)-370(type-specialize)]TJ 0 -9.9627 Td[(dynamic)-394(languages.)-394(Existing)-395(w)10(ork)-394(shares)-394(the)-394(idea)-394(of)-395(generating)]TJ 0 -9.9626 Td[(type-specialized)-369(code)-369(speculat)1(i)25(v)15(ely)-369(with)-369(guards)-369(along)-369(interpreter)]TJ 0 -9.9627 Td[(traces.)]TJ 11.9552 -9.9626 Td[(T)80(o)-459(our)-460(kno)25(wledge,)-459(Rigo')55(s)-459(Psyco)-459(\05016\051)-460(is)-459(the)-459(only)-459(published)]TJ -11.9552 -9.9626 Td[(type-specializing)-275(trace)-274(compiler)-275(for)-275(a)-274(dynamic)-275(language)-275(\050Python\051.)]TJ 0 -9.9627 Td[(Psyco)-210(does)-209(not)-210(attempt)-209(to)-210(identify)-210(hot)-209(loops)-210(or)-210(inl)1(ine)-210(function)-210(calls.)]TJ 0 -9.9626 Td[(Instead,)-219(Psyco)-219(transforms)-220(loops)-219(to)-219(mutual)-219(recursion)-219(before)-220(running)]TJ 0 -9.9627 Td[(and)-250(traces)-250(all)-250(operations.)]TJ 11.9552 -9.9626 Td[(P)15(all')55(s)-258(LuaJIT)-258(is)-258(a)-257(Lua)-258(VM)-258(in)-258(de)25(v)15(elopment)-258(that)-258(uses)-258(tra)1(ce)-258(com-)]TJ -11.9552 -9.9626 Td[(pilation)-230(ideas.)-229(\0501\051.)-230(There)-229(are)-230(no)-230(publications)-229(on)-230(LuaJIT)-229(b)20(ut)-230(the)-230(cre-)]TJ 0 -9.9627 Td[(ator)-260(has)-260(told)-261(us)-260(that)-260(LuaJIT)-260(has)-260(a)-261(similar)-260(design)-260(to)-260(our)-260(system,)-261(b)20(ut)]TJ 0 -9.9626 Td[(will)-335(use)-335(a)-335(less)-334(aggressi)25(v)15(e)-335(type)-335(speculation)-335(\050e.g.,)-335(using)-335(a)-335(\003oating-)]TJ 0 -9.9627 Td[(point)-324(representation)-325(for)-324(all)-325(number)-324(v)25(alues\051)-324(and)-325(does)-324(not)-325(generate)]TJ 0 -9.9626 Td[(nested)-250(traces)-250(for)-250(nested)-250(loops.)]TJ/F41 8.9664 Tf 11.9552 -9.9626 Td[(General)-431(trace)-432(optimization.)]TJ/F42 8.9664 Tf 112.4579 0 Td[(General)-431(trace)-432(optimization)-431(has)]TJ -124.4131 -9.9627 Td[(a)-465(longer)-466(history)-465(that)-466(has)-465(treated)-466(mostly)-465(nati)25(v)15(e)-466(code)-465(and)-466(typed)]TJ 0 -9.9626 Td[(languages)-254(lik)10(e)-254(Ja)20(v)25(a.)-254(Thus,)-253(these)-254(systems)-254(ha)20(v)15(e)-254(focused)-254(less)-254(on)-254(type)]TJ 0 -9.9627 Td[(specialization)-250(and)-250(more)-250(on)-250(other)-250(optimizations.)]TJ 11.9552 -9.9626 Td[(Dynamo)-325(\0507\051)-325(by)-325(Bala)-324(et)-325(al,)-325(introduced)-325(nati)25(v)15(e)-325(code)-325(tracing)-324(as)-325(a)]TJ -11.9552 -9.9626 Td[(replacement)-314(for)-314(pro\002le-guided)-314(optimization)-314(\050PGO\051.)-314(A)-315(major)-314(goal)]TJ 0 -9.9627 Td[(w)10(as)-457(to)-456(perform)-457(PGO)-456(online)-457(so)-457(that)-456(the)-457(pro\002le)-456(w)10(as)-457(speci\002c)-457(to)]TJ 0 -9.9626 Td[(the)-273(current)-272(e)15(x)15(ecution.)-273(Dynamo)-272(used)-273(loop)-272(headers)-273(as)-272(candidate)-273(hot)]TJ 0 -9.9627 Td[(traces,)-250(b)20(ut)-250(did)-250(not)-250(try)-250(to)-250(create)-250(loop)-250(traces)-250(speci\002cally)65(.)]TJ 11.9552 -9.9626 Td[(T)35(race)-355(trees)-354(were)-355(originally)-355(proposed)-355(by)-355(Gal)-354(et)-355(al.)-355(\05011\051)-355(in)-354(the)]TJ -11.9552 -9.9626 Td[(conte)15(xt)-357(of)-357(Ja)20(v)25(a,)-356(a)-357(statically)-357(typed)-357(language.)-356(Their)-357(trace)-357(trees)-357(ac-)]TJ 0 -9.9627 Td[(tually)-311(inlined)-312(parts)-311(of)-311(outer)-312(loops)-311(within)-312(the)-311(inner)-311(loops)-312(\050because)]TJ ET 1 0 0 1 54 505.7593 cm q .55 0 0 .55 0 0 cm q 1 0 0 1 -55.1171 -331.3474 cm /Im8 Do Q Q 1 0 0 1 0 -11.2877 cm q []0 d 0 J 0.3288 w 0 0.1644 m 239.1034 0.1644 l S Q 1 0 0 1 -54 -494.4716 cm BT /F41 8.9664 Tf 54 484.3088 Td[(Figur)18(e)-281(12.)-500(Fraction)-282(of)-281(time)-282(spent)-281(on)-281(major)-282(VM)-281(acti)10(vities.)]TJ/F42 8.9664 Tf 225.1607 0 Td[(The)]TJ -225.1607 -9.9627 Td[(speedup)-343(vs.)-344(interpreter)-343(is)-343(sho)25(wn)-344(in)-343(parentheses)-344(ne)15(xt)-343(to)-343(each)-344(test.)]TJ 0 -9.9626 Td[(Most)-273(programs)-273(where)-273(the)-273(VM)-273(spends)-273(the)-273(majority)-273(of)-273(its)-273(time)-273(run-)]TJ 0 -9.9627 Td[(ning)-265(nati)25(v)15(e)-265(code)-265(ha)20(v)15(e)-265(a)-265(good)-265(speedup.)-265(Recording)-265(and)-265(compilation)]TJ 0 -9.9626 Td[(costs)-278(can)-278(be)-278(substantial;)-278(speeding)-278(up)-278(those)-278(parts)-279(of)-278(the)-278(implemen-)]TJ 0 -9.9627 Td[(tation)-250(w)10(ould)-250(impro)15(v)15(e)-250(SunSpider)-250(performance.)]TJ 0 -47.2477 Td[(inner)-264(loops)-265(become)-264(hot)-264(\002rst\051,)-264(leading)-265(to)-264(much)-264(greater)-264(tail)-265(duplica-)]TJ 0 -9.9627 Td[(tion.)]TJ 11.9552 -9.9626 Td[(YETI,)-396(from)-397(Zaleski)-396(et)-397(al.)-396(\05019\051)-397(applied)-396(Dynamo-style)-396(tracing)]TJ -11.9552 -9.9626 Td[(to)-466(Ja)20(v)25(a)-467(in)-466(order)-467(to)-466(achie)25(v)15(e)-467(inli)1(ning,)-467(indirect)-466(jump)-467(elimination,)]TJ 0 -9.9627 Td[(and)-289(other)-288(optimizations.)-289(Their)-288(primary)-289(focus)-288(w)10(as)-289(on)-288(designing)-289(an)]TJ 0 -9.9626 Td[(interpreter)-242(that)-241(could)-242(easily)-242(be)-241(gradually)-242(re-engineered)-241(as)-242(a)-242(tracing)]TJ 0 -9.9627 Td[(VM.)]TJ 11.9552 -9.9626 Td[(Sug)5(anuma)-190(et)-190(al.)-190(\05018\051)-190(described)-190(re)15(gion-based)-190(compilation)-190(\050RBC\051,)]TJ -11.9552 -9.9626 Td[(a)-310(relati)25(v)15(e)-309(of)-310(tracing.)-310(A)-309(re)15(gion)-310(is)-310(an)-309(subprogram)-310(w)10(orth)-310(optimizing)]TJ 0 -9.9627 Td[(that)-239(can)-239(include)-239(subsets)-239(of)-239(an)15(y)-239(number)-239(of)-239(methods.)-240(Thus,)-239(the)-239(com-)]TJ 0 -9.9626 Td[(piler)-295(has)-296(more)-295(\003e)15(xibility)-296(and)-295(can)-295(potentially)-296(generate)-295(better)-296(code,)]TJ 0 -9.9627 Td[(b)20(ut)-197(the)-197(pro\002ling)-198(and)-197(compilation)-197(systems)-197(are)-197(correspondingly)-198(more)]TJ 0 -9.9626 Td[(comple)15(x.)]TJ/F41 8.9664 Tf 11.9552 -9.9626 Td[(T)74(ype)-475(specialization)-475(f)25(or)-475(dynamic)-475(languages.)]TJ/F42 8.9664 Tf 176.0768 0 Td[(Dynamic)-475(lan-)]TJ -188.032 -9.9627 Td[(guage)-311(implementors)-310(ha)20(v)15(e)-311(long)-310(recognized)-311(the)-311(im)1(portance)-311(of)-311(type)]TJ 0 -9.9626 Td[(specialization)-217(for)-217(performance.)-217(Most)-217(pre)25(vious)-217(w)10(ork)-217(has)-217(focused)-217(on)]TJ 0 -9.9627 Td[(methods)-250(instead)-250(of)-250(traces.)]TJ 11.9552 -9.9626 Td[(Chambers)-374(et.)-374(al)-373(\0509\051)-374(pioneered)-374(the)-374(idea)-374(of)-374(compiling)-373(multiple)]TJ -11.9552 -9.9626 Td[(v)15(ersions)-320(of)-320(a)-320(procedure)-320(specialized)-320(for)-320(the)-320(input)-320(types)-321(in)-320(the)-320(lan-)]TJ 0 -9.9627 Td[(guage)-391(Self.)-392(In)-391(one)-392(implementation,)-391(the)15(y)-392(generated)-391(a)-392(specialized)]TJ 0 -9.9626 Td[(method)-213(online)-213(each)-213(time)-213(a)-213(method)-213(w)10(as)-213(called)-213(with)-214(ne)25(w)-213(input)-213(types.)]TJ 0 -9.9627 Td[(In)-364(another)40(,)-365(the)15(y)-364(used)-364(an)-365(of)25(\003ine)-364(whole-program)-364(static)-364(analysis)-365(to)]TJ 0 -9.9626 Td[(infer)-302(input)-302(types)-301(and)-302(constant)-302(recei)25(v)15(er)-302(types)-301(at)-302(call)-302(sites.)-302(Interest-)]TJ 0 -9.9626 Td[(ingly)65(,)-250(the)-250(tw)10(o)-250(techniques)-250(produced)-250(nearly)-250(the)-250(same)-250(performance.)]TJ 11.9552 -9.9627 Td[(Salib)-223(\05017\051)-222(designed)-223(a)-223(type)-223(inference)-222(algorithm)-223(for)-223(Python)-222(based)]TJ -11.9552 -9.9626 Td[(on)-239(the)-239(Cartesian)-240(Produc)1(t)-240(Algorithm)-239(and)-239(used)-239(the)-239(results)-240(to)-239(special-)]TJ 0 -9.9627 Td[(ize)-250(on)-250(types)-250(and)-250(translate)-250(the)-250(program)-250(to)-250(C++.)]TJ 11.9552 -9.9626 Td[(McClosk)10(e)15(y)-430(\05014\051)-431(has)-430(w)10(ork)-430(in)-431(progress)-430(based)-431(on)-430(a)-430(language-)]TJ -11.9552 -9.9626 Td[(independent)-473(t)1(ype)-473(inference)-473(that)-472(is)-473(used)-472(to)-473(generate)-472(ef)25(\002cient)-473(C)]TJ 0 -9.9627 Td[(implementations)-250(of)-250(Ja)20(v)25(aScript)-250(and)-250(Python)-250(programs.)]TJ/F41 8.9664 Tf 11.9552 -9.9626 Td[(Nati)10(v)10(e)-268(code)-269(generation)-268(by)-268(inter)10(pr)18(eters.)]TJ/F42 8.9664 Tf 152.2911 0 Td[(The)-268(traditional)-269(inter)20(-)]TJ -164.2463 -9.9627 Td[(preter)-353(design)-354(is)-353(a)-354(virtual)-353(machine)-354(that)-353(directly)-354(e)15(x)15(ecutes)-353(ASTs)-354(or)]TJ 0 -9.9626 Td[(machine-code-lik)10(e)-209(bytecodes.)-209(Researchers)-209(ha)20(v)15(e)-209(sho)25(wn)-209(ho)25(w)-210(to)-209(gen-)]TJ 263.0137 643.5866 Td[(erate)-309(nati)25(v)15(e)-309(code)-308(with)-309(nearly)-309(the)-309(same)-308(structure)-309(b)20(ut)-309(better)-309(perfor)20(-)]TJ 0 -9.9627 Td[(mance.)]TJ 11.9552 -9.9626 Td[(Call)-346(threading,)-345(also)-346(kno)25(wn)-346(as)-345(conte)15(xt)-346(threading)-346(\0508\051,)-345(compiles)]TJ -11.9552 -9.9627 Td[(methods)-400(by)-400(generating)-400(a)-400(nati)25(v)15(e)-400(call)-400(instruction)-400(to)-400(an)-400(interpreter)]TJ 0 -9.9626 Td[(method)-331(for)-331(each)-332(interpreter)-331(bytecode.)-331(A)-331(call-return)-331(pair)-331(has)-332(been)]TJ 0 -9.9627 Td[(sho)25(wn)-247(to)-246(be)-247(a)-247(potentially)-246(much)-247(more)-247(e)1(f)25(\002cient)-247(dispatch)-247(mechanism)]TJ 0 -9.9626 Td[(than)-250(the)-250(indirect)-250(jumps)-250(used)-250(in)-250(standard)-250(bytecode)-250(interpreters.)]TJ 11.9552 -9.9626 Td[(Inline)-360(threading)-360(\05015\051)-360(copies)-360(chunks)-360(of)-360(interpre)1(ter)-360(nati)25(v)15(e)-360(code)]TJ -11.9552 -9.9627 Td[(which)-286(implement)-286(the)-286(required)-286(bytecodes)-286(into)-286(a)-286(nati)25(v)15(e)-286(code)-286(cache,)]TJ 0 -9.9626 Td[(thus)-230(acting)-230(as)-230(a)-230(simple)-230(per)20(-method)-230(JIT)-231(compi)1(ler)-231(that)-230(eliminates)-230(the)]TJ 0 -9.9627 Td[(dispatch)-250(o)15(v)15(erhead.)]TJ 11.9552 -9.9626 Td[(Neither)-209(call)-209(threading)-209(nor)-209(inline)-209(threading)-209(perform)-209(type)-209(special-)]TJ -11.9552 -9.9626 Td[(ization.)]TJ 11.9552 -9.9627 Td[(Apple')55(s)-348(SquirrelFish)-348(Extreme)-348(\0505\051)-348(is)-348(a)-348(Ja)20(v)25(aScript)-348(implementa-)]TJ -11.9552 -9.9626 Td[(tion)-310(based)-311(on)-310(call)-310(threading)-311(with)-310(selecti)25(v)15(e)-310(inline)-310(threading.)-311(Com-)]TJ 0 -9.9627 Td[(bined)-350(with)-349(ef)25(\002cient)-350(interpreter)-350(engineering,)-349(these)-350(threading)-350(tech-)]TJ 0 -9.9626 Td[(niques)-227(ha)20(v)15(e)-226(gi)25(v)15(en)-227(SFX)-227(e)15(xcellent)-226(performance)-227(on)-226(the)-227(standard)-227(Sun-)]TJ 0 -9.9626 Td[(Spider)-250(benchmarks.)]TJ 11.9552 -9.9627 Td[(Google')55(s)-427(V8)-428(is)-427(a)-427(Ja)20(v)25(aScript)-428(implementation)-427(primarily)-427(based)]TJ -11.9552 -9.9626 Td[(on)-470(inline)-469(threading,)-470(with)-470(call)-470(threading)-469(only)-470(for)-470(v)15(ery)-470(comple)15(x)]TJ 0 -9.9627 Td[(operations.)]TJ/F41 10.9589 Tf 0 -21.2536 Td[(9.)-1000(Conclusions)]TJ/F42 8.9664 Tf 0 -13.9477 Td[(This)-284(paper)-284(described)-284(ho)25(w)-283(to)-284(run)-284(dynamic)-284(languages)-284(ef)25(\002ciently)-284(by)]TJ 0 -9.9626 Td[(recording)-360(hot)-360(traces)-360(and)-360(generating)-360(type-specialized)-360(nati)25(v)15(e)-360(code.)]TJ 0 -9.9627 Td[(Our)-292(technique)-292(focuses)-292(on)-292(aggressi)25(v)15(ely)-292(inlined)-292(loops,)-292(and)-293(for)-292(each)]TJ 0 -9.9626 Td[(loop,)-474(it)-474(generates)-474(a)-475(tree)-474(of)-474(nati)25(v)15(e)-474(code)-474(traces)-475(represe)1(nting)-475(the)]TJ 0 -9.9627 Td[(paths)-342(and)-342(v)25(alue)-342(types)-342(through)-342(the)-342(loop)-342(observ)15(ed)-342(at)-343(run)-342(time.)-342(W)80(e)]TJ 0 -9.9626 Td[(e)15(xplained)-325(ho)25(w)-325(to)-325(identify)-324(loop)-325(nesting)-325(relationships)-325(and)-325(generate)]TJ 0 -9.9626 Td[(nested)-480(traces)-481(in)-480(order)-480(to)-480(a)20(v)20(oid)-481(e)15(xcessi)25(v)15(e)-480(code)-480(duplication)-481(due)]TJ 0 -9.9627 Td[(to)-451(the)-451(man)15(y)-451(paths)-451(through)-450(a)-451(loop)-451(nest.)-451(W)80(e)-451(described)-451(our)-451(type)]TJ 0 -9.9626 Td[(specialization)-462(algorithm.)-463(W)80(e)-462(also)-463(des)1(cribed)-463(our)-462(trace)-463(compiler)40(,)]TJ 0 -9.9627 Td[(which)-466(translates)-466(a)-466(trace)-466(from)-466(an)-467(intermediate)-466(representation)-466(to)]TJ 0 -9.9626 Td[(optimized)-250(nati)25(v)15(e)-250(code)-250(in)-250(tw)10(o)-250(linear)-250(passes.)]TJ 11.9552 -9.9626 Td[(Our)-346(e)15(xperimental)-345(results)-346(sho)25(w)-346(that)-345(in)-346(practice)-346(loops)-345(typically)]TJ -11.9552 -9.9627 Td[(are)-314(entered)-313(with)-314(only)-314(a)-313(fe)25(w)-314(dif)25(ferent)-314(combinations)-313(of)-314(v)25(alue)-314(types)]TJ 0 -9.9626 Td[(of)-318(v)25(ariables.)-318(Thus,)-318(a)-318(small)-318(number)-318(of)-318(traces)-318(per)-319(loop)-318(is)-318(suf)25(\002cient)]TJ 0 -9.9627 Td[(to)-388(run)-389(a)-388(program)-389(ef)25(\002)1(ciently)65(.)-389(Our)-388(e)15(xperiments)-389(also)-388(sho)25(w)-388(that)-389(on)]TJ 0 -9.9626 Td[(programs)-250(amenable)-250(to)-250(tracing,)-250(we)-250(achie)25(v)15(e)-250(speedups)-250(of)-250(2x)-250(to)-250(20x.)]TJ/F41 10.9589 Tf 0 -21.2536 Td[(10.)-1000(Futur)18(e)-250(W)75(ork)]TJ/F42 8.9664 Tf 0 -13.9477 Td[(W)80(ork)-426(is)-425(underw)10(ay)-426(in)-425(a)-426(number)-426(of)-425(areas)-426(to)-425(further)-426(impro)15(v)15(e)-426(the)]TJ 0 -9.9627 Td[(performance)-301(of)-301(our)-300(trace-based)-301(Ja)20(v)25(aScript)-301(compiler)55(.)-301(W)80(e)-301(currently)]TJ 0 -9.9626 Td[(do)-407(not)-408(trace)-407(across)-408(recursi)25(v)15(e)-407(function)-408(call)1(s,)-408(b)20(ut)-407(plan)-408(to)-407(add)-408(the)]TJ 0 -9.9626 Td[(support)-305(for)-304(this)-305(capabilit)1(y)-305(in)-305(the)-304(near)-305(term.)-304(W)80(e)-305(are)-304(also)-305(e)15(xploring)]TJ 0 -9.9627 Td[(adoption)-293(of)-293(the)-294(e)15(xist)1(ing)-294(w)10(ork)-293(on)-293(tree)-293(recompilation)-293(in)-294(the)-293(conte)15(xt)]TJ 0 -9.9626 Td[(of)-273(the)-272(presented)-273(dynamic)-273(compiler)-272(in)-273(order)-273(to)-272(minimize)-273(JIT)-273(pause)]TJ 0 -9.9627 Td[(times)-268(and)-268(obtain)-268(the)-268(best)-268(of)-268(both)-268(w)10(orlds,)-268(f)10(ast)-269(tree)-268(stitching)-268(as)-268(well)]TJ 0 -9.9626 Td[(as)-250(the)-250(impro)15(v)15(ed)-250(code)-250(quality)-250(due)-250(to)-250(tree)-250(recompilation.)]TJ 11.9552 -9.9626 Td[(W)80(e)-345(also)-345(plan)-345(on)-345(adding)-345(support)-345(for)-345(tracing)-344(across)-345(re)15(gular)-345(e)15(x-)]TJ -11.9552 -9.9627 Td[(pression)-440(substitutions)-440(using)-440(lambda)-440(functions,)-440(function)-440(applica-)]TJ 0 -9.9626 Td[(tions)-430(and)-430(e)15(xpression)-430(e)25(v)25(aluation)-430(using)]TJ/F33 8.9664 Tf 144.2134 0 Td[(eval)]TJ/F42 8.9664 Tf 18.8292 0 Td[(.)-430(All)-430(these)-430(language)]TJ -163.0426 -9.9627 Td[(constructs)-382(are)-382(currently)-382(e)15(x)15(ecuted)-382(via)-382(interpretation,)-382(which)-382(limits)]TJ 0 -9.9626 Td[(our)-250(performance)-250(for)-250(applications)-250(that)-250(use)-250(those)-250(features.)]TJ/F41 10.9589 Tf 0 -21.2536 Td[(Ackno)10(wledgments)]TJ/F42 8.9664 Tf 0 -13.9477 Td[(P)15(arts)-364(of)-363(this)-364(ef)25(fort)-363(ha)20(v)15(e)-364(been)-363(sponsored)-364(by)-364(the)-363(National)-364(Science)]TJ 0 -9.9626 Td[(F)15(oundation)-229(under)-228(grants)-229(CNS-0615443)-228(and)-229(CNS-0627747,)-228(as)-229(well)]TJ 0 -9.9627 Td[(as)-332(by)-332(the)-331(California)-332(MICR)40(O)-332(Program)-331(and)-332(industrial)-332(sponsor)-332(Sun)]TJ 0 -9.9626 Td[(Microsystems)-250(under)-250(Project)-250(No.)-250(07-127.)]TJ 11.9552 -9.9627 Td[(The)-271(U.S.)-270(Go)15(v)15(ernment)-271(is)-271(authorized)-270(to)-271(reproduce)-271(and)-270(distrib)20(ute)]TJ -11.9552 -9.9626 Td[(reprints)-250(for)-251(Go)15(v)15(ernmental)-250(purposes)-251(notwithstanding)-250(an)15(y)-251(cop)10(yright)]TJ 0 -9.9626 Td[(annotation)-221(thereon.)-221(An)15(y)-221(opinions,)-221(\002ndings,)-221(and)-221(conclusions)-221(or)-221(rec-)]TJ 0 -9.9627 Td[(ommendations)-342(e)15(xpressed)-341(here)-342(are)-342(those)-342(of)-341(the)-342(author)-342(and)-342(should)]TJ ET BT /F42 8.9664 Tf 54 712.0299 Td[(not)-413(be)-413(interpreted)-414(as)-413(necessarily)-413(representing)-413(the)-413(of)25(\002cial)-414(vie)25(ws,)]TJ 0 -9.9627 Td[(policies)-342(or)-341(endorsements,)-342(either)-342(e)15(xpressed)-342(or)-341(implied,)-342(of)-342(the)-342(Na-)]TJ 0 -9.9626 Td[(tional)-202(Science)-202(foundation)-202(\050NSF\051,)-203(an)15(y)-202(other)-202(agenc)15(y)-202(of)-202(the)-202(U.S.)-203(Go)15(v-)]TJ 0 -9.9626 Td[(ernment,)-250(or)-250(an)15(y)-250(of)-250(the)-250(companies)-250(mentioned)-250(abo)15(v)15(e.)]TJ/F41 10.9589 Tf 0 -20.9216 Td[(Refer)18(ences)]TJ/F42 7.9701 Tf 3.9851 -12.9514 Td[([1])-437(LuaJIT)-1250(roadmap)-1250(2008)-1250(-)-1250(http://lua-users.or)18(g/lists/lua-l/2008-)]TJ 12.78 -8.9664 Td[(02/msg00051.html.)]TJ -12.78 -11.7061 Td[([2])-437(Mozilla)-529(\227)-529(Firefox)-529(web)-529(bro)25(wser)-529(and)-529(Thunderbird)-528(email)-529(client)-529(-)]TJ 12.78 -8.9664 Td[(http://www)65(.mozilla.com.)]TJ -12.78 -11.7061 Td[([3])-437(SPECJVM98)-250(-)-250(http://www)65(.spec.or)18(g/jvm98/.)]TJ 0 -11.7061 Td[([4])-437(SpiderMonk)10(e)15(y)-4343(\050Ja)20(v)25(aScript-C\051)-4339(Engine)-4343(-)]TJ 12.78 -8.9664 Td[(http://www)65(.mozilla.or)18(g/js/spidermonk)10(e)15(y/.)]TJ -12.78 -11.7061 Td[([5])-437(Sur\002n')-371(Saf)10(ari)-371(-)-371(Blog)-371(Archi)25(v)15(e)-371(-)-371(Announcing)-371(SquirrelFish)-371(Extreme)-371(-)]TJ 12.78 -8.9664 Td[(http://webkit.or)18(g/blog/214/introducing-squirrel\002sh-e)15(xtreme/.)]TJ -12.78 -11.7061 Td[([6])-437(A.)-404(Aho,)-403(R.)-403(Sethi,)-403(J.)-404(Ullman,)-403(and)-403(M.)-403(Lam.)-851(Compilers:)-403(Principles,)]TJ 12.78 -8.9664 Td[(techniques,)-250(and)-250(tools,)-250(2006.)]TJ -12.78 -11.7061 Td[([7])-437(V)128(.)-400(Bala,)-400(E.)-400(Duesterw)10(ald,)-400(and)-400(S.)-400(Banerjia.)-840(Dynamo:)-400(A)-400(transparent)]TJ 12.78 -8.9664 Td[(dynamic)-288(optimization)-289(system)1(.)-483(In)]TJ/F46 7.9701 Tf 109.2574 0 Td[(Pr)45(oceedings)-288(of)-289(the)-288(A)30(CM)-288(SIGPLAN)]TJ -109.2574 -8.9664 Td[(Confer)37(ence)-324(on)-324(Pr)45(o)10(gr)15(amming)-323(Langua)10(g)10(e)-324(Design)-324(and)-324(Implementation)]TJ/F42 7.9701 Tf 220.3458 0 Td[(,)]TJ -220.3458 -8.9663 Td[(pages)-250(1\22612.)-250(A)40(CM)-250(Press,)-250(2000.)]TJ -12.78 -11.7061 Td[([8])-437(M.)-282(Berndl,)-282(B.)-282(V)60(itale,)-282(M.)-282(Zaleski,)-282(and)-281(A.)-282(Bro)25(wn.)-462(Conte)15(xt)-282(Threading:)]TJ 12.78 -8.9664 Td[(a)-335(Fle)15(xible)-335(and)-336(Ef)25(\002cient)-335(Dispatch)-335(T)70(echnique)-335(for)-335(V)60(irtual)-335(Machine)-336(In-)]TJ 0 -8.9664 Td[(terpreters.)-577(In)]TJ/F46 7.9701 Tf 45.8616 0 Td[(Code)-318(Gener)15(ation)-318(and)-318(Optimization,)-318(2005.)-317(CGO)-318(2005.)]TJ -45.8616 -8.9664 Td[(International)-250(Symposium)-250(on)]TJ/F42 7.9701 Tf 90.3246 0 Td[(,)-250(pages)-250(15\22626,)-250(2005.)]TJ -103.1046 -11.7061 Td[([9])-437(C.)-415(Chambers)-415(and)-414(D.)-415(Ung)5(ar)55(.)-886(Customization:)-415(Optimizing)-414(Compiler)]TJ 12.78 -8.9664 Td[(T)70(echnology)-412(for)-411(SELF)80(,)-412(a)-412(Dynamically-T)80(yped)-411(O)-412(bject-Oriented)-412(Pro-)]TJ 0 -8.9664 Td[(gramming)-408(Language.)-867(In)]TJ/F46 7.9701 Tf 86.2388 0 Td[(Pr)45(oceedings)-408(of)-409(the)-408(A)30(CM)-408(SIGPLAN)-408(1989)]TJ -86.2388 -8.9663 Td[(Confer)37(ence)-324(on)-324(Pr)45(o)10(gr)15(amming)-323(Langua)10(g)10(e)-324(Design)-324(and)-324(Implementation)]TJ/F42 7.9701 Tf 220.3458 0 Td[(,)]TJ -220.3458 -8.9664 Td[(pages)-250(146\226160.)-250(A)40(CM)-250(Ne)25(w)-250(Y)110(ork,)-250(NY)129(,)-250(USA,)-250(1989.)]TJ 246.2486 291.9053 Td[([10])-438(A)1(.)-317(Gal.)]TJ/F46 7.9701 Tf 45.089 0 Td[(Ef)18(\002cient)-316(Bytecode)-316(V)111(eri\002cation)-316(and)-316(Compilation)-317(in)-316(a)-316(V)74(irtual)]TJ -28.3239 -8.9663 Td[(Mac)15(hine)-345(Dissertation)]TJ/F42 7.9701 Tf 69.9272 0 Td[(.)-663(PhD)-345(thesis,)-345(Uni)25(v)15(ersity)-344(Of)-345(California,)-345(Irvine,)]TJ -69.9272 -8.9664 Td[(2006.)]TJ -16.7651 -11.9552 Td[([11])-437(A.)-352(Gal,)-351(C.)-351(W)92(.)-352(Probst,)-351(and)-351(M.)-351(Franz.)-684(HotpathVM:)-352(An)-351(ef)25(fecti)25(v)15(e)-351(JIT)]TJ 16.7651 -8.9664 Td[(compiler)-465(for)-464(resource-constrained)-465(de)25(vices.)-1047(In)]TJ/F46 7.9701 Tf 159.5081 0 Td[(Pr)45(oceedings)-465(of)-464(the)]TJ -159.5081 -8.9663 Td[(International)-382(Confer)37(ence)-381(on)-382(V)74(irtual)-381(Execution)-382(En)40(vir)45(onments)]TJ/F42 7.9701 Tf 199.1564 0 Td[(,)-382(pages)]TJ -199.1564 -8.9664 Td[(144\226153.)-250(A)40(CM)-250(Press,)-250(2006.)]TJ -16.7651 -11.9552 Td[([12])-437(C.)-336(Garrett,)-336(J.)-335(Dean,)-336(D.)-336(Gro)15(v)15(e,)-335(and)-336(C.)-335(Chambers.)-634(Measurement)-336(and)]TJ 16.7651 -8.9664 Td[(Application)-250(of)-250(Dynamic)-250(Recei)25(v)15(er)-250(Class)-250(Distrib)20(utions.)-360(1994.)]TJ -16.7651 -11.9551 Td[([13])-437(J.)-292(Ha,)-292(M.)-291(R.)-292(Haghighat,)-292(S.)-291(Cong,)-292(and)-292(K.)-291(S.)-292(McKinle)15(y)65(.)-493(A)-292(concurrent)]TJ 16.7651 -8.9664 Td[(trace-based)-399(just-in-time)-400(compiler)-399(for)-400(ja)20(v)25(ascript.)-838(Dept.of)-400(Computer)]TJ 0 -8.9664 Td[(Sciences,)-250(The)-250(Uni)25(v)15(ersity)-250(of)-250(T)70(e)15(xas)-250(at)-250(Austin,)-250(TR-09-06,)-250(2009.)]TJ -16.7651 -11.9552 Td[([14])-437(B.)-250(McClosk)10(e)15(y)65(.)-360(Personal)-250(communication.)]TJ 0 -11.9551 Td[([15])-437(I.)-232(Piumarta)-231(and)-231(F)80(.)-231(Riccardi.)-319(Optimizing)-231(direct)-231(threaded)-231(code)-231(by)-231(selec-)]TJ 16.7651 -8.9664 Td[(ti)25(v)15(e)-294(inlining.)-502(In)]TJ/F46 7.9701 Tf 53.7632 0 Td[(Pr)45(oceedings)-294(of)-295(the)-294(A)30(CM)-294(SIGPLAN)-295(1998)-294(confer)37(ence)]TJ -53.7632 -8.9664 Td[(on)-399(Pr)45(o)10(gr)15(amming)-399(langua)10(g)10(e)-399(design)-399(and)-399(implementation)]TJ/F42 7.9701 Tf 179.8961 0 Td[(,)-399(pages)-399(291\226)]TJ -179.8961 -8.9664 Td[(300.)-250(A)40(CM)-250(Ne)25(w)-250(Y)110(ork,)-250(NY)129(,)-250(USA,)-250(1998.)]TJ -16.7651 -11.9551 Td[([16])-437(A.)-394(Rigo.)-820(Representation-Based)-394(Just-In-time)-394(Specialization)-393(and)-394(the)]TJ 16.7651 -8.9664 Td[(Psyco)-250(Prototype)-250(for)-250(Python.)-360(In)]TJ/F46 7.9701 Tf 101.3871 0 Td[(PEPM)]TJ/F42 7.9701 Tf 21.2483 0 Td[(,)-250(2004.)]TJ -139.4005 -11.9552 Td[([17])-438(M)1(.)-488(Salib)40(.)-1120(Starkiller:)-488(A)-487(Static)-488(T)80(ype)-487(Inferencer)-488(and)-488(C)1(ompiler)-488(for)]TJ 16.7651 -8.9663 Td[(Python.)-360(In)]TJ/F46 7.9701 Tf 36.0805 0 Td[(Master')40(s)-250(Thesis)]TJ/F42 7.9701 Tf 50.3785 0 Td[(,)-250(2004.)]TJ -103.2241 -11.9552 Td[([18])-437(T)74(.)-304(Sug)5(anuma,)-304(T)74(.)-304(Y)100(asue,)-304(and)-304(T)74(.)-304(Nakatani.)-533(A)-304(Re)15(gion-Based)-304(Compila-)]TJ 16.7651 -8.9664 Td[(tion)-329(T)70(echnique)-330(for)-329(Dynamic)-329(Compilers.)]TJ/F46 7.9701 Tf 134.5894 0 Td[(A)30(CM)-329(T)55(r)15(ansactions)-329(on)-330(Pr)45(o-)]TJ -134.5894 -8.9664 Td[(gr)15(amming)-250(Langua)10(g)10(es)-250(and)-250(Systems)-250(\050T)18(OPLAS\051)]TJ/F42 7.9701 Tf 146.1312 0 Td[(,)-250(28\0501\051:134\226174,)-250(2006.)]TJ -162.8963 -11.9551 Td[([19])-437(M.)-467(Zaleski,)-467(A.)-467(D.)-467(Bro)25(wn,)-466(and)-467(K.)-467(Stoodle)15(y)65(.)-1054(YETI:)-466(A)-467(graduallY)]TJ 16.7651 -8.9664 Td[(Extensible)-474(Trace)-473(Interpreter)55(.)-1077(In)]TJ/F46 7.9701 Tf 113.5207 0 Td[(Pr)45(oceedings)-474(of)-474(the)-473(International)]TJ -113.5207 -8.9664 Td[(Confer)37(ence)-368(on)-369(V)74(irtual)-369(Exec)1(ution)-369(En)40(vir)45(onments)]TJ/F42 7.9701 Tf 153.6315 0 Td[(,)-369(pages)-368(83\22693.)-369(A)40(CM)]TJ -153.6315 -8.9664 Td[(Press,)-250(2007.)]TJ ET BT /F41 17.9328 Tf 80.5159 700.6706 Td[(T)74(race-based)-250(J)15(ust-in-T)18(ime)-250(T)74(ype)-250(Specialization)-250(f)25(or)-250(Dynamic)]TJ 183.1901 -19.9253 Td[(Languages)]TJ/F42 10.9589 Tf -143.3836 -35.8655 Td[(Andreas)-250(Gal)]TJ/F26 7.9701 Tf 55.0789 3.9588 Td[(\003)]TJ/F22 7.9701 Tf 4.7323 0 Td[(+)]TJ/F42 10.9589 Tf 7.0846 -3.9588 Td[(,)-250(Brendan)-250(Eich)]TJ/F26 7.9701 Tf 65.4351 3.9588 Td[(\003)]TJ/F42 10.9589 Tf 4.7323 -3.9588 Td[(,)-250(Mik)10(e)-250(Sha)20(v)15(er)]TJ/F26 7.9701 Tf 61.2928 3.9588 Td[(\003)]TJ/F42 10.9589 Tf 4.7323 -3.9588 Td[(,)-250(Da)20(vid)-250(Anderson)]TJ/F26 7.9701 Tf 77.3913 3.9588 Td[(\003)]TJ/F42 10.9589 Tf 4.7323 -3.9588 Td[(,)-250(Da)20(vid)-250(Mandelin)]TJ/F26 7.9701 Tf 76.7884 3.9588 Td[(\003)]TJ/F42 10.9589 Tf 4.7323 -3.9588 Td[(,)]TJ -393.5134 -12.9514 Td[(Mohammad)-250(R.)-250(Haghighat)]TJ/F22 7.9701 Tf 114.147 3.9588 Td[($)]TJ/F42 10.9589 Tf 4.7323 -3.9588 Td[(,)-250(Blak)10(e)-250(Kaplan)]TJ/F26 7.9701 Tf 65.3254 3.9588 Td[(\003)]TJ/F42 10.9589 Tf 4.7323 -3.9588 Td[(,)-250(Graydon)-250(Hoare)]TJ/F26 7.9701 Tf 73.3366 3.9588 Td[(\003)]TJ/F42 10.9589 Tf 4.7323 -3.9588 Td[(,)-250(Boris)-250(Zbarsk)15(y)]TJ/F26 7.9701 Tf 67.7145 3.9588 Td[(\003)]TJ/F42 10.9589 Tf 4.7324 -3.9588 Td[(,)-250(Jason)-250(Orendorf)25(f)]TJ/F26 7.9701 Tf 76.1089 3.9588 Td[(\003)]TJ/F42 10.9589 Tf 4.7323 -3.9588 Td[(,)]TJ -445.5607 -12.9514 Td[(Jesse)-250(Ruderman)]TJ/F26 7.9701 Tf 70.9142 3.9588 Td[(\003)]TJ/F42 10.9589 Tf 4.7323 -3.9588 Td[(,)-250(Edwin)-250(Smith)]TJ/F22 7.9701 Tf 63.0241 3.9588 Td[(#)]TJ/F42 10.9589 Tf 7.5551 -3.9588 Td[(,)-250(Rick)-250(Reitmaier)]TJ/F22 7.9701 Tf 72.1414 3.9588 Td[(#)]TJ/F42 10.9589 Tf 7.5551 -3.9588 Td[(,)-250(Michael)-250(Bebenita)]TJ/F22 7.9701 Tf 83.0893 3.9588 Td[(+)]TJ/F42 10.9589 Tf 7.0847 -3.9588 Td[(,)-250(Mason)-250(Chang)]TJ/F22 7.9701 Tf 66.6625 3.9588 Td[(+)-63(#)]TJ/F42 10.9589 Tf 14.6398 -3.9588 Td[(,)-250(Michael)-250(Franz)]TJ/F22 7.9701 Tf 69.0841 3.9588 Td[(+)]TJ/F42 8.9664 Tf -268.5924 -18.9028 Td[(Mozilla)-250(Corporation)]TJ/F32 5.9776 Tf 73.4696 3.809 Td[(\003)]TJ/F31 8.9664 Tf -248.6584 -13.7716 Td[(f)]TJ/F33 8.9664 Tf 4.6077 0 Td[(gal,brendan,shaver,danderson,dmandelin,mrbkap,graydon,bz,jorendorff,jruder)1(man)]TJ/F31 8.9664 Tf 362.4615 0 Td[(g)]TJ/F33 8.9664 Tf 4.6077 0 Td[(@mozilla.com)]TJ/F42 8.9664 Tf -195.5725 -16.1793 Td[(Adobe)-250(Corporation)]TJ/F28 5.9776 Tf 69.48 3.809 Td[(#)]TJ/F31 8.9664 Tf -99.6583 -13.7716 Td[(f)]TJ/F33 8.9664 Tf 4.6077 0 Td[(edwsmith,rreitmai)]TJ/F31 8.9664 Tf 80.024 0 Td[(g)]TJ/F33 8.9664 Tf 4.6077 0 Td[(@adobe.com)]TJ/F42 8.9664 Tf -54.1642 -16.5114 Td[(Intel)-250(Corporation)]TJ/F28 5.9776 Tf 62.0108 3.809 Td[($)]TJ/F31 8.9664 Tf -104.1469 -13.7716 Td[(f)]TJ/F33 8.9664 Tf 4.6077 0 Td[(mohammad.r.haghighat)]TJ/F31 8.9664 Tf 94.1458 0 Td[(g)]TJ/F33 8.9664 Tf 4.6077 0 Td[(@intel.com)]TJ/F42 8.9664 Tf -87.0392 -15.8472 Td[(Uni)25(v)15(ersity)-250(of)-250(California,)-250(Irvine)]TJ/F28 5.9776 Tf 111.7019 3.809 Td[(+)]TJ/F31 8.9664 Tf -125.6703 -13.7716 Td[(f)]TJ/F33 8.9664 Tf 4.6077 0 Td[(mbebenit,changm,franz)]TJ/F31 8.9664 Tf 98.8531 0 Td[(g)]TJ/F33 8.9664 Tf 4.6077 0 Td[(@uci.edu)]TJ/F41 10.9589 Tf -286.2636 -67.746 Td[(Abstract)]TJ/F42 8.9664 Tf 0 -13.9477 Td[(Dynamic)-329(languages)-330(such)-329(as)-329(Ja)20(v)25(aScript)-329(are)-330(more)-329(dif)25(\002cult)-329(to)-330(com-)]TJ 0 -9.9626 Td[(pile)-275(than)-275(statically)-275(typed)-275(ones.)-275(Since)-275(no)-276(concrete)-275(type)-275(information)]TJ 0 -9.9627 Td[(is)-197(a)20(v)25(ailable,)-196(traditional)-197(compilers)-197(need)-196(to)-197(emit)-197(generic)-196(code)-197(that)-197(can)]TJ 0 -9.9626 Td[(handle)-233(all)-234(possible)-233(type)-233(combinations)-234(at)-233(runtime.)-234(W)80(e)-233(present)-233(an)-234(al-)]TJ 0 -9.9626 Td[(ternati)25(v)15(e)-376(compilat)1(ion)-376(technique)-376(for)-375(dynamically-typed)-376(languages)]TJ 0 -9.9627 Td[(that)-269(identi\002es)-270(frequently)-269(e)15(x)15(ecuted)-269(loop)-269(traces)-270(at)-269(run-time)-269(and)-270(then)]TJ 0 -9.9626 Td[(generates)-374(machine)-375(code)-374(on)-374(the)-375(\003y)-374(that)-374(is)-375(specialized)-374(for)-374(the)-375(ac-)]TJ 0 -9.9627 Td[(tual)-331(dynamic)-331(types)-331(occurring)-331(on)-331(each)-331(path)-331(through)-331(the)-331(loop.)-331(Our)]TJ 0 -9.9626 Td[(method)-232(pro)15(vides)-232(cheap)-232(inter)20(-procedural)-232(type)-233(s)1(pecialization,)-233(and)-232(an)]TJ 0 -9.9626 Td[(ele)15(g)5(ant)-238(and)-239(ef)25(\002cient)-238(w)10(ay)-239(of)-238(incrementally)-239(compiling)-238(lazily)-239(disco)15(v-)]TJ 0 -9.9627 Td[(ered)-273(alternati)25(v)15(e)-274(paths)-273(through)-274(nested)-273(loops.)-274(W)80(e)-273(ha)20(v)15(e)-274(implemented)]TJ 0 -9.9626 Td[(a)-283(dynamic)-283(compiler)-283(for)-282(Ja)20(v)25(aScript)-283(based)-283(on)-283(our)-283(technique)-283(and)-283(we)]TJ 0 -9.9627 Td[(ha)20(v)15(e)-350(measured)-351(speedups)-350(of)-351(10x)-350(and)-350(more)-351(for)-350(certain)-351(benchmark)]TJ 0 -9.9626 Td[(programs.)]TJ/F45 8.9664 Tf 0 -15.6041 Td[(Categories)-392(and)-391(Subject)-392(Descriptors)]TJ/F42 8.9664 Tf 142.5488 0 Td[(D.3.4)-392([)]TJ/F46 8.9664 Tf 26.4219 0 Td[(Pr)45(o)10(gr)15(amming)-392(Lan-)]TJ -168.9707 -9.9626 Td[(gua)10(g)10(es)]TJ/F42 8.9664 Tf 25.2223 0 Td[(]:)-250(Processors)-250(\227)]TJ/F46 8.9664 Tf 59.5181 0 Td[(Incr)37(emental)-250(compiler)10(s,)-250(code)-250(g)10(ener)15(ation)]TJ/F42 8.9664 Tf 142.788 0 Td[(.)]TJ/F45 8.9664 Tf -227.5284 -15.6041 Td[(General)-328(T)92(erms)]TJ/F42 8.9664 Tf 64.3755 0 Td[(Design,)-328(Experimentation,)-327(Measurement,)-328(Perfor)20(-)]TJ -64.3755 -9.9627 Td[(mance.)]TJ/F45 8.9664 Tf 0 -15.6041 Td[(K)25(eyw)15(ords)]TJ/F42 8.9664 Tf 44.4728 0 Td[(Ja)20(v)25(aScript,)-250(just-in-time)-250(compilation,)-250(trace)-250(trees.)]TJ/F41 10.9589 Tf -44.4728 -22.5779 Td[(1.)-1000(Intr)18(oduction)]TJ/F46 8.9664 Tf 0 -13.9477 Td[(Dynamic)-222(langua)10(g)10(es)]TJ/F42 8.9664 Tf 73.0244 0 Td[(such)-222(as)-221(Ja)20(v)25(aScript,)-222(Python,)-221(and)-222(Ruby)65(,)-222(are)-221(pop-)]TJ -73.0244 -9.9626 Td[(ular)-258(since)-259(the)15(y)-258(are)-258(e)15(xpressi)25(v)15(e,)-259(ac)1(cessible)-259(to)-258(non-e)15(xperts,)-258(and)-259(mak)10(e)]TJ 0 -9.9627 Td[(deplo)10(yment)-280(as)-280(easy)-279(as)-280(distrib)20(uting)-280(a)-280(source)-279(\002le.)-280(The)15(y)-280(are)-280(used)-280(for)]TJ 0 -9.9626 Td[(small)-365(scripts)-365(as)-365(well)-365(as)-365(for)-365(comple)15(x)-366(applications.)-365(Ja)20(v)25(aScript,)-365(for)]TJ 0 -9.9627 Td[(e)15(xample,)-266(is)-265(the)-266(de)-266(f)10(acto)-266(standard)-265(for)-266(client-side)-266(web)-266(programming)]TJ/F42 6.9738 Tf 0 -41.5565 Td[(Permission)-328(to)-329(mak)10(e)-328(digital)-329(or)-328(hard)-329(copies)-328(of)-328(all)-329(or)-328(part)-329(of)-328(this)-329(w)10(ork)-328(for)-329(personal)-328(or)]TJ 0 -7.9701 Td[(classroom)-277(use)-277(is)-278(granted)-277(without)-277(fee)-277(pro)15(vided)-278(that)-277(copies)-277(are)-277(not)-278(made)-277(or)-277(distrib)20(uted)]TJ 0 -7.9701 Td[(for)-229(pro\002t)-229(or)-229(commercial)-229(adv)25(antage)-229(and)-229(that)-229(copies)-229(bear)-229(this)-229(notice)-229(and)-229(the)-229(full)-229(citation)]TJ 0 -7.9701 Td[(on)-274(the)-274(\002rst)-274(page.)-274(T)80(o)-274(cop)10(y)-274(otherwise,)-274(to)-273(republish,)-274(to)-274(post)-274(on)-274(serv)15(ers)-274(or)-274(to)-274(redistrib)20(ute)]TJ 0 -7.9701 Td[(to)-250(lists,)-250(requires)-250(prior)-250(speci\002c)-250(permission)-250(and/or)-250(a)-250(fee.)]TJ/F48 6.9738 Tf 0 -9.9626 Td[(PLDI'09,)]TJ/F42 6.9738 Tf 33.6277 0 Td[(June)-250(15\22620,)-250(2009,)-250(Dublin,)-250(Ireland.)]TJ -33.6277 -7.9701 Td[(Cop)10(yright)]TJ 32.3825 0.2102 Td[(c)]TJ/F13 6.9738 Tf -2.4231 -0.2102 Td[(\015)]TJ/F42 6.9738 Tf 9.6859 0 Td[(2009)-250(A)40(CM)-250(978-1-60558-392-1/09/06.)-150(.)-150(.)-150($5.00)]TJ/F42 8.9664 Tf 223.3684 377.9455 Td[(and)-268(is)-267(used)-268(for)-267(the)-268(application)-267(logic)-268(of)-267(bro)25(wser)20(-based)-268(producti)25(vity)]TJ 0 -9.9627 Td[(applications)-324(such)-325(as)-324(Google)-325(Mail,)-324(Google)-324(Docs)-325(and)-324(Zimbra)-325(Col-)]TJ 0 -9.9626 Td[(laboration)-375(Suite.)-375(In)-376(this)-375(domain,)-375(in)-375(order)-376(to)-375(pro)15(vide)-375(a)-375(\003uid)-376(user)]TJ 0 -9.9626 Td[(e)15(xperience)-212(and)-212(enable)-212(a)-212(ne)25(w)-212(generation)-212(of)-213(applications,)-212(virtual)-212(ma-)]TJ 0 -9.9627 Td[(chines)-250(must)-250(pro)15(vide)-250(a)-250(lo)25(w)-250(startup)-250(time)-250(and)-250(high)-250(performance.)]TJ 11.9552 -9.9626 Td[(Compilers)-299(for)-299(statically)-299(typed)-299(languages)-299(rely)-299(on)-299(type)-299(informa-)]TJ -11.9552 -9.9627 Td[(tion)-206(to)-206(generate)-206(ef)25(\002cient)-205(machine)-206(code.)-206(In)-206(a)-206(dynamically)-206(typed)-206(pro-)]TJ 0 -9.9626 Td[(gramming)-386(language)-387(such)-386(as)-387(Ja)20(v)25(aScript,)-386(the)-387(types)-386(of)-387(e)15(xpressions)]TJ 0 -9.9626 Td[(may)-323(v)25(ary)-324(at)-323(runtime.)-323(This)-324(means)-323(that)-323(the)-324(compiler)-323(can)-323(no)-324(longer)]TJ 0 -9.9627 Td[(easily)-318(transform)-318(operations)-318(into)-318(machine)-318(instructions)-318(that)-318(operate)]TJ 0 -9.9626 Td[(on)-266(one)-266(speci)1(\002c)-266(type.)-266(W)40(ithout)-266(e)15(xact)-265(type)-266(information,)-266(the)-266(compiler)]TJ 0 -9.9627 Td[(must)-309(emit)-308(slo)25(wer)-309(generalized)-308(machine)-309(code)-308(that)-309(can)-309(deal)-308(with)-309(all)]TJ 0 -9.9626 Td[(potential)-285(type)-285(combinations.)-285(While)-285(compile-time)-285(static)-285(type)-285(infer)20(-)]TJ 0 -9.9626 Td[(ence)-412(might)-412(be)-412(able)-412(to)-412(g)5(ather)-412(type)-413(inf)1(ormation)-413(to)-412(generate)-412(opti-)]TJ 0 -9.9627 Td[(mized)-360(machine)-360(code,)-360(traditional)-360(static)-360(analysis)-360(is)-360(v)15(ery)-360(e)15(xpensi)25(v)15(e)]TJ 0 -9.9626 Td[(and)-253(hence)-253(not)-253(well)-253(s)1(uited)-253(for)-253(the)-253(highly)-253(interacti)25(v)15(e)-253(en)40(vironment)-253(of)]TJ 0 -9.9627 Td[(a)-250(web)-250(bro)25(wser)55(.)]TJ 11.9552 -9.9626 Td[(W)80(e)-409(present)-409(a)-410(trace-based)-409(compilation)-409(technique)-409(for)-409(dynamic)]TJ -11.9552 -9.9626 Td[(languages)-283(that)-283(reconciles)-282(speed)-283(of)-283(compilation)-283(with)-283(e)15(xcellent)-283(per)20(-)]TJ 0 -9.9627 Td[(formance)-211(of)-210(the)-211(generated)-210(machine)-211(code.)-210(Our)-211(system)-211(uses)-210(a)-211(mix)15(ed-)]TJ 0 -9.9626 Td[(mode)-231(e)15(x)15(ecution)-231(approach:)-231(the)-231(system)-231(starts)-231(running)-231(Ja)20(v)25(aScript)-231(in)-231(a)]TJ 0 -9.9627 Td[(f)10(ast-starting)-280(bytecode)-279(interpreter)55(.)-280(As)-279(the)-280(program)-280(runs)1(,)-280(the)-280(system)]TJ 0 -9.9626 Td[(identi\002es)]TJ/F46 8.9664 Tf 36.6853 0 Td[(hot)]TJ/F42 8.9664 Tf 15.4263 0 Td[(\050frequently)-424(e)15(x)15(ecuted\051)-425(bytecode)-424(sequences,)-425(records)]TJ -52.1116 -9.9626 Td[(them,)-368(and)-367(compiles)-368(them)-368(to)-368(f)10(ast)-367(nati)25(v)15(e)-368(code.)-368(W)80(e)-368(c)1(all)-368(such)-368(a)-368(se-)]TJ 0 -9.9627 Td[(quence)-250(of)-250(instructions)-250(a)]TJ/F46 8.9664 Tf 87.6544 0 Td[(tr)15(ace)]TJ/F42 8.9664 Tf 18.2911 0 Td[(.)]TJ -93.9903 -9.9626 Td[(Unlik)10(e)-424(method-based)-423(dynamic)-424(compilers,)-423(our)-424(dynamic)-423(com-)]TJ -11.9552 -9.9627 Td[(piler)-389(operates)-389(at)-389(the)-388(granularity)-389(of)-389(indi)25(vidual)-389(loops.)-389(This)-389(design)]TJ 0 -9.9626 Td[(choice)-391(is)-391(based)-390(on)-391(the)-391(e)15(xpectation)-391(that)-390(programs)-391(spend)-391(most)-391(of)]TJ 0 -9.9626 Td[(their)-318(time)-319(in)-318(hot)-318(loops.)-319(Ev)15(en)-318(in)-319(dynamically)-318(typed)-318(languages,)-319(we)]TJ 0 -9.9627 Td[(e)15(xpect)-221(hot)-222(l)1(oops)-222(to)-221(be)-221(mostly)]TJ/F46 8.9664 Tf 105.9153 0 Td[(type-stable)]TJ/F42 8.9664 Tf 39.3439 0 Td[(,)-221(meaning)-222(t)1(hat)-222(the)-221(types)-221(of)]TJ -145.2592 -9.9626 Td[(v)25(alues)-221(are)-220(in)40(v)25(ariant.)-221(\05012\051)-221(F)15(or)-220(e)15(xample,)-221(we)-221(w)10(ould)-220(e)15(xpect)-221(loop)-221(coun-)]TJ 0 -9.9627 Td[(ters)-253(that)-253(start)-253(as)-254(inte)15(gers)-253(to)-253(remain)-253(inte)15(gers)-253(for)-253(all)-254(iterations.)-253(When)]TJ 0 -9.9626 Td[(both)-318(of)-317(these)-318(e)15(xpectations)-317(hold,)-318(a)-317(trace-based)-318(compiler)-317(can)-318(co)15(v)15(er)]TJ 0 -9.9626 Td[(the)-229(program)-230(e)15(x)15(ecution)-229(with)-229(a)-230(small)-229(number)-229(of)-229(type-specialized,)-230(ef-)]TJ 0 -9.9627 Td[(\002ciently)-250(compiled)-250(traces.)]TJ 11.9552 -9.9626 Td[(Each)-269(compiled)-270(trace)-269(co)15(v)15(ers)-269(one)-270(path)-269(through)-270(the)-269(program)-269(with)]TJ -11.9552 -9.9627 Td[(one)-220(mapping)-220(of)-220(v)25(alues)-220(to)-220(types.)-220(When)-220(the)-221(VM)-220(e)15(x)15(ecutes)-220(a)-220(compiled)]TJ 0 -9.9626 Td[(trace,)-484(it)-483(cannot)-484(guarantee)-483(that)-484(the)-483(same)-484(path)-484(will)-483(be)-484(follo)25(wed)]TJ 0 -9.9626 Td[(or)-420(that)-419(the)-420(same)-420(types)-419(will)-420(occur)-420(in)-419(subsequent)-420(loop)-420(iterations.)]TJ ET BT /F42 8.9664 Tf 54 712.0299 Td[(Hence,)-209(recording)-209(and)-209(compiling)-209(a)-209(trace)]TJ/F46 8.9664 Tf 141.4609 0 Td[(speculates)]TJ/F42 8.9664 Tf 39.2273 0 Td[(that)-209(the)-209(path)-209(and)]TJ -180.6882 -9.9627 Td[(typing)-220(will)-220(be)-221(e)15(xac)1(tly)-221(as)-220(the)15(y)-220(were)-220(during)-220(recording)-221(for)-220(subsequent)]TJ 0 -9.9626 Td[(iterations)-250(of)-250(the)-250(loop.)]TJ 11.9552 -9.9626 Td[(Ev)15(ery)-285(compiled)-285(trace)-285(contains)-285(all)-285(the)]TJ/F46 8.9664 Tf 137.2149 0 Td[(guar)37(ds)]TJ/F42 8.9664 Tf 27.1327 0 Td[(\050checks\051)-285(required)]TJ -176.3028 -9.9627 Td[(to)-400(v)25(alidate)-400(the)-400(speculation.)-400(If)-400(one)-400(of)-400(the)-401(guards)-400(f)10(ails)-400(\050if)-400(control)]TJ 0 -9.9626 Td[(\003o)25(w)-365(is)-366(dif)25(ferent,)-365(or)-366(a)-365(v)25(alue)-365(of)-366(a)-365(dif)25(ferent)-366(type)-365(is)-365(generated\051,)-366(the)]TJ 0 -9.9627 Td[(trace)-371(e)15(xits.)-372(If)-371(an)-371(e)15(xit)-372(becomes)-371(hot,)-371(the)-372(V)1(M)-372(can)-371(record)-371(a)]TJ/F46 8.9664 Tf 213.9706 0 Td[(br)15(anc)15(h)]TJ -213.9706 -9.9626 Td[(tr)15(ace)]TJ/F42 8.9664 Tf 20.4956 0 Td[(starting)-246(at)-246(the)-245(e)15(xit)-246(to)-246(co)15(v)15(er)-246(the)-246(ne)25(w)-246(path.)-246(In)-245(this)-246(w)10(ay)65(,)-246(the)-246(VM)]TJ -20.4956 -9.9626 Td[(records)-250(a)]TJ/F46 8.9664 Tf 34.852 0 Td[(tr)15(ace)-250(tr)37(ee)]TJ/F42 8.9664 Tf 36.385 0 Td[(co)15(v)15(ering)-250(all)-250(the)-250(hot)-250(paths)-250(through)-250(the)-250(loop.)]TJ -59.2818 -9.9627 Td[(Nested)-361(loops)-361(can)-361(be)-362(dif)25(\002cult)-361(to)-361(optimize)-361(for)-361(tracing)-361(VMs.)-361(In)]TJ -11.9552 -9.9626 Td[(a)-355(na)]TJ 15.3806 0.0448 Td[(\250)]TJ 0.2466 -0.0448 Td[(\021v)15(e)-355(implementation,)-355(inner)-355(loops)-354(w)10(ould)-355(become)-355(hot)-355(\002rst,)-355(and)]TJ -15.6272 -9.9627 Td[(the)-346(VM)-346(w)10(ould)-346(start)-346(tracing)-346(there.)-346(When)-346(the)-346(inner)-347(loop)-346(e)15(xits,)-346(the)]TJ 0 -9.9626 Td[(VM)-226(w)10(ould)-226(detect)-226(that)-227(a)-226(dif)25(ferent)-226(branch)-226(w)10(as)-226(tak)10(en.)-226(The)-227(VM)-226(w)10(ould)]TJ 0 -9.9626 Td[(try)-285(to)-285(record)-284(a)-285(branch)-285(trace,)-285(and)-285(\002nd)-285(that)-284(the)-285(trace)-285(reaches)-285(not)-285(the)]TJ 0 -9.9627 Td[(inner)-267(loop)-267(header)40(,)-266(b)20(ut)-267(the)-267(outer)-267(loop)-267(header)55(.)-266(At)-267(this)-267(point,)-267(the)-267(VM)]TJ 0 -9.9626 Td[(could)-270(continue)-271(tracing)-270(until)-271(it)-270(reaches)-271(the)-270(inner)-271(loop)-270(header)-271(ag)5(ain,)]TJ 0 -9.9627 Td[(thus)-368(tracing)-369(the)-368(outer)-369(loop)-368(inside)-369(a)-368(trace)-369(tree)-368(for)-369(the)-368(inner)-369(loop.)]TJ 0 -9.9626 Td[(But)-236(this)-236(requires)-236(tracing)-236(a)-237(cop)10(y)-236(of)-236(the)-236(outer)-236(loop)-236(for)-236(e)25(v)15(ery)-237(side)-236(e)15(xit)]TJ 0 -9.9626 Td[(and)-315(type)-315(combination)-315(in)-315(the)-315(inner)-315(loop.)-315(In)-315(essence,)-316(t)1(his)-316(is)-315(a)-315(form)]TJ 0 -9.9627 Td[(of)-287(unintended)-288(tail)-287(duplication,)-288(which)-287(can)-287(easily)-288(o)15(v)15(er\003o)25(w)-287(the)-288(code)]TJ 0 -9.9626 Td[(cache.)-212(Alternati)25(v)15(ely)65(,)-212(the)-212(VM)-212(could)-212(simply)-212(stop)-212(tracing,)-212(and)-213(gi)25(v)15(e)-212(up)]TJ 0 -9.9627 Td[(on)-250(e)25(v)15(er)-250(tracing)-250(outer)-250(loops.)]TJ 11.9552 -9.9626 Td[(W)80(e)-402(solv)15(e)-401(the)-402(nested)-401(loop)-402(problem)-402(by)-401(recording)]TJ/F46 8.9664 Tf 182.3472 0 Td[(nested)-402(tr)15(ace)]TJ -194.3024 -9.9626 Td[(tr)37(ees)]TJ/F42 8.9664 Tf 17.0985 0 Td[(.)-230(Our)-230(system)-230(traces)-231(the)-230(inner)-230(loop)-230(e)15(xactly)-230(as)-230(the)-231(na)]TJ 180.3682 0.0448 Td[(\250)]TJ 0.2466 -0.0448 Td[(\021v)15(e)-230(v)15(ersion.)]TJ -197.7133 -9.9627 Td[(The)-259(system)-260(stops)-259(e)15(xtending)-260(the)-259(inner)-260(tree)-259(when)-259(it)-260(reaches)-259(an)-260(outer)]TJ 0 -9.9626 Td[(loop,)-303(b)20(ut)-303(then)-303(it)-303(starts)-303(a)-303(ne)25(w)-303(trace)-303(at)-303(the)-303(outer)-303(loop)-303(header)55(.)-303(When)]TJ 0 -9.9626 Td[(the)-228(outer)-229(loop)-228(reaches)-228(the)-229(inner)-228(loop)-228(header)40(,)-228(the)-229(system)-228(tries)-228(to)-229(call)]TJ 0 -9.9627 Td[(the)-202(trac)1(e)-202(tree)-202(for)-201(the)-202(inner)-201(loop.)-202(If)-201(the)-202(call)-201(succeeds,)-202(the)-201(VM)-202(records)]TJ 0 -9.9626 Td[(the)-424(cal)1(l)-424(to)-424(the)-423(inner)-424(tree)-423(as)-424(part)-423(of)-424(the)-423(outer)-424(trace)-423(and)-424(\002nishes)]TJ 0 -9.9627 Td[(the)-378(outer)-379(trace)-378(as)-379(normal.)-378(In)-378(this)-379(w)10(ay)65(,)-378(our)-379(system)-378(can)-378(trace)-379(an)15(y)]TJ 0 -9.9626 Td[(number)-246(of)-246(loops)-247(nested)-246(to)-246(an)15(y)-246(depth)-246(without)-246(causing)-247(e)15(xcessi)25(v)15(e)-246(tail)]TJ 0 -9.9626 Td[(duplication.)]TJ 11.9552 -9.9627 Td[(These)-355(techniques)-355(allo)25(w)-355(a)-356(VM)-355(to)-355(dynamically)-355(translate)-355(a)-355(pro-)]TJ -11.9552 -9.9626 Td[(gram)-425(to)-424(nested,)-425(type-specialized)-425(trace)-425(trees.)-424(Because)-425(traces)-425(can)]TJ 0 -9.9627 Td[(cross)-292(function)-292(call)-293(boundaries,)-292(our)-292(techniques)-292(also)-292(achie)25(v)15(e)-292(the)-293(ef-)]TJ 0 -9.9626 Td[(fects)-211(of)-211(inlining.)-211(Because)-210(traces)-211(ha)20(v)15(e)-211(no)-211(internal)-211(control-\003o)25(w)-211(joins,)]TJ 0 -9.9626 Td[(the)15(y)-383(can)-383(be)-383(optimized)-383(in)-383(linear)-383(time)-383(by)-383(a)-383(simple)-383(compiler)-383(\05010\051.)]TJ 0 -9.9627 Td[(Thus,)-383(our)-384(tracing)-383(VM)-384(ef)25(\002ciently)-383(performs)-384(the)-383(same)-384(kind)-383(of)-384(op-)]TJ 0 -9.9626 Td[(timizations)-342(that)-342(w)10(ould)-342(require)-342(interprocedural)-342(analysis)-342(in)-342(a)-342(static)]TJ 0 -9.9627 Td[(optimization)-261(setting.)-262(This)-261(mak)10(es)-262(tracing)-261(an)-262(attracti)25(v)15(e)-261(and)-262(ef)25(fecti)25(v)15(e)]TJ 0 -9.9626 Td[(tool)-250(to)-250(type)-250(specialize)-250(e)25(v)15(en)-250(comple)15(x)-250(function)-250(call-rich)-250(code.)]TJ 11.9552 -9.9626 Td[(W)80(e)-247(implemented)-247(these)-247(techniques)-248(for)-247(an)-247(e)15(xisting)-247(Ja)20(v)25(aScript)-247(in-)]TJ -11.9552 -9.9627 Td[(terpreter)40(,)-313(SpiderMonk)10(e)15(y)65(.)-314(W)80(e)-313(call)-314(the)-313(resulting)-314(tracing)-313(VM)]TJ/F46 8.9664 Tf 215.8268 0 Td[(T)55(r)15(ace-)]TJ -215.8268 -9.9626 Td[(Monk)10(e)30(y)]TJ/F42 8.9664 Tf 28.0198 0 Td[(.)-293(T)35(raceMonk)10(e)15(y)-293(supports)-294(all)-293(the)-293(Ja)20(v)25(aScript)-293(features)-293(of)-294(Spi-)]TJ -28.0198 -9.9627 Td[(derMonk)10(e)15(y)65(,)-250(with)-250(a)-250(2x-20x)-250(speedup)-250(for)-250(traceable)-250(programs.)]TJ 11.9552 -9.9626 Td[(This)-250(paper)-250(mak)10(es)-250(the)-250(follo)25(wing)-250(contrib)20(utions:)]TJ/F26 7.9701 Tf -6.7249 -18.0308 Td[(\017)]TJ/F42 8.9664 Tf 7.7211 -0.8982 Td[(W)80(e)-246(e)15(xplain)-245(an)-246(algorithm)-246(for)-246(dynam)1(ically)-246(forming)-246(trace)-246(trees)-245(to)]TJ 0 -9.9626 Td[(co)15(v)15(er)-202(a)-201(program,)-202(representing)-202(nested)-201(loops)-202(as)-202(nested)-202(trace)-201(trees.)]TJ/F26 7.9701 Tf -7.7211 -13.0495 Td[(\017)]TJ/F42 8.9664 Tf 7.7211 -0.8982 Td[(W)80(e)-190(e)15(xplain)-190(ho)25(w)-190(to)-190(speculati)25(v)15(ely)-190(generate)-190(ef)25(\002cient)-190(type-specialized)]TJ 0 -9.9626 Td[(code)-250(for)-250(traces)-250(from)-250(dynamic)-250(language)-250(programs.)]TJ/F26 7.9701 Tf -7.7211 -13.0495 Td[(\017)]TJ/F42 8.9664 Tf 7.7211 -0.8982 Td[(W)80(e)-264(v)25(alidate)-263(our)-264(tracing)-264(techniques)-263(in)-264(an)-264(implementation)-263(based)]TJ 0 -9.9626 Td[(on)-315(the)-315(SpiderMonk)10(e)15(y)-315(Ja)20(v)25(aScript)-315(int)1(erpreter)40(,)-315(achie)25(ving)-315(2x-20x)]TJ 0 -9.9627 Td[(speedups)-250(on)-250(man)15(y)-250(programs.)]TJ -0.9963 -18.929 Td[(The)-219(remainder)-220(of)-219(this)-220(paper)-219(is)-219(or)18(g)5(anized)-220(as)-219(follo)25(ws.)-220(Section)-219(3)-219(is)]TJ -11.9551 -9.9626 Td[(a)-299(general)-298(o)15(v)15(ervie)25(w)-299(of)-299(trace)-299(t)1(ree)-299(based)-299(compilation)-299(we)-298(use)-299(to)-299(cap-)]TJ 0 -9.9627 Td[(ture)-379(and)-379(compile)-379(frequently)-379(e)15(x)15(ecuted)-379(code)-379(re)15(gions.)-380(In)-379(Section)-379(4)]TJ 0 -9.9626 Td[(we)-342(describe)-343(our)-342(approach)-343(of)-342(co)15(v)15(ering)-343(nested)-342(loops)-343(using)-342(a)-343(num-)]TJ 0 -9.9627 Td[(ber)-364(of)-364(indi)25(vidual)-364(trace)-364(trees.)-364(In)-364(Section)-364(5)-364(we)-365(describe)-364(our)-364(trace-)]TJ 0 -9.9626 Td[(compilation)-253(ba)1(sed)-253(speculati)25(v)15(e)-253(type)-252(specialization)-253(approach)-252(we)-253(use)]TJ 0 -9.9626 Td[(to)-292(generate)-293(ef)25(\002cient)-292(machine)-293(code)-292(from)-293(recorded)-292(bytecode)-293(traces.)]TJ 0 -9.9627 Td[(Our)-366(implementation)-365(of)-366(a)-366(dynamic)-365(type-specializing)-366(compiler)-366(for)]TJ 0 -9.9626 Td[(Ja)20(v)25(aScript)-314(is)-314(described)-314(in)-314(Section)-314(6.)-314(Related)-314(w)10(ork)-315(is)-314(discussed)-314(in)]TJ 0 -9.9627 Td[(Section)-230(8.)-229(In)-230(Section)-230(7)-230(we)-229(e)25(v)25(aluate)-230(our)-230(dynamic)-229(compiler)-230(based)-230(on)]TJ/F33 8.9664 Tf 263.0137 645.33 Td[(1)-525(for)-525(\050var)-525(i)-525(=)-525(2;)-525(i)-525(<)-525(100;)-525(++i\051)-525({)]TJ 0 -9.9626 Td[(2)-1575(if)-525(\050!primes[i]\051)]TJ 0 -9.9626 Td[(3)-2625(continue;)]TJ 0 -9.9627 Td[(4)-1575(for)-525(\050var)-525(k)-525(=)-525(i)-525(+)-525(i;)-525(i)-525(<)-525(100;)-525(k)-525(+=)-525(i\051)]TJ 0 -9.9626 Td[(5)-2625(primes[k])-525(=)-525(false;)]TJ 0 -9.9627 Td[(6)-525(})]TJ ET 1 0 0 1 317.0137 651.9253 cm q []0 d 0 J 0.3288 w 0 0.1644 m 239.1034 0.1644 l S Q 1 0 0 1 -317.0137 -651.9253 cm BT /F41 8.9664 Tf 317.0137 641.7624 Td[(Figur)18(e)-408(1.)-500(Sample)-408(pr)18(ogram:)-409(sie)15(v)10(e)-408(of)-408(Eratosthenes.)]TJ/F33 8.9664 Tf 201.2185 0 Td[(primes)]TJ/F42 8.9664 Tf 31.9045 0 Td[(is)]TJ -233.123 -9.9626 Td[(initialized)-353(to)-353(an)-353(array)-353(of)-353(100)]TJ/F33 8.9664 Tf 109.635 0 Td[(false)]TJ/F42 8.9664 Tf 26.7022 0 Td[(v)25(alues)-353(on)-353(entry)-353(to)-353(this)-353(code)]TJ -136.3372 -9.9627 Td[(snippet.)]TJ ET 1 0 0 1 317.0137 414.7685 cm q 0.43082 0 0 0.43082 0 0 cm q 1 0 0 1 0 0 cm /Im1 Do Q Q 1 0 0 1 0 -11.2876 cm q []0 d 0 J 0.3288 w 0 0.1644 m 239.1034 0.1644 l S Q 1 0 0 1 -317.0137 -403.4809 cm BT /F41 8.9664 Tf 317.0137 393.318 Td[(Figur)18(e)-312(2.)]TJ/F42 8.9664 Tf 39.2501 0 Td[(State)-312(machine)-313(describing)-312(the)-313(major)-312(acti)25(vities)-313(of)-312(T)35(race-)]TJ -39.2501 -9.9626 Td[(Monk)10(e)15(y)-352(and)-353(the)-352(conditions)-352(that)-352(cause)-353(transitions)-352(to)-352(a)-352(ne)25(w)-353(acti)25(v-)]TJ 0 -9.9627 Td[(ity)65(.)-400(In)-399(the)-400(dark)-399(box,)-400(TM)-399(e)15(x)15(ecutes)-399(JS)-400(as)-399(compiled)-400(traces.)-399(In)-400(the)]TJ 0 -9.9626 Td[(light)-244(gray)-244(box)15(es,)-243(TM)-244(e)15(x)15(ecutes)-244(JS)-244(in)-243(the)-244(standard)-244(interpreter)55(.)-244(White)]TJ 0 -9.9627 Td[(box)15(es)-348(are)-349(o)15(v)15(erhead.)-348(Thus,)-349(to)-348(maximize)-348(performance,)-349(we)-348(need)-349(to)]TJ 0 -9.9626 Td[(maximize)-233(time)-234(spent)-233(in)-233(the)-234(dark)10(est)-233(box)-233(and)-234(minimize)-233(time)-233(spent)-234(in)]TJ 0 -9.9626 Td[(the)-241(white)-242(box)15(es.)-241(The)-242(best)-241(case)-242(is)-241(a)-242(loop)-241(where)-242(the)-241(types)-242(at)-241(the)-242(loop)]TJ 0 -9.9627 Td[(edge)-243(are)-243(the)-242(same)-243(as)-243(the)-243(types)-243(on)-243(entry\226then)-242(TM)-243(can)-243(stay)-243(in)-243(nati)25(v)15(e)]TJ 0 -9.9626 Td[(code)-250(until)-250(the)-250(loop)-250(is)-250(done.)]TJ 0 -28.4956 Td[(a)-303(set)-303(of)-304(industry)-303(benchmarks.)-303(The)-303(paper)-303(ends)-303(with)-304(conclusions)-303(in)]TJ 0 -9.9626 Td[(Section)-230(9)-230(and)-231(an)-230(outlook)-230(on)-230(future)-231(w)10(ork)-230(is)-230(presented)-230(in)-230(Section)-231(10.)]TJ/F41 10.9589 Tf 0 -23.4028 Td[(2.)-1000(Ov)10(er)10(view:)-250(Example)-250(T)74(racing)-250(Run)]TJ/F42 8.9664 Tf 0 -13.9477 Td[(This)-434(section)-434(pro)15(vides)-434(an)-434(o)15(v)15(ervie)25(w)-434(of)-434(our)-435(system)-434(by)-434(describing)]TJ 0 -9.9626 Td[(ho)25(w)-446(T)35(raceMonk)10(e)15(y)-447(e)15(x)15(ecutes)-446(an)-447(e)15(xample)-446(program.)-446(The)-447(e)15(xample)]TJ 0 -9.9627 Td[(program,)-242(sho)25(wn)-241(in)-242(Figure)-241(1,)-242(computes)-241(the)-242(\002rst)-242(100)-241(prime)-242(numbers)]TJ 0 -9.9626 Td[(with)-196(nested)-196(loops.)-196(The)-196(narra)1(ti)25(v)15(e)-196(should)-196(be)-196(read)-196(along)-196(with)-196(Figure)-196(2,)]TJ 0 -9.9627 Td[(which)-296(describes)-296(the)-296(acti)25(vities)-296(T)35(raceMonk)10(e)15(y)-296(performs)-296(and)-297(when)-296(it)]TJ 0 -9.9626 Td[(transitions)-250(between)-250(the)-250(loops.)]TJ 11.9552 -9.9626 Td[(T)35(raceMonk)10(e)15(y)-336(al)10(w)10(ays)-336(be)15(gins)-335(e)15(x)15(ecuting)-336(a)-336(program)-336(in)-336(the)-335(byte-)]TJ -11.9552 -9.9627 Td[(code)-363(interpreter)55(.)-363(Ev)15(ery)-363(loop)-364(back)-363(edge)-363(is)-363(a)-363(potential)-364(tra)1(ce)-364(point.)]TJ 0 -9.9626 Td[(When)-382(the)-381(interpreter)-382(crosses)-382(a)-382(loop)-381(edge,)-382(T)35(raceMonk)10(e)15(y)-382(in)40(v)20(ok)10(es)]TJ 0 -9.9627 Td[(the)]TJ/F46 8.9664 Tf 13.5447 0 Td[(tr)15(ace)-289(monitor)]TJ/F42 8.9664 Tf 49.2753 0 Td[(,)-289(which)-288(may)-289(decide)-288(to)-289(record)-289(or)-288(e)15(x)15(ecute)-289(a)-289(nat)1(i)25(v)15(e)]TJ -62.82 -9.9626 Td[(trace.)-246(At)-246(the)-246(start)-247(of)-246(e)15(x)15(ecution,)-246(there)-246(are)-246(no)-246(compiled)-246(traces)-247(yet,)-246(so)]TJ 0 -9.9626 Td[(the)-199(trace)-200(monitor)-199(counts)-200(the)-199(number)-200(of)-199(times)-200(each)-199(loop)-200(back)-199(edge)-200(is)]TJ 0 -9.9627 Td[(e)15(x)15(ecuted)-220(until)-220(a)-221(loop)-220(becomes)]TJ/F46 8.9664 Tf 109.2092 0 Td[(hot)]TJ/F42 8.9664 Tf 11.4589 0 Td[(,)-220(currently)-220(after)-221(2)-220(crossings.)-220(Note)]TJ -120.6681 -9.9626 Td[(that)-207(the)-208(w)10(ay)-207(our)-207(loops)-208(are)-207(compiled,)-207(the)-207(loop)-208(edge)-207(is)-207(crossed)-208(before)]TJ 0 -9.9627 Td[(entering)-275(the)-275(loop,)-276(so)-275(the)-275(second)-275(crossing)-275(occurs)-276(immediat)1(ely)-276(after)]TJ 0 -9.9626 Td[(the)-250(\002rst)-250(iteration.)]TJ 11.9552 -9.9626 Td[(Here)-469(is)-469(the)-469(sequence)-470(of)-469(e)25(v)15(ents)-469(brok)10(en)-469(do)25(wn)-469(by)-469(outer)-469(loop)]TJ -11.9552 -9.9627 Td[(iteration:)]TJ ET BT /F33 8.9664 Tf 54 713.7733 Td[(v0)-525(:=)-525(ld)-525(state[748])-2625(//)-525(load)-525(primes)-525(from)-525(the)-525(trace)-525(activation)-525(record)]TJ 28.2438 -9.9626 Td[(st)-525(sp[0],)-525(v0)-3150(//)-525(store)-525(primes)-525(to)-525(interpreter)-525(stack)]TJ -28.2438 -9.9626 Td[(v1)-525(:=)-525(ld)-525(state[764])-2625(//)-525(load)-525(k)-525(from)-525(the)-525(trace)-525(activation)-525(record)]TJ 0 -9.9627 Td[(v2)-525(:=)-525(i2f\050v1\051)-5775(//)-525(convert)-525(k)-525(from)-525(int)-525(to)-525(double)]TJ 28.2438 -9.9626 Td[(st)-525(sp[8],)-525(v1)-3150(//)-525(store)-525(k)-525(to)-525(interpreter)-525(stack)]TJ 0 -9.9627 Td[(st)-525(sp[16],)-525(0)-3150(//)-525(store)-525(false)-525(to)-525(interpreter)-525(stack)]TJ -28.2438 -9.9626 Td[(v3)-525(:=)-525(ld)-525(v0[4])-5250(//)-525(load)-525(class)-525(word)-525(for)-525(primes)]TJ 0 -9.9626 Td[(v4)-525(:=)-525(and)-525(v3,)-525(-4)-4200(//)-525(mask)-525(out)-525(object)-525(class)-525(tag)-525(for)-525(primes)]TJ 0 -9.9627 Td[(v5)-525(:=)-525(eq)-525(v4,)-525(Array)-3150(//)-525(test)-525(whether)-525(primes)-525(is)-525(an)-525(array)]TJ 28.2438 -9.9626 Td[(xf)-525(v5)-6825(//)-525(side)-525(exit)-525(if)-525(v5)-525(is)-525(false)]TJ -28.2438 -9.9627 Td[(v6)-525(:=)-525(js_Array_set\050v0,)-525(v2,)-525(false\051)-1050(//)-525(call)-525(function)-525(to)-525(set)-525(array)-525(element)]TJ 0 -9.9626 Td[(v7)-525(:=)-525(eq)-525(v6,)-525(0)-5250(//)-525(test)-525(return)-525(value)-525(from)-525(call)]TJ 28.2438 -9.9626 Td[(xt)-525(v7)-6825(//)-525(side)-525(exit)-525(if)-525(js_Array_set)-525(returns)-525(false.)]TJ ET 1 0 0 1 54 580.9414 cm q []0 d 0 J 0.3288 w 0 0.1644 m 502.1171 0.1644 l S Q 1 0 0 1 -54 -580.9414 cm BT /F41 8.9664 Tf 54 570.7786 Td[(Figur)18(e)-350(3.)-500(LIR)-349(snippet)-350(f)25(or)-349(sample)-350(pr)18(ogram.)]TJ/F42 8.9664 Tf 173.1706 0 Td[(This)-350(is)-349(the)-350(LIR)-349(recorded)-350(for)-349(line)-350(5)-350(of)-349(the)-350(sample)-349(program)-350(in)-349(Figure)-350(1.)-350(The)-349(LIR)-350(encodes)]TJ -173.1706 -9.9626 Td[(the)-328(semantics)-328(in)-328(SSA)-328(form)-328(using)-327(temporary)-328(v)25(ariables.)-328(The)-328(LIR)-328(also)-328(encodes)-328(all)-328(the)-328(stores)-328(that)-328(the)-327(interpreter)-328(w)10(ould)-328(do)-328(to)-328(its)-328(data)-328(stack.)]TJ 0 -9.9627 Td[(Sometimes)-255(these)-256(stores)-255(can)-256(be)-255(optimized)-256(a)15(w)10(ay)-255(as)-255(the)-256(stack)-255(locations)-256(are)-255(li)25(v)15(e)-256(only)-255(on)-256(e)15(xits)-255(to)-255(the)-256(interpreter)55(.)-255(Finally)65(,)-256(the)-255(LIR)-256(records)-255(guards)]TJ 0 -9.9626 Td[(and)-250(side)-250(e)15(xits)-250(to)-250(v)15(erify)-250(the)-250(assumptions)-250(made)-250(in)-250(this)-250(recording:)-250(that)]TJ/F33 8.9664 Tf 244.2951 0 Td[(primes)]TJ/F42 8.9664 Tf 30.4854 0 Td[(is)-250(an)-250(array)-250(and)-250(that)-250(the)-250(call)-250(to)-250(set)-250(its)-250(element)-250(succeeds.)]TJ/F33 8.9664 Tf -274.7805 -26.1519 Td[(mov)-525(edx,)-525(ebx\050748\051)-3150(//)-525(load)-525(primes)-525(from)-525(the)-525(trace)-525(activation)-525(record)]TJ 0 -9.9627 Td[(mov)-525(edi\0500\051,)-525(edx)-4200(//)-525(\050*\051)-525(store)-525(primes)-525(to)-525(interpreter)-525(stack)]TJ 0 -9.9626 Td[(mov)-525(esi,)-525(ebx\050764\051)-3150(//)-525(load)-525(k)-525(from)-525(the)-525(trace)-525(activation)-525(record)]TJ 0 -9.9627 Td[(mov)-525(edi\0508\051,)-525(esi)-4200(//)-525(\050*\051)-525(store)-525(k)-525(to)-525(interpreter)-525(stack)]TJ 0 -9.9626 Td[(mov)-525(edi\05016\051,)-525(0)-4725(//)-525(\050*\051)-525(store)-525(false)-525(to)-525(interpreter)-525(stack)]TJ 0 -9.9626 Td[(mov)-525(eax,)-525(edx\0504\051)-4200(//)-525(\050*\051)-525(load)-525(object)-525(class)-525(word)-525(for)-525(primes)]TJ 0 -9.9627 Td[(and)-525(eax,)-525(-4)-6300(//)-525(\050*\051)-525(mask)-525(out)-525(object)-525(class)-525(tag)-525(for)-525(primes)]TJ 0 -9.9626 Td[(cmp)-525(eax,)-525(Array)-4725(//)-525(\050*\051)-525(test)-525(whether)-525(primes)-525(is)-525(an)-525(array)]TJ 0 -9.9627 Td[(jne)-525(side_exit_1)-4200(//)-525(\050*\051)-525(side)-525(exit)-525(if)-525(primes)-525(is)-525(not)-525(an)-525(array)]TJ 0 -9.9626 Td[(sub)-525(esp,)-525(8)-6825(//)-525(bump)-525(stack)-525(for)-525(call)-525(alignment)-525(convention)]TJ 0 -9.9626 Td[(push)-525(false)-6825(//)-525(push)-525(last)-525(argument)-525(for)-525(call)]TJ 0 -9.9627 Td[(push)-525(esi)-7875(//)-525(push)-525(first)-525(argument)-525(for)-525(call)]TJ 0 -9.9626 Td[(call)-525(js_Array_set)-3150(//)-525(call)-525(function)-525(to)-525(set)-525(array)-525(element)]TJ 0 -9.9627 Td[(add)-525(esp,)-525(8)-6825(//)-525(clean)-525(up)-525(extra)-525(stack)-525(space)]TJ 0 -9.9626 Td[(mov)-525(ecx,)-525(ebx)-5775(//)-525(\050*\051)-525(created)-525(by)-525(register)-525(allocator)]TJ 0 -9.9626 Td[(test)-525(eax,)-525(eax)-5250(//)-525(\050*\051)-525(test)-525(return)-525(value)-525(of)-525(js_Array_set)]TJ 0 -9.9627 Td[(je)-525(side_exit_2)-4725(//)-525(\050*\051)-525(side)-525(exit)-525(if)-525(call)-525(failed)]TJ 0 -9.9626 Td[(...)]TJ 0 -9.9627 Td[(side_exit_1:)]TJ 0 -9.9626 Td[(mov)-525(ecx,)-525(ebp\050-4\051)-3675(//)-525(restore)-525(ecx)]TJ 0 -9.9626 Td[(mov)-525(esp,)-525(ebp)-5775(//)-525(restore)-525(esp)]TJ 0 -9.9627 Td[(jmp)-525(epilog)-6825(//)-525(jump)-525(to)-525(ret)-525(statement)]TJ ET 1 0 0 1 54 292.2431 cm q []0 d 0 J 0.3288 w 0 0.1644 m 502.1171 0.1644 l S Q 1 0 0 1 -54 -292.2431 cm BT /F41 8.9664 Tf 54 282.0803 Td[(Figur)18(e)-224(4.)-500(x86)-224(snippet)-223(f)25(or)-224(sample)-224(pr)18(ogram.)]TJ/F42 8.9664 Tf 163.9137 0 Td[(This)-224(is)-224(the)-223(x86)-224(code)-224(compiled)-224(from)-224(the)-224(LIR)-223(snippet)-224(in)-224(Figure)-224(3.)-224(Most)-224(LIR)-223(instructions)-224(compile)]TJ -163.9137 -9.9627 Td[(to)-308(a)-307(single)-308(x86)-307(instruction.)-308(Instructions)-307(mark)10(ed)-308(with)]TJ/F33 8.9664 Tf 193.5674 0 Td[(\050*\051)]TJ/F42 8.9664 Tf 16.8795 0 Td[(w)10(ould)-308(be)-307(omitted)-308(by)-307(an)-308(idealized)-307(compiler)-308(that)-307(kne)25(w)-308(that)-307(none)-308(of)-307(the)-308(side)-307(e)15(xits)]TJ -210.4469 -9.9626 Td[(w)10(ould)-263(e)25(v)15(er)-263(be)-263(tak)10(en.)-263(The)-263(17)-263(instructions)-263(generated)-263(by)-263(the)-263(compiler)-263(compare)-263(f)10(a)20(v)20(orably)-263(with)-263(the)-263(100+)-263(instructions)-263(that)-263(the)-263(interpreter)-263(w)10(ould)]TJ 0 -9.9627 Td[(e)15(x)15(ecute)-250(for)-250(the)-250(same)-250(code)-250(snippet,)-250(including)-250(4)-250(indirect)-250(jumps.)]TJ/F41 8.9664 Tf 11.9552 -29.8365 Td[(i=2.)]TJ/F42 8.9664 Tf 17.8463 0 Td[(This)-392(is)-393(the)-392(\002rst)-392(iteration)-393(of)-392(the)-392(outer)-393(loop.)-392(The)-393(loop)-392(on)]TJ -29.8015 -9.9626 Td[(lines)-265(4-5)-265(becomes)-264(hot)-265(on)-265(its)-265(second)-264(iteration,)-265(so)-265(T)35(raceMonk)10(e)15(y)-265(en-)]TJ 0 -9.9627 Td[(ters)-359(recording)-359(mode)-360(on)-359(line)-359(4.)-359(In)-359(recording)-360(m)1(ode,)-360(T)35(raceMonk)10(e)15(y)]TJ 0 -9.9626 Td[(records)-257(the)-257(code)-258(along)-257(the)-257(trace)-257(in)-257(a)-257(lo)25(w-le)25(v)15(el)-258(compiler)-257(intermedi-)]TJ 0 -9.9627 Td[(ate)-258(representation)-257(we)-258(call)]TJ/F46 8.9664 Tf 93.8904 0 Td[(LIR)]TJ/F42 8.9664 Tf 13.4495 0 Td[(.)-258(The)-257(LIR)-258(trace)-257(encodes)-258(all)-258(the)-257(oper)20(-)]TJ -107.3399 -9.9626 Td[(ations)-266(performed)-265(and)-266(the)-266(types)-265(of)-266(all)-266(operands.)-266(The)-265(LIR)-266(trace)-266(also)]TJ 0 -9.9626 Td[(encodes)]TJ/F46 8.9664 Tf 31.4698 0 Td[(guar)37(ds)]TJ/F42 8.9664 Tf 24.5767 0 Td[(,)-289(which)-289(are)-288(checks)-289(that)-289(v)15(erify)-289(that)-288(the)-289(control)-289(\003o)25(w)]TJ -56.0465 -9.9627 Td[(and)-370(types)-369(are)-370(identical)-370(to)-369(those)-370(observ)15(ed)-369(during)-370(trace)-370(recording.)]TJ 0 -9.9626 Td[(Thus,)-306(on)-306(later)-306(e)15(x)15(ecutions,)-307(if)-306(and)-306(only)-306(if)-306(all)-306(guards)-306(are)-307(passed,)-306(the)]TJ 0 -9.9627 Td[(trace)-250(has)-250(the)-250(required)-250(program)-250(semantics.)]TJ 11.9552 -9.9626 Td[(T)35(raceMonk)10(e)15(y)-442(stops)-442(recording)-443(when)-442(e)15(x)15(ecution)-442(returns)-442(to)-442(the)]TJ -11.9552 -9.9626 Td[(loop)-282(header)-282(or)-282(e)15(xits)-282(the)-281(loop.)-282(In)-282(this)-282(case,)-282(e)15(x)15(ecution)-282(returns)-282(to)-282(the)]TJ 0 -9.9627 Td[(loop)-250(header)-250(on)-250(line)-250(4.)]TJ 11.9552 -9.9626 Td[(After)-276(recording)-275(is)-276(\002nished,)-275(T)35(raceMonk)10(e)15(y)-276(compiles)-275(the)-276(trace)-275(to)]TJ -11.9552 -9.9627 Td[(nati)25(v)15(e)-321(code)-322(using)-321(the)-322(recorded)-321(type)-322(information)-321(for)-322(optimization.)]TJ 0 -9.9626 Td[(The)-439(result)-439(is)-439(a)-439(nati)25(v)15(e)-439(code)-439(fragment)-439(that)-439(can)-439(be)-440(entered)-439(if)-439(the)]TJ 263.0137 149.4396 Td[(interpreter)-282(PC)-282(and)-283(the)-282(types)-282(of)-283(v)25(alues)-282(match)-282(those)-282(observ)15(ed)-283(when)]TJ 0 -9.9626 Td[(trace)-392(recording)-393(w)10(as)-392(started.)-392(The)-392(\002rst)-393(trace)-392(in)-392(our)-392(e)15(xample,)]TJ/F29 8.9664 Tf 223.6818 0 Td[(T)]TJ/F28 5.9776 Tf 5.376 -0.9963 Td[(45)]TJ/F42 8.9664 Tf 7.804 0.9963 Td[(,)]TJ -236.8618 -9.9627 Td[(co)15(v)15(ers)-238(lines)-239(4)-238(and)-238(5.)-238(This)-239(trace)-238(can)-238(be)-239(entered)-238(if)-238(the)-239(PC)-238(is)-238(at)-238(line)-239(4,)]TJ/F33 8.9664 Tf 0 -9.9626 Td[(i)]TJ/F42 8.9664 Tf 6.774 0 Td[(and)]TJ/F33 8.9664 Tf 15.0142 0 Td[(k)]TJ/F42 8.9664 Tf 6.774 0 Td[(are)-230(inte)15(gers,)-231(and)]TJ/F33 8.9664 Tf 60.5897 0 Td[(primes)]TJ/F42 8.9664 Tf 30.3105 0 Td[(is)-230(an)-231(object.)-230(After)-231(compiling)]TJ/F29 8.9664 Tf 104.2194 0 Td[(T)]TJ/F28 5.9776 Tf 5.376 -0.9963 Td[(45)]TJ/F42 8.9664 Tf 7.804 0.9963 Td[(,)]TJ -236.8618 -9.9627 Td[(T)35(raceMonk)10(e)15(y)-250(returns)-250(to)-250(the)-250(interpreter)-250(and)-250(loops)-250(back)-250(to)-250(line)-250(1.)]TJ/F41 8.9664 Tf 11.9552 -9.9626 Td[(i=3.)]TJ/F42 8.9664 Tf 17.3136 0 Td[(No)25(w)-333(the)-333(loop)-333(header)-333(at)-333(line)-333(1)-333(has)-333(become)-333(hot,)-332(so)-333(T)35(race-)]TJ -29.2688 -9.9626 Td[(Monk)10(e)15(y)-390(starts)-391(recording.)-390(When)-391(recording)-390(reaches)-391(line)-390(4,)-391(T)35(race-)]TJ 0 -9.9627 Td[(Monk)10(e)15(y)-307(observ)15(es)-307(that)-308(it)-307(has)-307(reached)-307(an)-308(inner)-307(loop)-307(header)-307(that)-308(al-)]TJ 0 -9.9626 Td[(ready)-332(has)-331(a)-332(compiled)-331(trace,)-332(so)-331(T)35(raceMonk)10(e)15(y)-332(attempts)-332(to)-331(nest)-332(the)]TJ 0 -9.9627 Td[(inner)-255(loop)-254(inside)-255(the)-254(current)-255(trace.)-255(The)-254(\002rst)-255(step)-254(is)-255(to)-255(ca)1(ll)-255(the)-255(inner)]TJ 0 -9.9626 Td[(trace)-209(as)-209(a)-208(subroutine.)-209(This)-209(e)15(x)15(ecutes)-209(the)-209(loop)-208(on)-209(line)-209(4)-209(to)-209(completion)]TJ 0 -9.9626 Td[(and)-255(then)-256(returns)-255(to)-255(the)-256(recorder)55(.)-255(T)35(raceMonk)10(e)15(y)-256(v)15(eri\002es)-255(that)-255(the)-256(call)]TJ 0 -9.9627 Td[(w)10(as)-232(successful)-232(and)-232(then)-232(records)-233(the)-232(call)-232(to)-232(the)-232(inner)-232(trace)-232(as)-233(part)-232(of)]TJ 0 -9.9626 Td[(the)-279(current)-279(trace.)-279(Recor)1(ding)-279(continues)-279(until)-279(e)15(x)15(ecution)-279(reaches)-279(line)]TJ 0 -9.9627 Td[(1,)-320(and)-321(at)-320(which)-321(point)-320(T)35(raceMonk)10(e)15(y)-320(\002nishes)-321(and)-320(compiles)-320(a)-321(trace)]TJ 0 -9.9626 Td[(for)-250(the)-250(outer)-250(loop,)]TJ/F29 8.9664 Tf 66.9873 0 Td[(T)]TJ/F28 5.9776 Tf 5.376 -0.9962 Td[(16)]TJ/F42 8.9664 Tf 7.804 0.9962 Td[(.)]TJ ET BT /F41 8.9664 Tf 65.9552 712.0299 Td[(i=4.)]TJ/F42 8.9664 Tf 16.3253 0 Td[(On)-223(this)-222(iteration,)-223(T)35(raceMonk)10(e)15(y)-223(calls)]TJ/F29 8.9664 Tf 132.214 0 Td[(T)]TJ/F28 5.9776 Tf 5.376 -0.9963 Td[(16)]TJ/F42 8.9664 Tf 7.804 0.9963 Td[(.)-223(Because)]TJ/F33 8.9664 Tf 36.1115 0 Td[(i=4)]TJ/F42 8.9664 Tf 14.1219 0 Td[(,)-223(the)]TJ/F33 8.9664 Tf -223.9079 -9.9627 Td[(if)]TJ/F42 8.9664 Tf 12.3342 0 Td[(statement)-326(on)-325(line)-326(2)-325(is)-326(tak)10(en.)-326(This)-325(branch)-326(w)10(as)-325(not)-326(tak)10(en)-325(in)-326(the)]TJ -12.3342 -9.9626 Td[(original)-231(trace,)-231(so)-232(this)-231(causes)]TJ/F29 8.9664 Tf 102.2519 0 Td[(T)]TJ/F28 5.9776 Tf 5.376 -0.9962 Td[(16)]TJ/F42 8.9664 Tf 9.8771 0.9962 Td[(to)-231(f)10(ail)-231(a)-232(guard)-231(and)-231(tak)10(e)-231(a)-231(side)-232(e)15(xit.)]TJ -117.505 -9.9626 Td[(The)-304(e)15(xit)-304(is)-303(not)-304(yet)-304(hot,)-304(so)-304(T)35(raceMonk)10(e)15(y)-303(returns)-304(to)-304(the)-304(interpreter)40(,)]TJ 0 -9.9627 Td[(which)-250(e)15(x)15(ecutes)-250(the)-250(continue)-250(statement.)]TJ/F41 8.9664 Tf 11.9552 -9.9626 Td[(i=5.)]TJ/F42 8.9664 Tf 16.3435 0 Td[(T)35(raceMonk)10(e)15(y)-225(calls)]TJ/F29 8.9664 Tf 70.2197 0 Td[(T)]TJ/F28 5.9776 Tf 5.376 -0.9963 Td[(16)]TJ/F42 8.9664 Tf 7.804 0.9963 Td[(,)-225(which)-225(in)-224(turn)-225(calls)-225(the)-224(nested)-225(trace)]TJ/F29 8.9664 Tf -111.6984 -9.9627 Td[(T)]TJ/F28 5.9776 Tf 5.376 -0.9962 Td[(45)]TJ/F42 8.9664 Tf 7.804 0.9962 Td[(.)]TJ/F29 8.9664 Tf 5.3921 0 Td[(T)]TJ/F28 5.9776 Tf 5.376 -0.9962 Td[(16)]TJ/F42 8.9664 Tf 10.9544 0.9962 Td[(loops)-351(back)-352(to)-351(its)-351(o)25(wn)-352(header)40(,)-351(starting)-351(the)-352(ne)15(xt)-351(iteration)]TJ -34.9025 -9.9626 Td[(without)-250(e)25(v)15(er)-250(returning)-250(to)-250(the)-250(monitor)55(.)]TJ/F41 8.9664 Tf 11.9552 -9.9626 Td[(i=6.)]TJ/F42 8.9664 Tf 16.5046 0 Td[(On)-243(this)-242(iteration,)-243(the)-243(side)-243(e)15(xit)-242(on)-243(line)-243(2)-242(is)-243(tak)10(en)-243(ag)5(ain.)-243(This)]TJ -28.4598 -9.9627 Td[(time,)-352(the)-352(side)-352(e)15(xit)-351(becomes)-352(hot,)-352(so)-352(a)-352(trace)]TJ/F29 8.9664 Tf 159.7422 0 Td[(T)]TJ/F28 5.9776 Tf 5.376 -0.9962 Td[(23)]TJ/F30 5.9776 Tf 7.3058 0 Td[(;)]TJ/F28 5.9776 Tf 2.2693 0 Td[(1)]TJ/F42 8.9664 Tf 7.3061 0.9962 Td[(is)-352(recorded)-352(that)]TJ -181.9994 -9.9626 Td[(co)15(v)15(ers)-258(line)-257(3)-258(and)-257(returns)-258(to)-257(the)-258(loop)-257(header)55(.)-258(Thus,)-258(the)-257(end)-258(of)]TJ/F29 8.9664 Tf 220.0013 0 Td[(T)]TJ/F28 5.9776 Tf 5.376 -0.9963 Td[(23)]TJ/F30 5.9776 Tf 7.3058 0 Td[(;)]TJ/F28 5.9776 Tf 2.2692 0 Td[(1)]TJ/F42 8.9664 Tf -234.9523 -8.9664 Td[(jumps)-313(directly)-314(to)-313(the)-314(start)-313(of)]TJ/F29 8.9664 Tf 107.0194 0 Td[(T)]TJ/F28 5.9776 Tf 5.376 -0.9962 Td[(16)]TJ/F42 8.9664 Tf 7.8039 0.9962 Td[(.)-313(The)-314(side)-313(e)15(xit)-314(is)-313(patched)-314(so)-313(that)]TJ -120.1993 -9.9626 Td[(on)-250(future)-250(iterations,)-250(it)-250(jumps)-250(directly)-250(to)]TJ/F29 8.9664 Tf 142.9581 0 Td[(T)]TJ/F28 5.9776 Tf 5.376 -0.9962 Td[(23)]TJ/F30 5.9776 Tf 7.3058 0 Td[(;)]TJ/F28 5.9776 Tf 2.2692 0 Td[(1)]TJ/F42 8.9664 Tf 4.1511 0.9962 Td[(.)]TJ -150.105 -9.9626 Td[(At)-193(this)-192(point,)-193(T)35(raceMonk)10(e)15(y)-192(has)-193(compiled)-193(enough)-192(traces)-193(to)-192(co)15(v)15(er)]TJ -11.9552 -9.9627 Td[(the)-397(entire)-397(nested)-397(loop)-397(st)1(ructure,)-397(so)-397(the)-397(rest)-397(of)-397(the)-397(program)-397(runs)]TJ 0 -9.9626 Td[(entirely)-250(as)-250(nati)25(v)15(e)-250(code.)]TJ/F41 10.9589 Tf 0 -27.0984 Td[(3.)-1000(T)74(race)-250(T)74(r)18(ees)]TJ/F42 8.9664 Tf 0 -13.9477 Td[(In)-371(this)-370(section,)-371(we)-370(describe)-371(traces,)-370(trace)-371(trees,)-370(and)-371(ho)25(w)-370(the)15(y)-371(are)]TJ 0 -9.9626 Td[(formed)-243(at)-244(run)-243(time.)-244(Although)-243(our)-244(techniques)-243(apply)-244(to)-243(an)15(y)-244(dynamic)]TJ 0 -9.9627 Td[(language)-349(interpreter)40(,)-350(we)-349(will)-350(describe)-349(them)-350(assuming)-349(a)-350(bytecode)]TJ 0 -9.9626 Td[(interpreter)-250(to)-250(k)10(eep)-250(the)-250(e)15(xposition)-250(simple.)]TJ/F41 8.9664 Tf 0 -20.7223 Td[(3.1)-1000(T)74(races)]TJ/F42 8.9664 Tf 0 -13.9477 Td[(A)]TJ/F46 8.9664 Tf 9.4995 0 Td[(tr)15(ace)]TJ/F42 8.9664 Tf 21.3178 0 Td[(is)-338(sim)1(ply)-338(a)-338(program)-337(path,)-338(which)-337(may)-338(cross)-337(function)-338(call)]TJ -30.8173 -9.9626 Td[(boundaries.)-281(T)35(raceMonk)10(e)15(y)-281(focuses)-280(on)]TJ/F46 8.9664 Tf 137.2694 0 Td[(loop)-281(tr)15(aces)]TJ/F42 8.9664 Tf 40.2395 0 Td[(,)-281(that)-281(originate)-281(at)]TJ -177.5089 -9.9627 Td[(a)-284(loop)-284(edge)-284(and)-284(represent)-283(a)-284(single)-284(iteration)-284(through)-284(the)-284(associated)]TJ 0 -9.9626 Td[(loop.)]TJ 11.9552 -9.9627 Td[(Similar)-368(to)-368(an)-368(e)15(xtended)-368(basic)-368(block,)-368(a)-368(trace)-368(is)-367(only)-368(entered)-368(at)]TJ -11.9552 -9.9626 Td[(the)-282(top,)-282(b)20(ut)-281(may)-282(ha)20(v)15(e)-282(man)15(y)-282(e)15(xits.)-282(In)-281(contrast)-282(to)-282(an)-282(e)15(xtended)-282(basic)]TJ 0 -9.9626 Td[(block,)-381(a)-381(trace)-381(can)-382(contain)-381(join)-381(nodes.)-381(Since)-381(a)-381(trace)-382(al)10(w)10(ays)-381(only)]TJ 0 -9.9627 Td[(follo)25(ws)-212(one)-213(single)-212(path)-212(through)-212(the)-213(original)-212(program,)-212(ho)25(we)25(v)15(er)40(,)-213(join)]TJ 0 -9.9626 Td[(nodes)-397(are)-397(not)-397(recognizable)-397(as)-397(such)-397(in)-397(a)-397(trace)-397(and)-398(ha)20(v)15(e)-397(a)-397(single)]TJ 0 -9.9627 Td[(predecessor)-250(node)-250(lik)10(e)-250(re)15(gular)-250(nodes.)]TJ 11.9552 -9.9626 Td[(A)]TJ/F46 8.9664 Tf 8.6978 0 Td[(typed)-248(tr)15(ace)]TJ/F42 8.9664 Tf 42.1603 0 Td[(is)-248(a)-248(trace)-248(annotated)-248(with)-248(a)-248(type)-248(for)-248(e)25(v)15(ery)-248(v)25(ariable)]TJ -62.8133 -9.9626 Td[(\050including)-205(temporaries\051)-205(on)-205(the)-206(trace.)-205(A)-205(typed)-205(trace)-205(also)-205(has)-206(an)-205(entry)]TJ/F46 8.9664 Tf 0 -9.9627 Td[(type)-303(map)]TJ/F42 8.9664 Tf 35.813 0 Td[(gi)25(ving)-303(the)-303(required)-303(types)-303(for)-303(v)25(ariables)-303(used)-303(on)-303(the)-304(trace)]TJ -35.813 -9.9626 Td[(before)-220(the)15(y)-221(are)-220(de\002ned.)-220(F)15(or)-221(e)15(xample,)-220(a)-220(trace)-220(could)-221(ha)20(v)15(e)-220(a)-220(type)-221(map)]TJ/F33 8.9664 Tf 0 -9.9627 Td[(\050x:)-525(int,)-525(b:)-525(boolean\051)]TJ/F42 8.9664 Tf 94.1459 0 Td[(,)-314(meaning)-314(that)-314(the)-314(trace)-315(may)-314(be)-314(entered)]TJ -94.1459 -9.9626 Td[(only)-261(if)-261(the)-261(v)25(alue)-261(of)-261(the)-261(v)25(ariable)]TJ/F33 8.9664 Tf 115.0411 0 Td[(x)]TJ/F42 8.9664 Tf 7.048 0 Td[(is)-261(of)-261(type)]TJ/F33 8.9664 Tf 35.9115 0 Td[(int)]TJ/F42 8.9664 Tf 16.4626 0 Td[(and)-261(the)-261(v)25(alue)-261(of)]TJ/F33 8.9664 Tf 59.9329 0 Td[(b)]TJ/F42 8.9664 Tf -234.3961 -9.9626 Td[(is)-267(of)-266(type)]TJ/F33 8.9664 Tf 36.06 0 Td[(boolean)]TJ/F42 8.9664 Tf 32.9511 0 Td[(.)-267(The)-266(entry)-267(type)-266(map)-267(is)-266(much)-267(lik)10(e)-266(the)-267(signature)]TJ -69.0111 -9.9627 Td[(of)-250(a)-250(function.)]TJ 11.9552 -9.9626 Td[(In)-368(this)-367(paper)40(,)-368(we)-367(only)-368(discuss)-367(typed)-368(loop)-368(traces,)-367(and)-368(we)-367(will)]TJ -11.9552 -9.9627 Td[(refer)-344(to)-343(them)-344(simply)-344(as)-343(\223traces\224.)-344(The)-344(k)10(e)15(y)-344(property)-343(of)-344(typed)-344(loop)]TJ 0 -9.9626 Td[(traces)-267(is)-266(that)-267(the)15(y)-267(can)-267(be)-266(compiled)-267(to)-267(ef)25(\002cient)-266(machine)-267(code)-267(using)]TJ 0 -9.9626 Td[(the)-250(same)-250(techniques)-250(used)-250(for)-250(typed)-250(languages.)]TJ 11.9552 -9.9627 Td[(In)-261(T)35(raceMonk)10(e)15(y)65(,)-262(traces)-261(are)-261(recorded)-261(in)-262(trace-\003a)20(v)20(ored)-261(SSA)]TJ/F46 8.9664 Tf 213.6987 0 Td[(LIR)]TJ/F42 8.9664 Tf -225.6539 -9.9626 Td[(\050lo)25(w-le)25(v)15(el)-338(intermediate)-338(representation\051.)-338(In)-338(trace-\003a)20(v)20(ored)-339(SSA)-338(\050or)]TJ 0 -9.9627 Td[(TSSA\051,)-278(phi)-278(nodes)-278(appear)-279(only)-278(at)-278(the)-278(entry)-278(point,)-278(which)-279(is)-278(reached)]TJ 0 -9.9626 Td[(both)-379(on)-379(entry)-380(and)-379(via)-379(loop)-379(edges.)-379(The)-380(im)1(portant)-380(LIR)-379(primiti)25(v)15(es)]TJ 0 -9.9626 Td[(are)-482(constant)-481(v)25(alues,)-482(memory)-482(loads)-482(and)-481(stores)-482(\050by)-482(address)-482(and)]TJ 0 -9.9627 Td[(of)25(fset\051,)-378(inte)15(ger)-378(operators,)-377(\003oating-point)-378(operators,)-378(function)-378(calls,)]TJ 0 -9.9626 Td[(and)-275(conditional)-275(e)15(xits.)-275(T)80(ype)-274(con)40(v)15(ersions,)-275(such)-275(as)-275(inte)15(ger)-275(to)-275(double,)]TJ 0 -9.9627 Td[(are)-443(represented)-443(by)-444(function)-443(calls.)-443(This)-443(mak)10(es)-443(the)-443(LIR)-443(used)-444(by)]TJ 0 -9.9626 Td[(T)35(raceMonk)10(e)15(y)-390(independent)-390(of)-391(the)-390(concrete)-390(type)-390(system)-390(and)-391(type)]TJ 0 -9.9626 Td[(con)40(v)15(ersion)-368(rules)-368(of)-368(the)-368(source)-368(language.)-368(The)-368(LIR)-368(operations)-368(are)]TJ 0 -9.9627 Td[(generic)-221(enough)-220(that)-221(the)-221(back)10(end)-221(compiler)-220(is)-221(language)-221(independent.)]TJ 0 -9.9626 Td[(Figure)-250(3)-250(sho)25(ws)-250(an)-250(e)15(xample)-250(LIR)-250(trace.)]TJ 11.9552 -9.9627 Td[(Bytecode)-452(interpreters)-453(typically)-452(represent)-452(v)25(alues)-453(in)-452(a)-452(v)25(arious)]TJ -11.9552 -9.9626 Td[(comple)15(x)-304(data)-303(structures)-304(\050e.g.,)-303(hash)-304(tables\051)-303(in)-304(a)-304(box)15(ed)-303(format)-304(\050i.e.,)]TJ 0 -9.9626 Td[(with)-311(attached)-311(type)-311(tag)-311(bits\051.)-311(Since)-311(a)-311(trace)-312(i)1(s)-312(intended)-311(to)-311(represent)]TJ 0 -9.9627 Td[(ef)25(\002cient)-332(code)-333(that)-332(eliminates)-332(all)-332(that)-333(comple)15(xity)65(,)-332(our)-332(traces)-333(oper)20(-)]TJ 0 -9.9626 Td[(ate)-340(on)-339(unbox)15(ed)-340(v)25(alues)-340(in)-340(simpl)1(e)-340(v)25(ariables)-340(and)-340(arrays)-339(as)-340(much)-340(as)]TJ 0 -9.9627 Td[(possible.)]TJ 274.9689 643.5866 Td[(A)-297(trace)-297(records)-297(a)1(ll)-297(its)-297(intermediate)-297(v)25(alues)-297(in)-297(a)-297(small)-296(acti)25(v)25(ation)]TJ -11.9552 -9.9627 Td[(record)-275(area.)-275(T)80(o)-275(mak)10(e)-275(v)25(ariable)-275(accesses)-275(f)10(ast)-275(on)-275(trace,)-275(the)-275(trace)-275(also)]TJ 0 -9.9626 Td[(imports)-300(local)-301(and)-300(global)-301(v)25(ariables)-300(by)-300(unboxing)-301(them)-300(and)-301(cop)10(ying)]TJ 0 -9.9626 Td[(them)-384(to)-384(its)-384(acti)25(v)25(ation)-383(record.)-384(Thus,)-384(the)-384(trace)-384(can)-384(read)-384(and)-384(write)]TJ 0 -9.9627 Td[(these)-201(v)25(ariables)-201(wit)1(h)-201(simple)-201(loads)-201(and)-201(stores)-200(from)-201(a)-201(nati)25(v)15(e)-201(acti)25(v)25(ation)]TJ 0 -9.9626 Td[(recording,)-434(independently)-435(of)-434(the)-435(boxing)-434(mechanism)-435(used)-434(by)-435(the)]TJ 0 -9.9627 Td[(interpreter)55(.)-378(When)-379(the)-378(trace)-378(e)15(xits,)-378(the)-379(VM)-378(box)15(es)-378(the)-378(v)25(alues)-379(from)]TJ 0 -9.9626 Td[(this)-266(nati)25(v)15(e)-265(storage)-266(location)-265(and)-266(copies)-265(them)-266(back)-266(to)-265(the)-266(interpreter)]TJ 0 -9.9626 Td[(structures.)]TJ 11.9552 -9.9627 Td[(F)15(or)-584(e)25(v)15(ery)-583(control-\003o)25(w)-584(branch)-583(in)-584(the)-583(source)-584(program,)-583(the)]TJ -11.9552 -9.9626 Td[(recorder)-229(generates)-229(conditional)-229(e)15(xit)-229(LIR)-230(inst)1(ructions.)-230(These)-229(instruc-)]TJ 0 -9.9627 Td[(tions)-325(e)15(xit)-324(from)-325(the)-324(trace)-325(if)-324(required)-325(control)-324(\003o)25(w)-325(is)-324(dif)25(ferent)-325(from)]TJ 0 -9.9626 Td[(what)-310(it)-310(w)10(as)-310(at)-310(trac)1(e)-310(recording,)-310(ensuring)-310(that)-310(the)-310(trace)-310(instructions)]TJ 0 -9.9626 Td[(are)-416(run)-415(only)-416(if)-415(the)15(y)-416(are)-416(supposed)-415(to.)-416(W)80(e)-416(call)-415(these)-416(instructions)]TJ/F46 8.9664 Tf 0 -9.9627 Td[(guar)37(d)]TJ/F42 8.9664 Tf 23.5724 0 Td[(instructions.)]TJ -11.6172 -9.9626 Td[(Most)-198(of)-199(our)-198(traces)-199(represent)-198(loops)-198(and)-199(end)-198(with)-199(the)-198(special)]TJ/F33 8.9664 Tf 208.319 0 Td[(loop)]TJ/F42 8.9664 Tf -220.2742 -9.9627 Td[(LIR)-306(instruction.)-305(This)-306(is)-305(just)-306(an)-306(unconditional)-305(branch)-306(to)-305(the)-306(top)-306(of)]TJ 0 -9.9626 Td[(the)-250(trace.)-250(Such)-250(traces)-250(return)-250(only)-250(via)-250(guards.)]TJ 11.9552 -9.9626 Td[(No)25(w)65(,)-325(we)-325(describe)-325(the)-326(k)10(e)15(y)-325(optimizations)-325(that)-325(are)-325(performed)-325(as)]TJ -11.9552 -9.9627 Td[(part)-320(of)-320(recording)-320(LIR.)-320(All)-320(of)-321(thes)1(e)-321(optimizations)-320(reduce)-320(comple)15(x)]TJ 0 -9.9626 Td[(dynamic)-396(language)-396(constructs)-397(to)-396(simple)-396(typed)-396(constructs)-396(by)-397(spe-)]TJ 0 -9.9627 Td[(cializing)-238(for)-239(the)-238(current)-239(trace.)-238(Each)-238(optimization)-239(requires)-238(guard)-239(in-)]TJ 0 -9.9626 Td[(structions)-342(to)-342(v)15(erify)-342(their)-342(assumptions)-342(about)-342(the)-342(state)-343(a)1(nd)-343(e)15(xit)-342(the)]TJ 0 -9.9626 Td[(trace)-250(if)-250(necessary)65(.)]TJ/F41 8.9664 Tf 11.9552 -9.9627 Td[(T)74(ype)-250(specialization.)]TJ/F42 8.9664 Tf 0 -9.9626 Td[(All)-369(LIR)-369(primiti)26(v)14(e)1(s)-369(apply)-369(to)-369(operands)-369(of)-369(speci\002c)-369(type)1(s.)-369(Thus,)]TJ -11.9552 -9.9627 Td[(LIR)-435(traces)-435(are)-435(necessarily)-435(type-specialized,)-435(and)-435(a)-436(compiler)-435(can)]TJ 0 -9.9626 Td[(easily)-430(produc)1(e)-430(a)-430(translation)-429(that)-430(requires)-429(no)-430(type)-429(dispatches.)-430(A)]TJ 0 -9.9626 Td[(typical)-291(byt)1(ecode)-291(interpreter)-291(carri)1(es)-291(tag)-291(bits)-290(along)-291(with)-290(each)-291(v)25(alue,)]TJ 0 -9.9627 Td[(and)-241(to)-241(perform)-240(an)15(y)-241(operation,)-241(must)-241(check)-240(the)-241(tag)-241(bits,)-241(dynamically)]TJ 0 -9.9626 Td[(dispatch,)-478(mask)-478(out)-478(the)-478(tag)-478(bits)-478(to)-478(reco)15(v)15(er)-479(the)-478(untagged)-478(v)25(alue,)]TJ 0 -9.9627 Td[(perform)-233(the)-234(operation,)-233(and)-233(then)-234(reappl)1(y)-234(tags.)-233(LIR)-233(omits)-234(e)25(v)15(erything)]TJ 0 -9.9626 Td[(e)15(xcept)-250(the)-250(operation)-250(itself.)]TJ 11.9552 -9.9626 Td[(A)-244(potential)-244(problem)-244(is)-244(that)-244(some)-244(operations)-243(can)-244(produce)-244(v)25(alues)]TJ -11.9552 -9.9627 Td[(of)-368(unpredictable)-368(types.)-369(F)15(or)-368(e)15(xample,)-368(reading)-368(a)-368(property)-368(from)-369(an)]TJ 0 -9.9626 Td[(object)-411(could)-410(yield)-411(a)-410(v)25(alue)-411(of)-411(an)15(y)-410(type,)-411(not)-411(ne)1(cessarily)-411(the)-411(type)]TJ 0 -9.9627 Td[(observ)15(ed)-340(during)-341(rec)1(ording.)-341(The)-340(recorder)-340(emits)-340(guard)-341(instructions)]TJ 0 -9.9626 Td[(that)-284(conditionally)-284(e)15(xit)-284(if)-284(the)-284(operation)-284(yields)-284(a)-284(v)25(alue)-285(of)-284(a)-284(dif)25(ferent)]TJ 0 -9.9626 Td[(type)-462(from)-463(that)-462(seen)-462(during)-463(recording.)-462(These)-462(guard)-463(instructions)]TJ 0 -9.9627 Td[(guarantee)-285(that)-285(as)-285(long)-286(as)-285(e)15(x)15(ecution)-285(is)-285(on)-285(trace,)-285(the)-285(types)-286(of)-285(v)25(alues)]TJ 0 -9.9626 Td[(match)-283(those)-283(of)-283(the)-283(typed)-283(trace.)-283(When)-283(the)-283(VM)-283(observ)15(es)-284(a)-283(side)-283(e)15(xit)]TJ 0 -9.9627 Td[(along)-283(such)-283(a)-283(type)-284(guard,)-283(a)-283(ne)25(w)-283(typed)-283(trace)-283(is)-284(recorded)-283(originating)]TJ 0 -9.9626 Td[(at)-265(the)-265(side)-266(e)15(xit)-265(location,)-265(capturing)-265(the)-266(ne)25(w)-265(type)-265(of)-265(the)-265(operation)-266(in)]TJ 0 -9.9626 Td[(question.)]TJ/F41 8.9664 Tf 11.9552 -9.9627 Td[(Repr)18(esentation)-424(specialization:)-425(objects.)]TJ/F42 8.9664 Tf 153.4538 0 Td[(In)-425(Ja)20(v)25(aS)1(cript,)-425(name)]TJ -165.409 -9.9626 Td[(lookup)-352(semantics)-352(are)-352(comple)15(x)-352(and)-352(potentially)-352(e)15(xpensi)25(v)15(e)-352(because)]TJ 0 -9.9627 Td[(the)15(y)-263(include)-263(features)-263(lik)10(e)-263(object)-263(inheritance)-263(and)]TJ/F33 8.9664 Tf 174.6448 0 Td[(eval)]TJ/F42 8.9664 Tf 18.8292 0 Td[(.)-263(T)80(o)-263(e)25(v)25(aluate)]TJ -193.474 -9.9626 Td[(an)-362(object)-363(property)-362(read)-362(e)15(xpression)-363(li)1(k)10(e)]TJ/F33 8.9664 Tf 147.2531 0 Td[(o.x)]TJ/F42 8.9664 Tf 14.1219 0 Td[(,)-362(the)-363(interpreter)-362(must)]TJ -161.375 -9.9626 Td[(search)-283(the)-283(property)-283(map)-283(of)]TJ/F33 8.9664 Tf 99.8342 0 Td[(o)]TJ/F42 8.9664 Tf 7.2455 0 Td[(and)-283(all)-283(of)-283(its)-283(prototypes)-283(and)-283(parents.)]TJ -107.0797 -9.9627 Td[(Property)-351(maps)-351(can)-351(be)-351(implemented)-351(with)-351(dif)25(ferent)-351(data)-351(structures)]TJ 0 -9.9626 Td[(\050e.g.,)-358(per)20(-object)-359(hash)-358(tables)-358(or)-358(shared)-359(hash)-358(tables\051,)-358(so)-358(the)-359(search)]TJ 0 -9.9627 Td[(process)-420(also)-421(must)-420(dispatch)-420(on)-421(t)1(he)-421(representation)-420(of)-420(each)-421(object)]TJ 0 -9.9626 Td[(found)-210(during)-209(search.)-210(T)35(raceMonk)10(e)15(y)-210(can)-209(simply)-210(observ)15(e)-209(the)-210(result)-210(of)]TJ 0 -9.9626 Td[(the)-312(search)-311(process)-312(and)-312(record)-311(the)-312(simplest)-312(possible)-311(LIR)-312(to)-312(access)]TJ 0 -9.9627 Td[(the)-220(property)-220(v)25(alue.)-219(F)15(or)-220(e)15(xample,)-220(the)-220(search)-220(might)-219(\002nds)-220(the)-220(v)25(alue)-220(of)]TJ/F33 8.9664 Tf 0 -9.9626 Td[(o.x)]TJ/F42 8.9664 Tf 16.242 0 Td[(in)-236(the)-237(prototype)-236(of)]TJ/F33 8.9664 Tf 68.2496 0 Td[(o)]TJ/F42 8.9664 Tf 4.7073 0 Td[(,)-236(which)-237(uses)-236(a)-237(shared)-236(hash-table)-237(represen-)]TJ -89.1989 -9.9627 Td[(tation)-232(that)-233(places)]TJ/F33 8.9664 Tf 62.5359 0 Td[(x)]TJ/F42 8.9664 Tf 6.7923 0 Td[(in)-233(sl)1(ot)-233(2)-233(of)-232(a)-233(property)-232(v)15(ector)55(.)-233(Then)-232(the)-233(recorded)]TJ -69.3282 -9.9626 Td[(can)-226(generate)-226(LIR)-226(that)-226(reads)]TJ/F33 8.9664 Tf 99.7654 0 Td[(o.x)]TJ/F42 8.9664 Tf 16.1497 0 Td[(with)-226(just)-226(tw)10(o)-226(or)-227(three)-226(loads:)-226(one)-226(to)]TJ -115.9151 -9.9626 Td[(get)-225(the)-225(prototype,)-224(possibly)-225(one)-225(to)-225(get)-225(the)-224(property)-225(v)25(alue)-225(v)15(ector)40(,)-225(and)]TJ 0 -9.9627 Td[(one)-262(more)-261(to)-262(get)-262(slot)-261(2)-262(from)-262(the)-261(v)15(ector)55(.)-262(This)-262(is)-261(a)-262(v)25(ast)-262(simpli\002cation)]TJ 0 -9.9626 Td[(and)-261(speedup)-262(compared)-261(to)-261(the)-262(original)-261(interpreter)-261(code.)-262(Inheritance)]TJ 0 -9.9627 Td[(relationships)-307(and)-307(object)-306(representations)-307(can)-307(change)-307(during)-307(e)15(x)15(ecu-)]TJ 0 -9.9626 Td[(tion,)-287(so)-288(the)-287(simpli\002ed)-287(code)-288(require)1(s)-288(guard)-287(instructions)-287(that)-288(ensure)]TJ 0 -9.9626 Td[(the)-200(object)-200(representation)-200(is)-199(the)-200(same.)-200(In)-200(T)35(raceMonk)10(e)15(y)65(,)-200(objects')-200(rep-)]TJ ET BT /F42 8.9664 Tf 54 712.0299 Td[(resentations)-385(are)-384(assigned)-385(an)-385(inte)15(ger)-385(k)10(e)15(y)-384(called)-385(the)]TJ/F46 8.9664 Tf 190.5798 0 Td[(object)-385(shape)]TJ/F42 8.9664 Tf 46.282 0 Td[(.)]TJ -236.8618 -9.9627 Td[(Thus,)-250(the)-250(guard)-250(is)-250(a)-250(simple)-250(equality)-250(check)-250(on)-250(the)-250(object)-250(shape.)]TJ/F41 8.9664 Tf 11.9552 -9.9626 Td[(Repr)18(esentation)-452(specialization:)-452(numbers.)]TJ/F42 8.9664 Tf 161.1756 0 Td[(Ja)20(v)25(aScript)-452(has)-452(no)]TJ -173.1308 -9.9626 Td[(inte)15(ger)-374(type,)-374(only)-375(a)-374(Number)-374(type)-374(that)-375(is)-374(the)-374(set)-374(of)-374(64-bit)-375(IEEE-)]TJ 0 -9.9627 Td[(754)-469(\003oating-pointer)-469(numbers)-468(\050\223doubles\224\051.)-469(But)-469(man)15(y)-469(Ja)20(v)25(aScript)]TJ 0 -9.9626 Td[(operators,)-258(in)-258(particular)-258(array)-258(accesses)-258(and)-258(bitwise)-258(operators,)-258(really)]TJ 0 -9.9627 Td[(operate)-296(on)-296(inte)15(gers,)-296(so)-296(the)15(y)-296(\002rst)-296(con)40(v)15(ert)-296(the)-296(number)-296(to)-296(an)-296(inte)15(ger)40(,)]TJ 0 -10.3249 Td[(and)-373(then)-372(con)40(v)15(ert)-373(an)15(y)-373(inte)15(ger)-373(result)-372(back)-373(to)-373(a)-372(double.)]TJ/F42 5.9776 Tf 196.896 3.809 Td[(1)]TJ/F42 8.9664 Tf 6.8289 -3.809 Td[(Clearly)65(,)-373(a)]TJ -203.7249 -9.9626 Td[(Ja)20(v)25(aScript)-279(VM)-280(that)-279(w)10(ants)-280(to)-280(be)-279(f)10(ast)-280(must)-279(\002nd)-280(a)-279(w)10(ay)-280(to)-279(operate)-280(on)]TJ 0 -9.9627 Td[(inte)15(gers)-250(directly)-250(and)-250(a)20(v)20(oid)-250(these)-250(con)40(v)15(ersions.)]TJ 11.9552 -9.9626 Td[(In)-310(T)35(raceMonk)10(e)15(y)65(,)-310(we)-309(support)-310(tw)10(o)-310(representations)-310(for)-309(numbers:)]TJ -11.9552 -9.9627 Td[(inte)15(gers)-350(and)-351(doubles.)-350(The)-351(interpreter)-350(uses)-350(inte)15(ger)-351(representations)]TJ 0 -9.9626 Td[(as)-225(much)-225(as)-225(it)-225(can,)-225(switching)-225(for)-225(results)-225(that)-225(can)-225(only)-225(be)-225(represented)]TJ 0 -9.9626 Td[(as)-291(doubles.)-290(When)-291(a)-290(trace)-291(is)-291(started,)-290(some)-291(v)25(alues)-290(may)-291(be)-291(imported)]TJ 0 -9.9627 Td[(and)-369(represented)-369(as)-369(inte)15(gers.)-369(Some)-369(operations)-370(on)-369(inte)15(gers)-369(require)]TJ 0 -9.9626 Td[(guards.)-292(F)15(or)-292(e)15(xample,)-292(adding)-291(tw)10(o)-292(inte)15(gers)-292(can)-292(produce)-292(a)-292(v)25(alue)-292(too)]TJ 0 -9.9627 Td[(lar)18(ge)-250(for)-250(the)-250(inte)15(ger)-250(representation.)]TJ/F41 8.9664 Tf 11.9552 -9.9626 Td[(Function)-411(inlining)15(.)]TJ/F42 8.9664 Tf 73.2653 0 Td[(LIR)-411(traces)-411(can)-411(cross)-411(function)-411(boundaries)]TJ -85.2205 -9.9626 Td[(in)-326(either)-325(direction,)-326(achie)25(ving)-325(function)-326(inlining.)-325(Mo)15(v)15(e)-326(instructions)]TJ 0 -9.9627 Td[(need)-292(to)-293(be)-292(recorded)-292(for)-293(function)-292(entry)-292(and)-293(e)15(xit)-292(to)-292(cop)10(y)-293(ar)18(guments)]TJ 0 -9.9626 Td[(in)-225(and)-226(return)-225(v)25(alues)-226(out)1(.)-226(These)-225(mo)15(v)15(e)-226(statements)-225(are)-225(then)-226(optimized)]TJ 0 -9.9627 Td[(a)15(w)10(ay)-305(by)-304(the)-305(compiler)-304(using)-305(cop)10(y)-305(propag)5(ation.)-304(In)-305(order)-304(to)-305(be)-305(able)]TJ 0 -9.9626 Td[(to)-421(return)-421(to)-420(the)-421(interpreter)40(,)-421(the)-421(trace)-421(must)-420(also)-421(generate)-421(LIR)-421(to)]TJ 0 -9.9626 Td[(record)-384(that)-383(a)-384(call)-383(frame)-384(has)-383(been)-384(entered)-383(and)-384(e)15(xited.)-383(The)-384(frame)]TJ 0 -9.9627 Td[(entry)-463(and)-464(e)15(xit)-463(LIR)-463(sa)20(v)15(es)-463(just)-464(enough)-463(information)-463(to)-463(allo)25(w)-464(the)]TJ 0 -9.9626 Td[(intepreter)-324(call)-323(stack)-324(to)-324(be)-323(restored)-324(later)-324(and)-324(is)-323(much)-324(simpler)-324(than)]TJ 0 -9.9627 Td[(the)-362(interpreter')55(s)-362(standard)-362(call)-361(code.)-362(If)-362(the)-362(function)-362(being)-362(entered)]TJ 0 -9.9626 Td[(is)-317(not)-318(constant)-317(\050which)-317(in)-318(Ja)20(v)25(aScript)-317(includes)-318(an)15(y)-317(call)-317(by)-318(function)]TJ 0 -9.9626 Td[(name\051,)-301(the)-301(recorder)-301(must)-301(also)-300(emit)-301(LIR)-301(to)-301(guard)-301(that)-301(the)-301(function)]TJ 0 -9.9627 Td[(is)-250(the)-250(same.)]TJ/F41 8.9664 Tf 11.9552 -9.9626 Td[(Guards)-485(and)-484(side)-485(exits.)]TJ/F42 8.9664 Tf 95.3529 0 Td[(Each)-485(optimization)-484(described)-485(abo)15(v)15(e)]TJ -107.3081 -9.9627 Td[(requires)-419(one)-418(or)-419(more)-418(guards)-419(to)-418(v)15(erify)-419(the)-419(assumptions)-418(made)-419(in)]TJ 0 -9.9626 Td[(doing)-260(the)-260(optimization.)-260(A)-261(guard)-260(is)-260(just)-260(a)-260(group)-260(of)-261(LIR)-260(instructions)]TJ 0 -9.9626 Td[(that)-384(performs)-385(a)-384(test)-385(and)-384(conditional)-385(e)15(xit.)-384(The)-384(e)15(xit)-385(branches)-384(to)-385(a)]TJ/F46 8.9664 Tf 0 -9.9627 Td[(side)-372(e)20(xit)]TJ/F42 8.9664 Tf 30.551 0 Td[(,)-372(a)-373(small)-372(of)25(f-trace)-372(piece)-373(of)-372(LIR)-372(that)-372(returns)-373(a)-372(pointer)-372(to)]TJ -30.551 -9.9626 Td[(a)-416(structure)-416(that)-416(describes)-416(the)-416(reason)-416(for)-416(the)-416(e)15(xit)-416(along)-416(with)-416(the)]TJ 0 -9.9627 Td[(interpreter)-239(PC)-239(at)-239(the)-239(e)15(xit)-239(point)-239(and)-239(an)15(y)-239(other)-240(dat)1(a)-240(needed)-239(to)-239(restore)]TJ 0 -9.9626 Td[(the)-250(interpreter')55(s)-250(state)-250(structures.)]TJ/F41 8.9664 Tf 11.9552 -9.9626 Td[(Aborts.)]TJ/F42 8.9664 Tf 31.7673 0 Td[(Some)-349(constructs)-349(are)-349(dif)25(\002cult)-349(to)-349(record)-349(in)-349(LIR)-348(traces.)]TJ -43.7225 -9.9627 Td[(F)15(or)-376(e)15(xample,)]TJ/F33 8.9664 Tf 51.5401 0 Td[(eval)]TJ/F42 8.9664 Tf 22.1969 0 Td[(or)-376(calls)-375(to)-376(e)15(xternal)-375(functions)-376(can)-375(change)-376(the)]TJ -73.737 -9.9626 Td[(program)-427(state)-427(in)-427(unpredictable)-427(w)10(ays,)-427(making)-427(it)-428(dif)25(\002c)1(ult)-428(for)-427(the)]TJ 0 -9.9627 Td[(tracer)-344(to)-343(kno)25(w)-344(the)-344(current)-343(type)-344(map)-344(in)-344(order)-343(to)-344(continue)-344(tracing.)]TJ 0 -9.9626 Td[(A)-272(tracing)-272(implementation)-272(can)-272(also)-272(ha)20(v)15(e)-272(an)15(y)-272(number)-273(of)-272(other)-272(limi-)]TJ 0 -9.9626 Td[(tations,)-272(e.g.,a)-271(small-memory)-272(de)25(vice)-271(may)-272(limit)-272(the)-271(length)-272(of)-272(traces.)]TJ 0 -9.9627 Td[(When)-313(an)15(y)-313(situation)-313(occurs)-312(that)-313(pre)25(v)15(ents)-313(the)-313(implementation)-313(from)]TJ 0 -9.9626 Td[(continuing)-211(trace)-211(recording,)-211(the)-211(implementation)]TJ/F46 8.9664 Tf 169.0923 0 Td[(aborts)]TJ/F42 8.9664 Tf 24.8109 0 Td[(trace)-211(record-)]TJ -193.9032 -9.9627 Td[(ing)-250(and)-250(returns)-250(to)-250(the)-250(trace)-250(monitor)55(.)]TJ/F41 8.9664 Tf 0 -24.4515 Td[(3.2)-1000(T)74(race)-250(T)74(r)18(ees)]TJ/F42 8.9664 Tf 0 -13.9477 Td[(Especially)-376(simple)-376(loops,)-375(namely)-376(those)-376(where)-376(control)-376(\003o)25(w)65(,)-376(v)25(alue)]TJ 0 -9.9626 Td[(types,)-244(v)25(alue)-245(representations,)-244(and)-245(inlined)-244(functions)-245(are)-244(all)-245(in)40(v)25(ariant,)]TJ 0 -9.9626 Td[(can)-311(be)-311(represented)-312(by)-311(a)-311(single)-311(trace.)-312(But)-311(most)-311(loops)-311(ha)20(v)15(e)-311(at)-312(least)]TJ 0 -9.9627 Td[(some)-361(v)25(ariation,)-361(and)-361(so)-361(the)-360(program)-361(will)-361(tak)10(e)-361(side)-361(e)15(xits)-361(from)-361(the)]TJ 0 -9.9626 Td[(main)-341(trace.)-342(When)-341(a)-342(side)-341(e)15(xit)-342(becomes)-341(hot,)-342(T)35(raceMonk)10(e)15(y)-341(starts)-342(a)]TJ 0 -9.9627 Td[(ne)25(w)]TJ/F46 8.9664 Tf 17.021 0 Td[(br)15(anc)15(h)-257(tr)15(ace)]TJ/F42 8.9664 Tf 48.0385 0 Td[(from)-257(that)-258(point)-257(and)-257(patches)-258(the)-257(side)-257(e)15(xit)-257(to)-258(jump)]TJ -65.0595 -9.9626 Td[(directly)-235(to)-235(that)-234(trace.)-235(In)-235(this)-235(w)10(ay)65(,)-235(a)-234(single)-235(trace)-235(e)15(xpands)-235(on)-235(demand)]TJ 0 -9.9626 Td[(to)-250(a)-250(single-entry)65(,)-250(multiple-e)15(xit)]TJ/F46 8.9664 Tf 110.6079 0 Td[(tr)15(ace)-250(tr)37(ee)]TJ/F42 8.9664 Tf 34.1434 0 Td[(.)]TJ -132.7961 -9.9627 Td[(This)-280(section)-280(e)15(xplains)-280(ho)25(w)-281(trace)-280(trees)-280(are)-280(formed)-280(during)-280(e)15(x)15(ecu-)]TJ -11.9552 -9.9626 Td[(tion.)-267(The)-267(goal)-267(is)-267(to)-267(form)-267(trace)-267(trees)-267(during)-267(e)15(x)15(ecution)-267(that)-267(co)15(v)15(er)-267(all)]TJ 0 -9.9627 Td[(the)-250(hot)-250(paths)-250(of)-250(the)-250(program.)]TJ ET 1 0 0 1 54 95.3424 cm q []0 d 0 J 0.3288 w 0 0.1644 m 119.5517 0.1644 l S Q 1 0 0 1 -54 -95.3424 cm BT /F42 5.9776 Tf 54 89.1889 Td[(1)]TJ/F42 7.9701 Tf 4.4832 -2.8128 Td[(Arrays)-246(are)-247(actually)-246(w)10(orse)-246(than)-247(this:)-246(if)-246(the)-247(inde)15(x)-246(v)25(alue)-246(is)-247(a)-246(number)40(,)-246(it)-247(must)]TJ -4.4832 -8.9664 Td[(be)-249(con)40(v)15(erted)-250(from)-249(a)-250(double)-249(to)-249(a)-250(string)-249(for)-250(the)-249(property)-249(access)-250(operator)40(,)-249(and)]TJ 0 -8.9664 Td[(then)-250(to)-250(an)-250(inte)15(ger)-250(internally)-250(to)-250(the)-250(array)-250(implementation.)]TJ/F41 8.9664 Tf 274.9689 643.5866 Td[(Starting)-230(a)-231(tr)18(ee.)]TJ/F42 8.9664 Tf 59.0707 0 Td[(T)35(ree)-230(trees)-231(al)10(w)10(ays)-230(start)-230(at)-231(loop)-230(headers,)-230(because)]TJ -71.0259 -9.9627 Td[(the)15(y)-225(are)-225(a)-225(natural)-226(place)-225(to)-225(look)-225(for)-225(hot)-225(paths.)-225(In)-226(T)35(raceMonk)10(e)15(y)65(,)-225(loop)]TJ 0 -9.9626 Td[(headers)-402(are)-402(easy)-402(to)-402(detect\226the)-402(bytecode)-402(compiler)-403(ensur)1(es)-403(that)-402(a)]TJ 0 -9.9627 Td[(bytecode)-289(is)-289(a)-288(loop)-289(header)-289(if)25(f)-289(it)-289(is)-289(the)-288(tar)18(get)-289(of)-289(a)-289(backw)10(ard)-289(branch.)]TJ 0 -9.9626 Td[(T)35(raceMonk)10(e)15(y)-265(starts)-265(a)-265(tree)-266(when)-265(a)-265(gi)25(v)15(en)-265(loop)-265(header)-265(has)-266(bee)1(n)-266(e)15(x)15(e-)]TJ 0 -9.9626 Td[(cuted)-275(a)-276(certain)-275(number)-276(of)-275(times)-276(\0502)-275(in)-276(the)-275(current)-276(implementation\051.)]TJ 0 -9.9627 Td[(Starting)-283(a)-284(tree)-283(just)-284(means)-283(starting)-284(recordi)1(ng)-284(a)-283(trace)-284(for)-283(the)-284(current)]TJ 0 -9.9626 Td[(point)-221(and)-220(type)-221(map)-221(and)-220(marking)-221(the)-221(trace)-221(as)-220(the)-221(root)-221(of)-220(a)-221(tree.)-221(Each)]TJ 0 -9.9627 Td[(tree)-233(is)-234(associated)-233(with)-233(a)-234(loop)-233(header)-233(and)-234(type)-233(map,)-234(so)-233(there)-233(may)-234(be)]TJ 0 -9.9626 Td[(se)25(v)15(eral)-250(trees)-250(for)-250(a)-250(gi)25(v)15(en)-250(loop)-250(header)55(.)]TJ/F41 8.9664 Tf 11.9552 -9.9626 Td[(Closing)-250(the)-250(loop.)]TJ/F42 8.9664 Tf 66.2608 0 Td[(T)35(race)-250(recording)-250(can)-250(end)-250(in)-250(se)25(v)15(eral)-250(w)10(ays.)]TJ -66.2608 -9.9627 Td[(Ideally)65(,)-310(the)-310(trace)-310(reaches)-310(the)-310(loop)-310(header)-310(where)-310(it)-310(started)-310(with)]TJ -11.9552 -9.9626 Td[(the)-369(same)-369(type)-369(map)-370(as)-369(on)-369(entry)65(.)-369(This)-369(is)-369(called)-369(a)]TJ/F46 8.9664 Tf 180.5073 0 Td[(type-stable)]TJ/F42 8.9664 Tf 42.654 0 Td[(loop)]TJ -223.1613 -9.9627 Td[(iteration.)-372(In)-372(this)-372(case,)-372(the)-373(end)-372(of)-372(the)-372(trace)-372(can)-372(jump)-372(right)-373(to)-372(the)]TJ 0 -9.9626 Td[(be)15(ginning,)-264(as)-265(all)-264(the)-265(v)25(alue)-264(representations)-265(are)-264(e)15(xactly)-265(as)-264(needed)-265(to)]TJ 0 -9.9626 Td[(enter)-294(the)-294(trace.)-294(The)-294(jump)-294(can)-294(e)25(v)15(en)-294(skip)-294(the)-294(usual)-294(code)-294(that)-294(w)10(ould)]TJ 0 -9.9627 Td[(cop)10(y)-276(out)-276(the)-276(state)-275(at)-276(the)-276(end)-276(of)-276(the)-276(trace)-276(and)-275(cop)10(y)-276(it)-276(back)-276(in)-276(to)-276(the)]TJ 0 -9.9626 Td[(trace)-250(acti)25(v)25(ation)-250(record)-250(to)-250(enter)-250(a)-250(trace.)]TJ 11.9552 -9.9627 Td[(In)-374(certain)-375(cases)-374(the)-375(trace)-374(might)-374(reach)-375(the)-374(loop)-375(header)-374(with)-374(a)]TJ -11.9552 -9.9626 Td[(dif)25(ferent)-235(type)-235(map.)-235(This)-235(scenario)-235(is)-235(sometime)-235(observ)15(ed)-235(for)-235(the)-235(\002rst)]TJ 0 -9.9626 Td[(iteration)-217(of)-217(a)-217(loop.)-217(Some)-217(v)25(ariables)-217(inside)-217(the)-217(loop)-217(might)-217(initially)-217(be)]TJ/F46 8.9664 Tf 0 -9.9627 Td[(unde\002ned)]TJ/F42 8.9664 Tf 34.8612 0 Td[(,)-203(before)-203(the)15(y)-203(are)-204(set)-203(to)-203(a)-203(concrete)-203(type)-203(during)-203(the)-204(\002rst)-203(loop)]TJ -34.8612 -9.9626 Td[(iteration.)-411(When)-410(recording)-411(such)-410(an)-411(iteration,)-411(t)1(he)-411(recorder)-411(cannot)]TJ 0 -9.9627 Td[(link)-273(the)-273(trace)-274(back)-273(to)-273(its)-273(o)25(wn)-274(loop)-273(header)-273(since)-273(it)-273(is)]TJ/F46 8.9664 Tf 188.5515 0 Td[(type-unstable)]TJ/F42 8.9664 Tf 48.3103 0 Td[(.)]TJ -236.8618 -9.9626 Td[(Instead,)-264(the)-263(iteration)-264(is)-263(terminated)-264(with)-263(a)-264(side)-263(e)15(xit)-264(that)-263(will)-264(al)10(w)10(ays)]TJ 0 -9.9626 Td[(f)10(ail)-339(and)-338(return)-339(to)-338(the)-339(interpreter)55(.)-339(At)-338(the)-339(same)-338(time)-339(a)-339(ne)25(w)-338(trace)-339(is)]TJ 0 -9.9627 Td[(recorded)-368(with)-369(the)-368(ne)25(w)-368(type)-369(map.)-368(Ev)15(ery)-369(time)-368(an)-368(additional)-369(type-)]TJ 0 -9.9626 Td[(unstable)-235(trace)-236(is)-236(adde)1(d)-236(to)-236(a)-235(re)15(gion,)-236(its)-235(e)15(xit)-236(type)-235(map)-236(is)-235(compared)-236(to)]TJ 0 -9.9627 Td[(the)-306(entry)-307(m)1(ap)-307(of)-306(all)-306(e)15(xisting)-306(traces)-307(in)-306(case)-306(the)15(y)-306(complement)-307(each)]TJ 0 -9.9626 Td[(other)55(.)-316(W)40(ith)-316(this)-316(approach)-315(we)-316(are)-316(able)-316(to)-316(co)15(v)15(er)-316(type-unstable)-316(loop)]TJ 0 -9.9626 Td[(iterations)-250(as)-250(long)-250(the)15(y)-250(e)25(v)15(entually)-250(form)-250(a)-250(stable)-250(equilibrium.)]TJ 11.9552 -9.9627 Td[(Finally)65(,)-333(the)-334(trace)-333(might)-333(e)15(xit)-334(the)-333(loop)-333(before)-334(reaching)-333(the)-333(loop)]TJ -11.9552 -9.9626 Td[(header)40(,)-242(for)-242(e)15(xample)-243(because)-242(e)15(x)15(ecution)-242(reaches)-242(a)]TJ/F33 8.9664 Tf 175.5107 0 Td[(break)]TJ/F42 8.9664 Tf 25.7082 0 Td[(or)]TJ/F33 8.9664 Tf 9.6407 0 Td[(return)]TJ/F42 8.9664 Tf -210.8596 -9.9627 Td[(statement.)-298(In)-298(this)-297(case,)-298(the)-298(VM)-298(simply)-298(ends)-297(the)-298(trace)-298(with)-298(an)-298(e)15(xit)]TJ 0 -9.9626 Td[(to)-250(the)-250(trace)-250(monitor)55(.)]TJ 11.9552 -9.9626 Td[(As)-354(mentioned)-353(pre)25(viously)65(,)-354(we)-353(may)-354(speculati)25(v)15(ely)-353(chose)-354(to)-353(rep-)]TJ -11.9552 -9.9627 Td[(resent)-284(certain)-284(Number)20(-typed)-284(v)25(alues)-285(as)-284(inte)15(gers)-284(on)-284(trace.)-284(W)80(e)-284(do)-285(so)]TJ 0 -9.9626 Td[(when)-337(we)-336(observ)15(e)-337(that)-336(Number)20(-typed)-337(v)25(ariables)-337(c)1(ontain)-337(an)-337(inte)15(ger)]TJ 0 -9.9627 Td[(v)25(alue)-293(at)-293(trace)-293(entry)65(.)-293(If)-292(during)-293(trace)-293(recording)-293(the)-293(v)25(ariable)-293(is)-293(une)15(x-)]TJ 0 -9.9626 Td[(pectedly)-322(assigned)-322(a)-322(non-inte)15(ger)-322(v)25(alue,)-322(we)-322(ha)20(v)15(e)-322(to)-322(widen)-322(the)-322(type)]TJ 0 -9.9626 Td[(of)-253(the)-252(v)25(ariable)-253(to)-253(a)-253(double.)-252(As)-253(a)-253(result,)-253(the)-252(recorded)-253(trace)-253(becomes)]TJ 0 -9.9627 Td[(inherently)-402(type-unstable)-402(since)-402(it)-402(starts)-402(with)-402(an)-403(i)1(nte)15(ger)-403(v)25(alue)-402(b)20(ut)]TJ 0 -9.9626 Td[(ends)-287(with)-287(a)-288(double)-287(v)25(alue.)-287(This)-287(represents)-287(a)-288(mis-speculat)1(ion,)-288(since)]TJ 0 -9.9627 Td[(at)-247(trace)-247(entry)-247(we)-246(specialized)-247(the)-247(Number)20(-typed)-247(v)25(alue)-247(to)-247(an)-247(inte)15(ger)40(,)]TJ 0 -9.9626 Td[(assuming)-213(that)-213(at)-214(the)-213(loop)-213(edge)-213(we)-214(w)10(ould)-213(ag)5(ain)-213(\002nd)-213(an)-213(inte)15(ger)-214(v)25(alue)]TJ 0 -9.9626 Td[(in)-255(the)-255(v)25(ariable,)-256(allo)25(wing)-255(us)-255(to)-255(close)-256(the)-255(loop.)-255(T)80(o)-255(a)20(v)20(oid)-255(future)-256(spec-)]TJ 0 -9.9627 Td[(ulati)25(v)15(e)-309(f)10(ai)1(lures)-309(in)40(v)20(olving)-309(this)-308(v)25(ariable,)-309(and)-308(to)-309(obtain)-308(a)-309(type-stable)]TJ 0 -9.9626 Td[(trace)-227(we)-227(note)-227(the)-227(f)10(act)-227(that)-227(the)-227(v)25(ariable)-227(in)-227(question)-227(as)-227(been)-227(observ)15(ed)]TJ 0 -9.9627 Td[(to)-264(sometimes)-264(hold)-264(non-inte)15(ger)-264(v)25(alues)-264(in)-264(an)-265(advisory)-264(data)-264(structure)]TJ 0 -9.9626 Td[(which)-250(we)-250(call)-250(the)-250(\223oracle\224.)]TJ 11.9552 -9.9626 Td[(When)-296(compiling)-296(loops,)-295(we)-296(consult)-296(the)-296(oracle)-296(before)-295(specializ-)]TJ -11.9552 -9.9627 Td[(ing)-355(v)25(alues)-356(to)-355(inte)15(gers.)-356(Speculation)-355(to)25(w)10(ards)-356(inte)15(gers)-355(is)-356(performed)]TJ 0 -9.9626 Td[(only)-363(if)-362(no)-363(adv)15(erse)-362(information)-363(is)-362(kno)25(wn)-363(to)-362(the)-363(oracle)-362(about)-363(that)]TJ 0 -9.9627 Td[(particular)-297(v)25(ariable.)-297(Whene)25(v)15(er)-298(we)-297(accidentally)-297(compile)-297(a)-297(loop)-298(that)]TJ 0 -9.9626 Td[(is)-388(type-unstable)-388(due)-388(to)-388(mis-speculation)-388(of)-388(a)-389(Number)20(-typed)-388(v)25(ari-)]TJ 0 -9.9626 Td[(able,)-331(we)-331(immediately)-331(trigger)-331(the)-331(recording)-331(of)-331(a)-331(ne)25(w)-331(trace,)-331(which)]TJ 0 -9.9627 Td[(based)-255(on)-255(the)-255(no)25(w)-256(updated)-255(oracle)-255(information)-255(will)-255(start)-255(with)-255(a)-256(dou-)]TJ 0 -9.9626 Td[(ble)-250(v)25(alue)-250(and)-250(thus)-250(become)-250(type)-250(stable.)]TJ/F41 8.9664 Tf 11.9552 -9.9627 Td[(Extending)-423(a)-424(tr)18(ee.)]TJ/F42 8.9664 Tf 72.2432 0 Td[(Side)-423(e)15(xits)-424(lead)-423(to)-424(di)1(f)25(ferent)-424(paths)-423(through)]TJ -84.1984 -9.9626 Td[(the)-300(loop,)-300(or)-300(paths)-300(with)-300(dif)25(ferent)-300(types)-300(or)-301(representations)1(.)-301(Thus,)-300(to)]TJ 0 -9.9626 Td[(completely)-218(co)15(v)15(er)-218(the)-217(loop,)-218(the)-218(VM)-218(must)-218(record)-217(traces)-218(starting)-218(at)-218(all)]TJ 0 -9.9627 Td[(side)-263(e)15(xits.)-263(These)-263(traces)-263(are)-263(recorded)-263(much)-263(lik)10(e)-264(root)-263(traces:)-263(there)-263(is)]TJ 0 -9.9626 Td[(a)-217(counter)-217(for)-218(each)-217(side)-217(e)15(xit,)-217(and)-218(when)-217(the)-217(counter)-217(reaches)-217(a)-218(hotness)]TJ 0 -9.9627 Td[(threshold,)-286(recording)-286(starts.)-286(Recording)-286(stops)-286(e)15(xactly)-286(as)-286(for)-287(the)-286(root)]TJ 0 -9.9626 Td[(trace,)-250(using)-250(the)-250(loop)-250(header)-250(of)-250(the)-250(root)-250(trace)-250(as)-250(the)-250(tar)18(get)-250(to)-250(reach.)]TJ ET BT /F42 8.9664 Tf 65.9552 712.0299 Td[(Our)-263(implementation)-263(does)-263(not)-263(e)15(xtend)-263(at)-263(all)-263(side)-263(e)15(xits.)-263(It)-263(e)15(xtends)]TJ -11.9552 -9.9627 Td[(only)-223(if)-224(the)-223(side)-223(e)15(xit)-224(is)-223(for)-223(a)-224(control-\003o)25(w)-223(branch,)-223(and)-224(only)-223(if)-223(the)-224(side)]TJ 0 -9.9626 Td[(e)15(xit)-252(does)-252(not)-251(lea)20(v)15(e)-252(the)-252(loop.)-252(In)-252(particular)-252(we)-251(do)-252(not)-252(w)10(ant)-252(to)-252(e)15(xtend)]TJ 0 -9.9626 Td[(a)-362(trace)-361(tree)-362(along)-362(a)-361(path)-362(that)-362(leads)-361(to)-362(an)-362(outer)-361(loop,)-362(because)-362(we)]TJ 0 -9.9627 Td[(w)10(ant)-250(to)-250(co)15(v)15(er)-250(such)-250(paths)-250(in)-250(an)-250(outer)-250(tree)-250(through)-250(tree)]TJ/F46 8.9664 Tf 192.623 0 Td[(nesting)]TJ/F42 8.9664 Tf 25.9036 0 Td[(.)]TJ/F41 8.9664 Tf -218.5266 -17.5342 Td[(3.3)-1000(Blacklisting)]TJ/F42 8.9664 Tf 0 -13.9477 Td[(Sometimes,)-463(a)-463(program)-463(follo)25(ws)-463(a)-463(path)-463(that)-463(cannot)-463(be)-463(compiled)]TJ 0 -9.9627 Td[(into)-309(a)-309(trace,)-309(usually)-308(because)-309(of)-309(limitations)-309(in)-309(the)-309(implementation.)]TJ 0 -9.9626 Td[(T)35(raceMonk)10(e)15(y)-362(does)-362(not)-362(currently)-362(support)-362(recording)-363(thro)25(wing)-362(and)]TJ 0 -9.9626 Td[(catching)-266(of)-265(arbitrary)-266(e)15(xceptions.)-265(This)-266(design)-265(trade)-266(of)25(f)-265(w)10(as)-266(chosen,)]TJ 0 -9.9627 Td[(because)-396(e)15(xceptions)-395(are)-396(usually)-396(rare)-396(in)-395(Ja)20(v)25(aScript.)-396(Ho)25(we)25(v)15(er)40(,)-396(if)-396(a)]TJ 0 -9.9626 Td[(program)-430(opts)-429(to)-430(use)-430(e)15(xceptions)-430(intensi)25(v)15(ely)65(,)-429(we)-430(w)10(ould)-430(suddenly)]TJ 0 -9.9627 Td[(incur)-309(a)-309(punishing)-310(runt)1(ime)-310(o)15(v)15(erhead)-309(if)-309(we)-309(repeatedly)-309(try)-310(to)-309(record)]TJ 0 -9.9626 Td[(a)-371(trace)-371(for)-371(this)-371(path)-370(and)-371(repeatedly)-371(f)10(ail)-371(to)-371(do)-371(so,)-371(since)-371(we)-371(abort)]TJ 0 -9.9626 Td[(tracing)-250(e)25(v)15(ery)-250(time)-250(we)-250(observ)15(e)-250(an)-250(e)15(xception)-250(being)-250(thro)25(wn.)]TJ 11.9552 -9.9627 Td[(As)-221(a)-220(result,)-221(if)-220(a)-221(hot)-220(loop)-221(contains)-221(traces)-220(that)-221(al)10(w)10(ays)-220(f)10(ail,)-221(the)-220(VM)]TJ -11.9552 -9.9626 Td[(could)-306(potentially)-305(run)-306(much)-306(more)-305(slo)25(wly)-306(than)-305(the)-306(base)-306(interpreter:)]TJ 0 -9.9627 Td[(the)-251(VM)-251(repeatedly)-251(spends)-251(t)1(ime)-251(trying)-251(to)-251(record)-251(traces,)-251(b)20(ut)-251(is)-251(ne)25(v)15(er)]TJ 0 -9.9626 Td[(able)-289(to)-289(run)-288(an)15(y)65(.)-289(T)80(o)-289(a)20(v)20(oid)-289(this)-289(problem,)-288(whene)25(v)15(er)-289(the)-289(VM)-289(is)-289(about)]TJ 0 -9.9626 Td[(to)-231(start)-231(tracing,)-231(it)-231(must)-230(try)-231(to)-231(predict)-231(whether)-231(it)-231(will)-231(\002nish)-231(the)-231(trace.)]TJ 11.9552 -9.9627 Td[(Our)-426(prediction)-427(algorithm)-426(is)-427(based)-426(on)]TJ/F46 8.9664 Tf 143.4761 0 Td[(blac)20(klisting)]TJ/F42 8.9664 Tf 45.4898 0 Td[(traces)-426(that)]TJ -200.9211 -9.9626 Td[(ha)20(v)15(e)-212(been)-212(tried)-212(and)-212(f)10(ailed.)-212(When)-212(the)-212(VM)-212(f)10(ails)-212(to)-212(\002nish)-212(a)-212(trace)-212(start-)]TJ 0 -9.9627 Td[(ing)-214(at)-214(a)-213(gi)25(v)15(en)-214(point,)-214(the)-214(VM)-213(records)-214(that)-214(a)-213(f)10(ailure)-214(has)-214(occurred.)-214(The)]TJ 0 -9.9626 Td[(VM)-193(also)-193(sets)-192(a)-193(counter)-193(so)-193(that)-193(it)-193(will)-193(not)-192(try)-193(to)-193(record)-193(a)-193(trace)-193(starting)]TJ 0 -9.9626 Td[(at)-319(that)-320(point)-319(until)-319(it)-320(is)-319(passed)-319(a)-320(fe)25(w)-319(more)-319(times)-320(\05032)-319(in)-319(our)-320(imple-)]TJ 0 -9.9627 Td[(mentation\051.)-345(This)]TJ/F46 8.9664 Tf 63.2261 0 Td[(bac)20(k)10(of)18(f)]TJ/F42 8.9664 Tf 30.3714 0 Td[(counter)-345(gi)25(v)15(es)-346(t)1(emporary)-346(conditions)-345(that)]TJ -93.5975 -9.9626 Td[(pre)25(v)15(ent)-318(tracing)-318(a)-319(chance)-318(to)-318(end.)-318(F)15(or)-319(e)15(xample,)-318(a)-318(loop)-318(may)-319(beha)20(v)15(e)]TJ 0 -9.9627 Td[(dif)25(ferently)-205(during)-206(startup)-205(than)-205(during)-206(its)-205(steady-state)-205(e)15(x)15(ecution.)-206(Af-)]TJ 0 -9.9626 Td[(ter)-316(a)-315(gi)25(v)15(en)-316(number)-315(of)-316(f)10(ailures)-315(\0502)-316(in)-315(our)-316(implementation\051,)-315(the)-316(VM)]TJ 0 -9.9626 Td[(marks)-241(the)-240(fragment)-241(as)-240(blacklisted,)-241(which)-240(means)-241(the)-241(VM)-240(will)-241(ne)25(v)15(er)]TJ 0 -9.9627 Td[(ag)5(ain)-250(start)-250(recording)-250(at)-250(that)-250(point.)]TJ 11.9552 -9.9626 Td[(After)-426(implem)1(enting)-426(this)-426(basic)-425(strate)15(gy)65(,)-426(we)-425(observ)15(ed)-426(that)-425(for)]TJ -11.9552 -9.9627 Td[(small)-275(loops)-276(that)-275(get)-275(blacklisted,)-275(the)-276(system)-275(can)-275(spend)-275(a)-276(noticeable)]TJ 0 -9.9626 Td[(amount)-239(of)-239(time)-239(just)-239(\002nding)-239(the)-239(loop)-239(fragment)-239(and)-239(determining)-239(that)]TJ 0 -9.9626 Td[(it)-238(has)-238(been)-239(blacklisted.)-238(W)80(e)-238(no)25(w)-238(a)20(v)20(oid)-239(that)-238(problem)-238(by)-238(patching)-239(the)]TJ 0 -9.9627 Td[(bytecode.)-291(W)80(e)-290(de\002ne)-291(an)-291(e)15(xtra)-290(no-op)-291(bytecode)-291(that)-290(indicates)-291(a)-291(loop)]TJ 0 -9.9626 Td[(header)55(.)-327(The)-326(VM)-327(calls)-326(into)-327(the)-327(trace)-326(monitor)-327(e)25(v)15(ery)-326(time)-327(the)-327(inter)20(-)]TJ 0 -9.9627 Td[(preter)-356(e)15(x)15(ecutes)-356(a)-356(loop)-357(header)-356(no-op.)-356(T)80(o)-356(blacklist)-356(a)-357(fragm)1(ent,)-357(we)]TJ 0 -9.9626 Td[(simply)-319(replace)-318(the)-319(loop)-319(header)-318(no-op)-319(with)-319(a)-318(re)15(gular)-319(no-op.)-319(Thus,)]TJ 0 -9.9626 Td[(the)-250(interpreter)-250(will)-250(ne)25(v)15(er)-250(ag)5(ain)-250(e)25(v)15(en)-250(call)-250(into)-250(the)-250(trace)-250(monitor)55(.)]TJ 11.9552 -9.9627 Td[(There)-220(is)-220(a)-219(related)-220(problem)-220(we)-220(ha)20(v)15(e)-219(not)-220(yet)-220(solv)15(ed,)-220(which)-219(occurs)]TJ -11.9552 -9.9626 Td[(when)-250(a)-250(loop)-250(meets)-250(all)-250(of)-250(these)-250(conditions:)]TJ/F26 7.9701 Tf 5.2303 -13.9462 Td[(\017)]TJ/F42 8.9664 Tf 7.7211 -0.8982 Td[(The)-250(VM)-250(can)-250(form)-250(at)-250(least)-250(one)-250(root)-250(trace)-250(for)-250(the)-250(loop.)]TJ/F26 7.9701 Tf -7.7211 -13.0495 Td[(\017)]TJ/F42 8.9664 Tf 7.7211 -0.8982 Td[(There)-395(is)-395(at)-395(least)-395(one)-396(hot)-395(side)-395(e)15(xit)-395(for)-395(which)-395(the)-395(VM)-395(cannot)]TJ 0 -9.9626 Td[(complete)-250(a)-250(trace.)]TJ/F26 7.9701 Tf -7.7211 -13.0495 Td[(\017)]TJ/F42 8.9664 Tf 7.7211 -0.8982 Td[(The)-250(loop)-250(body)-250(is)-250(short.)]TJ -0.9963 -14.8443 Td[(In)-216(this)-217(case,)-216(the)-216(VM)-217(will)-216(repeatedly)-216(pass)-216(the)-217(loop)-216(header)40(,)-216(search)]TJ -11.9551 -9.9626 Td[(for)-471(a)-472(trace,)-471(\002nd)-472(it,)-471(e)15(x)15(ecute)-471(it,)-472(and)-471(f)10(all)-472(back)-471(to)-471(the)-472(interpreter)55(.)]TJ 0 -9.9627 Td[(W)40(ith)-399(a)-399(short)-399(loop)-399(body)65(,)-398(the)-399(o)15(v)15(erhead)-399(of)-399(\002nding)-399(and)-399(calling)-399(the)]TJ 0 -9.9626 Td[(trace)-342(is)-343(high,)-342(and)-343(causes)-342(performance)-343(to)-342(be)-342(e)25(v)15(en)-343(slo)25(wer)-342(than)-343(the)]TJ 0 -9.9627 Td[(basic)-417(interpreter)55(.)-418(So)-417(f)10(ar)40(,)-417(in)-418(this)-417(situation)-418(we)-417(ha)20(v)15(e)-417(impro)15(v)15(ed)-418(the)]TJ 0 -9.9626 Td[(implementation)-442(so)-442(that)-442(the)-441(VM)-442(can)-442(complete)-442(the)-442(branch)-442(trace.)]TJ 0 -9.9626 Td[(But)-390(it)-390(is)-390(hard)-391(to)-390(guarantee)-390(that)-390(this)-390(situation)-390(will)-391(ne)26(v)14(e)1(r)-391(happen.)]TJ 0 -9.9627 Td[(As)-358(future)-358(w)10(ork,)-358(this)-358(situation)-358(could)-358(be)-358(a)20(v)20(oided)-359(by)-358(detecting)-358(and)]TJ 0 -9.9626 Td[(blacklisting)-406(loops)-406(for)-406(which)-405(the)-406(a)20(v)15(erage)-406(trace)-406(call)-406(e)15(x)15(ecutes)-406(fe)25(w)]TJ 0 -9.9627 Td[(bytecodes)-250(before)-250(returning)-250(to)-250(the)-250(interpreter)55(.)]TJ/F41 10.9589 Tf 0 -22.5155 Td[(4.)-1000(Nested)-250(T)74(race)-250(T)74(r)18(ee)-250(F)25(ormation)]TJ/F42 8.9664 Tf 0 -13.9477 Td[(Figure)-220(7)-220(sho)25(ws)-220(basic)-220(trace)-219(tree)-220(compilation)-220(\05011\051)-220(applied)-220(to)-220(a)-220(nested)]TJ 0 -9.9627 Td[(loop)-363(where)-364(the)-363(inner)-363(loop)-364(contains)-363(tw)10(o)-364(paths.)-363(Usually)65(,)-363(the)-364(inner)]TJ 0 -9.9626 Td[(loop)-239(\050with)-239(header)-239(at)]TJ/F29 8.9664 Tf 73.8141 0 Td[(i)]TJ/F28 5.9776 Tf 3.1534 -0.9962 Td[(2)]TJ/F42 8.9664 Tf 4.151 0.9962 Td[(\051)-239(becomes)-239(hot)-239(\002rst,)-239(and)-239(a)-239(trace)-240(tree)-239(is)-239(rooted)]TJ -81.1185 -9.9626 Td[(at)-310(that)-310(point.)-309(F)15(or)-310(e)15(xample,)-310(the)-310(\002rst)-310(recorded)-309(trace)-310(may)-310(be)-310(a)-310(c)15(ycle)]TJ ET 1 0 0 1 388.7455 583.8003 cm q 0.37213 0 0 0.37213 0 0 cm q 1 0 0 1 0 0 cm /Im2 Do Q Q 1 0 0 1 -71.7318 -11.2877 cm q []0 d 0 J 0.3288 w 0 0.1644 m 239.1034 0.1644 l S Q 1 0 0 1 -317.0137 -572.5126 cm BT /F41 8.9664 Tf 317.0137 562.3497 Td[(Figur)18(e)-402(5.)]TJ/F42 8.9664 Tf 40.0542 0 Td[(A)-402(tree)-402(with)-402(tw)10(o)-403(trac)1(es,)-403(a)-402(trunk)-402(trace)-402(and)-402(one)-403(branch)]TJ -40.0542 -9.9626 Td[(trace.)-245(The)-244(trunk)-245(trace)-245(contains)-244(a)-245(guard)-244(to)-245(which)-245(a)-244(branch)-245(trace)-245(w)10(as)]TJ 0 -9.9627 Td[(attached.)-231(The)-232(branch)-231(trace)-232(contain)-231(a)-232(guard)-231(that)-231(may)-232(f)10(ail)-231(and)-232(trigger)]TJ 0 -9.9626 Td[(a)-222(side)-221(e)15(xit.)-222(Both)-222(the)-221(trunk)-222(and)-222(the)-222(branch)-221(trace)-222(loop)-222(back)-221(to)-222(the)-222(tree)]TJ 0 -9.9626 Td[(anchor)40(,)-250(which)-250(is)-250(the)-250(be)15(ginning)-250(of)-250(the)-250(trace)-250(tree.)]TJ ET 1 0 0 1 352.8796 315.1907 cm q 0.46622 0 0 0.46622 0 0 cm q 1 0 0 1 0 0 cm /Im3 Do Q Q 1 0 0 1 -35.8659 -11.2877 cm q []0 d 0 J 0.3288 w 0 0.1644 m 239.1034 0.1644 l S Q 1 0 0 1 -317.0137 -303.903 cm BT /F41 8.9664 Tf 317.0137 293.7402 Td[(Figur)18(e)-436(6.)]TJ/F42 8.9664 Tf 40.3573 0 Td[(W)80(e)-436(handle)-436(type-unstable)-436(loops)-436(by)-436(allo)25(wing)-436(traces)-436(to)]TJ -40.3573 -9.9627 Td[(compile)-385(that)-386(cannot)-385(loop)-386(back)-385(to)-386(themselv)15(es)-385(due)-385(to)-386(a)-385(type)-386(mis-)]TJ 0 -9.9626 Td[(match.)-223(As)-223(such)-222(traces)-223(accumulate,)-223(we)-223(attempt)-222(to)-223(connect)-223(their)-223(loop)]TJ 0 -9.9626 Td[(edges)-237(to)-238(form)-237(groups)-238(of)-237(trace)-238(trees)-237(that)-237(can)-238(e)15(x)15(ecute)-237(without)-238(ha)20(ving)]TJ 0 -9.9627 Td[(to)-309(side-e)15(xit)-309(to)-309(the)-309(interpreter)-309(to)-309(co)15(v)15(er)-309(odd)-309(type)-310(case)1(s.)-310(This)-309(is)-309(par)20(-)]TJ 0 -9.9626 Td[(ticularly)-223(important)-223(for)-223(nested)-222(trace)-223(trees)-223(where)-223(an)-223(outer)-223(tree)-223(tries)-223(to)]TJ 0 -9.9627 Td[(call)-245(an)-244(inner)-245(tree)-244(\050or)-245(in)-245(this)-244(case)-245(a)-245(forest)-244(of)-245(inner)-244(trees\051,)-245(since)-245(inner)]TJ 0 -9.9626 Td[(loops)-244(frequently)-244(ha)20(v)15(e)-244(initially)-244(unde\002ned)-244(v)25(alues)-244(which)-245(change)-244(type)]TJ 0 -9.9626 Td[(to)-250(a)-250(concrete)-250(v)25(alue)-250(after)-250(the)-250(\002rst)-250(iteration.)]TJ 0 -26.0441 Td[(through)-406(the)-406(inner)-407(l)1(oop,)]TJ/F31 8.9664 Tf 90.0285 0 Td[(f)]TJ/F29 8.9664 Tf 4.6077 0 Td[(i)]TJ/F28 5.9776 Tf 3.1534 -0.9962 Td[(2)]TJ/F29 8.9664 Tf 4.151 0.9962 Td[(;)-172(i)]TJ/F28 5.9776 Tf 7.2491 -0.9962 Td[(3)]TJ/F29 8.9664 Tf 4.151 0.9962 Td[(;)-172(i)]TJ/F28 5.9776 Tf 7.2491 -0.9962 Td[(5)]TJ/F29 8.9664 Tf 4.1511 0.9962 Td[(;)-172(\013)]TJ/F31 8.9664 Tf 10.0085 0 Td[(g)]TJ/F42 8.9664 Tf 4.6077 0 Td[(.)-406(The)]TJ/F29 8.9664 Tf 23.4683 0 Td[(\013)]TJ/F42 8.9664 Tf 9.5549 0 Td[(symbol)-406(is)-406(used)-406(to)]TJ -172.3803 -9.9626 Td[(indicate)-250(that)-250(the)-250(trace)-250(loops)-250(back)-250(the)-250(tree)-250(anchor)55(.)]TJ 11.9552 -9.9627 Td[(When)-261(e)15(x)15(ecution)-260(lea)20(v)15(es)-261(the)-261(inner)-261(loop,)-260(the)-261(basic)-261(design)-261(has)-260(tw)10(o)]TJ -11.9552 -9.9626 Td[(choices.)-211(First,)-211(the)-211(system)-210(can)-211(stop)-211(tracing)-211(and)-211(gi)25(v)15(e)-211(up)-211(on)-211(compiling)]TJ 0 -9.9627 Td[(the)-273(outer)-272(loop,)-273(clearly)-273(an)-272(undesirable)-273(solution.)-273(The)-272(other)-273(choice)-273(is)]TJ 0 -9.9626 Td[(to)-320(continue)-320(tracing,)-319(compiling)-320(traces)-320(for)-320(the)-319(outer)-320(loop)-320(inside)-320(the)]TJ 0 -9.9626 Td[(inner)-250(loop')55(s)-250(trace)-250(tree.)]TJ 11.9552 -9.9627 Td[(F)15(or)-292(e)15(xample,)-291(the)-292(program)-291(might)-292(e)15(xit)-292(at)]TJ/F29 8.9664 Tf 145.1588 0 Td[(i)]TJ/F28 5.9776 Tf 3.1533 -0.9962 Td[(5)]TJ/F42 8.9664 Tf 6.7659 0.9962 Td[(and)-292(record)-291(a)-292(branch)]TJ -167.0332 -9.9626 Td[(trace)-564(that)-563(incorporates)-564(the)-564(outer)-563(loop:)]TJ/F31 8.9664 Tf 153.3327 0 Td[(f)]TJ/F29 8.9664 Tf 4.6077 0 Td[(i)]TJ/F28 5.9776 Tf 3.1534 -0.9963 Td[(5)]TJ/F29 8.9664 Tf 4.151 0.9963 Td[(;)-172(i)]TJ/F28 5.9776 Tf 7.2491 -0.9963 Td[(7)]TJ/F29 8.9664 Tf 4.151 0.9963 Td[(;)-172(i)]TJ/F28 5.9776 Tf 7.2491 -0.9963 Td[(1)]TJ/F29 8.9664 Tf 4.1511 0.9963 Td[(;)-172(i)]TJ/F28 5.9776 Tf 7.2491 -0.9963 Td[(6)]TJ/F29 8.9664 Tf 4.151 0.9963 Td[(;)-172(i)]TJ/F28 5.9776 Tf 7.2491 -0.9963 Td[(7)]TJ/F29 8.9664 Tf 4.151 0.9963 Td[(;)-172(i)]TJ/F28 5.9776 Tf 7.2491 -0.9963 Td[(1)]TJ/F29 8.9664 Tf 4.1511 0.9963 Td[(;)-172(\013)]TJ/F31 8.9664 Tf 10.0085 0 Td[(g)]TJ/F42 8.9664 Tf 4.6077 0 Td[(.)]TJ -236.8617 -9.9627 Td[(Later)40(,)-459(the)-458(program)-459(might)-459(tak)10(e)-459(the)-458(other)-459(branch)-459(at)]TJ/F29 8.9664 Tf 195.185 0 Td[(i)]TJ/F28 5.9776 Tf 3.1533 -0.9962 Td[(2)]TJ/F42 8.9664 Tf 8.2644 0.9962 Td[(and)-459(then)]TJ -206.6027 -9.9626 Td[(e)15(xit,)-339(recording)-340(another)-339(branch)-340(trace)-339(incorporating)-340(the)-339(outer)-340(loop:)]TJ/F31 8.9664 Tf 0 -9.9626 Td[(f)]TJ/F29 8.9664 Tf 4.6077 0 Td[(i)]TJ/F28 5.9776 Tf 3.1534 -0.9963 Td[(2)]TJ/F29 8.9664 Tf 4.151 0.9963 Td[(;)-172(i)]TJ/F28 5.9776 Tf 7.2491 -0.9963 Td[(4)]TJ/F29 8.9664 Tf 4.151 0.9963 Td[(;)-172(i)]TJ/F28 5.9776 Tf 7.2491 -0.9963 Td[(5)]TJ/F29 8.9664 Tf 4.1511 0.9963 Td[(;)-172(i)]TJ/F28 5.9776 Tf 7.2491 -0.9963 Td[(7)]TJ/F29 8.9664 Tf 4.151 0.9963 Td[(;)-172(i)]TJ/F28 5.9776 Tf 7.2491 -0.9963 Td[(1)]TJ/F29 8.9664 Tf 4.151 0.9963 Td[(;)-172(i)]TJ/F28 5.9776 Tf 7.2491 -0.9963 Td[(6)]TJ/F29 8.9664 Tf 4.1511 0.9963 Td[(;)-172(i)]TJ/F28 5.9776 Tf 7.2491 -0.9963 Td[(7)]TJ/F29 8.9664 Tf 4.151 0.9963 Td[(;)-172(i)]TJ/F28 5.9776 Tf 7.2491 -0.9963 Td[(1)]TJ/F29 8.9664 Tf 4.151 0.9963 Td[(;)-172(\013)]TJ/F31 8.9664 Tf 10.0086 0 Td[(g)]TJ/F42 8.9664 Tf 4.6077 0 Td[(.)-235(Thus,)-235(the)-235(outer)-234(loop)-235(is)-235(recorded)-235(and)]TJ -106.3293 -9.9627 Td[(compiled)-197(twice,)-198(and)-198(both)-197(copies)-198(must)-197(be)-198(retained)-197(in)-198(the)-197(trace)-198(cache.)]TJ ET 1 0 0 1 93.9255 581.3979 cm q 0.35 0 0 0.35 0 0 cm q 1 0 0 1 0 0 cm /Im4 Do Q Q 1 0 0 1 -39.9255 -11.2877 cm q []0 d 0 J 0.3288 w 0 0.1644 m 239.1034 0.1644 l S Q 1 0 0 1 -54 -570.1102 cm BT /F41 8.9664 Tf 54 559.9474 Td[(Figur)18(e)-249(7.)]TJ/F42 8.9664 Tf 38.6815 0 Td[(Control)-249(\003o)25(w)-249(graph)-249(of)-249(a)-249(nested)-249(loop)-249(with)-250(an)-249(if)-249(statement)]TJ -38.6815 -9.9627 Td[(inside)-412(the)-412(inner)-412(most)-412(loop)-412(\050a\051.)-412(An)-412(inner)-413(tre)1(e)-413(captures)-412(the)-412(inner)]TJ 0 -9.9626 Td[(loop,)-241(and)-241(is)-242(nested)-241(inside)-241(an)-241(outer)-242(tree)-241(which)-241(\223calls\224)-241(the)-241(inner)-242(tree.)]TJ 0 -9.9626 Td[(The)-305(inner)-305(tree)-305(returns)-305(to)-304(the)-305(outer)-305(tree)-305(once)-305(it)-305(e)15(xits)-305(along)-305(its)-305(loop)]TJ 0 -9.9627 Td[(condition)-250(guard)-250(\050b\051.)]TJ 0 -28.6839 Td[(In)-225(general,)-226(if)-225(loops)-225(are)-226(nes)1(ted)-226(to)-225(depth)]TJ/F29 8.9664 Tf 137.9245 0 Td[(k)]TJ/F42 8.9664 Tf 5.0609 0 Td[(,)-225(and)-226(each)-225(loop)-225(has)]TJ/F29 8.9664 Tf 69.6109 0 Td[(n)]TJ/F42 8.9664 Tf 7.5793 0 Td[(paths)]TJ -220.1756 -10.3994 Td[(\050on)-402(geometric)-403(a)20(v)15(erage\051,)-402(this)-403(na)]TJ 116.2073 0.0448 Td[(\250)]TJ 0.2466 -0.0448 Td[(\021v)15(e)-402(strate)15(gy)-403(yields)]TJ/F29 8.9664 Tf 71.322 0 Td[(O)]TJ/F27 8.9664 Tf 7.2682 0 Td[(\050)]TJ/F29 8.9664 Tf 3.5838 0 Td[(n)]TJ/F30 5.9776 Tf 5.559 3.809 Td[(k)]TJ/F27 8.9664 Tf 4.5731 -3.809 Td[(\051)]TJ/F42 8.9664 Tf 7.1926 0 Td[(traces,)]TJ -215.9526 -9.9626 Td[(which)-250(can)-250(easily)-250(\002ll)-250(the)-250(trace)-250(cache.)]TJ 11.9552 -9.9627 Td[(In)-406(order)-406(to)-405(e)15(x)14(e)1(cute)-406(programs)-406(with)-406(nested)-406(loops)-406(ef)25(\002cientl)1(y)64(,)-405(a)]TJ -11.9552 -9.9626 Td[(tracing)-215(system)-214(needs)-215(a)-214(technique)-215(for)-214(co)15(v)15(ering)-215(the)-215(nested)-214(loops)-215(with)]TJ 0 -9.9627 Td[(nati)25(v)15(e)-250(code)-250(without)-250(e)15(xponential)-250(trace)-250(duplication.)]TJ/F41 8.9664 Tf 0 -18.3527 Td[(4.1)-1000(Nesting)-250(Algorithm)]TJ/F42 8.9664 Tf 0 -13.9477 Td[(The)-286(k)10(e)15(y)-286(insight)-287(is)-286(that)-286(if)-286(each)-286(loop)-287(is)-286(represented)-286(by)-286(its)-286(o)25(wn)-287(trace)]TJ 0 -9.9626 Td[(tree,)-297(the)-298(code)-297(for)-297(each)-297(loop)-298(can)-297(be)-297(contained)-298(only)-297(in)-297(its)-297(o)25(wn)-298(tree,)]TJ 0 -9.9627 Td[(and)-228(outer)-227(loop)-228(paths)-228(will)-228(not)-227(be)-228(duplicated.)-228(Another)-228(k)10(e)15(y)-227(f)10(act)-228(is)-228(that)]TJ 0 -9.9626 Td[(we)-239(are)-240(not)-239(tracing)-239(arbitrary)-240(bytec)1(odes)-240(that)-239(might)-239(ha)20(v)15(e)-240(irreduceable)]TJ 0 -9.9626 Td[(control)-317(\003o)25(w)-318(graphs,)-317(b)20(ut)-317(rather)-318(byt)1(ecodes)-318(produced)-317(by)-317(a)-318(compiler)]TJ 0 -9.9627 Td[(for)-320(a)-320(language)-320(with)-319(structured)-320(control)-320(\003o)25(w)65(.)-320(Thus,)-320(gi)25(v)15(en)-320(tw)10(o)-320(loop)]TJ 0 -9.9626 Td[(edges,)-413(the)-413(system)-413(can)-412(easily)-413(determine)-413(whether)-413(the)15(y)-413(are)-413(nested)]TJ 0 -9.9627 Td[(and)-270(which)-270(is)-270(the)-271(inner)-270(loop.)-270(Using)-270(this)-270(kno)25(wledge,)-270(the)-271(system)-270(can)]TJ 0 -9.9626 Td[(compile)-216(inner)-217(and)-216(outer)-216(loops)-216(separately)65(,)-217(and)-216(mak)10(e)-216(the)-216(outer)-217(loop')55(s)]TJ 0 -9.9626 Td[(traces)]TJ/F46 8.9664 Tf 23.1508 0 Td[(call)]TJ/F42 8.9664 Tf 15.6998 0 Td[(the)-250(inner)-250(loop')55(s)-250(trace)-250(tree.)]TJ -26.8954 -9.9627 Td[(The)-299(algorithm)-299(for)-299(b)20(uilding)-299(nested)-299(trace)-299(trees)-299(is)-299(as)-299(follo)25(ws.)-299(W)80(e)]TJ -11.9552 -9.9626 Td[(start)-277(tracing)-277(at)-277(loop)-277(headers)-277(e)15(xactly)-277(as)-277(in)-278(the)-277(basic)-277(tracing)-277(system.)]TJ 0 -9.9627 Td[(When)-385(we)-386(e)15(xit)-385(a)-386(loop)-385(\050detected)-385(by)-386(comparing)-385(the)-385(interpreter)-386(PC)]TJ 0 -9.9626 Td[(with)-416(the)-416(range)-415(gi)25(v)15(en)-416(by)-416(the)-416(loop)-416(edge\051,)-415(we)-416(stop)-416(the)-416(trace.)-416(The)]TJ 0 -9.9626 Td[(k)10(e)15(y)-392(step)-392(of)-392(the)-392(algorithm)-391(occurs)-392(when)-392(we)-392(are)-392(recording)-392(a)-392(trace)]TJ 0 -9.9627 Td[(for)-298(loop)]TJ/F29 8.9664 Tf 31.7379 0 Td[(L)]TJ/F30 5.9776 Tf 6.2709 -0.9963 Td[(R)]TJ/F42 8.9664 Tf 8.7027 0.9963 Td[(\050)]TJ/F29 8.9664 Tf 2.9858 0 Td[(R)]TJ/F42 8.9664 Tf 9.7062 0 Td[(for)-298(loop)-298(being)-297(recorded\051)-298(and)-298(we)-298(reach)-298(the)-298(header)]TJ -59.4034 -9.9626 Td[(of)-242(a)-243(dif)25(ferent)-242(loop)]TJ/F29 8.9664 Tf 66.7304 0 Td[(L)]TJ/F30 5.9776 Tf 6.2709 -0.9963 Td[(O)]TJ/F42 8.9664 Tf 8.4482 0.9963 Td[(\050)]TJ/F29 8.9664 Tf 2.9858 0 Td[(O)]TJ/F42 8.9664 Tf 9.4411 0 Td[(for)-242(other)-243(loop\051.)-242(Note)-242(that)]TJ/F29 8.9664 Tf 91.7943 0 Td[(L)]TJ/F30 5.9776 Tf 6.2709 -0.9963 Td[(O)]TJ/F42 8.9664 Tf 8.4482 0.9963 Td[(must)-242(be)-243(an)]TJ -200.3898 -9.9626 Td[(inner)-250(loop)-250(of)]TJ/F29 8.9664 Tf 48.5616 0 Td[(L)]TJ/F30 5.9776 Tf 6.2709 -0.9963 Td[(R)]TJ/F42 8.9664 Tf 8.2738 0.9963 Td[(because)-250(we)-250(stop)-250(the)-250(trace)-250(when)-250(we)-250(e)15(xit)-250(a)-250(loop.)]TJ/F26 7.9701 Tf -57.876 -14.2558 Td[(\017)]TJ/F42 8.9664 Tf 7.7212 -0.8982 Td[(If)]TJ/F29 8.9664 Tf 8.6997 0 Td[(L)]TJ/F30 5.9776 Tf 6.2709 -0.9962 Td[(O)]TJ/F42 8.9664 Tf 9.0035 0.9962 Td[(has)-304(a)-305(type-)1(matching)-305(compiled)-304(trace)-304(tree,)-304(we)-305(call)]TJ/F29 8.9664 Tf 179.4346 0 Td[(L)]TJ/F30 5.9776 Tf 6.2709 -0.9962 Td[(O)]TJ/F42 8.9664 Tf 9.0035 0.9962 Td[(as)]TJ -218.6831 -9.9626 Td[(a)-274(nested)-274(trace)-274(tree.)-274(If)-274(the)-274(call)-274(succeeds,)-273(then)-274(we)-274(record)-274(the)-274(call)]TJ 0 -9.9626 Td[(in)-260(the)-261(trace)-260(for)]TJ/F29 8.9664 Tf 55.1491 0 Td[(L)]TJ/F30 5.9776 Tf 6.2709 -0.9963 Td[(R)]TJ/F42 8.9664 Tf 6.0322 0.9963 Td[(.)-260(On)-261(future)-260(e)15(x)15(ecutions,)-261(the)-260(trace)-260(for)]TJ/F29 8.9664 Tf 130.1102 0 Td[(L)]TJ/F30 5.9776 Tf 6.2709 -0.9963 Td[(R)]TJ/F42 8.9664 Tf 8.3673 0.9963 Td[(will)]TJ -212.2006 -9.9626 Td[(call)-250(the)-250(inner)-250(trace)-250(directly)65(.)]TJ/F26 7.9701 Tf -7.7211 -13.0495 Td[(\017)]TJ/F42 8.9664 Tf 7.7211 -0.8982 Td[(If)]TJ/F29 8.9664 Tf 8.9629 0 Td[(L)]TJ/F30 5.9776 Tf 6.2709 -0.9963 Td[(O)]TJ/F42 8.9664 Tf 9.2667 0.9963 Td[(does)-334(not)-333(ha)20(v)15(e)-334(a)-333(type-matching)-334(compiled)-334(trace)-333(tree)-334(yet,)]TJ -24.5005 -9.9626 Td[(we)-386(ha)20(v)15(e)-385(to)-386(obtain)-385(it)-386(before)-385(we)-386(are)-385(able)-386(to)-385(proceed.)-386(In)-385(order)]TJ 0 -9.9627 Td[(to)-319(do)-318(this,)-319(we)-318(simply)-319(abort)-318(recording)-319(the)-319(\002rst)-318(trace.)-319(The)-318(trace)]TJ 0 -9.9626 Td[(monitor)-366(will)-366(see)-365(the)-366(inner)-366(loop)-366(header)40(,)-366(and)-366(wi)1(ll)-366(immediately)]TJ 0 -10.3249 Td[(start)-250(recording)-250(the)-250(inner)-250(loop.)]TJ/F42 5.9776 Tf 108.5728 3.809 Td[(2)]TJ/F42 8.9664 Tf -109.569 -18.9629 Td[(If)-202(all)-202(the)-201(loops)-202(in)-202(a)-202(nest)-202(are)-201(type-stable,)-202(then)-202(loop)-202(nesting)-201(creates)]TJ -11.9552 -9.9627 Td[(no)-206(duplication.)-205(Otherwise,)-206(if)-206(loops)-205(are)-206(nested)-206(to)-205(a)-206(depth)]TJ/F29 8.9664 Tf 198.7384 0 Td[(k)]TJ/F42 8.9664 Tf 5.0609 0 Td[(,)-206(and)-205(each)]TJ ET 1 0 0 1 54 104.3088 cm q []0 d 0 J 0.3288 w 0 0.1644 m 119.5517 0.1644 l S Q 1 0 0 1 -54 -104.3088 cm BT /F42 5.9776 Tf 54 98.1552 Td[(2)]TJ/F42 7.9701 Tf 4.4832 -2.8128 Td[(Instead)-292(of)-291(aborting)-292(the)-291(outer)-292(recording,)-291(we)-292(could)-291(principally)-292(merely)-292(sus-)]TJ -4.4832 -8.9664 Td[(pend)-344(the)-344(recording,)-344(b)20(ut)-344(that)-344(w)10(ould)-344(require)-344(the)-344(implementation)-344(to)-344(be)-344(able)]TJ 0 -8.9663 Td[(to)-333(record)-333(se)25(v)15(eral)-333(traces)-333(simultaneously)65(,)-333(complicating)-333(the)-333(implementation,)]TJ 0 -8.9664 Td[(while)-250(sa)20(ving)-250(only)-250(a)-250(fe)25(w)-250(iterations)-250(in)-250(the)-250(interpreter)55(.)]TJ ET 1 0 0 1 382.7675 600.193 cm q 0.33005 0 0 0.33005 0 0 cm q 1 0 0 1 0 0 cm /Im5 Do Q Q 1 0 0 1 -65.7538 -11.2877 cm q []0 d 0 J 0.3288 w 0 0.1644 m 239.1034 0.1644 l S Q 1 0 0 1 -317.0137 -588.9053 cm BT /F41 8.9664 Tf 317.0137 578.7425 Td[(Figur)18(e)-225(8.)]TJ/F42 8.9664 Tf 38.463 0 Td[(Control)-225(\003o)25(w)-224(graph)-225(of)-225(a)-225(loop)-224(with)-225(tw)10(o)-225(nested)-224(loops)-225(\050left\051)]TJ -38.463 -9.9627 Td[(and)-320(its)-320(nested)-320(trace)-320(tree)-320(con\002guration)-320(\050right\051.)-320(The)-321(outer)-320(tree)-320(calls)]TJ 0 -9.9626 Td[(the)-271(tw)10(o)-271(inner)-271(nested)-272(trace)-271(trees)-271(and)-271(places)-271(guards)-271(at)-271(their)-272(side)-271(e)15(xit)]TJ 0 -9.9626 Td[(locations.)]TJ 0 -33.3876 Td[(loop)-236(is)-235(entered)-236(with)]TJ/F29 8.9664 Tf 72.7002 0 Td[(m)]TJ/F42 8.9664 Tf 10.2308 0 Td[(dif)25(ferent)-236(t)1(ype)-236(maps)-236(\050on)-235(geometric)-236(a)20(v)15(erage\051,)]TJ -82.931 -10.3994 Td[(then)-288(we)-289(compile)]TJ/F29 8.9664 Tf 62.5392 0 Td[(O)]TJ/F27 8.9664 Tf 7.2682 0 Td[(\050)]TJ/F29 8.9664 Tf 3.5838 0 Td[(m)]TJ/F30 5.9776 Tf 8.1188 3.809 Td[(k)]TJ/F27 8.9664 Tf 4.5731 -3.809 Td[(\051)]TJ/F42 8.9664 Tf 6.1689 0 Td[(copies)-288(of)-289(the)-288(innermost)-288(loop.)-288(As)-289(long)-288(as)]TJ/F29 8.9664 Tf -92.252 -9.9626 Td[(m)]TJ/F42 8.9664 Tf 10.3604 0 Td[(is)-250(close)-250(to)-250(1,)-250(the)-250(resulting)-250(trace)-250(trees)-250(will)-250(be)-250(tractable.)]TJ 1.5948 -9.9627 Td[(An)-197(important)-197(detail)-197(is)-196(that)-197(the)-197(call)-197(to)-197(the)-197(inner)-197(trace)-197(tree)-196(must)-197(act)]TJ -11.9552 -9.9626 Td[(lik)10(e)-237(a)-237(function)-237(call)-237(site:)-236(it)-237(must)-237(return)-237(to)-237(the)-237(same)-237(point)-237(e)25(v)15(ery)-237(time.)]TJ 0 -9.9626 Td[(The)-289(goal)-289(of)-289(nesting)-289(is)-289(to)-289(mak)10(e)-289(inner)-290(and)-289(outer)-289(loops)-289(independent;)]TJ 0 -9.9627 Td[(thus)-358(when)-358(the)-358(inner)-359(tree)-358(is)-358(called,)-358(it)-358(must)-358(e)15(xit)-358(to)-358(the)-359(same)-358(point)]TJ 0 -9.9626 Td[(in)-326(the)-325(outer)-326(tree)-325(e)25(v)15(ery)-326(time)-325(with)-326(the)-325(same)-326(type)-326(map.)-325(Because)-326(we)]TJ 0 -9.9627 Td[(cannot)-315(actually)-316(guarantee)-315(this)-315(property)65(,)-316(we)-315(must)-316(guard)-315(on)-315(it)-316(after)]TJ 0 -9.9626 Td[(the)-386(call,)-385(and)-386(side)-386(e)15(xit)-386(if)-385(the)-386(property)-386(does)-386(not)-385(hold.)-386(A)-386(common)]TJ 0 -9.9626 Td[(reason)-422(for)-423(the)-422(inner)-423(tree)-422(not)-423(to)-422(return)-423(to)-422(the)-423(same)-422(point)-423(w)10(ould)]TJ 0 -9.9627 Td[(be)-399(if)-399(the)-399(inner)-399(tree)-399(took)-399(a)-399(ne)25(w)-399(side)-399(e)15(xit)-399(for)-399(which)-399(it)-399(had)-399(ne)25(v)15(er)]TJ 0 -9.9626 Td[(compiled)-352(a)-352(trace.)-352(At)-352(this)-352(point,)-352(the)-352(interpreter)-352(PC)-352(is)-353(in)-352(the)-352(inner)]TJ 0 -9.9627 Td[(tree,)-320(so)-321(we)-320(cannot)-320(continue)-321(recording)-320(or)-321(e)15(x)15(ecuting)-320(the)-320(outer)-321(tree.)]TJ 0 -9.9626 Td[(If)-312(this)-312(happens)-313(during)-312(recording,)-312(we)-312(abort)-313(the)-312(outer)-312(trace,)-312(to)-313(gi)25(v)15(e)]TJ 0 -9.9626 Td[(the)-257(inner)-258(tree)-257(a)-258(chance)-257(to)-257(\002nish)-258(gro)25(wing.)-257(A)-258(fut)1(ure)-258(e)15(x)15(ecution)-257(of)-258(the)]TJ 0 -9.9627 Td[(outer)-249(tree)-249(w)10(ould)-249(then)-249(be)-249(able)-249(to)-249(properly)-249(\002nish)-249(and)-250(rec)1(ord)-250(a)-249(call)-249(to)]TJ 0 -9.9626 Td[(the)-233(inner)-234(tree.)-233(If)-234(an)-233(inner)-234(tree)-233(side)-234(e)15(xit)-233(happens)-234(during)-233(e)15(x)15(ecution)-234(of)]TJ 0 -9.9627 Td[(a)-314(compiled)-315(trace)-314(for)-314(the)-315(outer)-314(tree,)-314(we)-314(simply)-315(e)15(xit)-314(the)-314(outer)-315(trace)]TJ 0 -9.9626 Td[(and)-250(start)-250(recording)-250(a)-250(ne)25(w)-250(branch)-250(in)-250(the)-250(inner)-250(tree.)]TJ/F41 8.9664 Tf 0 -21.6236 Td[(4.2)-1000(Blacklisting)-250(with)-250(Nesting)]TJ/F42 8.9664 Tf 0 -13.9477 Td[(The)-362(blacklisting)-363(algorithm)-362(needs)-363(modi\002cation)-362(to)-363(w)10(ork)-362(well)-363(with)]TJ 0 -9.9626 Td[(nesting.)-359(The)-358(problem)-359(is)-359(that)-358(outer)-359(loop)-359(traces)-358(often)-359(abort)-359(during)]TJ 0 -9.9627 Td[(startup)-263(\050because)-264(the)-263(inner)-263(tree)-264(is)-263(not)-263(a)20(v)25(ailable)-263(or)-264(tak)10(es)-263(a)-263(side)-264(e)15(xit\051,)]TJ 0 -9.9626 Td[(which)-362(w)10(ould)-363(lead)-362(to)-363(t)1(heir)-363(being)-362(quickly)-363(blacklisted)-362(by)-362(the)-363(basic)]TJ 0 -9.9626 Td[(algorithm.)]TJ 11.9552 -9.9627 Td[(The)-283(k)10(e)15(y)-284(observ)25(ation)-283(is)-284(that)-283(when)-284(an)-283(outer)-284(tr)1(ace)-284(aborts)-283(because)]TJ -11.9552 -9.9626 Td[(the)-299(inner)-299(tree)-299(is)-300(not)-299(ready)65(,)-299(this)-299(is)-299(probably)-299(a)-300(temporary)-299(condition.)]TJ 0 -9.9627 Td[(Thus,)-279(we)-278(should)-279(not)-279(count)-278(such)-279(aborts)-279(to)25(w)10(ard)-278(blacklisting)-279(as)-279(long)]TJ 0 -9.9626 Td[(as)-250(we)-250(are)-250(able)-250(to)-250(b)20(uild)-250(up)-250(more)-250(traces)-250(for)-250(the)-250(inner)-250(tree.)]TJ 11.9552 -9.9626 Td[(In)-325(our)-326(implementation,)-325(when)-326(an)-325(outer)-326(tree)-325(aborts)-325(on)-326(the)-325(inner)]TJ -11.9552 -9.9627 Td[(tree,)-353(we)-354(increment)-353(the)-353(outer)-354(tree')55(s)-353(blacklist)-354(counter)-353(as)-353(usual)-354(and)]TJ 0 -9.9626 Td[(back)-313(of)25(f)-312(on)-313(compiling)-313(it.)-313(When)-312(the)-313(inner)-313(tree)-313(\002nis)1(hes)-313(a)-313(trace,)-313(we)]TJ 0 -9.9627 Td[(decrement)-311(the)-311(blacklist)-311(count)1(er)-311(on)-311(the)-311(outer)-311(loop,)-311(\223for)18(gi)25(ving\224)-311(the)]TJ 0 -9.9626 Td[(outer)-219(loop)-218(for)-219(aborting)-218(pre)25(viously)65(.)-219(W)80(e)-218(also)-219(undo)-218(the)-219(back)10(of)25(f)-218(so)-219(that)]TJ 0 -9.9626 Td[(the)-244(outer)-244(tree)-244(can)-244(start)-244(immediately)-244(trying)-244(to)-244(compile)-245(the)-244(ne)15(xt)-244(time)]TJ 0 -9.9627 Td[(we)-250(reach)-250(it.)]TJ/F41 10.9589 Tf 0 -28.4503 Td[(5.)-1000(T)74(race)-250(T)74(r)18(ee)-250(Optimization)]TJ/F42 8.9664 Tf 0 -13.9477 Td[(This)-488(section)-488(e)15(xplains)-488(ho)25(w)-487(a)-488(recorded)-488(trace)-488(is)-488(translated)-488(to)-488(an)]TJ 0 -9.9626 Td[(optimized)-358(machine)-358(code)-357(trace.)-358(The)-358(trace)-358(compilation)-358(subsystem,)]TJ/F42 7.1731 Tf 0.2242 -9.9627 Td[(N)-28(A)-62(N)-61(O)-62(J)-62(I)-62(T)]TJ/F42 8.9664 Tf 32.915 0 Td[(,)-470(is)-470(separate)-470(from)-470(the)-470(VM)-470(and)-470(can)-470(be)-471(used)-470(for)-470(other)]TJ -33.1392 -9.9626 Td[(applications.)]TJ ET BT /F41 8.9664 Tf 54 712.0299 Td[(5.1)-1000(Optimizations)]TJ/F42 8.9664 Tf 0 -13.9477 Td[(Because)-429(traces)-429(are)-429(in)-430(SSA)-429(form)-429(and)-429(ha)20(v)15(e)-429(no)-429(join)-430(points)-429(or)]TJ/F29 8.9664 Tf 230.6326 0 Td[(\036)]TJ/F42 8.9664 Tf 5.485 0 Td[(-)]TJ -236.1176 -9.9626 Td[(nodes,)-433(certa)1(in)-433(optimizations)-433(a)1(re)-433(easy)-433(to)-432(implement.)-433(In)-432(order)-433(to)]TJ 0 -9.9627 Td[(get)-286(good)-286(startup)-287(performance,)-286(the)-286(optimizations)-286(must)-286(run)-287(quickly)65(,)]TJ 0 -9.9626 Td[(so)-433(we)-434(chose)-433(a)-433(small)-433(set)-434(of)-433(optimizations.)-433(W)80(e)-433(implemented)-434(the)]TJ 0 -9.9627 Td[(optimizations)-269(as)-269(pipelined)-270(\002lters)-269(so)-269(that)-269(the)15(y)-270(can)-269(be)-269(turned)-269(on)-270(and)]TJ 0 -9.9626 Td[(of)25(f)-305(independently)65(,)-305(and)-305(yet)-305(all)-305(run)-305(in)-305(just)-305(tw)10(o)-306(l)1(oop)-306(passes)-305(o)15(v)15(er)-305(the)]TJ 0 -9.9626 Td[(trace:)-250(one)-250(forw)10(ard)-250(and)-250(one)-250(backw)10(ard.)]TJ 11.9552 -9.9627 Td[(Ev)15(ery)-360(time)-361(the)-360(trace)-360(recorder)-361(emits)-360(a)-360(LIR)-361(instruction,)-360(the)-360(in-)]TJ -11.9552 -9.9626 Td[(struction)-423(is)-424(immediately)-423(passed)-423(to)-424(the)-423(\002rst)-424(\002lter)-423(in)-423(the)-424(forw)10(ard)]TJ 0 -9.9627 Td[(pipeline.)-377(Thus,)-377(forw)10(ard)-377(\002lte)1(r)-377(optimizations)-377(are)-377(performed)-377(as)-377(the)]TJ 0 -9.9626 Td[(trace)-287(is)-287(recorded.)-288(Each)-287(\002lter)-287(may)-287(pass)-288(each)-287(instruction)-287(to)-287(the)-288(ne)15(xt)]TJ 0 -9.9626 Td[(\002lter)-336(unchanged,)-336(write)-336(a)-337(dif)25(ferent)-336(instruction)-336(to)-336(the)-336(ne)15(xt)-336(\002lter)40(,)-337(or)]TJ 0 -9.9627 Td[(write)-303(no)-303(instruction)-303(at)-304(all.)-303(F)15(or)-303(e)15(xample,)-303(the)-303(constant)-304(folding)-303(\002lter)]TJ 0 -9.9626 Td[(can)-309(replace)-309(a)-309(multiply)-309(instruction)-309(lik)10(e)]TJ/F29 8.9664 Tf 141.0458 0 Td[(v)]TJ/F28 5.9776 Tf 4.4762 -0.9963 Td[(13)]TJ/F27 8.9664 Tf 11.3699 0.9963 Td[(:=)]TJ/F29 8.9664 Tf 13.2932 0 Td[(mu)-1(l)]TJ/F27 8.9664 Tf 16.3207 0 Td[(3)]TJ/F29 8.9664 Tf 4.6077 0 Td[(;)]TJ/F27 8.9664 Tf 4.0957 0 Td[(1000)]TJ/F42 8.9664 Tf 21.201 0 Td[(with)-309(a)]TJ -216.4102 -9.9627 Td[(constant)-250(instruction)]TJ/F29 8.9664 Tf 72.7253 0 Td[(v)]TJ/F28 5.9776 Tf 4.4762 -0.9962 Td[(13)]TJ/F27 8.9664 Tf 10.3638 0.9962 Td[(=)-286(3000)]TJ/F42 8.9664 Tf 28.1581 0 Td[(.)]TJ -103.7683 -9.9626 Td[(W)80(e)-250(currently)-250(apply)-250(four)-250(forw)10(ard)-250(\002lters:)]TJ/F26 7.9701 Tf -6.7248 -16.4368 Td[(\017)]TJ/F42 8.9664 Tf 7.7211 -0.8982 Td[(On)-377(ISAs)-377(without)-377(\003oating-point)-377(instructions,)-376(a)-377(soft-\003oat)-377(\002lter)]TJ 0 -9.9626 Td[(con)40(v)15(erts)-248(\003oating-point)-249(LIR)-248(instructions)-249(to)-248(sequences)-249(of)-248(inte)15(ger)]TJ 0 -9.9627 Td[(instructions.)]TJ/F26 7.9701 Tf -7.7211 -13.0495 Td[(\017)]TJ/F42 8.9664 Tf 7.7211 -0.8982 Td[(CSE)-250(\050constant)-250(sube)15(xpression)-250(elimination\051,)]TJ/F26 7.9701 Tf -7.7211 -13.0495 Td[(\017)]TJ/F42 8.9664 Tf 7.7211 -0.8982 Td[(e)15(xpression)-264(simpli\002cation,)-264(including)-264(constant)-263(folding)-264(and)-264(a)-264(fe)25(w)]TJ 0 -9.9626 Td[(algebraic)-250(identities)-250(\050e.g.,)]TJ/F29 8.9664 Tf 90.6399 0 Td[(a)]TJ/F31 8.9664 Tf 6.9298 0 Td[(\000)]TJ/F29 8.9664 Tf 9.2154 0 Td[(a)]TJ/F27 8.9664 Tf 7.4418 0 Td[(=)-286(0)]TJ/F42 8.9664 Tf 14.3351 0 Td[(\051,)-250(and)]TJ/F26 7.9701 Tf -136.2831 -13.0495 Td[(\017)]TJ/F42 8.9664 Tf 7.7211 -0.8982 Td[(source)-512(language)-511(semantic-speci\002c)-512(e)15(xpression)-511(simpli\002cation,)]TJ 0 -9.9626 Td[(primarily)-228(algebraic)-228(identit)1(ies)-228(that)-228(allo)25(w)]TJ/F42 7.1731 Tf 142.6987 0 Td[(D)-62(O)-61(U)-62(B)-62(L)-61(E)]TJ/F42 8.9664 Tf 33.559 0 Td[(to)-228(be)-228(replaced)]TJ -176.2577 -9.9627 Td[(with)]TJ/F42 7.1731 Tf 18.6812 0 Td[(I)-62(N)-62(T)]TJ/F42 8.9664 Tf 13.0548 0 Td[(.)-281(F)15(or)-280(e)15(xample,)-280(LIR)-281(that)-280(con)40(v)15(erts)-281(an)]TJ/F42 7.1731 Tf 131.1187 0 Td[(I)-62(N)-62(T)]TJ/F42 8.9664 Tf 15.5699 0 Td[(to)-280(a)]TJ/F42 7.1731 Tf 16.2111 0 Td[(D)-62(O)-61(U)-62(B)-62(L)-61(E)]TJ/F42 8.9664 Tf -194.6357 -9.9626 Td[(and)-250(then)-250(back)-250(ag)5(ain)-250(w)10(ould)-250(be)-250(remo)15(v)15(ed)-250(by)-250(this)-250(\002lter)55(.)]TJ -0.9963 -17.335 Td[(When)-311(trace)-311(recording)-311(is)-311(completed,)-311(nanojit)-311(runs)-311(the)-311(backw)10(ard)]TJ -11.9551 -9.9626 Td[(optimization)-337(\002lters.)-337(These)-338(are)-337(used)-337(for)-337(optimizations)-337(that)-338(require)]TJ 0 -9.9627 Td[(backw)10(ard)-401(program)-400(analysis.)-401(When)-400(running)-401(the)-400(backw)10(ard)-401(\002lters,)]TJ 0 -9.9626 Td[(nanojit)-216(reads)-215(one)-216(LIR)-216(instruction)-216(at)-215(a)-216(time,)-216(and)-216(t)1(he)-216(reads)-216(are)-216(passed)]TJ 0 -9.9627 Td[(through)-250(the)-250(pipeline.)]TJ 11.9551 -9.9626 Td[(W)80(e)-250(currently)-250(apply)-250(three)-250(backw)10(ard)-250(\002lters:)]TJ/F26 7.9701 Tf -6.7248 -16.4368 Td[(\017)]TJ/F42 8.9664 Tf 7.7211 -0.8982 Td[(Dead)-221(data-stack)-222(store)-221(elimination.)-222(The)-221(LIR)-221(trace)-222(encodes)-221(man)15(y)]TJ 0 -9.9626 Td[(stores)-278(to)-278(locations)-278(in)-278(the)-278(interpreter)-278(stack.)-277(But)-278(these)-278(v)25(alues)-278(are)]TJ 0 -9.9627 Td[(ne)25(v)15(er)-340(read)-339(back)-340(before)-340(e)15(xiting)-340(the)-339(trace)-340(\050by)-340(the)-340(interpret)1(er)-340(or)]TJ 0 -9.9626 Td[(another)-418(trace\051.)-417(Thus,)-418(stores)-417(to)-418(the)-418(s)1(tack)-418(that)-418(are)-417(o)15(v)15(erwritten)]TJ 0 -9.9626 Td[(before)-377(the)-377(ne)15(xt)-376(e)15(xit)-377(are)-377(dead.)-377(Store)1(s)-377(to)-377(locations)-377(that)-376(are)-377(of)25(f)]TJ 0 -9.9627 Td[(the)-250(top)-250(of)-250(the)-250(interpreter)-250(stack)-250(at)-250(future)-250(e)15(xits)-250(are)-250(also)-250(dead.)]TJ/F26 7.9701 Tf -7.7211 -13.0495 Td[(\017)]TJ/F42 8.9664 Tf 7.7211 -0.8982 Td[(Dead)-219(call-stack)-219(store)-219(elimination.)-219(This)-219(is)-219(the)-219(same)-219(optimization)]TJ 0 -9.9626 Td[(as)-291(abo)15(v)15(e,)-291(e)15(xcept)-292(applied)-291(to)-291(the)-291(interpreter')55(s)-292(call)-291(stack)-291(used)-291(for)]TJ 0 -9.9627 Td[(function)-250(call)-250(inlining.)]TJ/F26 7.9701 Tf -7.7211 -13.0495 Td[(\017)]TJ/F42 8.9664 Tf 7.7211 -0.8982 Td[(Dead)-546(code)-546(elimination.)-547(This)-546(eliminates)-546(an)15(y)-546(operation)-546(that)]TJ 0 -9.9626 Td[(stores)-250(to)-250(a)-250(v)25(alue)-250(that)-250(is)-250(ne)25(v)15(er)-250(used.)]TJ -0.9963 -17.335 Td[(After)-452(a)-452(LIR)-452(instruction)-452(is)-452(successfully)-452(read)-452(\050\223pulled\224\051)-452(from)]TJ -11.9551 -9.9626 Td[(the)-316(backw)10(ard)-316(\002lter)-316(pipeli)1(ne,)-316(nanojit')55(s)-316(code)-316(generator)-316(emits)-316(nati)25(v)15(e)]TJ 0 -9.9627 Td[(machine)-250(instruction\050s\051)-250(for)-250(it.)]TJ/F41 8.9664 Tf 0 -18.3312 Td[(5.2)-1000(Register)-250(Allocation)]TJ/F42 8.9664 Tf 0 -13.9477 Td[(W)80(e)-483(use)-484(a)-483(simple)-483(greedy)-483(re)15(gister)-484(allocator)-483(that)-483(mak)10(es)-483(a)-484(single)]TJ 0 -9.9627 Td[(backw)10(ard)-359(pass)-359(o)15(v)15(er)-359(the)-360(trace)-359(\050it)-359(is)-359(inte)15(grated)-359(with)-359(the)-360(c)1(ode)-360(gen-)]TJ 0 -9.9626 Td[(erator\051.)-371(By)-371(the)-371(time)-371(the)-371(allocator)-371(has)-371(reached)-371(an)-371(instruction)-371(lik)10(e)]TJ/F29 8.9664 Tf 0 -9.9626 Td[(v)]TJ/F28 5.9776 Tf 4.4762 -0.9963 Td[(3)]TJ/F27 8.9664 Tf 7.0642 0.9963 Td[(=)]TJ/F29 8.9664 Tf 10.0807 0 Td[(add)-270(v)]TJ/F28 5.9776 Tf 21.335 -0.9963 Td[(1)]TJ/F29 8.9664 Tf 4.1511 0.9963 Td[(;)-172(v)]TJ/F28 5.9776 Tf 8.572 -0.9963 Td[(2)]TJ/F42 8.9664 Tf 4.151 0.9963 Td[(,)-271(it)-270(has)-271(already)-271(assigned)-270(a)-271(re)15(gister)-271(to)]TJ/F29 8.9664 Tf 133.5763 0 Td[(v)]TJ/F28 5.9776 Tf 4.4762 -0.9963 Td[(3)]TJ/F42 8.9664 Tf 4.151 0.9963 Td[(.)-271(If)]TJ/F29 8.9664 Tf 13.0676 0 Td[(v)]TJ/F28 5.9776 Tf 4.4763 -0.9963 Td[(1)]TJ/F42 8.9664 Tf 6.5783 0.9963 Td[(and)]TJ/F29 8.9664 Tf -226.156 -9.9627 Td[(v)]TJ/F28 5.9776 Tf 4.4763 -0.9962 Td[(2)]TJ/F42 8.9664 Tf 6.4242 0.9962 Td[(ha)20(v)15(e)-254(not)-253(yet)-254(been)-253(assigned)-254(re)15(gister)1(s,)-254(the)-254(all)1(ocator)-254(assigns)-253(a)-254(free)]TJ -10.9005 -9.9626 Td[(re)15(gister)-240(to)-240(each.)-240(If)-240(there)-240(are)-240(no)-240(free)-240(re)15(gisters,)-240(a)-241(v)25(alue)-240(is)-240(selected)-240(for)]TJ 0 -9.9627 Td[(spilling.)-298(W)80(e)-298(use)-298(a)-298(class)-298(heuristic)-298(that)-299(sel)1(ects)-299(the)-298(\223oldest\224)-298(re)15(gister)20(-)]TJ 0 -9.9626 Td[(carried)-250(v)25(alue)-250(\0506\051.)]TJ 11.9552 -9.9626 Td[(The)-253(heuristic)-252(considers)-253(the)-253(set)]TJ/F29 8.9664 Tf 110.9357 0 Td[(R)]TJ/F42 8.9664 Tf 9.3016 0 Td[(of)-253(v)25(alues)]TJ/F29 8.9664 Tf 34.6855 0 Td[(v)]TJ/F42 8.9664 Tf 7.0638 0 Td[(in)-253(re)15(gisters)-252(imme-)]TJ -173.9418 -9.9627 Td[(diately)-290(after)-290(the)-290(current)-291(instruction)-290(for)-290(spilling.)-290(Let)]TJ/F29 8.9664 Tf 187.9104 0 Td[(v)]TJ/F30 5.9776 Tf 4.4762 -0.9962 Td[(m)]TJ/F42 8.9664 Tf 9.638 0.9962 Td[(be)-290(the)-290(last)]TJ -202.0246 -9.9626 Td[(instruction)-258(before)-257(the)-258(current)-258(where)-257(each)]TJ/F29 8.9664 Tf 149.8021 0 Td[(v)]TJ/F42 8.9664 Tf 7.1087 0 Td[(is)-258(referred)-257(to.)-258(Then)-258(the)]TJ 112.6402 644.5828 Td[(T)80(ag)]TJ ET 1 0 0 1 342.7789 710.0373 cm q []0 d 0 J 0.3985 w 0.1992 0 m 0.1992 9.9626 l S Q 1 0 0 1 -342.7789 -710.0373 cm BT /F42 8.9664 Tf 348.9558 713.0262 Td[(JS)-250(T)80(ype)]TJ ET 1 0 0 1 390.0973 710.0373 cm q []0 d 0 J 0.3985 w 0.1992 0 m 0.1992 9.9626 l S Q 1 0 0 1 -390.0973 -710.0373 cm BT /F42 8.9664 Tf 396.2741 713.0262 Td[(Description)]TJ ET 1 0 0 1 317.5734 709.6388 cm q []0 d 0 J 0.3985 w 0 0.1992 m 237.984 0.1992 l S Q 1 0 0 1 -317.5734 -709.6388 cm BT /F42 8.9664 Tf 323.551 702.665 Td[(xx1)]TJ ET 1 0 0 1 342.7789 699.6762 cm q []0 d 0 J 0.3985 w 0.1992 0 m 0.1992 9.9626 l S Q 1 0 0 1 -342.7789 -699.6762 cm BT /F42 8.9664 Tf 348.9558 702.665 Td[(number)]TJ ET 1 0 0 1 390.0973 699.6762 cm q []0 d 0 J 0.3985 w 0.1992 0 m 0.1992 9.9626 l S Q 1 0 0 1 -390.0973 -699.6762 cm BT /F42 8.9664 Tf 396.2741 702.665 Td[(31-bit)-250(inte)15(ger)-250(representation)]TJ -72.7231 -9.9626 Td[(000)]TJ ET 1 0 0 1 342.7789 689.7136 cm q []0 d 0 J 0.3985 w 0.1992 0 m 0.1992 9.9626 l S Q 1 0 0 1 -342.7789 -689.7136 cm BT /F42 8.9664 Tf 348.9558 692.7024 Td[(object)]TJ ET 1 0 0 1 390.0973 689.7136 cm q []0 d 0 J 0.3985 w 0.1992 0 m 0.1992 9.9626 l S Q 1 0 0 1 -390.0973 -689.7136 cm BT /F42 8.9664 Tf 396.2741 692.7024 Td[(pointer)-250(to)-250(JSObject)-250(handle)]TJ -72.7231 -9.9627 Td[(010)]TJ ET 1 0 0 1 342.7789 679.7509 cm q []0 d 0 J 0.3985 w 0.1992 0 m 0.1992 9.9626 l S Q 1 0 0 1 -342.7789 -679.7509 cm BT /F42 8.9664 Tf 348.9558 682.7397 Td[(number)]TJ ET 1 0 0 1 390.0973 679.7509 cm q []0 d 0 J 0.3985 w 0.1992 0 m 0.1992 9.9626 l S Q 1 0 0 1 -390.0973 -679.7509 cm BT /F42 8.9664 Tf 396.2741 682.7397 Td[(pointer)-250(to)-250(double)-250(handle)]TJ -72.7231 -9.9626 Td[(100)]TJ ET 1 0 0 1 342.7789 669.7883 cm q []0 d 0 J 0.3985 w 0.1992 0 m 0.1992 9.9626 l S Q 1 0 0 1 -342.7789 -669.7883 cm BT /F42 8.9664 Tf 348.9558 672.7771 Td[(string)]TJ ET 1 0 0 1 390.0973 669.7883 cm q []0 d 0 J 0.3985 w 0.1992 0 m 0.1992 9.9626 l S Q 1 0 0 1 -390.0973 -669.7883 cm BT /F42 8.9664 Tf 396.2741 672.7771 Td[(pointer)-250(to)-250(JSString)-250(handle)]TJ -72.7231 -9.9626 Td[(110)]TJ ET 1 0 0 1 342.7789 659.8256 cm q []0 d 0 J 0.3985 w 0.1992 0 m 0.1992 9.9626 l S Q 1 0 0 1 -342.7789 -659.8256 cm BT /F42 8.9664 Tf 348.9558 662.8145 Td[(boolean)]TJ ET 1 0 0 1 390.0973 659.8256 cm q []0 d 0 J 0.3985 w 0.1992 0 m 0.1992 9.9626 l S Q 1 0 0 1 -390.0973 -659.8256 cm BT /F42 8.9664 Tf 396.2741 662.8145 Td[(enumeration)-250(for)-250(null,)-250(unde\002ned,)-250(true,)-250(f)10(alse)]TJ ET 1 0 0 1 342.7789 649.863 cm q []0 d 0 J 0.3985 w 0.1992 0 m 0.1992 9.9626 l S Q 1 0 0 1 -342.7789 -649.863 cm BT /F42 8.9664 Tf 348.9558 652.8518 Td[(null,)-250(or)]TJ ET 1 0 0 1 390.0973 649.863 cm q []0 d 0 J 0.3985 w 0.1992 0 m 0.1992 9.9626 l S Q 1 0 0 1 -47.3184 -9.9626 cm q []0 d 0 J 0.3985 w 0.1992 0 m 0.1992 9.9626 l S Q 1 0 0 1 -342.7789 -639.9004 cm BT /F42 8.9664 Tf 348.9558 642.8892 Td[(unde\002ned)]TJ ET 1 0 0 1 390.0973 639.9004 cm q []0 d 0 J 0.3985 w 0.1992 0 m 0.1992 9.9626 l S Q 1 0 0 1 -73.0836 -4.3139 cm q []0 d 0 J 0.3288 w 0 0.1644 m 239.1034 0.1644 l S Q 1 0 0 1 -317.0137 -635.5865 cm BT /F41 8.9664 Tf 317.0137 625.4237 Td[(Figur)18(e)-354(9.)-500(T)92(agged)-355(v)10(alues)-354(in)-355(the)-354(SpiderMonk)10(ey)-354(JS)-355(inter)10(pr)18(eter)100(.)]TJ/F42 8.9664 Tf 0 -9.9626 Td[(T)70(esting)-275(tags,)-274(unboxing)-275(\050e)15(xtracting)-274(the)-275(untagged)-274(v)25(alue\051)-275(and)-275(boxing)]TJ 0 -9.9627 Td[(\050creating)-276(tagged)-276(v)25(alues\051)-276(are)-275(signi\002cant)-276(costs.)-276(A)74(v)20(oiding)-276(these)-276(costs)]TJ 0 -9.9626 Td[(is)-250(a)-250(k)10(e)15(y)-250(bene\002t)-250(of)-250(tracing.)]TJ 0 -37.0852 Td[(heuristic)-337(selects)]TJ/F29 8.9664 Tf 60.8249 0 Td[(v)]TJ/F42 8.9664 Tf 7.8187 0 Td[(with)-337(minimum)]TJ/F29 8.9664 Tf 56.8623 0 Td[(v)]TJ/F30 5.9776 Tf 4.4762 -0.9962 Td[(m)]TJ/F42 8.9664 Tf 7.0361 0.9962 Td[(.)-337(The)-337(moti)25(v)25(ation)-337(is)-336(that)-337(this)]TJ -137.0182 -9.9626 Td[(frees)-250(up)-250(a)-250(re)15(gister)-250(for)-250(as)-250(long)-250(as)-250(possible)-250(gi)25(v)15(en)-250(a)-250(single)-250(spill.)]TJ 11.9552 -9.9627 Td[(If)-410(we)-411(need)-410(to)-411(spill)-410(a)-410(v)25(alue)]TJ/F29 8.9664 Tf 104.7152 0 Td[(v)]TJ/F30 5.9776 Tf 4.4762 -0.9962 Td[(s)]TJ/F42 8.9664 Tf 7.6717 0.9962 Td[(at)-410(this)-411(point,)-410(we)-411(ge)1(nerate)-411(the)]TJ -128.8183 -9.9626 Td[(restore)-437(code)-437(just)-436(after)-437(the)-437(code)-437(for)-436(the)-437(current)-437(instruction.)-437(The)]TJ 0 -9.9627 Td[(corresponding)-239(spill)-240(code)-239(is)-239(generated)-240(just)-239(after)-240(the)-239(last)-239(point)-240(where)]TJ/F29 8.9664 Tf 0 -9.9626 Td[(v)]TJ/F30 5.9776 Tf 4.4762 -0.9962 Td[(s)]TJ/F42 8.9664 Tf 6.0391 0.9962 Td[(w)10(as)-228(used.)-229(The)-228(re)15(gister)-228(that)-228(w)10(as)-229(assigned)-228(to)]TJ/F29 8.9664 Tf 154.7624 0 Td[(v)]TJ/F30 5.9776 Tf 4.4762 -0.9962 Td[(s)]TJ/F42 8.9664 Tf 6.0391 0.9962 Td[(is)-228(mark)10(ed)-229(free)-228(for)]TJ -175.793 -9.9626 Td[(the)-352(preceding)-352(code,)-352(because)-352(that)-352(re)15(gister)-352(can)-352(no)25(w)-353(be)-352(used)-352(freely)]TJ 0 -9.9627 Td[(without)-250(af)25(fecting)-250(the)-250(follo)25(wing)-250(code)]TJ/F41 10.9589 Tf 0 -24.6146 Td[(6.)-1000(Implementation)]TJ/F42 8.9664 Tf 0 -13.9477 Td[(T)80(o)-431(demonstrate)-432(the)-431(ef)25(fecti)25(v)15(eness)-431(of)-431(our)-432(approach,)-431(we)-431(ha)20(v)15(e)-432(im-)]TJ 0 -9.9626 Td[(plemented)-314(a)-314(trace-based)-314(dynamic)-314(compiler)-314(for)-314(the)-314(SpiderMonk)10(e)15(y)]TJ 0 -9.9626 Td[(Ja)20(v)25(aScript)-418(V)60(irtual)-419(Machine)-418(\0504\051.)-419(SpiderM)1(onk)10(e)15(y)-419(is)-418(the)-419(Ja)20(v)25(aScript)]TJ 0 -9.9627 Td[(VM)-285(embedded)-285(in)-285(Mozilla')55(s)-285(Firefox)-285(open-source)-285(web)-286(bro)25(wser)-285(\0502\051,)]TJ 0 -9.9626 Td[(which)-216(is)-216(used)-216(by)-216(more)-215(than)-216(200)-216(million)-216(users)-216(w)10(orld-wide.)-216(The)-216(core)]TJ 0 -9.9627 Td[(of)-250(SpiderMonk)10(e)15(y)-250(is)-250(a)-250(bytecode)-250(interpreter)-250(implemented)-250(in)-250(C++.)]TJ 11.9551 -9.9626 Td[(In)-337(SpiderMonk)10(e)15(y)65(,)-336(all)-337(Ja)20(v)25(aScript)-337(v)25(alues)-336(are)-337(represented)-337(by)-336(the)]TJ -11.9551 -9.9626 Td[(type)]TJ/F33 8.9664 Tf 17.9031 0 Td[(jsval)]TJ/F42 8.9664 Tf 23.5364 0 Td[(.)-275(A)]TJ/F33 8.9664 Tf 13.6414 0 Td[(jsval)]TJ/F42 8.9664 Tf 25.9996 0 Td[(is)-275(machine)-274(w)10(ord)-275(in)-275(which)-274(up)-275(to)-275(the)-275(3)-274(of)-275(the)]TJ -81.0805 -9.9627 Td[(least)-255(signi\002cant)-255(bits)-255(are)-255(a)-255(type)-255(tag,)-255(and)-255(the)-255(remaining)-255(bits)-255(are)-255(data.)]TJ 0 -9.9626 Td[(See)-267(Figure)-267(6)-266(for)-267(details.)-267(All)-267(pointers)-267(contai)1(ned)-267(in)]TJ/F33 8.9664 Tf 180.6644 0 Td[(jsvals)]TJ/F42 8.9664 Tf 30.6361 0 Td[(point)-267(to)]TJ -211.3005 -9.9627 Td[(GC-controlled)-250(blocks)-250(aligned)-250(on)-250(8-byte)-250(boundaries.)]TJ 11.9551 -9.9626 Td[(Ja)20(v)25(aScript)]TJ/F46 8.9664 Tf 39.0476 0 Td[(object)]TJ/F42 8.9664 Tf 24.1725 0 Td[(v)25(alues)-234(are)-234(mappings)-234(of)-234(string-v)25(alued)-234(property)]TJ -75.1752 -9.9626 Td[(names)-241(to)-241(arbitrary)-241(v)25(alues.)-241(The)15(y)-241(are)-241(represented)-241(in)-241(one)-241(of)-241(tw)10(o)-241(w)10(ays)]TJ 0 -9.9627 Td[(in)-304(SpiderMonk)10(e)15(y)65(.)-304(Most)-304(objects)-303(are)-304(represented)-304(by)-304(a)-304(shared)-304(struc-)]TJ 0 -9.9626 Td[(tural)-217(desc)1(ription,)-217(called)-217(the)]TJ/F46 8.9664 Tf 98.6576 0 Td[(object)-217(shape)]TJ/F42 8.9664 Tf 44.7736 0 Td[(,)-217(that)-216(maps)-217(property)-216(names)]TJ -143.4312 -9.9627 Td[(to)-315(array)-316(inde)15(x)15(es)-315(using)-316(a)-315(hash)-315(table.)-316(The)-315(object)-316(store)1(s)-316(a)-315(pointer)-316(to)]TJ 0 -9.9626 Td[(the)-361(shape)-361(and)-361(the)-361(array)-361(of)-361(its)-361(o)25(wn)-362(property)-361(v)25(alues.)-361(Objects)-361(with)]TJ 0 -9.9626 Td[(lar)18(ge,)-290(unique)-289(sets)-290(of)-290(property)-289(names)-290(store)-289(their)-290(properties)-290(directly)]TJ 0 -9.9627 Td[(in)-250(a)-250(hash)-250(table.)]TJ 11.9551 -9.9626 Td[(The)-369(g)5(arbage)-369(collector)-369(is)-369(an)-369(e)15(xact,)-369(non-gene)1(rational,)-369(stop-the-)]TJ -11.9551 -9.9627 Td[(w)10(orld)-250(mark-and-sweep)-250(collector)55(.)]TJ 11.9551 -9.9626 Td[(In)-223(the)-223(rest)-223(of)-223(this)-224(section)-223(we)-223(discuss)-223(k)10(e)15(y)-223(areas)-223(of)-223(the)-223(T)35(raceMon-)]TJ -11.9551 -9.9626 Td[(k)10(e)15(y)-250(implementation.)]TJ/F41 8.9664 Tf 0 -19.0664 Td[(6.1)-1000(Calling)-250(Compiled)-250(T)74(races)]TJ/F42 8.9664 Tf 0 -13.9477 Td[(Compiled)-293(traces)-292(are)-293(stored)-293(in)-293(a)]TJ/F46 8.9664 Tf 115.8509 0 Td[(tr)15(ace)-293(cac)15(he)]TJ/F42 8.9664 Tf 41.6915 0 Td[(,)-293(inde)15(x)15(ed)-293(by)-292(intepreter)]TJ -157.5424 -9.9627 Td[(PC)-543(and)-542(type)-543(map.)-543(T)35(races)-543(are)-543(compiled)-542(so)-543(that)-543(the)15(y)-543(may)-543(be)]TJ 0 -9.9626 Td[(called)-280(as)-279(functions)-280(using)-280(standard)-280(nati)25(v)15(e)-279(calling)-280(con)40(v)15(entions)-280(\050e.g.,)]TJ/F33 8.9664 Tf 0 -9.9626 Td[(FASTCALL)]TJ/F42 8.9664 Tf 39.8999 0 Td[(on)-250(x86\051.)]TJ -27.9448 -9.9627 Td[(The)-354(interpreter)-354(must)-354(hit)-353(a)-354(loop)-354(edge)-354(and)-354(enter)-354(the)-354(m)1(onitor)-354(in)]TJ -11.9551 -9.9626 Td[(order)-251(to)-252(call)-251(a)-252(nati)25(v)15(e)-251(trace)-251(for)-252(the)-251(\002rst)-252(time.)-251(The)-251(monitor)-252(computes)]TJ 0 -9.9627 Td[(the)-401(current)-402(type)-401(map,)-401(checks)-402(the)-401(trace)-401(cache)-401(for)-402(a)-401(trace)-401(for)-402(the)]TJ 0 -9.9626 Td[(current)-250(PC)-250(and)-250(type)-250(map,)-250(and)-250(if)-250(it)-250(\002nds)-250(one,)-250(e)15(x)15(ecutes)-250(the)-250(trace.)]TJ 11.9552 -9.9626 Td[(T)80(o)-399(e)15(x)15(ecute)-399(a)-399(trace,)-399(the)-399(monitor)-399(must)-399(b)20(uild)-399(a)-399(trace)-399(acti)25(v)25(ation)]TJ -11.9552 -9.9627 Td[(record)-350(containi)1(ng)-350(imported)-350(local)-349(and)-350(global)-349(v)25(ariables,)-350(temporary)]TJ 0 -9.9626 Td[(stack)-269(s)1(pace,)-269(and)-269(space)-268(for)-269(ar)18(guments)-268(to)-269(nati)25(v)15(e)-268(calls.)-269(The)-268(local)-269(and)]TJ 0 -9.9627 Td[(global)-266(v)25(alue)1(s)-266(are)-266(then)-265(copied)-266(from)-265(the)-266(interpreter)-265(state)-266(to)-265(the)-266(trace)]TJ 0 -9.9626 Td[(acti)25(v)25(ation)-243(record.)-244(Then,)-243(the)-243(trace)-244(is)-243(called)-243(lik)10(e)-244(a)-243(normal)-243(C)-244(function)]TJ 0 -9.9626 Td[(pointer)55(.)]TJ ET BT /F42 8.9664 Tf 65.9552 712.0299 Td[(When)-356(a)-355(trace)-356(call)-356(returns,)-356(the)-355(monitor)-356(restores)-356(the)-355(interpreter)]TJ -11.9552 -9.9627 Td[(state.)-391(First,)-390(the)-391(monitor)-391(checks)-390(the)-391(reason)-391(for)-391(the)-390(trace)-391(e)15(xit)-391(and)]TJ 0 -9.9626 Td[(applies)-354(blacklisting)-355(if)-354(needed.)-355(Then,)-354(it)-354(pops)-355(or)-354(synthesizes)-355(inter)20(-)]TJ 0 -9.9626 Td[(preter)-273(Ja)20(v)25(aScript)-272(call)-273(stack)-273(frames)-272(as)-273(needed.)-273(Finally)65(,)-272(it)-273(copies)-273(the)]TJ 0 -9.9627 Td[(imported)-291(v)25(ariables)-292(back)-291(from)-292(the)-291(trace)-292(acti)25(v)25(ation)-291(record)-292(to)-291(the)-292(in-)]TJ 0 -9.9626 Td[(terpreter)-250(state.)]TJ 11.9552 -9.9627 Td[(At)-296(least)-295(in)-296(the)-295(current)-296(implementation,)-295(these)-296(steps)-295(ha)20(v)15(e)-296(a)-295(non-)]TJ -11.9552 -9.9626 Td[(ne)15(gligible)-328(runtime)-327(cost,)-328(so)-327(minimizing)-328(the)-328(numbe)1(r)-328(of)-328(interpreter)20(-)]TJ 0 -9.9626 Td[(to-trace)-345(and)-346(trac)1(e-to-interpreter)-346(transitions)-345(is)-345(essential)-345(for)-346(perfor)20(-)]TJ 0 -9.9627 Td[(mance.)-419(\050see)-419(also)-419(Section)-419(3.3\051.)-419(Our)-419(e)15(xperiments)-419(\050see)-419(Figure)-419(12\051)]TJ 0 -9.9626 Td[(sho)25(w)-414(that)-414(for)-415(programs)-414(we)-414(can)-414(trace)-414(well)-414(such)-415(transiti)1(ons)-415(hap-)]TJ 0 -9.9627 Td[(pen)-305(infrequently)-305(and)-305(hence)-305(do)-305(not)-305(contrib)20(ute)-305(signi\002cantly)-305(to)-305(total)]TJ 0 -9.9626 Td[(runtime.)-357(In)-357(a)-357(fe)25(w)-357(programs,)-357(where)-357(the)-358(s)1(ystem)-358(is)-357(pre)25(v)15(ented)-357(from)]TJ 0 -9.9626 Td[(recording)-338(branch)-337(traces)-338(for)-338(hot)-338(s)1(ide)-338(e)15(xits)-338(by)-338(aborts,)-337(this)-338(cost)-338(can)]TJ 0 -9.9627 Td[(rise)-250(to)-250(up)-250(to)-250(10%)-250(of)-250(total)-250(e)15(x)15(ecution)-250(time.)]TJ/F41 8.9664 Tf 0 -18.929 Td[(6.2)-1000(T)74(race)-250(Stitching)]TJ/F42 8.9664 Tf 0 -13.9477 Td[(T)35(ransitions)-332(from)-332(a)-333(trace)-332(to)-332(a)-332(branch)-332(trace)-333(at)-332(a)-332(side)-332(e)15(xit)-332(a)20(v)20(oid)-333(the)]TJ 0 -9.9626 Td[(costs)-346(of)-347(calling)-346(traces)-347(from)-346(the)-347(monitor)40(,)-346(in)-346(a)-347(feature)-346(called)]TJ/F46 8.9664 Tf 220.8122 0 Td[(tr)15(ace)]TJ -220.8122 -9.9627 Td[(stitc)15(hing)]TJ/F42 8.9664 Tf 30.7542 0 Td[(.)-327(At)-326(a)-327(side)-327(e)15(xit,)-327(the)-326(e)15(xiting)-327(trace)-327(only)-327(needs)-326(to)-327(write)-327(li)25(v)15(e)]TJ -30.7542 -9.9626 Td[(re)15(gister)20(-carried)-226(v)25(alues)-225(back)-226(to)-226(its)-225(trace)-226(acti)25(v)25(ation)-226(record.)-225(In)-226(our)-226(im-)]TJ 0 -9.9627 Td[(plementation,)-289(identical)-290(type)-289(maps)-290(yield)-289(identical)-289(acti)25(v)25(ation)-290(record)]TJ 0 -9.9626 Td[(layouts,)-343(so)-342(the)-343(trace)-343(acti)25(v)25(ati)1(on)-343(record)-343(can)-342(be)-343(reused)-343(immediately)]TJ 0 -9.9626 Td[(by)-250(the)-250(branch)-250(trace.)]TJ 11.9552 -9.9627 Td[(In)-381(programs)-381(with)-381(branch)5(y)-381(trace)-381(trees)-381(with)-381(small)-380(traces,)-381(trace)]TJ -11.9552 -9.9626 Td[(stitching)-361(has)-362(a)-361(noticeable)-361(cost.)-361(Although)-362(writing)-361(to)-361(memory)-362(and)]TJ 0 -9.9627 Td[(then)-476(soon)-475(reading)-476(back)-475(w)10(ould)-476(be)-476(e)15(xpected)-475(to)-476(ha)20(v)15(e)-475(a)-476(high)-476(L1)]TJ 0 -9.9626 Td[(cache)-309(hit)-309(rate,)-309(for)-309(small)-309(traces)-309(the)-309(increased)-309(instruction)-309(count)-309(has)]TJ 0 -9.9626 Td[(a)-477(noticeable)-476(cost.)-477(Also,)-477(if)-476(the)-477(writes)-477(and)-477(reads)-476(are)-477(v)15(ery)-477(close)]TJ 0 -9.9627 Td[(in)-483(the)-483(dynam)1(ic)-483(instruction)-483(stream,)-483(we)-482(ha)20(v)15(e)-483(found)-483(that)-483(current)]TJ 0 -9.9626 Td[(x86)-358(processors)-358(often)-358(incur)-358(penalties)-358(of)-358(6)-358(c)15(ycles)-358(or)-358(more)-358(\050e.g.,)-358(if)]TJ 0 -9.9627 Td[(the)-326(instructions)-325(use)-326(dif)25(ferent)-326(base)-325(re)15(gisters)-326(with)-325(equal)-326(v)25(alues,)-326(the)]TJ 0 -9.9626 Td[(processor)-251(may)-250(not)-251(be)-250(able)-251(to)-250(detect)-251(that)-250(the)-251(addresses)-251(are)-250(the)-251(same)]TJ 0 -9.9626 Td[(right)-250(a)15(w)10(ay\051.)]TJ 11.9552 -9.9627 Td[(The)-309(alternate)-309(solution)-308(is)-309(to)-309(recompile)-309(an)-309(entire)-309(trace)-309(tre)1(e,)-309(thus)]TJ -11.9552 -9.9626 Td[(achie)25(ving)-350(inter)20(-trace)-351(re)15(gister)-350(allocation)-350(\05010\051.)-351(The)-350(disadv)25(antage)-351(is)]TJ 0 -9.9627 Td[(that)-210(tree)-210(recompilation)-210(tak)10(es)-209(time)-210(quadratic)-210(in)-210(the)-210(number)-210(of)-210(traces.)]TJ 0 -9.9626 Td[(W)80(e)-424(belie)25(v)15(e)-424(that)-425(the)-424(cost)-424(of)-424(recompiling)-425(a)-424(trace)-424(tree)-424(e)25(v)15(ery)-425(time)]TJ 0 -9.9626 Td[(a)-397(branch)-397(is)-397(added)-397(w)10(ould)-397(be)-397(prohibiti)25(v)15(e.)-397(That)-397(problem)-397(might)-397(be)]TJ 0 -9.9627 Td[(mitig)5(ated)-361(by)-360(recompiling)-361(only)-360(at)-361(certain)-360(points,)-361(or)-361(onl)1(y)-361(for)-361(v)15(ery)]TJ 0 -9.9626 Td[(hot,)-250(stable)-250(trees.)]TJ 11.9552 -9.9627 Td[(In)-380(the)-380(future,)-380(multicore)-380(hardw)10(are)-380(is)-380(e)15(xpected)-379(to)-380(be)-380(common,)]TJ -11.9552 -9.9626 Td[(making)-343(background)-342(tree)-343(recompilation)-342(attracti)25(v)15(e.)-343(In)-342(a)-343(closely)-343(re-)]TJ 0 -9.9626 Td[(lated)-366(project)-366(\05013\051)-365(background)-366(recompilation)-366(yielded)-366(speedups)-366(of)]TJ 0 -9.9627 Td[(up)-337(to)-338(1.25x)-337(on)-337(benchmarks)-338(with)-337(man)15(y)-337(branch)-338(traces.)-337(W)80(e)-337(plan)-338(to)]TJ 0 -9.9626 Td[(apply)-250(this)-250(technique)-250(to)-250(T)35(raceMonk)10(e)15(y)-250(as)-250(future)-250(w)10(ork.)]TJ/F41 8.9664 Tf 0 -18.929 Td[(6.3)-1000(T)74(race)-250(Recording)]TJ/F42 8.9664 Tf 0 -13.9477 Td[(The)-209(job)-208(of)-209(the)-209(trace)-209(recorder)-208(is)-209(to)-209(emit)-209(LIR)-208(with)-209(identical)-209(semantics)]TJ 0 -9.9627 Td[(to)-294(the)-294(currently)-294(running)-293(interpreter)-294(bytecode)-294(trace.)-294(A)-294(good)-294(imple-)]TJ 0 -9.9626 Td[(mentation)-323(should)-323(ha)20(v)15(e)-323(lo)25(w)-323(impact)-323(on)-324(non-tracing)-323(interpreter)-323(per)20(-)]TJ 0 -9.9626 Td[(formance)-329(and)-329(a)-329(con)40(v)15(enient)-328(w)10(ay)-329(for)-329(implementers)-329(to)-329(maintain)-329(se-)]TJ 0 -9.9627 Td[(mantic)-250(equi)25(v)25(alence.)]TJ 11.9552 -9.9626 Td[(In)-240(our)-240(implementation,)-240(the)-240(only)-240(direct)-240(modi\002cation)-240(to)-240(the)-240(inter)20(-)]TJ -11.9552 -9.9627 Td[(preter)-233(is)-234(a)-233(call)-233(to)-234(the)-233(trace)-234(m)1(onitor)-234(at)-233(loop)-234(edges.)-233(In)-233(our)-234(benchmark)]TJ 0 -9.9626 Td[(results)-329(\050see)-329(Figure)-329(12\051)-329(the)-328(total)-329(time)-329(spent)-329(in)-329(the)-329(monitor)-329(\050for)-329(all)]TJ 0 -9.9626 Td[(acti)25(vities\051)-356(is)-355(usually)-356(less)-356(than)-355(5%,)-356(so)-356(we)-355(consider)-356(the)-356(interpreter)]TJ 0 -9.9627 Td[(impact)-339(re)1(quirement)-339(met.)-339(Increm)1(enting)-339(the)-339(loop)-338(hit)-339(counter)-338(is)-339(e)15(x-)]TJ 0 -9.9626 Td[(pensi)25(v)15(e)-215(because)-215(it)-215(requires)-215(us)-215(to)-215(look)-215(up)-215(the)-215(loop)-216(in)-215(the)-215(trace)-215(cache,)]TJ 0 -9.9627 Td[(b)20(ut)-279(we)-280(ha)20(v)15(e)-279(tuned)-280(our)-279(loops)-279(to)-280(become)-279(hot)-280(and)-279(trace)-279(v)15(ery)-280(quickly)]TJ 0 -9.9626 Td[(\050on)-263(the)-263(second)-262(iteration\051.)-263(The)-263(hit)-262(counter)-263(implementation)-263(could)-263(be)]TJ 0 -9.9626 Td[(impro)15(v)15(ed,)-310(which)-309(might)-310(gi)25(v)15(e)-310(us)-309(a)-310(small)-310(increase)-309(in)-310(o)15(v)15(erall)-310(perfor)20(-)]TJ 0 -9.9627 Td[(mance,)-310(as)-311(well)-310(as)-311(more)-310(\003e)15(xibility)-310(with)-311(tuning)-310(hotness)-311(thresholds.)]TJ 0 -9.9626 Td[(Once)-291(a)-291(loop)-290(is)-291(blacklisted)-291(we)-291(ne)25(v)15(er)-291(call)-290(into)-291(the)-291(trace)-291(monitor)-291(for)]TJ 0 -9.9627 Td[(that)-250(loop)-250(\050see)-250(Section)-250(3.3\051.)]TJ 274.9689 643.5866 Td[(Recording)-425(is)-425(acti)25(v)25(ated)-425(by)-425(a)-425(pointer)-425(sw)10(ap)-425(that)-425(sets)-425(the)-425(inter)20(-)]TJ -11.9552 -9.9627 Td[(preter')55(s)-375(dispatch)-376(ta)1(ble)-376(to)-375(call)-375(a)-376(single)-375(\223interrupt\224)-375(routine)-375(for)-376(e)25(v-)]TJ 0 -9.9626 Td[(ery)-358(bytecode.)-359(The)-358(interrupt)-358(routine)-359(\002rst)-358(calls)-358(a)-359(bytecode-speci\002c)]TJ 0 -9.9626 Td[(recording)-377(routine.)-377(Then,)-377(it)-377(turns)-377(of)25(f)-377(recording)-377(if)-377(necessary)-377(\050e.g.,)]TJ 0 -9.9627 Td[(the)-290(trace)-291(ended\051.)-290(Finally)65(,)-290(it)-290(jumps)-291(to)-290(the)-290(standard)-290(interpreter)-291(byte-)]TJ 0 -9.9626 Td[(code)-202(implementation.)-201(Some)-202(bytecodes)-201(ha)20(v)15(e)-202(ef)25(fects)-202(on)-201(the)-202(type)-202(map)]TJ 0 -9.9627 Td[(that)-310(cannot)-309(be)-310(predicted)-310(before)-310(e)15(x)15(ecuting)-309(the)-310(bytecode)-310(\050e.g.,)-310(call-)]TJ 0 -9.9626 Td[(ing)]TJ/F33 8.9664 Tf 14.1757 0 Td[(String.charCodeAt)]TJ/F42 8.9664 Tf 80.024 0 Td[(,)-303(which)-303(returns)-303(an)-303(inte)15(ger)-303(or)]TJ/F46 8.9664 Tf 106.0533 0 Td[(NaN)]TJ/F42 8.9664 Tf 19.6985 0 Td[(if)-303(the)]TJ -219.9515 -9.9626 Td[(inde)15(x)-228(ar)18(gument)-229(is)-228(out)-229(of)-228(range\051.)-229(F)15(or)-228(these,)-229(we)-228(arrange)-229(for)-228(the)-229(inter)20(-)]TJ 0 -9.9627 Td[(preter)-307(to)-307(call)-307(into)-307(the)-307(recorder)-307(ag)5(ain)-307(after)-308(e)15(x)15(ecuting)-307(the)-307(bytecode.)]TJ 0 -9.9626 Td[(Since)-302(such)-302(hooks)-301(are)-302(relati)25(v)15(ely)-302(rare,)-302(we)-301(embed)-302(them)-302(directly)-302(into)]TJ 0 -9.9627 Td[(the)-318(interpreter)40(,)-319(with)-318(an)-319(additional)-318(runtime)-319(check)-318(to)-319(see)-318(whether)-319(a)]TJ 0 -9.9626 Td[(recorder)-250(is)-250(currently)-250(acti)25(v)15(e.)]TJ 11.9552 -9.9626 Td[(While)-244(separating)-244(the)-244(interpreter)-244(from)-244(the)-244(recorder)-244(reduces)-244(indi-)]TJ -11.9552 -9.9627 Td[(vidual)-215(code)-216(comple)15(xity)65(,)-215(it)-215(also)-216(requires)-215(careful)-215(implementation)-216(and)]TJ 0 -9.9626 Td[(e)15(xtensi)25(v)15(e)-250(testing)-250(to)-250(achie)25(v)15(e)-250(semantic)-250(equi)25(v)25(alence.)]TJ 11.9552 -9.9627 Td[(In)-302(some)-301(cases)-302(achie)25(ving)-301(this)-302(equi)25(v)25(alence)-302(is)-301(dif)25(\002cult)-302(since)-301(Spi-)]TJ -11.9552 -9.9626 Td[(derMonk)10(e)15(y)-313(follo)25(ws)-312(a)]TJ/F46 8.9664 Tf 80.1794 0 Td[(fat-bytecode)]TJ/F42 8.9664 Tf 47.1246 0 Td[(design,)-313(which)-312(w)10(as)-313(found)-313(to)-313(be)]TJ -127.304 -9.9626 Td[(bene\002cial)-250(to)-250(pure)-250(interpreter)-250(performance.)]TJ 11.9552 -9.9627 Td[(In)-428(f)10(at-bytecode)-427(designs,)-428(indi)25(vidual)-428(bytecodes)-428(can)-427(implement)]TJ -11.9552 -9.9626 Td[(comple)15(x)-446(processing)-446(\050e.g.,)-446(the)]TJ/F33 8.9664 Tf 114.2213 0 Td[(getprop)]TJ/F42 8.9664 Tf 36.9499 0 Td[(bytecode,)-446(which)-446(imple-)]TJ -151.1712 -9.9627 Td[(ments)-221(full)-221(Ja)20(v)25(aScript)-222(property)-221(v)25(alue)-221(access,)-221(including)-222(s)1(pecial)-222(cases)]TJ 0 -9.9626 Td[(for)-250(cached)-250(and)-250(dense)-250(array)-250(access\051.)]TJ 11.9552 -9.9626 Td[(F)15(at)-461(bytecodes)-461(ha)20(v)15(e)-461(tw)10(o)-461(adv)25(antages:)-461(fe)25(wer)-461(bytecodes)-461(means)]TJ -11.9552 -9.9627 Td[(lo)25(wer)-255(dispatch)-255(cost,)-255(and)-255(bigger)-255(bytecode)-256(impleme)1(ntations)-256(gi)25(v)15(e)-255(the)]TJ 0 -9.9626 Td[(compiler)-250(more)-250(opportunities)-250(to)-250(optimize)-250(the)-250(interpreter)55(.)]TJ 11.9552 -9.9627 Td[(F)15(at)-436(bytecodes)-436(are)-435(a)-436(problem)-436(for)-436(T)35(raceMonk)10(e)15(y)-436(because)-435(the)15(y)]TJ -11.9552 -9.9626 Td[(require)-408(the)-408(recorder)-409(to)-408(reimplement)-408(the)-408(same)-408(special)-409(c)1(ase)-409(logic)]TJ 0 -9.9626 Td[(in)-433(the)-433(same)-433(w)10(ay)65(.)-433(Also,)-433(the)-433(adv)25(antages)-433(are)-434(reduced)-433(because)-433(\050a\051)]TJ 0 -9.9627 Td[(dispatch)-374(costs)-374(are)-374(eliminated)-374(entirely)-374(in)-374(compiled)-374(traces,)-374(\050b\051)-374(the)]TJ 0 -9.9626 Td[(traces)-456(contain)-457(only)-456(one)-457(special)-456(case,)-456(not)-457(the)-456(interpreter')55(s)-457(lar)18(ge)]TJ 0 -9.9627 Td[(chunk)-282(of)-281(code,)-282(and)-281(\050c\051)-282(T)35(raceMonk)10(e)15(y)-281(spends)-282(less)-282(time)-281(running)-282(the)]TJ 0 -9.9626 Td[(base)-250(interpreter)55(.)]TJ 11.9552 -9.9626 Td[(One)-247(w)10(ay)-246(we)-247(ha)20(v)15(e)-246(mitig)5(ated)-247(these)-247(problems)-246(is)-247(by)-246(implementing)]TJ -11.9552 -9.9627 Td[(certain)-311(comple)15(x)-311(bytecodes)-311(in)-311(the)-311(recorder)-311(as)-312(sequences)-311(of)-311(simple)]TJ 0 -9.9626 Td[(bytecodes.)-193(Expressing)-193(the)-193(original)-192(semantics)-193(this)-193(w)10(ay)-193(is)-193(not)-193(too)-193(dif-)]TJ 0 -9.9627 Td[(\002cult,)-247(and)-248(recording)-247(simple)-247(bytecodes)-247(is)-248(much)-247(easier)55(.)-247(This)-248(enables)]TJ 0 -9.9626 Td[(us)-235(to)-234(retain)-235(the)-234(adv)25(antages)-235(of)-234(f)10(at)-235(bytecodes)-234(while)-235(a)20(v)20(oiding)-234(some)-235(of)]TJ 0 -9.9626 Td[(their)-252(problems)-252(for)-252(trace)-251(recording.)-252(This)-252(is)-252(particularly)-252(ef)25(fecti)25(v)15(e)-252(for)]TJ 0 -9.9627 Td[(f)10(at)-288(bytecodes)-288(that)-287(recurse)-288(back)-288(into)-288(the)-287(interpreter)40(,)-288(for)-288(e)15(xample)-288(to)]TJ 0 -9.9626 Td[(con)40(v)15(ert)-287(an)-288(object)-287(into)-288(a)-287(primiti)25(v)15(e)-288(v)25(alue)-287(by)-288(in)40(v)20(oking)-287(a)-288(well-kno)25(wn)]TJ 0 -9.9627 Td[(method)-250(on)-250(the)-250(object,)-250(since)-250(it)-250(lets)-250(us)-250(inline)-250(this)-250(function)-250(call.)]TJ 11.9552 -9.9626 Td[(It)-269(is)-270(important)-269(to)-270(note)-269(that)-270(we)-269(split)-270(f)10(at)-269(opcodes)-269(into)-270(thinner)-269(op-)]TJ -11.9552 -9.9626 Td[(codes)-256(only)-257(during)-256(recording.)-257(When)-256(running)-256(purely)-257(interpretati)25(v)15(ely)]TJ 0 -9.9627 Td[(\050i.e.)-259(code)-259(that)-259(has)-259(been)-259(blacklisted\051,)-259(the)-259(interpreter)-260(direct)1(ly)-260(and)-259(ef-)]TJ 0 -9.9626 Td[(\002ciently)-250(e)15(x)15(ecutes)-250(the)-250(f)10(at)-250(opcodes.)]TJ/F41 8.9664 Tf 0 -31.8805 Td[(6.4)-1000(Pr)18(eemption)]TJ/F42 8.9664 Tf 0 -13.9477 Td[(SpiderMonk)10(e)15(y)65(,)-223(lik)10(e)-223(man)15(y)-223(VMs,)-223(needs)-223(to)-223(preempt)-224(the)-223(user)-223(program)]TJ 0 -9.9626 Td[(periodically)65(.)-441(The)-440(main)-441(reasons)-440(are)-441(to)-441(pre)25(v)15(ent)-440(in\002nitely)-441(looping)]TJ 0 -9.9626 Td[(scripts)-250(from)-250(locking)-250(up)-250(the)-250(host)-250(system)-250(and)-250(to)-250(schedule)-250(GC.)]TJ 11.9552 -9.9627 Td[(In)-274(the)-274(interpreter)40(,)-274(this)-274(had)-274(been)-274(implemented)-274(by)-273(setting)-274(a)-274(\223pre-)]TJ -11.9552 -9.9626 Td[(empt)-357(no)25(w\224)-358(\003ag)-357(that)-357(w)10(as)-357(check)10(ed)-358(on)-357(e)25(v)15(ery)-357(backw)10(ard)-357(jump.)-358(This)]TJ 0 -9.9627 Td[(strate)15(gy)-244(carried)-245(o)15(v)15(er)-244(into)-245(T)35(raceMonk)10(e)15(y:)-244(the)-245(VM)-244(inserts)-245(a)-244(guard)-245(on)]TJ 0 -9.9626 Td[(the)-342(preemption)-342(\003ag)-343(at)-342(e)25(v)15(ery)-342(loop)-342(edge.)-343(W)80(e)-342(measured)-342(less)-342(than)-343(a)]TJ 0 -9.9626 Td[(1%)-327(increase)-327(in)-327(runtime)-327(on)-327(most)-327(benchmarks)-327(for)-327(this)-327(e)15(xtra)-327(guard.)]TJ 0 -9.9627 Td[(In)-237(practice,)-236(the)-237(cost)-237(is)-236(detectable)-237(only)-237(for)-237(programs)-236(with)-237(v)15(ery)-237(short)]TJ 0 -9.9626 Td[(loops.)]TJ 11.9552 -9.9627 Td[(W)80(e)-390(tested)-390(and)-391(rejected)-390(a)-390(solution)-390(that)-391(a)20(v)20(oided)-390(the)-390(guards)-390(by)]TJ -11.9552 -9.9626 Td[(compiling)-361(the)-362(loop)-361(edge)-361(as)-362(a)1(n)-362(unconditional)-361(jump,)-361(and)-362(patching)]TJ 0 -9.9626 Td[(the)-412(jump)-412(tar)18(get)-412(to)-412(an)-412(e)15(xit)-412(routine)-412(when)-412(preemption)-412(is)-412(required.)]TJ 0 -9.9627 Td[(This)-394(solution)-395(can)-394(mak)10(e)-394(the)-395(normal)-394(case)-395(slightly)-394(f)10(aster)40(,)-394(b)20(ut)-395(then)]TJ 0 -9.9626 Td[(preemption)-256(becomes)-257(v)15(ery)-256(slo)25(w)65(.)-256(The)-257(implementation)-256(w)10(as)-256(also)-257(v)15(ery)]TJ 0 -9.9627 Td[(comple)15(x,)-201(especially)-200(trying)-201(to)-201(restart)-201(e)15(x)15(ecution)-200(after)-201(the)-201(preemption.)]TJ ET