mirror of
https://github.com/pdf2htmlEX/pdf2htmlEX.git
synced 2024-12-22 13:00:08 +00:00
2 lines
578 KiB
HTML
2 lines
578 KiB
HTML
<!DOCTYPE html>
|
||
<html><head><meta charset="utf-8"><style type="text/css">#pdf-main { font-family: sans-serif; position:absolute; top:0; left:0; bottom:0; right:0; overflow:auto; background-color:grey;}#pdf-main .p { position:relative; margin:13px auto; background-color:white; overflow:hidden; display:none;}.p .t { position:absolute; top:0; left:0; bottom:0; right:0; transform-origin:0% 100%; -ms-transform-origin:0% 100%; -moz-transform-origin:0% 100%; -webkit-transform-origin:0% 100%; -o-transform-origin:0% 100%;}.t .l { position:absolute; white-space:pre; transform-origin:0% 100%; -ms-transform-origin:0% 100%; -moz-transform-origin:0% 100%; -webkit-transform-origin:0% 100%; -o-transform-origin:0% 100%;}.l > span{ display:inline-block;}::selection{ background: rgba(168,209,255,0.5);}::-moz-selection{ background: rgba(168,209,255,0.5);}</style><link rel="stylesheet" type="text/css" href="all.css" /><script type="text/javascript">function show_pages(){ var pages = document.getElementById('pdf-main').childNodes; var idx = 0; var f = function(){ if (idx < pages.length) { pages[idx].style.display='block'; ++idx; setTimeout(f,100); } }; f();};</script></head><body onload="show_pages();"><div id="pdf-main"><div id="page-1" class="p" style="width:612px;height:792px;"><div class="t"><div class="l f1 s1 t0" style="top:91.3294px;left:80.5159px;" data-x="80.5159" data-y="700.671">T</div><div class="l f1 s1 t0" style="top:91.3294px;left:91.1501px;" data-x="91.1501" data-y="700.671">race-based<span class="w0"> </span>Just-in-Time<span class="w0"> </span>T</div><div class="l f1 s1 t0" style="top:91.3294px;left:291.459px;" data-x="291.459" data-y="700.671">ype<span class="w0"> </span>Specialization<span class="w0"> </span>for<span class="w0"> </span>Dynamic</div><div class="l f1 s1 t0" style="top:111.255px;left:263.706px;" data-x="263.706" data-y="680.745">Languages</div><div class="l f2 s2 t0" style="top:147.12px;left:120.322px;" data-x="120.322" data-y="644.88">Andreas<span class="w1"> </span>Gal</div><div class="l f3 s3 t0" style="top:143.161px;left:175.401px;" data-x="175.401" data-y="648.839">∗</div><div class="l f4 s3 t0" style="top:143.161px;left:180.134px;" data-x="180.134" data-y="648.839">+</div><div class="l f2 s2 t0" style="top:147.12px;left:187.218px;" data-x="187.218" data-y="644.88">,<span class="w1"> </span>Brendan<span class="w1"> </span>Eich</div><div class="l f3 s3 t0" style="top:143.161px;left:252.653px;" data-x="252.653" data-y="648.839">∗</div><div class="l f2 s2 t0" style="top:147.12px;left:257.386px;" data-x="257.386" data-y="644.88">,<span class="w1"> </span>Mike<span class="w1"> </span>Shaver</div><div class="l f3 s3 t0" style="top:143.161px;left:318.678px;" data-x="318.678" data-y="648.839">∗</div><div class="l f2 s2 t0" style="top:147.12px;left:323.411px;" data-x="323.411" data-y="644.88">,<span class="w1"> </span>David<span class="w1"> </span>Anderson</div><div class="l f3 s3 t0" style="top:143.161px;left:400.802px;" data-x="400.802" data-y="648.839">∗</div><div class="l f2 s2 t0" style="top:147.12px;left:405.534px;" data-x="405.534" data-y="644.88">,<span class="w1"> </span>David<span class="w1"> </span>Mandelin</div><div class="l f3 s3 t0" style="top:143.161px;left:482.323px;" data-x="482.323" data-y="648.839">∗</div><div class="l f2 s2 t0" style="top:147.12px;left:487.055px;" data-x="487.055" data-y="644.88">,</div><div class="l f2 s2 t0" style="top:160.072px;left:93.5416px;" data-x="93.5416" data-y="631.928">Mohammad<span class="w1"> </span>R.<span class="w1"> </span>Haghighat</div><div class="l f4 s3 t0" style="top:156.113px;left:207.689px;" data-x="207.689" data-y="635.887">$</div><div class="l f2 s2 t0" style="top:160.072px;left:212.421px;" data-x="212.421" data-y="631.928">,<span class="w1"> </span>Blake<span class="w1"> </span>Kaplan</div><div class="l f3 s3 t0" style="top:156.113px;left:277.746px;" data-x="277.746" data-y="635.887">∗</div><div class="l f2 s2 t0" style="top:160.072px;left:282.479px;" data-x="282.479" data-y="631.928">,<span class="w1"> </span>Graydon<span class="w1"> </span>Hoare</div><div class="l f3 s3 t0" style="top:156.113px;left:355.815px;" data-x="355.815" data-y="635.887">∗</div><div class="l f2 s2 t0" style="top:160.072px;left:360.548px;" data-x="360.548" data-y="631.928">,<span class="w1"> </span>Boris<span class="w1"> </span>Zbarsky</div><div class="l f3 s3 t0" style="top:156.113px;left:428.262px;" data-x="428.262" data-y="635.887">∗</div><div class="l f2 s2 t0" style="top:160.072px;left:432.994px;" data-x="432.994" data-y="631.928">,<span class="w1"> </span>Jason<span class="w1"> </span>Orendorff</div><div class="l f3 s3 t0" style="top:156.113px;left:509.103px;" data-x="509.103" data-y="635.887">∗</div><div class="l f2 s2 t0" style="top:160.072px;left:513.836px;" data-x="513.836" data-y="631.928">,</div><div class="l f2 s2 t0" style="top:173.023px;left:68.2749px;" data-x="68.2749" data-y="618.977">Jesse<span class="w1"> </span>Ruderman</div><div class="l f3 s3 t0" style="top:169.064px;left:139.189px;" data-x="139.189" data-y="622.936">∗</div><div class="l f2 s2 t0" style="top:173.023px;left:143.921px;" data-x="143.921" data-y="618.977">,<span class="w1"> </span>Edwin<span class="w1"> </span>Smith</div><div class="l f4 s3 t0" style="top:169.064px;left:206.946px;" data-x="206.946" data-y="622.936">#</div><div class="l f2 s2 t0" style="top:173.023px;left:214.501px;" data-x="214.501" data-y="618.977">,<span class="w1"> </span>Rick<span class="w1"> </span>Reitmaier</div><div class="l f4 s3 t0" style="top:169.064px;left:286.642px;" data-x="286.642" data-y="622.936">#</div><div class="l f2 s2 t0" style="top:173.023px;left:294.197px;" data-x="294.197" data-y="618.977">,<span class="w1"> </span>Michael<span class="w1"> </span>Bebenita</div><div class="l f4 s3 t0" style="top:169.064px;left:377.286px;" data-x="377.286" data-y="622.936">+</div><div class="l f2 s2 t0" style="top:173.023px;left:384.371px;" data-x="384.371" data-y="618.977">,<span class="w1"> </span>Mason<span class="w1"> </span>Chang</div><div class="l f4 s3 t0" style="top:169.064px;left:451.034px;" data-x="451.034" data-y="622.936">+#</div><div class="l f2 s2 t0" style="top:173.023px;left:465.673px;" data-x="465.673" data-y="618.977">,<span class="w1"> </span>Michael<span class="w1"> </span>Franz</div><div class="l f4 s3 t0" style="top:169.064px;left:534.758px;" data-x="534.758" data-y="622.936">+</div><div class="l f2 s4 t0" style="top:187.967px;left:266.165px;" data-x="266.165" data-y="604.033">Mozilla<span class="w1"> </span>Corporation</div><div class="l f5 s5 t0" style="top:184.158px;left:339.635px;" data-x="339.635" data-y="607.842">∗</div><div class="l f6 s4 t0" style="top:197.93px;left:90.9763px;" data-x="90.9763" data-y="594.07">{</div><div class="l f7 s4 t0" style="top:197.93px;left:95.584px;" data-x="95.584" data-y="594.07">gal,brendan,shaver,danderson,dmandelin,mrbkap,graydon,bz,jorendorff,jruderman</div><div class="l f6 s4 t0" style="top:197.93px;left:458.045px;" data-x="458.045" data-y="594.07">}</div><div class="l f7 s4 t0" style="top:197.93px;left:462.653px;" data-x="462.653" data-y="594.07">@mozilla.com</div><div class="l f2 s4 t0" style="top:214.109px;left:267.081px;" data-x="267.081" data-y="577.891">Adobe<span class="w1"> </span>Corporation</div><div class="l f8 s5 t0" style="top:210.3px;left:336.561px;" data-x="336.561" data-y="581.7">#</div><div class="l f6 s4 t0" style="top:224.072px;left:236.902px;" data-x="236.902" data-y="567.928">{</div><div class="l f7 s4 t0" style="top:224.072px;left:241.51px;" data-x="241.51" data-y="567.928">edwsmith,rreitmai</div><div class="l f6 s4 t0" style="top:224.072px;left:321.534px;" data-x="321.534" data-y="567.928">}</div><div class="l f7 s4 t0" style="top:224.072px;left:326.142px;" data-x="326.142" data-y="567.928">@adobe.com</div><div class="l f2 s4 t0" style="top:240.583px;left:271.978px;" data-x="271.978" data-y="551.417">Intel<span class="w1"> </span>Corporation</div><div class="l f8 s5 t0" style="top:236.774px;left:333.988px;" data-x="333.988" data-y="555.226">$</div><div class="l f6 s4 t0" style="top:250.546px;left:229.841px;" data-x="229.841" data-y="541.454">{</div><div class="l f7 s4 t0" style="top:250.546px;left:234.449px;" data-x="234.449" data-y="541.454">mohammad.r.haghighat</div><div class="l f6 s4 t0" style="top:250.546px;left:328.595px;" data-x="328.595" data-y="541.454">}</div><div class="l f7 s4 t0" style="top:250.546px;left:333.203px;" data-x="333.203" data-y="541.454">@intel.com</div><div class="l f2 s4 t0" style="top:266.393px;left:246.163px;" data-x="246.163" data-y="525.607">University<span class="w1"> </span>of<span class="w2"> </span>California,<span class="w2"> </span>Irvine</div><div class="l f8 s5 t0" style="top:262.584px;left:357.865px;" data-x="357.865" data-y="529.416">+</div><div class="l f6 s4 t0" style="top:276.355px;left:232.195px;" data-x="232.195" data-y="515.645">{</div><div class="l f7 s4 t0" style="top:276.355px;left:236.803px;" data-x="236.803" data-y="515.645">mbebenit,changm,franz</div><div class="l f6 s4 t0" style="top:276.355px;left:335.656px;" data-x="335.656" data-y="515.645">}</div><div class="l f7 s4 t0" style="top:276.355px;left:340.264px;" data-x="340.264" data-y="515.645">@uci.edu</div><div class="l f1 s2 t0" style="top:344.101px;left:54px;" data-x="54" data-y="447.899">Abstract</div><div class="l f2 s4 t0" style="top:358.049px;left:54px;" data-x="54" data-y="433.951">Dynamic<span class="w1"> </span>languages<span class="w1"> </span>such<span class="w1"> </span>as<span class="w1"> </span>JavaScript<span class="w1"> </span>are<span class="w1"> </span>more<span class="w0"> </span>difficult<span class="w2"> </span>to<span class="w1"> </span>com-</div><div class="l f2 s4 t0" style="top:368.012px;left:54px;" data-x="54" data-y="423.988">pile<span class="w1"> </span>than<span class="w2"> </span>statically<span class="w1"> </span>typed<span class="w1"> </span>ones.<span class="w1"> </span>Since<span class="w1"> </span>no<span class="w2"> </span>concrete<span class="w1"> </span>type<span class="w1"> </span>information</div><div class="l f2 s4 t0" style="top:377.974px;left:54px;" data-x="54" data-y="414.026">is<span class="w2"> </span>available,<span class="w2"> </span>traditional<span class="w2"> </span>compilers<span class="w1"> </span>need<span class="w2"> </span>to<span class="w2"> </span>emit<span class="w2"> </span>generic<span class="w1"> </span>code<span class="w2"> </span>that<span class="w2"> </span>can</div><div class="l f2 s4 t0" style="top:387.937px;left:54px;" data-x="54" data-y="404.063">handle<span class="w2"> </span>all<span class="w1"> </span>possible<span class="w2"> </span>type<span class="w1"> </span>combinations<span class="w2"> </span>at<span class="w1"> </span>runtime.<span class="w2"> </span>We<span class="w2"> </span>present<span class="w1"> </span>an<span class="w2"> </span>al-</div><div class="l f2 s4 t0" style="top:397.9px;left:54px;" data-x="54" data-y="394.1">ternative<span class="w1"> </span>compilation<span class="w1"> </span>technique<span class="w0"> </span>for<span class="w1"> </span>dynamically-typed<span class="w0"> </span>languages</div><div class="l f2 s4 t0" style="top:407.862px;left:54px;" data-x="54" data-y="384.138">that<span class="w1"> </span>identifies<span class="w2"> </span>frequently<span class="w1"> </span>executed<span class="w1"> </span>loop<span class="w2"> </span>traces<span class="w1"> </span>at<span class="w1"> </span>run-time<span class="w1"> </span>and<span class="w2"> </span>then</div><div class="l f2 s4 t0" style="top:417.825px;left:54px;" data-x="54" data-y="374.175">generates<span class="w1"> </span>machine<span class="w0"> </span>code<span class="w1"> </span>on<span class="w1"> </span>the<span class="w0"> </span>fly<span class="w1"> </span>that<span class="w1"> </span>is<span class="w0"> </span>specialized<span class="w1"> </span>for<span class="w1"> </span>the<span class="w0"> </span>ac-</div><div class="l f2 s4 t0" style="top:427.788px;left:54px;" data-x="54" data-y="364.212">tual<span class="w1"> </span>dynamic<span class="w1"> </span>types<span class="w1"> </span>occurring<span class="w1"> </span>on<span class="w0"> </span>each<span class="w2"> </span>path<span class="w0"> </span>through<span class="w1"> </span>the<span class="w1"> </span>loop.<span class="w1"> </span>Our</div><div class="l f2 s4 t0" style="top:437.75px;left:54px;" data-x="54" data-y="354.25">method<span class="w2"> </span>provides<span class="w1"> </span>cheap<span class="w2"> </span>inter-procedural<span class="w1"> </span>type<span class="w2"> </span>specialization,<span class="w1"> </span>and<span class="w2"> </span>an</div><div class="l f2 s4 t0" style="top:447.713px;left:54px;" data-x="54" data-y="344.287">elegant<span class="w2"> </span>and<span class="w1"> </span>efficient<span class="w2"> </span>way<span class="w1"> </span>of<span class="w2"> </span>incrementally<span class="w1"> </span>compiling<span class="w2"> </span>lazily<span class="w1"> </span>discov-</div><div class="l f2 s4 t0" style="top:457.675px;left:54px;" data-x="54" data-y="334.325">ered<span class="w1"> </span>alternative<span class="w2"> </span>paths<span class="w1"> </span>through<span class="w1"> </span>nested<span class="w2"> </span>loops.<span class="w1"> </span>We<span class="w2"> </span>have<span class="w1"> </span>implemented</div><div class="l f2 s4 t0" style="top:467.638px;left:54px;" data-x="54" data-y="324.362">a<span class="w1"> </span>dynamic<span class="w2"> </span>compiler<span class="w1"> </span>for<span class="w1"> </span>JavaScript<span class="w1"> </span>based<span class="w1"> </span>on<span class="w2"> </span>our<span class="w1"> </span>technique<span class="w1"> </span>and<span class="w1"> </span>we</div><div class="l f2 s4 t0" style="top:477.601px;left:54px;" data-x="54" data-y="314.399">have<span class="w1"> </span>measured<span class="w1"> </span>speedups<span class="w1"> </span>of<span class="w0"> </span>10x<span class="w1"> </span>and<span class="w1"> </span>more<span class="w1"> </span>for<span class="w0"> </span>certain<span class="w1"> </span>benchmark</div><div class="l f2 s4 t0" style="top:487.563px;left:54px;" data-x="54" data-y="304.437">programs.</div><div class="l f9 s4 t0" style="top:503.167px;left:54px;" data-x="54" data-y="288.833">Categories<span class="w1"> </span>and<span class="w0"> </span>Subject<span class="w1"> </span>Descriptors</div><div class="l f2 s4 t0" style="top:503.167px;left:196.549px;" data-x="196.549" data-y="288.833">D.3.4<span class="w1"> </span>[</div><div class="l fa s4 t0" style="top:503.167px;left:222.971px;" data-x="222.971" data-y="288.833">Programming<span class="w1"> </span>Lan-</div><div class="l fa s4 t0" style="top:513.13px;left:54px;" data-x="54" data-y="278.87">guages</div><div class="l f2 s4 t0" style="top:513.13px;left:79.2223px;" data-x="79.2223" data-y="278.87">]:<span class="w2"> </span>Processors<span class="w1"> </span>—</div><div class="l fa s4 t0" style="top:513.13px;left:138.74px;" data-x="138.74" data-y="278.87">Incremental<span class="w2"> </span>compilers,<span class="w1"> </span>code<span class="w2"> </span>generation</div><div class="l f2 s4 t0" style="top:513.13px;left:281.528px;" data-x="281.528" data-y="278.87">.</div><div class="l f9 s4 t0" style="top:528.734px;left:54px;" data-x="54" data-y="263.266">General<span class="w1"> </span>Terms</div><div class="l f2 s4 t0" style="top:528.734px;left:118.375px;" data-x="118.375" data-y="263.266">Design,<span class="w1"> </span>Experimentation,<span class="w1"> </span>Measurement,<span class="w1"> </span>Perfor-</div><div class="l f2 s4 t0" style="top:538.697px;left:54px;" data-x="54" data-y="253.303">mance.</div><div class="l f9 s4 t0" style="top:554.301px;left:54px;" data-x="54" data-y="237.699">Keywords</div><div class="l f2 s4 t0" style="top:554.301px;left:98.4728px;" data-x="98.4728" data-y="237.699">JavaScript,<span class="w2"> </span>just-in-time<span class="w1"> </span>compilation,<span class="w2"> </span>trace<span class="w1"> </span>trees.</div><div class="l f1 s2 t0" style="top:576.879px;left:54px;" data-x="54" data-y="215.121">1.<span class="w3"> </span>Introduction</div><div class="l fa s4 t0" style="top:590.827px;left:54px;" data-x="54" data-y="201.173">Dynamic<span class="w2"> </span>languages</div><div class="l f2 s4 t0" style="top:590.827px;left:127.024px;" data-x="127.024" data-y="201.173">such<span class="w2"> </span>as<span class="w1"> </span>JavaScript,<span class="w2"> </span>Python,<span class="w2"> </span>and<span class="w1"> </span>Ruby,<span class="w2"> </span>are<span class="w2"> </span>pop-</div><div class="l f2 s4 t0" style="top:600.789px;left:54px;" data-x="54" data-y="191.211">ular<span class="w2"> </span>since<span class="w1"> </span>they<span class="w1"> </span>are<span class="w2"> </span>expressive,<span class="w1"> </span>accessible<span class="w2"> </span>to<span class="w1"> </span>non-experts,<span class="w1"> </span>and<span class="w2"> </span>make</div><div class="l f2 s4 t0" style="top:610.752px;left:54px;" data-x="54" data-y="181.248">deployment<span class="w1"> </span>as<span class="w2"> </span>easy<span class="w1"> </span>as<span class="w1"> </span>distributing<span class="w1"> </span>a<span class="w1"> </span>source<span class="w2"> </span>file.<span class="w1"> </span>They<span class="w1"> </span>are<span class="w1"> </span>used<span class="w1"> </span>for</div><div class="l f2 s4 t0" style="top:620.714px;left:54px;" data-x="54" data-y="171.286">small<span class="w1"> </span>scripts<span class="w0"> </span>as<span class="w1"> </span>well<span class="w1"> </span>as<span class="w1"> </span>for<span class="w0"> </span>complex<span class="w1"> </span>applications.<span class="w1"> </span>JavaScript,<span class="w1"> </span>for</div><div class="l f2 s4 t0" style="top:630.677px;left:54px;" data-x="54" data-y="161.323">example,<span class="w2"> </span>is<span class="w1"> </span>the<span class="w1"> </span>de<span class="w1"> </span>facto<span class="w2"> </span>standard<span class="w1"> </span>for<span class="w1"> </span>client-side<span class="w2"> </span>web<span class="w1"> </span>programming</div><div class="l f2 s6 t0" style="top:672.234px;left:54px;" data-x="54" data-y="119.766">Permission<span class="w2"> </span>to<span class="w1"> </span>make<span class="w1"> </span>digital<span class="w2"> </span>or<span class="w1"> </span>hard<span class="w1"> </span>copies<span class="w2"> </span>of<span class="w1"> </span>all<span class="w1"> </span>or<span class="w2"> </span>part<span class="w1"> </span>of<span class="w1"> </span>this<span class="w2"> </span>work<span class="w1"> </span>for<span class="w1"> </span>personal<span class="w2"> </span>or</div><div class="l f2 s6 t0" style="top:680.204px;left:54px;" data-x="54" data-y="111.796">classroom<span class="w2"> </span>use<span class="w1"> </span>is<span class="w2"> </span>granted<span class="w2"> </span>without<span class="w1"> </span>fee<span class="w2"> </span>provided<span class="w1"> </span>that<span class="w2"> </span>copies<span class="w2"> </span>are<span class="w1"> </span>not<span class="w2"> </span>made<span class="w1"> </span>or<span class="w2"> </span>distributed</div><div class="l f2 s6 t0" style="top:688.174px;left:54px;" data-x="54" data-y="103.826">for<span class="w2"> </span>profit<span class="w2"> </span>or<span class="w2"> </span>commercial<span class="w2"> </span>advantage<span class="w2"> </span>and<span class="w1"> </span>that<span class="w2"> </span>copies<span class="w2"> </span>bear<span class="w2"> </span>this<span class="w2"> </span>notice<span class="w2"> </span>and<span class="w1"> </span>the<span class="w2"> </span>full<span class="w2"> </span>citation</div><div class="l f2 s6 t0" style="top:696.144px;left:54px;" data-x="54" data-y="95.8561">on<span class="w2"> </span>the<span class="w1"> </span>first<span class="w2"> </span>page.<span class="w2"> </span>To<span class="w2"> </span>copy<span class="w1"> </span>otherwise,<span class="w2"> </span>to<span class="w2"> </span>republish,<span class="w1"> </span>to<span class="w2"> </span>post<span class="w1"> </span>on<span class="w2"> </span>servers<span class="w2"> </span>or<span class="w1"> </span>to<span class="w2"> </span>redistribute</div><div class="l f2 s6 t0" style="top:704.114px;left:54px;" data-x="54" data-y="87.886">to<span class="w2"> </span>lists,<span class="w2"> </span>requires<span class="w1"> </span>prior<span class="w2"> </span>specific<span class="w2"> </span>permission<span class="w2"> </span>and/or<span class="w1"> </span>a<span class="w2"> </span>fee.</div><div class="l fb s6 t0" style="top:714.077px;left:54px;" data-x="54" data-y="77.9234">PLDI’09,</div><div class="l f2 s6 t0" style="top:714.077px;left:87.6277px;" data-x="87.6277" data-y="77.9234">June<span class="w2"> </span>15–20,<span class="w2"> </span>2009,<span class="w1"> </span>Dublin,<span class="w2"> </span>Ireland.</div><div class="l f2 s6 t0" style="top:722.047px;left:54px;" data-x="54" data-y="69.9533">Copyright<span class="w0"> </span>c</div><div class="l f2 s6 t0" style="top:722.047px;left:93.6453px;" data-x="93.6453" data-y="69.9533">2009<span class="w2"> </span>ACM<span class="w2"> </span>978-1-60558-392-1/09/06.<span class="w2"> </span>.<span class="w2"> </span>.$5.00</div><div class="l f2 s4 t0" style="top:344.101px;left:317.014px;" data-x="317.014" data-y="447.899">and<span class="w1"> </span>is<span class="w2"> </span>used<span class="w1"> </span>for<span class="w1"> </span>the<span class="w1"> </span>application<span class="w2"> </span>logic<span class="w1"> </span>of<span class="w1"> </span>browser-based<span class="w2"> </span>productivity</div><div class="l f2 s4 t0" style="top:354.064px;left:317.014px;" data-x="317.014" data-y="437.936">applications<span class="w1"> </span>such<span class="w1"> </span>as<span class="w1"> </span>Google<span class="w1"> </span>Mail,<span class="w1"> </span>Google<span class="w0"> </span>Docs<span class="w2"> </span>and<span class="w1"> </span>Zimbra<span class="w0"> </span>Col-</div><div class="l f2 s4 t0" style="top:364.027px;left:317.014px;" data-x="317.014" data-y="427.973">laboration<span class="w1"> </span>Suite.<span class="w0"> </span>In<span class="w1"> </span>this<span class="w1"> </span>domain,<span class="w0"> </span>in<span class="w1"> </span>order<span class="w1"> </span>to<span class="w0"> </span>provide<span class="w1"> </span>a<span class="w1"> </span>fluid<span class="w0"> </span>user</div><div class="l f2 s4 t0" style="top:373.989px;left:317.014px;" data-x="317.014" data-y="418.011">experience<span class="w2"> </span>and<span class="w2"> </span>enable<span class="w1"> </span>a<span class="w2"> </span>new<span class="w2"> </span>generation<span class="w1"> </span>of<span class="w2"> </span>applications,<span class="w1"> </span>virtual<span class="w2"> </span>ma-</div><div class="l f2 s4 t0" style="top:383.952px;left:317.014px;" data-x="317.014" data-y="408.048">chines<span class="w2"> </span>must<span class="w1"> </span>provide<span class="w1"> </span>a<span class="w2"> </span>low<span class="w1"> </span>startup<span class="w2"> </span>time<span class="w1"> </span>and<span class="w1"> </span>high<span class="w2"> </span>performance.</div><div class="l f2 s4 t0" style="top:393.914px;left:328.969px;" data-x="328.969" data-y="398.086">Compilers<span class="w1"> </span>for<span class="w1"> </span>statically<span class="w1"> </span>typed<span class="w1"> </span>languages<span class="w1"> </span>rely<span class="w1"> </span>on<span class="w2"> </span>type<span class="w1"> </span>informa-</div><div class="l f2 s4 t0" style="top:403.877px;left:317.014px;" data-x="317.014" data-y="388.123">tion<span class="w2"> </span>to<span class="w2"> </span>generate<span class="w1"> </span>efficient<span class="w2"> </span>machine<span class="w2"> </span>code.<span class="w1"> </span>In<span class="w2"> </span>a<span class="w2"> </span>dynamically<span class="w1"> </span>typed<span class="w2"> </span>pro-</div><div class="l f2 s4 t0" style="top:413.84px;left:317.014px;" data-x="317.014" data-y="378.16">gramming<span class="w1"> </span>language<span class="w0"> </span>such<span class="w1"> </span>as<span class="w0"> </span>JavaScript,<span class="w1"> </span>the<span class="w1"> </span>types<span class="w0"> </span>of<span class="w1"> </span>expressions</div><div class="l f2 s4 t0" style="top:423.802px;left:317.014px;" data-x="317.014" data-y="368.198">may<span class="w1"> </span>vary<span class="w1"> </span>at<span class="w1"> </span>runtime.<span class="w1"> </span>This<span class="w1"> </span>means<span class="w1"> </span>that<span class="w1"> </span>the<span class="w0"> </span>compiler<span class="w2"> </span>can<span class="w1"> </span>no<span class="w0"> </span>longer</div><div class="l f2 s4 t0" style="top:433.765px;left:317.014px;" data-x="317.014" data-y="358.235">easily<span class="w1"> </span>transform<span class="w1"> </span>operations<span class="w1"> </span>into<span class="w1"> </span>machine<span class="w1"> </span>instructions<span class="w1"> </span>that<span class="w1"> </span>operate</div><div class="l f2 s4 t0" style="top:443.728px;left:317.014px;" data-x="317.014" data-y="348.272">on<span class="w1"> </span>one<span class="w2"> </span>specific<span class="w1"> </span>type.<span class="w1"> </span>Without<span class="w2"> </span>exact<span class="w1"> </span>type<span class="w1"> </span>information,<span class="w2"> </span>the<span class="w1"> </span>compiler</div><div class="l f2 s4 t0" style="top:453.69px;left:317.014px;" data-x="317.014" data-y="338.31">must<span class="w1"> </span>emit<span class="w1"> </span>slower<span class="w1"> </span>generalized<span class="w1"> </span>machine<span class="w1"> </span>code<span class="w1"> </span>that<span class="w1"> </span>can<span class="w1"> </span>deal<span class="w1"> </span>with<span class="w1"> </span>all</div><div class="l f2 s4 t0" style="top:463.653px;left:317.014px;" data-x="317.014" data-y="328.347">potential<span class="w1"> </span>type<span class="w2"> </span>combinations.<span class="w1"> </span>While<span class="w1"> </span>compile-time<span class="w1"> </span>static<span class="w1"> </span>type<span class="w1"> </span>infer-</div><div class="l f2 s4 t0" style="top:473.616px;left:317.014px;" data-x="317.014" data-y="318.384">ence<span class="w1"> </span>might<span class="w0"> </span>be<span class="w0"> </span>able<span class="w1"> </span>to<span class="w0"> </span>gather<span class="w1"> </span>type<span class="w0"> </span>information<span class="w1"> </span>to<span class="w0"> </span>generate<span class="w1"> </span>opti-</div><div class="l f2 s4 t0" style="top:483.578px;left:317.014px;" data-x="317.014" data-y="308.422">mized<span class="w1"> </span>machine<span class="w1"> </span>code,<span class="w0"> </span>traditional<span class="w1"> </span>static<span class="w1"> </span>analysis<span class="w0"> </span>is<span class="w1"> </span>very<span class="w1"> </span>expensive</div><div class="l f2 s4 t0" style="top:493.541px;left:317.014px;" data-x="317.014" data-y="298.459">and<span class="w2"> </span>hence<span class="w1"> </span>not<span class="w1"> </span>well<span class="w2"> </span>suited<span class="w1"> </span>for<span class="w1"> </span>the<span class="w2"> </span>highly<span class="w1"> </span>interactive<span class="w2"> </span>environment<span class="w1"> </span>of</div><div class="l f2 s4 t0" style="top:503.504px;left:317.014px;" data-x="317.014" data-y="288.496">a<span class="w2"> </span>web<span class="w1"> </span>browser.</div><div class="l f2 s4 t0" style="top:513.466px;left:328.969px;" data-x="328.969" data-y="278.534">We<span class="w1"> </span>present<span class="w0"> </span>a<span class="w1"> </span>trace-based<span class="w0"> </span>compilation<span class="w1"> </span>technique<span class="w0"> </span>for<span class="w1"> </span>dynamic</div><div class="l f2 s4 t0" style="top:523.429px;left:317.014px;" data-x="317.014" data-y="268.571">languages<span class="w1"> </span>that<span class="w2"> </span>reconciles<span class="w1"> </span>speed<span class="w1"> </span>of<span class="w1"> </span>compilation<span class="w1"> </span>with<span class="w1"> </span>excellent<span class="w2"> </span>per-</div><div class="l f2 s4 t0" style="top:533.391px;left:317.014px;" data-x="317.014" data-y="258.609">formance<span class="w2"> </span>of<span class="w1"> </span>the<span class="w2"> </span>generated<span class="w2"> </span>machine<span class="w1"> </span>code.<span class="w2"> </span>Our<span class="w2"> </span>system<span class="w1"> </span>uses<span class="w2"> </span>a<span class="w2"> </span>mixed-</div><div class="l f2 s4 t0" style="top:543.354px;left:317.014px;" data-x="317.014" data-y="248.646">mode<span class="w2"> </span>execution<span class="w1"> </span>approach:<span class="w2"> </span>the<span class="w1"> </span>system<span class="w2"> </span>starts<span class="w1"> </span>running<span class="w2"> </span>JavaScript<span class="w2"> </span>in<span class="w1"> </span>a</div><div class="l f2 s4 t0" style="top:553.317px;left:317.014px;" data-x="317.014" data-y="238.683">fast-starting<span class="w1"> </span>bytecode<span class="w2"> </span>interpreter.<span class="w1"> </span>As<span class="w1"> </span>the<span class="w2"> </span>program<span class="w1"> </span>runs,<span class="w1"> </span>the<span class="w1"> </span>system</div><div class="l f2 s4 t0" style="top:563.279px;left:317.014px;" data-x="317.014" data-y="228.721">identifies</div><div class="l fa s4 t0" style="top:563.279px;left:353.699px;" data-x="353.699" data-y="228.721">hot</div><div class="l f2 s4 t0" style="top:563.279px;left:369.125px;" data-x="369.125" data-y="228.721">(frequently<span class="w0"> </span>executed)<span class="w1"> </span>bytecode<span class="w0"> </span>sequences,<span class="w1"> </span>records</div><div class="l f2 s4 t0" style="top:573.242px;left:317.014px;" data-x="317.014" data-y="218.758">them,<span class="w1"> </span>and<span class="w0"> </span>compiles<span class="w1"> </span>them<span class="w1"> </span>to<span class="w0"> </span>fast<span class="w1"> </span>native<span class="w1"> </span>code.<span class="w1"> </span>We<span class="w1"> </span>call<span class="w1"> </span>such<span class="w0"> </span>a<span class="w1"> </span>se-</div><div class="l f2 s4 t0" style="top:583.205px;left:317.014px;" data-x="317.014" data-y="208.795">quence<span class="w2"> </span>of<span class="w1"> </span>instructions<span class="w1"> </span>a</div><div class="l fa s4 t0" style="top:583.205px;left:404.668px;" data-x="404.668" data-y="208.795">trace</div><div class="l f2 s4 t0" style="top:583.205px;left:422.959px;" data-x="422.959" data-y="208.795">.</div><div class="l f2 s4 t0" style="top:593.167px;left:328.969px;" data-x="328.969" data-y="198.833">Unlike<span class="w1"> </span>method-based<span class="w0"> </span>dynamic<span class="w0"> </span>compilers,<span class="w1"> </span>our<span class="w0"> </span>dynamic<span class="w0"> </span>com-</div><div class="l f2 s4 t0" style="top:603.13px;left:317.014px;" data-x="317.014" data-y="188.87">piler<span class="w1"> </span>operates<span class="w0"> </span>at<span class="w1"> </span>the<span class="w0"> </span>granularity<span class="w1"> </span>of<span class="w1"> </span>individual<span class="w0"> </span>loops.<span class="w1"> </span>This<span class="w0"> </span>design</div><div class="l f2 s4 t0" style="top:613.093px;left:317.014px;" data-x="317.014" data-y="178.907">choice<span class="w1"> </span>is<span class="w0"> </span>based<span class="w1"> </span>on<span class="w0"> </span>the<span class="w1"> </span>expectation<span class="w1"> </span>that<span class="w0"> </span>programs<span class="w1"> </span>spend<span class="w0"> </span>most<span class="w1"> </span>of</div><div class="l f2 s4 t0" style="top:623.055px;left:317.014px;" data-x="317.014" data-y="168.945">their<span class="w1"> </span>time<span class="w1"> </span>in<span class="w1"> </span>hot<span class="w1"> </span>loops.<span class="w1"> </span>Even<span class="w1"> </span>in<span class="w1"> </span>dynamically<span class="w1"> </span>typed<span class="w1"> </span>languages,<span class="w0"> </span>we</div><div class="l f2 s4 t0" style="top:633.018px;left:317.014px;" data-x="317.014" data-y="158.982">expect<span class="w2"> </span>hot<span class="w1"> </span>loops<span class="w2"> </span>to<span class="w2"> </span>be<span class="w1"> </span>mostly</div><div class="l fa s4 t0" style="top:633.018px;left:422.929px;" data-x="422.929" data-y="158.982">type-stable</div><div class="l f2 s4 t0" style="top:633.018px;left:462.273px;" data-x="462.273" data-y="158.982">,<span class="w2"> </span>meaning<span class="w1"> </span>that<span class="w2"> </span>the<span class="w1"> </span>types<span class="w2"> </span>of</div><div class="l f2 s4 t0" style="top:642.98px;left:317.014px;" data-x="317.014" data-y="149.02">values<span class="w2"> </span>are<span class="w2"> </span>invariant.<span class="w2"> </span>(12)<span class="w1"> </span>For<span class="w2"> </span>example,<span class="w1"> </span>we<span class="w2"> </span>would<span class="w2"> </span>expect<span class="w1"> </span>loop<span class="w2"> </span>coun-</div><div class="l f2 s4 t0" style="top:652.943px;left:317.014px;" data-x="317.014" data-y="139.057">ters<span class="w2"> </span>that<span class="w1"> </span>start<span class="w1"> </span>as<span class="w2"> </span>integers<span class="w1"> </span>to<span class="w1"> </span>remain<span class="w2"> </span>integers<span class="w1"> </span>for<span class="w2"> </span>all<span class="w1"> </span>iterations.<span class="w1"> </span>When</div><div class="l f2 s4 t0" style="top:662.906px;left:317.014px;" data-x="317.014" data-y="129.094">both<span class="w1"> </span>of<span class="w1"> </span>these<span class="w1"> </span>expectations<span class="w1"> </span>hold,<span class="w1"> </span>a<span class="w1"> </span>trace-based<span class="w1"> </span>compiler<span class="w1"> </span>can<span class="w1"> </span>cover</div><div class="l f2 s4 t0" style="top:672.868px;left:317.014px;" data-x="317.014" data-y="119.132">the<span class="w2"> </span>program<span class="w1"> </span>execution<span class="w2"> </span>with<span class="w1"> </span>a<span class="w2"> </span>small<span class="w1"> </span>number<span class="w2"> </span>of<span class="w1"> </span>type-specialized,<span class="w2"> </span>ef-</div><div class="l f2 s4 t0" style="top:682.831px;left:317.014px;" data-x="317.014" data-y="109.169">ficiently<span class="w2"> </span>compiled<span class="w1"> </span>traces.</div><div class="l f2 s4 t0" style="top:692.794px;left:328.969px;" data-x="328.969" data-y="99.2064">Each<span class="w1"> </span>compiled<span class="w2"> </span>trace<span class="w1"> </span>covers<span class="w1"> </span>one<span class="w2"> </span>path<span class="w1"> </span>through<span class="w1"> </span>the<span class="w1"> </span>program<span class="w2"> </span>with</div><div class="l f2 s4 t0" style="top:702.756px;left:317.014px;" data-x="317.014" data-y="89.2437">one<span class="w2"> </span>mapping<span class="w1"> </span>of<span class="w2"> </span>values<span class="w2"> </span>to<span class="w1"> </span>types.<span class="w2"> </span>When<span class="w1"> </span>the<span class="w2"> </span>VM<span class="w1"> </span>executes<span class="w2"> </span>a<span class="w2"> </span>compiled</div><div class="l f2 s4 t0" style="top:712.719px;left:317.014px;" data-x="317.014" data-y="79.2811">trace,<span class="w0"> </span>it<span class="w0"> </span>cannot<span class="w0"> </span>guarantee<span class="w0"> </span>that<span class="w0"> </span>the<span class="w1"> </span>same<span class="w0"> </span>path<span class="w0"> </span>will<span class="w0"> </span>be<span class="w0"> </span>followed</div><div class="l f2 s4 t0" style="top:722.682px;left:317.014px;" data-x="317.014" data-y="69.3185">or<span class="w0"> </span>that<span class="w1"> </span>the<span class="w0"> </span>same<span class="w1"> </span>types<span class="w0"> </span>will<span class="w1"> </span>occur<span class="w0"> </span>in<span class="w0"> </span>subsequent<span class="w1"> </span>loop<span class="w0"> </span>iterations.</div></div></div><div id="page-2" class="p" style="width:612px;height:792px;"><div class="t"><div class="l f2 s4 t0" style="top:79.9701px;left:54px;" data-x="54" data-y="712.03">Hence,<span class="w2"> </span>recording<span class="w2"> </span>and<span class="w1"> </span>compiling<span class="w2"> </span>a<span class="w1"> </span>trace</div><div class="l fa s4 t0" style="top:79.9701px;left:195.461px;" data-x="195.461" data-y="712.03">speculates</div><div class="l f2 s4 t0" style="top:79.9701px;left:234.688px;" data-x="234.688" data-y="712.03">that<span class="w2"> </span>the<span class="w2"> </span>path<span class="w1"> </span>and</div><div class="l f2 s4 t0" style="top:89.9328px;left:54px;" data-x="54" data-y="702.067">typing<span class="w2"> </span>will<span class="w1"> </span>be<span class="w2"> </span>exactly<span class="w2"> </span>as<span class="w1"> </span>they<span class="w2"> </span>were<span class="w1"> </span>during<span class="w2"> </span>recording<span class="w2"> </span>for<span class="w1"> </span>subsequent</div><div class="l f2 s4 t0" style="top:99.8954px;left:54px;" data-x="54" data-y="692.105">iterations<span class="w2"> </span>of<span class="w1"> </span>the<span class="w1"> </span>loop.</div><div class="l f2 s4 t0" style="top:109.858px;left:65.9552px;" data-x="65.9552" data-y="682.142">Every<span class="w1"> </span>compiled<span class="w2"> </span>trace<span class="w1"> </span>contains<span class="w1"> </span>all<span class="w1"> </span>the</div><div class="l fa s4 t0" style="top:109.858px;left:203.17px;" data-x="203.17" data-y="682.142">guards</div><div class="l f2 s4 t0" style="top:109.858px;left:230.303px;" data-x="230.303" data-y="682.142">(checks)<span class="w1"> </span>required</div><div class="l f2 s4 t0" style="top:119.821px;left:54px;" data-x="54" data-y="672.179">to<span class="w1"> </span>validate<span class="w0"> </span>the<span class="w1"> </span>speculation.<span class="w0"> </span>If<span class="w1"> </span>one<span class="w0"> </span>of<span class="w1"> </span>the<span class="w0"> </span>guards<span class="w1"> </span>fails<span class="w0"> </span>(if<span class="w1"> </span>control</div><div class="l f2 s4 t0" style="top:129.783px;left:54px;" data-x="54" data-y="662.217">flow<span class="w1"> </span>is<span class="w1"> </span>different,<span class="w0"> </span>or<span class="w1"> </span>a<span class="w1"> </span>value<span class="w1"> </span>of<span class="w0"> </span>a<span class="w1"> </span>different<span class="w1"> </span>type<span class="w1"> </span>is<span class="w0"> </span>generated),<span class="w1"> </span>the</div><div class="l f2 s4 t0" style="top:139.746px;left:54px;" data-x="54" data-y="652.254">trace<span class="w1"> </span>exits.<span class="w0"> </span>If<span class="w1"> </span>an<span class="w1"> </span>exit<span class="w1"> </span>becomes<span class="w0"> </span>hot,<span class="w1"> </span>the<span class="w1"> </span>VM<span class="w0"> </span>can<span class="w1"> </span>record<span class="w1"> </span>a</div><div class="l fa s4 t0" style="top:139.746px;left:267.971px;" data-x="267.971" data-y="652.254">branch</div><div class="l fa s4 t0" style="top:149.709px;left:54px;" data-x="54" data-y="642.291">trace</div><div class="l f2 s4 t0" style="top:149.709px;left:74.4956px;" data-x="74.4956" data-y="642.291">starting<span class="w2"> </span>at<span class="w1"> </span>the<span class="w1"> </span>exit<span class="w2"> </span>to<span class="w1"> </span>cover<span class="w2"> </span>the<span class="w1"> </span>new<span class="w2"> </span>path.<span class="w1"> </span>In<span class="w2"> </span>this<span class="w1"> </span>way,<span class="w2"> </span>the<span class="w1"> </span>VM</div><div class="l f2 s4 t0" style="top:159.671px;left:54px;" data-x="54" data-y="632.329">records<span class="w2"> </span>a</div><div class="l fa s4 t0" style="top:159.671px;left:88.852px;" data-x="88.852" data-y="632.329">trace<span class="w2"> </span>tree</div><div class="l f2 s4 t0" style="top:159.671px;left:125.237px;" data-x="125.237" data-y="632.329">covering<span class="w2"> </span>all<span class="w1"> </span>the<span class="w2"> </span>hot<span class="w1"> </span>paths<span class="w1"> </span>through<span class="w2"> </span>the<span class="w1"> </span>loop.</div><div class="l f2 s4 t0" style="top:169.634px;left:65.9552px;" data-x="65.9552" data-y="622.366">Nested<span class="w1"> </span>loops<span class="w1"> </span>can<span class="w0"> </span>be<span class="w1"> </span>difficult<span class="w1"> </span>to<span class="w0"> </span>optimize<span class="w1"> </span>for<span class="w1"> </span>tracing<span class="w1"> </span>VMs.<span class="w0"> </span>In</div><div class="l f2 s4 t0" style="top:179.596px;left:54px;" data-x="54" data-y="612.404">a<span class="w1"> </span>na¨</div><div class="l f2 s4 t0" style="top:179.596px;left:69.6272px;" data-x="69.6272" data-y="612.404">ıve<span class="w1"> </span>implementation,<span class="w1"> </span>inner<span class="w0"> </span>loops<span class="w1"> </span>would<span class="w1"> </span>become<span class="w1"> </span>hot<span class="w0"> </span>first,<span class="w1"> </span>and</div><div class="l f2 s4 t0" style="top:189.559px;left:54px;" data-x="54" data-y="602.441">the<span class="w1"> </span>VM<span class="w1"> </span>would<span class="w1"> </span>start<span class="w0"> </span>tracing<span class="w1"> </span>there.<span class="w1"> </span>When<span class="w1"> </span>the<span class="w0"> </span>inner<span class="w1"> </span>loop<span class="w1"> </span>exits,<span class="w1"> </span>the</div><div class="l f2 s4 t0" style="top:199.522px;left:54px;" data-x="54" data-y="592.478">VM<span class="w2"> </span>would<span class="w1"> </span>detect<span class="w2"> </span>that<span class="w1"> </span>a<span class="w2"> </span>different<span class="w2"> </span>branch<span class="w1"> </span>was<span class="w2"> </span>taken.<span class="w1"> </span>The<span class="w2"> </span>VM<span class="w1"> </span>would</div><div class="l f2 s4 t0" style="top:209.484px;left:54px;" data-x="54" data-y="582.516">try<span class="w1"> </span>to<span class="w2"> </span>record<span class="w1"> </span>a<span class="w1"> </span>branch<span class="w1"> </span>trace,<span class="w1"> </span>and<span class="w1"> </span>find<span class="w1"> </span>that<span class="w1"> </span>the<span class="w2"> </span>trace<span class="w1"> </span>reaches<span class="w1"> </span>not<span class="w1"> </span>the</div><div class="l f2 s4 t0" style="top:219.447px;left:54px;" data-x="54" data-y="572.553">inner<span class="w1"> </span>loop<span class="w2"> </span>header,<span class="w1"> </span>but<span class="w2"> </span>the<span class="w1"> </span>outer<span class="w1"> </span>loop<span class="w1"> </span>header.<span class="w2"> </span>At<span class="w1"> </span>this<span class="w2"> </span>point,<span class="w1"> </span>the<span class="w1"> </span>VM</div><div class="l f2 s4 t0" style="top:229.41px;left:54px;" data-x="54" data-y="562.59">could<span class="w1"> </span>continue<span class="w2"> </span>tracing<span class="w1"> </span>until<span class="w1"> </span>it<span class="w1"> </span>reaches<span class="w2"> </span>the<span class="w1"> </span>inner<span class="w1"> </span>loop<span class="w1"> </span>header<span class="w2"> </span>again,</div><div class="l f2 s4 t0" style="top:239.372px;left:54px;" data-x="54" data-y="552.628">thus<span class="w1"> </span>tracing<span class="w0"> </span>the<span class="w1"> </span>outer<span class="w1"> </span>loop<span class="w0"> </span>inside<span class="w1"> </span>a<span class="w1"> </span>trace<span class="w0"> </span>tree<span class="w1"> </span>for<span class="w1"> </span>the<span class="w1"> </span>inner<span class="w0"> </span>loop.</div><div class="l f2 s4 t0" style="top:249.335px;left:54px;" data-x="54" data-y="542.665">But<span class="w2"> </span>this<span class="w1"> </span>requires<span class="w2"> </span>tracing<span class="w1"> </span>a<span class="w2"> </span>copy<span class="w1"> </span>of<span class="w2"> </span>the<span class="w1"> </span>outer<span class="w1"> </span>loop<span class="w2"> </span>for<span class="w1"> </span>every<span class="w2"> </span>side<span class="w2"> </span>exit</div><div class="l f2 s4 t0" style="top:259.298px;left:54px;" data-x="54" data-y="532.702">and<span class="w1"> </span>type<span class="w1"> </span>combination<span class="w1"> </span>in<span class="w1"> </span>the<span class="w1"> </span>inner<span class="w1"> </span>loop.<span class="w1"> </span>In<span class="w1"> </span>essence,<span class="w1"> </span>this<span class="w1"> </span>is<span class="w1"> </span>a<span class="w0"> </span>form</div><div class="l f2 s4 t0" style="top:269.26px;left:54px;" data-x="54" data-y="522.74">of<span class="w1"> </span>unintended<span class="w1"> </span>tail<span class="w2"> </span>duplication,<span class="w1"> </span>which<span class="w1"> </span>can<span class="w1"> </span>easily<span class="w1"> </span>overflow<span class="w2"> </span>the<span class="w1"> </span>code</div><div class="l f2 s4 t0" style="top:279.223px;left:54px;" data-x="54" data-y="512.777">cache.<span class="w2"> </span>Alternatively,<span class="w2"> </span>the<span class="w2"> </span>VM<span class="w1"> </span>could<span class="w2"> </span>simply<span class="w2"> </span>stop<span class="w1"> </span>tracing,<span class="w2"> </span>and<span class="w1"> </span>give<span class="w2"> </span>up</div><div class="l f2 s4 t0" style="top:289.186px;left:54px;" data-x="54" data-y="502.814">on<span class="w2"> </span>ever<span class="w1"> </span>tracing<span class="w2"> </span>outer<span class="w1"> </span>loops.</div><div class="l f2 s4 t0" style="top:299.148px;left:65.9552px;" data-x="65.9552" data-y="492.852">We<span class="w1"> </span>solve<span class="w1"> </span>the<span class="w0"> </span>nested<span class="w1"> </span>loop<span class="w0"> </span>problem<span class="w1"> </span>by<span class="w0"> </span>recording</div><div class="l fa s4 t0" style="top:299.148px;left:248.302px;" data-x="248.302" data-y="492.852">nested<span class="w1"> </span>trace</div><div class="l fa s4 t0" style="top:309.111px;left:54px;" data-x="54" data-y="482.889">trees</div><div class="l f2 s4 t0" style="top:309.111px;left:71.0985px;" data-x="71.0985" data-y="482.889">.<span class="w2"> </span>Our<span class="w1"> </span>system<span class="w2"> </span>traces<span class="w1"> </span>the<span class="w2"> </span>inner<span class="w1"> </span>loop<span class="w2"> </span>exactly<span class="w1"> </span>as<span class="w2"> </span>the<span class="w1"> </span>na¨</div><div class="l f2 s4 t0" style="top:309.111px;left:251.713px;" data-x="251.713" data-y="482.889">ıve<span class="w2"> </span>version.</div><div class="l f2 s4 t0" style="top:319.073px;left:54px;" data-x="54" data-y="472.927">The<span class="w2"> </span>system<span class="w1"> </span>stops<span class="w1"> </span>extending<span class="w2"> </span>the<span class="w1"> </span>inner<span class="w1"> </span>tree<span class="w1"> </span>when<span class="w2"> </span>it<span class="w1"> </span>reaches<span class="w1"> </span>an<span class="w2"> </span>outer</div><div class="l f2 s4 t0" style="top:329.036px;left:54px;" data-x="54" data-y="462.964">loop,<span class="w1"> </span>but<span class="w1"> </span>then<span class="w1"> </span>it<span class="w1"> </span>starts<span class="w1"> </span>a<span class="w1"> </span>new<span class="w2"> </span>trace<span class="w1"> </span>at<span class="w1"> </span>the<span class="w1"> </span>outer<span class="w1"> </span>loop<span class="w1"> </span>header.<span class="w1"> </span>When</div><div class="l f2 s4 t0" style="top:338.999px;left:54px;" data-x="54" data-y="453.001">the<span class="w2"> </span>outer<span class="w1"> </span>loop<span class="w2"> </span>reaches<span class="w1"> </span>the<span class="w2"> </span>inner<span class="w1"> </span>loop<span class="w2"> </span>header,<span class="w2"> </span>the<span class="w1"> </span>system<span class="w2"> </span>tries<span class="w1"> </span>to<span class="w2"> </span>call</div><div class="l f2 s4 t0" style="top:348.961px;left:54px;" data-x="54" data-y="443.039">the<span class="w2"> </span>trace<span class="w2"> </span>tree<span class="w1"> </span>for<span class="w2"> </span>the<span class="w2"> </span>inner<span class="w1"> </span>loop.<span class="w2"> </span>If<span class="w2"> </span>the<span class="w1"> </span>call<span class="w2"> </span>succeeds,<span class="w2"> </span>the<span class="w2"> </span>VM<span class="w1"> </span>records</div><div class="l f2 s4 t0" style="top:358.924px;left:54px;" data-x="54" data-y="433.076">the<span class="w0"> </span>call<span class="w1"> </span>to<span class="w0"> </span>the<span class="w1"> </span>inner<span class="w0"> </span>tree<span class="w0"> </span>as<span class="w1"> </span>part<span class="w0"> </span>of<span class="w1"> </span>the<span class="w0"> </span>outer<span class="w0"> </span>trace<span class="w1"> </span>and<span class="w0"> </span>finishes</div><div class="l f2 s4 t0" style="top:368.887px;left:54px;" data-x="54" data-y="423.113">the<span class="w1"> </span>outer<span class="w0"> </span>trace<span class="w1"> </span>as<span class="w1"> </span>normal.<span class="w0"> </span>In<span class="w1"> </span>this<span class="w0"> </span>way</div><div class="l f2 s4 t0" style="top:368.887px;left:194.36px;" data-x="194.36" data-y="423.113">,<span class="w1"> </span>our<span class="w0"> </span>system<span class="w1"> </span>can<span class="w1"> </span>trace<span class="w0"> </span>any</div><div class="l f2 s4 t0" style="top:378.849px;left:54px;" data-x="54" data-y="413.151">number<span class="w2"> </span>of<span class="w1"> </span>loops<span class="w1"> </span>nested<span class="w2"> </span>to<span class="w1"> </span>any<span class="w2"> </span>depth<span class="w1"> </span>without<span class="w1"> </span>causing<span class="w2"> </span>excessive<span class="w2"> </span>tail</div><div class="l f2 s4 t0" style="top:388.812px;left:54px;" data-x="54" data-y="403.188">duplication.</div><div class="l f2 s4 t0" style="top:398.775px;left:65.9552px;" data-x="65.9552" data-y="393.225">These<span class="w1"> </span>techniques<span class="w1"> </span>allow<span class="w0"> </span>a<span class="w1"> </span>VM<span class="w1"> </span>to<span class="w1"> </span>dynamically<span class="w0"> </span>translate<span class="w1"> </span>a<span class="w1"> </span>pro-</div><div class="l f2 s4 t0" style="top:408.737px;left:54px;" data-x="54" data-y="383.263">gram<span class="w0"> </span>to<span class="w1"> </span>nested,<span class="w0"> </span>type-specialized<span class="w1"> </span>trace<span class="w0"> </span>trees.<span class="w0"> </span>Because<span class="w1"> </span>traces<span class="w0"> </span>can</div><div class="l f2 s4 t0" style="top:418.7px;left:54px;" data-x="54" data-y="373.3">cross<span class="w1"> </span>function<span class="w1"> </span>call<span class="w2"> </span>boundaries,<span class="w1"> </span>our<span class="w1"> </span>techniques<span class="w1"> </span>also<span class="w1"> </span>achieve<span class="w1"> </span>the<span class="w1"> </span>ef-</div><div class="l f2 s4 t0" style="top:428.662px;left:54px;" data-x="54" data-y="363.338">fects<span class="w2"> </span>of<span class="w1"> </span>inlining.<span class="w2"> </span>Because<span class="w2"> </span>traces<span class="w1"> </span>have<span class="w2"> </span>no<span class="w2"> </span>internal<span class="w1"> </span>control-flow<span class="w2"> </span>joins,</div><div class="l f2 s4 t0" style="top:438.625px;left:54px;" data-x="54" data-y="353.375">they<span class="w1"> </span>can<span class="w0"> </span>be<span class="w1"> </span>optimized<span class="w1"> </span>in<span class="w0"> </span>linear<span class="w1"> </span>time<span class="w0"> </span>by<span class="w1"> </span>a<span class="w1"> </span>simple<span class="w0"> </span>compiler<span class="w1"> </span>(10).</div><div class="l f2 s4 t0" style="top:448.588px;left:54px;" data-x="54" data-y="343.412">Thus,<span class="w1"> </span>our<span class="w0"> </span>tracing<span class="w1"> </span>VM<span class="w0"> </span>efficiently<span class="w1"> </span>performs<span class="w1"> </span>the<span class="w0"> </span>same<span class="w1"> </span>kind<span class="w1"> </span>of<span class="w0"> </span>op-</div><div class="l f2 s4 t0" style="top:458.55px;left:54px;" data-x="54" data-y="333.45">timizations<span class="w1"> </span>that<span class="w1"> </span>would<span class="w1"> </span>require<span class="w0"> </span>interprocedural<span class="w1"> </span>analysis<span class="w1"> </span>in<span class="w1"> </span>a<span class="w1"> </span>static</div><div class="l f2 s4 t0" style="top:468.513px;left:54px;" data-x="54" data-y="323.487">optimization<span class="w2"> </span>setting.<span class="w1"> </span>This<span class="w1"> </span>makes<span class="w1"> </span>tracing<span class="w2"> </span>an<span class="w1"> </span>attractive<span class="w2"> </span>and<span class="w1"> </span>effective</div><div class="l f2 s4 t0" style="top:478.476px;left:54px;" data-x="54" data-y="313.524">tool<span class="w2"> </span>to<span class="w1"> </span>type<span class="w1"> </span>specialize<span class="w2"> </span>even<span class="w1"> </span>complex<span class="w2"> </span>function<span class="w1"> </span>call-rich<span class="w2"> </span>code.</div><div class="l f2 s4 t0" style="top:488.438px;left:65.9552px;" data-x="65.9552" data-y="303.562">We<span class="w2"> </span>implemented<span class="w2"> </span>these<span class="w1"> </span>techniques<span class="w1"> </span>for<span class="w2"> </span>an<span class="w1"> </span>existing<span class="w2"> </span>JavaScript<span class="w1"> </span>in-</div><div class="l f2 s4 t0" style="top:498.401px;left:54px;" data-x="54" data-y="293.599">terpreter,<span class="w1"> </span>SpiderMonkey</div><div class="l f2 s4 t0" style="top:498.401px;left:141.548px;" data-x="141.548" data-y="293.599">.<span class="w1"> </span>We<span class="w2"> </span>call<span class="w1"> </span>the<span class="w1"> </span>resulting<span class="w1"> </span>tracing<span class="w0"> </span>VM</div><div class="l fa s4 t0" style="top:498.401px;left:269.827px;" data-x="269.827" data-y="293.599">Trace-</div><div class="l fa s4 t0" style="top:508.364px;left:54px;" data-x="54" data-y="283.636">Monkey</div><div class="l f2 s4 t0" style="top:508.364px;left:82.0198px;" data-x="82.0198" data-y="283.636">.<span class="w1"> </span>TraceMonkey<span class="w2"> </span>supports<span class="w1"> </span>all<span class="w1"> </span>the<span class="w1"> </span>JavaScript<span class="w1"> </span>features<span class="w2"> </span>of<span class="w1"> </span>Spi-</div><div class="l f2 s4 t0" style="top:518.326px;left:54px;" data-x="54" data-y="273.674">derMonkey,<span class="w2"> </span>with<span class="w2"> </span>a<span class="w1"> </span>2x-20x<span class="w1"> </span>speedup<span class="w2"> </span>for<span class="w1"> </span>traceable<span class="w1"> </span>programs.</div><div class="l f2 s4 t0" style="top:528.289px;left:65.9552px;" data-x="65.9552" data-y="263.711">This<span class="w2"> </span>paper<span class="w1"> </span>makes<span class="w1"> </span>the<span class="w2"> </span>following<span class="w1"> </span>contributions:</div><div class="l f3 s3 t0" style="top:546.32px;left:59.2303px;" data-x="59.2303" data-y="245.68">•</div><div class="l f2 s4 t0" style="top:547.218px;left:66.9514px;" data-x="66.9514" data-y="244.782">We<span class="w2"> </span>explain<span class="w2"> </span>an<span class="w1"> </span>algorithm<span class="w1"> </span>for<span class="w2"> </span>dynamically<span class="w1"> </span>forming<span class="w2"> </span>trace<span class="w1"> </span>trees<span class="w1"> </span>to</div><div class="l f2 s4 t0" style="top:557.18px;left:66.9514px;" data-x="66.9514" data-y="234.82">cover<span class="w2"> </span>a<span class="w2"> </span>program,<span class="w1"> </span>representing<span class="w2"> </span>nested<span class="w2"> </span>loops<span class="w2"> </span>as<span class="w1"> </span>nested<span class="w2"> </span>trace<span class="w2"> </span>trees.</div><div class="l f3 s3 t0" style="top:570.23px;left:59.2303px;" data-x="59.2303" data-y="221.77">•</div><div class="l f2 s4 t0" style="top:571.128px;left:66.9514px;" data-x="66.9514" data-y="220.872">Weexplain<span class="w1"> </span>how<span class="w2"> </span>to<span class="w2"> </span>speculatively<span class="w2"> </span>generate<span class="w2"> </span>efficient<span class="w2"> </span>type-specialized</div><div class="l f2 s4 t0" style="top:581.091px;left:66.9514px;" data-x="66.9514" data-y="210.909">code<span class="w2"> </span>for<span class="w1"> </span>traces<span class="w1"> </span>from<span class="w2"> </span>dynamic<span class="w1"> </span>language<span class="w1"> </span>programs.</div><div class="l f3 s3 t0" style="top:594.14px;left:59.2303px;" data-x="59.2303" data-y="197.86">•</div><div class="l f2 s4 t0" style="top:595.038px;left:66.9514px;" data-x="66.9514" data-y="196.962">We<span class="w2"> </span>validate<span class="w1"> </span>our<span class="w2"> </span>tracing<span class="w1"> </span>techniques<span class="w1"> </span>in<span class="w2"> </span>an<span class="w1"> </span>implementation<span class="w1"> </span>based</div><div class="l f2 s4 t0" style="top:605.001px;left:66.9514px;" data-x="66.9514" data-y="186.999">on<span class="w1"> </span>the<span class="w1"> </span>SpiderMonkey<span class="w1"> </span>JavaScript<span class="w1"> </span>interpreter,<span class="w2"> </span>achieving<span class="w1"> </span>2x-20x</div><div class="l f2 s4 t0" style="top:614.964px;left:66.9514px;" data-x="66.9514" data-y="177.036">speedups<span class="w2"> </span>on<span class="w1"> </span>many<span class="w1"> </span>programs.</div><div class="l f2 s4 t0" style="top:633.893px;left:65.9551px;" data-x="65.9551" data-y="158.107">The<span class="w2"> </span>remainder<span class="w1"> </span>of<span class="w2"> </span>this<span class="w2"> </span>paper<span class="w1"> </span>is<span class="w2"> </span>organized<span class="w1"> </span>as<span class="w2"> </span>follows.<span class="w2"> </span>Section<span class="w1"> </span>3<span class="w2"> </span>is</div><div class="l f2 s4 t0" style="top:643.855px;left:54px;" data-x="54" data-y="148.145">a<span class="w1"> </span>general<span class="w1"> </span>overview<span class="w2"> </span>of<span class="w1"> </span>trace<span class="w1"> </span>tree<span class="w1"> </span>based<span class="w1"> </span>compilation<span class="w1"> </span>we<span class="w1"> </span>use<span class="w1"> </span>to<span class="w1"> </span>cap-</div><div class="l f2 s4 t0" style="top:653.818px;left:54px;" data-x="54" data-y="138.182">ture<span class="w1"> </span>and<span class="w0"> </span>compile<span class="w1"> </span>frequently<span class="w1"> </span>executed<span class="w0"> </span>code<span class="w1"> </span>regions.<span class="w1"> </span>In<span class="w0"> </span>Section<span class="w1"> </span>4</div><div class="l f2 s4 t0" style="top:663.781px;left:54px;" data-x="54" data-y="128.219">we<span class="w1"> </span>describe<span class="w1"> </span>our<span class="w1"> </span>approach<span class="w0"> </span>of<span class="w1"> </span>covering<span class="w1"> </span>nested<span class="w1"> </span>loops<span class="w1"> </span>using<span class="w1"> </span>a<span class="w0"> </span>num-</div><div class="l f2 s4 t0" style="top:673.743px;left:54px;" data-x="54" data-y="118.257">ber<span class="w1"> </span>of<span class="w0"> </span>individual<span class="w2"> </span>trace<span class="w0"> </span>trees.<span class="w1"> </span>In<span class="w1"> </span>Section<span class="w0"> </span>5<span class="w1"> </span>we<span class="w1"> </span>describe<span class="w0"> </span>our<span class="w1"> </span>trace-</div><div class="l f2 s4 t0" style="top:683.706px;left:54px;" data-x="54" data-y="108.294">compilation<span class="w2"> </span>based<span class="w1"> </span>speculative<span class="w2"> </span>type<span class="w1"> </span>specialization<span class="w1"> </span>approach<span class="w2"> </span>we<span class="w1"> </span>use</div><div class="l f2 s4 t0" style="top:693.669px;left:54px;" data-x="54" data-y="98.3314">to<span class="w1"> </span>generate<span class="w1"> </span>efficient<span class="w2"> </span>machine<span class="w1"> </span>code<span class="w1"> </span>from<span class="w1"> </span>recorded<span class="w1"> </span>bytecode<span class="w1"> </span>traces.</div><div class="l f2 s4 t0" style="top:703.631px;left:54px;" data-x="54" data-y="88.3687">Our<span class="w1"> </span>implementation<span class="w0"> </span>of<span class="w1"> </span>a<span class="w1"> </span>dynamic<span class="w1"> </span>type-specializing<span class="w0"> </span>compiler<span class="w1"> </span>for</div><div class="l f2 s4 t0" style="top:713.594px;left:54px;" data-x="54" data-y="78.4061">JavaScript<span class="w1"> </span>is<span class="w1"> </span>described<span class="w1"> </span>in<span class="w1"> </span>Section<span class="w1"> </span>6.<span class="w1"> </span>Related<span class="w1"> </span>work<span class="w1"> </span>is<span class="w1"> </span>discussed<span class="w1"> </span>in</div><div class="l f2 s4 t0" style="top:723.557px;left:54px;" data-x="54" data-y="68.4434">Section<span class="w2"> </span>8.<span class="w1"> </span>In<span class="w2"> </span>Section<span class="w1"> </span>7<span class="w2"> </span>we<span class="w1"> </span>evaluate<span class="w2"> </span>our<span class="w2"> </span>dynamic<span class="w1"> </span>compiler<span class="w2"> </span>based<span class="w1"> </span>on</div><div class="l f7 s4 t0" style="top:78.2266px;left:317.014px;" data-x="317.014" data-y="713.773">1<span class="w0"> </span>for<span class="w0"> </span>(var<span class="w0"> </span>i<span class="w0"> </span>=<span class="w4"> </span>2;<span class="w0"> </span>i<span class="w0"> </span><<span class="w0"> </span>100;<span class="w0"> </span>++i)<span class="w4"> </span>{</div><div class="l f7 s4 t0" style="top:88.1892px;left:317.014px;" data-x="317.014" data-y="703.811">2<span class="w5"> </span>if<span class="w0"> </span>(!primes[i])</div><div class="l f7 s4 t0" style="top:98.1518px;left:317.014px;" data-x="317.014" data-y="693.848">3<span class="w6"> </span>continue;</div><div class="l f7 s4 t0" style="top:108.114px;left:317.014px;" data-x="317.014" data-y="683.886">4<span class="w5"> </span>for<span class="w0"> </span>(var<span class="w0"> </span>k<span class="w0"> </span>=<span class="w0"> </span>i<span class="w4"> </span>+<span class="w0"> </span>i;<span class="w0"> </span>i<span class="w0"> </span><<span class="w0"> </span>100;<span class="w4"> </span>k<span class="w0"> </span>+=<span class="w0"> </span>i)</div><div class="l f7 s4 t0" style="top:118.077px;left:317.014px;" data-x="317.014" data-y="673.923">5<span class="w6"> </span>primes[k]<span class="w0"> </span>=<span class="w0"> </span>false;</div><div class="l f7 s4 t0" style="top:128.04px;left:317.014px;" data-x="317.014" data-y="663.96">6<span class="w0"> </span>}</div></div><div class="t t1"></div><div class="t t0"><div class="l f1 s4 t0" style="top:150.238px;left:317.014px;" data-x="317.014" data-y="641.762">Figure<span class="w1"> </span>1.<span class="w0"> </span>Sample<span class="w0"> </span>program:<span class="w1"> </span>sieve<span class="w0"> </span>of<span class="w1"> </span>Eratosthenes.</div><div class="l f7 s4 t0" style="top:150.238px;left:518.232px;" data-x="518.232" data-y="641.762">primes</div><div class="l f2 s4 t0" style="top:150.238px;left:550.137px;" data-x="550.137" data-y="641.762">is</div><div class="l f2 s4 t0" style="top:160.2px;left:317.014px;" data-x="317.014" data-y="631.8">initialized<span class="w1"> </span>to<span class="w1"> </span>an<span class="w0"> </span>array<span class="w1"> </span>of<span class="w1"> </span>100</div><div class="l f7 s4 t0" style="top:160.2px;left:426.649px;" data-x="426.649" data-y="631.8">false</div><div class="l f2 s4 t0" style="top:160.2px;left:453.351px;" data-x="453.351" data-y="631.8">values<span class="w1"> </span>on<span class="w1"> </span>entry<span class="w0"> </span>to<span class="w1"> </span>this<span class="w1"> </span>code</div><div class="l f2 s4 t0" style="top:170.163px;left:317.014px;" data-x="317.014" data-y="621.837">snippet.</div></div><div class="t t2"></div><div class="t t3"></div><div class="t t4"></div><div class="t t5"></div><div class="t t6"></div><div class="t t7"></div><div class="t t8"></div><div class="t t9"></div><div class="t ta"></div><div class="t tb"></div><div class="t tc"></div><div class="t td"></div><div class="t te"></div><div class="t tf"><div class="l fd s7 t10" style="top:795px;left:-24.3369px;" data-x="405.402" data-y="575.895">Interpret</div><div class="l fe s7 t10" style="top:795px;left:24.3369px;" data-x="426.372" data-y="575.895"> </div><div class="l fe s7 t10" style="top:781px;left:-28.0166px;" data-x="403.817" data-y="569.864">Bytecodes</div></div><div class="t te"></div><div class="t t11"><div class="l fd s7 t10" style="top:788px;left:-21.9932px;" data-x="406.412" data-y="529.797">Monitor</div><div class="l fe s7 t10" style="top:788px;left:21.9932px;" data-x="425.362" data-y="529.797"> </div></div><div class="t te"></div><div class="t t12"><div class="l fd s7 t10" style="top:795px;left:-20.6719px;" data-x="337.619" data-y="513.426">Record</div><div class="l fe s7 t10" style="top:781px;left:-26.0156px;" data-x="335.317" data-y="507.395">LIR </div><div class="l fe s7 t10" style="top:781px;left:-4.21875px;" data-x="344.707" data-y="507.395">T</div><div class="l fe s7 t10" style="top:781px;left:2.67187px;" data-x="347.676" data-y="507.395">race</div></div><div class="t te"></div><div class="t t13"><div class="l fd s7 t10" style="top:795px;left:-23.0127px;" data-x="473.396" data-y="473.791">Execute</div><div class="l fe s7 t10" style="top:795px;left:23.0127px;" data-x="493.225" data-y="473.791"> </div><div class="l fe s7 t10" style="top:781px;left:-42.0234px;" data-x="465.206" data-y="467.759">Compiled </div><div class="l fe s7 t10" style="top:781px;left:11.7891px;" data-x="488.389" data-y="467.759">T</div><div class="l fe s7 t10" style="top:781px;left:18.6797px;" data-x="491.358" data-y="467.759">race</div></div><div class="t te"></div><div class="t t14"><div class="l fd s7 t10" style="top:795px;left:-15.3369px;" data-x="476.703" data-y="513.426">Enter</div><div class="l fe s7 t10" style="top:795px;left:15.3369px;" data-x="489.918" data-y="513.426"> </div><div class="l fe s7 t10" style="top:781px;left:-42.0234px;" data-x="465.206" data-y="507.395">Compiled </div><div class="l fe s7 t10" style="top:781px;left:11.7891px;" data-x="488.389" data-y="507.395">T</div><div class="l fe s7 t10" style="top:781px;left:18.6797px;" data-x="491.358" data-y="507.395">race</div></div><div class="t te"></div><div class="t t15"><div class="l fd s7 t10" style="top:795px;left:-23.669px;" data-x="336.328" data-y="473.791">Compile</div><div class="l fe s7 t10" style="top:781px;left:-26.0156px;" data-x="335.317" data-y="467.759">LIR </div><div class="l fe s7 t10" style="top:781px;left:-4.21875px;" data-x="344.707" data-y="467.759">T</div><div class="l fe s7 t10" style="top:781px;left:2.67187px;" data-x="347.676" data-y="467.759">race</div></div><div class="t te"></div><div class="t t16"><div class="l fd s7 t10" style="top:795px;left:-17.0127px;" data-x="475.981" data-y="434.155">Leave</div><div class="l fe s7 t10" style="top:795px;left:17.0127px;" data-x="490.64" data-y="434.155"> </div><div class="l fe s7 t10" style="top:781px;left:-42.0234px;" data-x="465.206" data-y="428.124">Compiled </div><div class="l fe s7 t10" style="top:781px;left:11.7891px;" data-x="488.389" data-y="428.124">T</div><div class="l fe s7 t10" style="top:781px;left:18.6797px;" data-x="491.358" data-y="428.124">race</div></div><div class="t te"></div><div class="t t17"><div class="l fe s7 t10" style="top:795px;left:-11.3438px;" data-x="402.383" data-y="556.077">loop </div><div class="l fe s7 t10" style="top:781px;left:-13.3477px;" data-x="401.52" data-y="550.046">edge</div></div><div class="t t18"><div class="l fe s7 t10" style="top:795px;left:-8.34082px;" data-x="383.859" data-y="516.442">hot</div><div class="l fe s7 t10" style="top:781px;left:-22.3477px;" data-x="377.825" data-y="510.411">loop/exit</div></div><div class="t t19"><div class="l fe s7 t10" style="top:795px;left:-13.6758px;" data-x="335.248" data-y="531.952">abort </div><div class="l fe s7 t10" style="top:781px;left:-25.0137px;" data-x="330.363" data-y="525.92">recording</div></div><div class="t t1a"><div class="l fe s7 t10" style="top:795px;left:-20.6777px;" data-x="353.557" data-y="497.055">fi</div><div class="l fe s7 t10" style="top:795px;left:-14.6777px;" data-x="356.142" data-y="497.055">nish at </div><div class="l fe s7 t10" style="top:781px;left:-31.6934px;" data-x="348.811" data-y="491.024">loop header</div></div><div class="t t1b"><div class="l fe s7 t10" style="top:795px;left:-40.6875px;" data-x="441.44" data-y="550.908">cold/blacklisted</div><div class="l fe s7 t10" style="top:781px;left:-22.3477px;" data-x="449.341" data-y="544.876">loop/exit</div></div><div class="t t1c"><div class="l fe s7 t10" style="top:795px;left:-39.0176px;" data-x="444.313" data-y="529.797">compiled trace </div><div class="l fe s7 t10" style="top:781px;left:-15.0088px;" data-x="454.657" data-y="523.766">ready</div></div><div class="t t1d"><div class="l fe s7 t10" style="top:795px;left:-38.6953px;" data-x="425.065" data-y="492.101">loop edge with </div><div class="l fe s7 t10" style="top:781px;left:-30.6797px;" data-x="428.519" data-y="486.069">same types</div></div><div class="t t1e"><div class="l fe s7 t10" style="top:795px;left:-28.6816px;" data-x="518.559" data-y="444.926">side exit to </div><div class="l fe s7 t10" style="top:781px;left:-35.3496px;" data-x="515.687" data-y="438.894">existing trace</div></div><div class="t t1f"><div class="l fe s7 t10" style="top:795px;left:-23.6777px;" data-x="427.442" data-y="447.08">side exit,</div><div class="l fe s7 t10" style="top:781px;left:-43.6904px;" data-x="418.821" data-y="441.049">no existing trace</div></div><div class="t te"></div><div class="t t20"><div class="l fe s7 t10" style="top:788px;left:-26.3496px;" data-x="507.07" data-y="571.587">Overhead</div><div class="l fe s7 t10" style="top:788px;left:26.3496px;" data-x="529.774" data-y="571.587"> </div></div><div class="t te"></div><div class="t t21"><div class="l fe s7 t10" style="top:788px;left:-30.3516px;" data-x="505.346" data-y="558.662">Interpreting</div></div><div class="t te"></div><div class="t t22"><div class="l fe s7 t10" style="top:788px;left:-17.0068px;" data-x="511.095" data-y="546.169">Native</div></div><div class="t te"></div><div class="t t23"><div class="l fd s7 t10" style="top:834px;left:-34.3447px;" data-x="504.918" data-y="582.788">Symbol Key</div></div><div class="t t24"></div><div class="t t0"><div class="l f1 s4 t0" style="top:398.682px;left:317.014px;" data-x="317.014" data-y="393.318">Figure<span class="w1"> </span>2.</div><div class="l f2 s4 t0" style="top:398.682px;left:356.264px;" data-x="356.264" data-y="393.318">State<span class="w1"> </span>machine<span class="w1"> </span>describing<span class="w1"> </span>the<span class="w1"> </span>major<span class="w1"> </span>activities<span class="w1"> </span>of<span class="w1"> </span>Trace-</div><div class="l f2 s4 t0" style="top:408.645px;left:317.014px;" data-x="317.014" data-y="383.355">Monkey<span class="w1"> </span>and<span class="w1"> </span>the<span class="w0"> </span>conditions<span class="w1"> </span>that<span class="w1"> </span>cause<span class="w1"> </span>transitions<span class="w1"> </span>to<span class="w0"> </span>a<span class="w1"> </span>new<span class="w1"> </span>activ-</div><div class="l f2 s4 t0" style="top:418.607px;left:317.014px;" data-x="317.014" data-y="373.393">ity.<span class="w1"> </span>In<span class="w0"> </span>the<span class="w1"> </span>dark<span class="w0"> </span>box,<span class="w1"> </span>TM<span class="w1"> </span>executes<span class="w0"> </span>JS<span class="w1"> </span>as<span class="w0"> </span>compiled<span class="w1"> </span>traces.<span class="w0"> </span>In<span class="w1"> </span>the</div><div class="l f2 s4 t0" style="top:428.57px;left:317.014px;" data-x="317.014" data-y="363.43">light<span class="w2"> </span>gray<span class="w1"> </span>boxes,<span class="w2"> </span>TM<span class="w1"> </span>executes<span class="w2"> </span>JS<span class="w1"> </span>in<span class="w1"> </span>the<span class="w2"> </span>standard<span class="w1"> </span>interpreter.<span class="w2"> </span>White</div><div class="l f2 s4 t0" style="top:438.533px;left:317.014px;" data-x="317.014" data-y="353.467">boxes<span class="w1"> </span>are<span class="w1"> </span>overhead.<span class="w1"> </span>Thus,<span class="w0"> </span>to<span class="w1"> </span>maximize<span class="w1"> </span>performance,<span class="w1"> </span>we<span class="w1"> </span>need<span class="w0"> </span>to</div><div class="l f2 s4 t0" style="top:448.495px;left:317.014px;" data-x="317.014" data-y="343.505">maximize<span class="w2"> </span>time<span class="w1"> </span>spent<span class="w2"> </span>in<span class="w1"> </span>the<span class="w2"> </span>darkest<span class="w1"> </span>box<span class="w2"> </span>and<span class="w1"> </span>minimize<span class="w2"> </span>time<span class="w1"> </span>spent<span class="w2"> </span>in</div><div class="l f2 s4 t0" style="top:458.458px;left:317.014px;" data-x="317.014" data-y="333.542">the<span class="w2"> </span>white<span class="w1"> </span>boxes.<span class="w2"> </span>The<span class="w1"> </span>best<span class="w1"> </span>case<span class="w2"> </span>is<span class="w1"> </span>a<span class="w2"> </span>loop<span class="w1"> </span>where<span class="w2"> </span>the<span class="w1"> </span>types<span class="w1"> </span>at<span class="w2"> </span>the<span class="w1"> </span>loop</div><div class="l f2 s4 t0" style="top:468.421px;left:317.014px;" data-x="317.014" data-y="323.579">edge<span class="w2"> </span>are<span class="w1"> </span>the<span class="w1"> </span>same<span class="w2"> </span>as<span class="w1"> </span>the<span class="w2"> </span>types<span class="w1"> </span>on<span class="w2"> </span>entry–then<span class="w1"> </span>TM<span class="w1"> </span>can<span class="w2"> </span>stay<span class="w1"> </span>in<span class="w2"> </span>native</div><div class="l f2 s4 t0" style="top:478.383px;left:317.014px;" data-x="317.014" data-y="313.617">code<span class="w2"> </span>until<span class="w1"> </span>the<span class="w1"> </span>loop<span class="w2"> </span>is<span class="w1"> </span>done.</div><div class="l f2 s4 t0" style="top:506.879px;left:317.014px;" data-x="317.014" data-y="285.121">a<span class="w1"> </span>set<span class="w1"> </span>of<span class="w1"> </span>industry<span class="w1"> </span>benchmarks.<span class="w1"> </span>The<span class="w1"> </span>paper<span class="w1"> </span>ends<span class="w1"> </span>with<span class="w1"> </span>conclusions<span class="w1"> </span>in</div><div class="l f2 s4 t0" style="top:516.841px;left:317.014px;" data-x="317.014" data-y="275.159">Section<span class="w2"> </span>9<span class="w1"> </span>and<span class="w2"> </span>an<span class="w1"> </span>outlook<span class="w2"> </span>on<span class="w1"> </span>future<span class="w2"> </span>work<span class="w1"> </span>is<span class="w2"> </span>presented<span class="w1"> </span>in<span class="w2"> </span>Section<span class="w1"> </span>10.</div><div class="l f1 s2 t0" style="top:540.244px;left:317.014px;" data-x="317.014" data-y="251.756">2.<span class="w3"> </span>Overview:<span class="w1"> </span>Example<span class="w1"> </span>T</div><div class="l f1 s2 t0" style="top:540.244px;left:438.044px;" data-x="438.044" data-y="251.756">racing<span class="w1"> </span>Run</div><div class="l f2 s4 t0" style="top:554.192px;left:317.014px;" data-x="317.014" data-y="237.808">This<span class="w0"> </span>section<span class="w1"> </span>provides<span class="w0"> </span>an<span class="w1"> </span>overview<span class="w0"> </span>of<span class="w0"> </span>our<span class="w1"> </span>system<span class="w0"> </span>by<span class="w0"> </span>describing</div><div class="l f2 s4 t0" style="top:564.154px;left:317.014px;" data-x="317.014" data-y="227.846">how<span class="w0"> </span>T</div><div class="l f2 s4 t0" style="top:564.154px;left:341.393px;" data-x="341.393" data-y="227.846">raceMonkey<span class="w0"> </span>executes<span class="w1"> </span>an<span class="w0"> </span>example<span class="w1"> </span>program.<span class="w0"> </span>The<span class="w0"> </span>example</div><div class="l f2 s4 t0" style="top:574.117px;left:317.014px;" data-x="317.014" data-y="217.883">program,<span class="w2"> </span>shown<span class="w1"> </span>in<span class="w2"> </span>Figure<span class="w1"> </span>1,<span class="w2"> </span>computes<span class="w1"> </span>the<span class="w1"> </span>first<span class="w2"> </span>100<span class="w1"> </span>prime<span class="w2"> </span>numbers</div><div class="l f2 s4 t0" style="top:584.08px;left:317.014px;" data-x="317.014" data-y="207.92">with<span class="w2"> </span>nested<span class="w2"> </span>loops.<span class="w1"> </span>The<span class="w2"> </span>narrative<span class="w2"> </span>should<span class="w2"> </span>be<span class="w2"> </span>read<span class="w1"> </span>along<span class="w2"> </span>with<span class="w2"> </span>Figure<span class="w1"> </span>2,</div><div class="l f2 s4 t0" style="top:594.042px;left:317.014px;" data-x="317.014" data-y="197.958">which<span class="w1"> </span>describes<span class="w1"> </span>the<span class="w1"> </span>activities<span class="w2"> </span>TraceMonkey<span class="w1"> </span>performs<span class="w1"> </span>and<span class="w1"> </span>when<span class="w1"> </span>it</div><div class="l f2 s4 t0" style="top:604.005px;left:317.014px;" data-x="317.014" data-y="187.995">transitions<span class="w2"> </span>between<span class="w1"> </span>the<span class="w1"> </span>loops.</div><div class="l f2 s4 t0" style="top:613.968px;left:328.969px;" data-x="328.969" data-y="178.032">TraceMonkey<span class="w1"> </span>always<span class="w1"> </span>begins<span class="w1"> </span>executing<span class="w1"> </span>a<span class="w1"> </span>program<span class="w1"> </span>in<span class="w1"> </span>the<span class="w0"> </span>byte-</div><div class="l f2 s4 t0" style="top:623.93px;left:317.014px;" data-x="317.014" data-y="168.07">code<span class="w1"> </span>interpreter.<span class="w1"> </span>Every<span class="w1"> </span>loop<span class="w0"> </span>back<span class="w1"> </span>edge<span class="w1"> </span>is<span class="w0"> </span>a<span class="w1"> </span>potential<span class="w1"> </span>trace<span class="w0"> </span>point.</div><div class="l f2 s4 t0" style="top:633.893px;left:317.014px;" data-x="317.014" data-y="158.107">When<span class="w1"> </span>the<span class="w0"> </span>interpreter<span class="w1"> </span>crosses<span class="w1"> </span>a<span class="w0"> </span>loop<span class="w1"> </span>edge,<span class="w0"> </span>TraceMonkey<span class="w1"> </span>invokes</div><div class="l f2 s4 t0" style="top:643.856px;left:317.014px;" data-x="317.014" data-y="148.144">the</div><div class="l fa s4 t0" style="top:643.856px;left:330.558px;" data-x="330.558" data-y="148.144">trace<span class="w1"> </span>monitor</div><div class="l f2 s4 t0" style="top:643.856px;left:379.834px;" data-x="379.834" data-y="148.144">,<span class="w1"> </span>which<span class="w1"> </span>may<span class="w2"> </span>decide<span class="w1"> </span>to<span class="w1"> </span>record<span class="w1"> </span>or<span class="w1"> </span>execute<span class="w1"> </span>a<span class="w1"> </span>native</div><div class="l f2 s4 t0" style="top:653.818px;left:317.014px;" data-x="317.014" data-y="138.182">trace.<span class="w2"> </span>At<span class="w1"> </span>the<span class="w1"> </span>start<span class="w2"> </span>of<span class="w1"> </span>execution,<span class="w2"> </span>there<span class="w1"> </span>are<span class="w2"> </span>no<span class="w1"> </span>compiled<span class="w1"> </span>traces<span class="w2"> </span>yet,<span class="w1"> </span>so</div><div class="l f2 s4 t0" style="top:663.781px;left:317.014px;" data-x="317.014" data-y="128.219">the<span class="w2"> </span>trace<span class="w2"> </span>monitor<span class="w1"> </span>counts<span class="w2"> </span>the<span class="w2"> </span>number<span class="w1"> </span>of<span class="w2"> </span>times<span class="w2"> </span>each<span class="w2"> </span>loop<span class="w1"> </span>back<span class="w2"> </span>edge<span class="w2"> </span>is</div><div class="l f2 s4 t0" style="top:673.744px;left:317.014px;" data-x="317.014" data-y="118.256">executed<span class="w2"> </span>until<span class="w2"> </span>a<span class="w1"> </span>loop<span class="w2"> </span>becomes</div><div class="l fa s4 t0" style="top:673.744px;left:426.223px;" data-x="426.223" data-y="118.256">hot</div><div class="l f2 s4 t0" style="top:673.744px;left:437.682px;" data-x="437.682" data-y="118.256">,<span class="w2"> </span>currently<span class="w1"> </span>after<span class="w2"> </span>2<span class="w1"> </span>crossings.<span class="w2"> </span>Note</div><div class="l f2 s4 t0" style="top:683.706px;left:317.014px;" data-x="317.014" data-y="108.294">that<span class="w2"> </span>the<span class="w2"> </span>way<span class="w1"> </span>our<span class="w2"> </span>loops<span class="w2"> </span>are<span class="w1"> </span>compiled,<span class="w2"> </span>the<span class="w2"> </span>loop<span class="w1"> </span>edge<span class="w2"> </span>is<span class="w1"> </span>crossed<span class="w2"> </span>before</div><div class="l f2 s4 t0" style="top:693.669px;left:317.014px;" data-x="317.014" data-y="98.3312">entering<span class="w1"> </span>the<span class="w2"> </span>loop,<span class="w1"> </span>so<span class="w1"> </span>the<span class="w1"> </span>second<span class="w1"> </span>crossing<span class="w2"> </span>occurs<span class="w1"> </span>immediately<span class="w1"> </span>after</div><div class="l f2 s4 t0" style="top:703.631px;left:317.014px;" data-x="317.014" data-y="88.3686">the<span class="w2"> </span>first<span class="w1"> </span>iteration.</div><div class="l f2 s4 t0" style="top:713.594px;left:328.969px;" data-x="328.969" data-y="78.406">Here<span class="w0"> </span>is<span class="w0"> </span>the<span class="w1"> </span>sequence<span class="w0"> </span>of<span class="w0"> </span>events<span class="w0"> </span>broken<span class="w0"> </span>down<span class="w1"> </span>by<span class="w0"> </span>outer<span class="w0"> </span>loop</div><div class="l f2 s4 t0" style="top:723.557px;left:317.014px;" data-x="317.014" data-y="68.4433">iteration:</div></div></div><div id="page-3" class="p" style="width:612px;height:792px;"><div class="t"><div class="l f7 s4 t0" style="top:78.2267px;left:54px;" data-x="54" data-y="713.773">v0<span class="w0"> </span>:=<span class="w0"> </span>ld<span class="w0"> </span>state[748]<span class="w6"> </span>//<span class="w0"> </span>load<span class="w4"> </span>primes<span class="w0"> </span>from<span class="w0"> </span>the<span class="w0"> </span>trace<span class="w0"> </span>activation<span class="w4"> </span>record</div><div class="l f7 s4 t0" style="top:88.1893px;left:82.2438px;" data-x="82.2438" data-y="703.811">st<span class="w0"> </span>sp[0],<span class="w0"> </span>v0<span class="w7"> </span>//<span class="w0"> </span>store<span class="w0"> </span>primes<span class="w0"> </span>to<span class="w0"> </span>interpreter<span class="w4"> </span>stack</div><div class="l f7 s4 t0" style="top:98.1519px;left:54px;" data-x="54" data-y="693.848">v1<span class="w0"> </span>:=<span class="w0"> </span>ld<span class="w0"> </span>state[764]<span class="w6"> </span>//<span class="w0"> </span>load<span class="w4"> </span>k<span class="w0"> </span>from<span class="w0"> </span>the<span class="w0"> </span>trace<span class="w0"> </span>activation<span class="w4"> </span>record</div><div class="l f7 s4 t0" style="top:108.115px;left:54px;" data-x="54" data-y="683.885">v2<span class="w0"> </span>:=<span class="w0"> </span>i2f(v1)<span class="w8"> </span>//<span class="w0"> </span>convert<span class="w0"> </span>k<span class="w0"> </span>from<span class="w0"> </span>int<span class="w4"> </span>to<span class="w0"> </span>double</div><div class="l f7 s4 t0" style="top:118.077px;left:82.2438px;" data-x="82.2438" data-y="673.923">st<span class="w0"> </span>sp[8],<span class="w0"> </span>v1<span class="w7"> </span>//<span class="w0"> </span>store<span class="w0"> </span>k<span class="w0"> </span>to<span class="w0"> </span>interpreter<span class="w4"> </span>stack</div><div class="l f7 s4 t0" style="top:128.04px;left:82.2438px;" data-x="82.2438" data-y="663.96">st<span class="w0"> </span>sp[16],<span class="w0"> </span>0<span class="w7"> </span>//<span class="w0"> </span>store<span class="w0"> </span>false<span class="w0"> </span>to<span class="w0"> </span>interpreter<span class="w4"> </span>stack</div><div class="l f7 s4 t0" style="top:138.002px;left:54px;" data-x="54" data-y="653.998">v3<span class="w0"> </span>:=<span class="w0"> </span>ld<span class="w0"> </span>v0[4]<span class="w9"> </span>//<span class="w0"> </span>load<span class="w0"> </span>class<span class="w0"> </span>word<span class="w0"> </span>for<span class="w4"> </span>primes</div><div class="l f7 s4 t0" style="top:147.965px;left:54px;" data-x="54" data-y="644.035">v4<span class="w0"> </span>:=<span class="w0"> </span>and<span class="w0"> </span>v3,<span class="w0"> </span>-4<span class="wa"> </span>//<span class="w0"> </span>mask<span class="w0"> </span>out<span class="w0"> </span>object<span class="w0"> </span>class<span class="w4"> </span>tag<span class="w0"> </span>for<span class="w0"> </span>primes</div><div class="l f7 s4 t0" style="top:157.928px;left:54px;" data-x="54" data-y="634.072">v5<span class="w0"> </span>:=<span class="w0"> </span>eq<span class="w0"> </span>v4,<span class="w0"> </span>Array<span class="w7"> </span>//<span class="w0"> </span>test<span class="w0"> </span>whether<span class="w4"> </span>primes<span class="w0"> </span>is<span class="w0"> </span>an<span class="w0"> </span>array</div><div class="l f7 s4 t0" style="top:167.89px;left:82.2438px;" data-x="82.2438" data-y="624.11">xf<span class="w0"> </span>v5<span class="wb"> </span>//<span class="w0"> </span>side<span class="w0"> </span>exit<span class="w0"> </span>if<span class="w0"> </span>v5<span class="w4"> </span>is<span class="w0"> </span>false</div><div class="l f7 s4 t0" style="top:177.853px;left:54px;" data-x="54" data-y="614.147">v6<span class="w0"> </span>:=<span class="w0"> </span>js_Array_set(v0,<span class="w0"> </span>v2,<span class="w0"> </span>false)<span class="w3"> </span>//<span class="w0"> </span>call<span class="w0"> </span>function<span class="w0"> </span>to<span class="w0"> </span>set<span class="w0"> </span>array<span class="w0"> </span>element</div><div class="l f7 s4 t0" style="top:187.816px;left:54px;" data-x="54" data-y="604.184">v7<span class="w0"> </span>:=<span class="w0"> </span>eq<span class="w0"> </span>v6,<span class="w0"> </span>0<span class="w9"> </span>//<span class="w0"> </span>test<span class="w0"> </span>return<span class="w0"> </span>value<span class="w4"> </span>from<span class="w0"> </span>call</div><div class="l f7 s4 t0" style="top:197.778px;left:82.2438px;" data-x="82.2438" data-y="594.222">xt<span class="w0"> </span>v7<span class="wb"> </span>//<span class="w0"> </span>side<span class="w0"> </span>exit<span class="w0"> </span>if<span class="w0"> </span>js_Array_set<span class="w4"> </span>returns<span class="w0"> </span>false.</div></div><div class="t t25"></div><div class="t t0"><div class="l f1 s4 t0" style="top:221.221px;left:54px;" data-x="54" data-y="570.779">Figure<span class="w1"> </span>3.<span class="w0"> </span>LIR<span class="w1"> </span>snippet<span class="w0"> </span>for<span class="w2"> </span>sample<span class="w0"> </span>program.</div><div class="l f2 s4 t0" style="top:221.221px;left:227.171px;" data-x="227.171" data-y="570.779">This<span class="w1"> </span>is<span class="w1"> </span>the<span class="w0"> </span>LIR<span class="w1"> </span>recorded<span class="w1"> </span>for<span class="w1"> </span>line<span class="w0"> </span>5<span class="w1"> </span>of<span class="w1"> </span>the<span class="w1"> </span>sample<span class="w1"> </span>program<span class="w0"> </span>in<span class="w1"> </span>Figure<span class="w1"> </span>1.<span class="w1"> </span>The<span class="w0"> </span>LIR<span class="w1"> </span>encodes</div><div class="l f2 s4 t0" style="top:231.184px;left:54px;" data-x="54" data-y="560.816">the<span class="w1"> </span>semantics<span class="w1"> </span>in<span class="w1"> </span>SSA<span class="w1"> </span>form<span class="w0"> </span>using<span class="w2"> </span>temporary<span class="w0"> </span>variables.<span class="w2"> </span>The<span class="w1"> </span>LIR<span class="w0"> </span>also<span class="w2"> </span>encodes<span class="w0"> </span>all<span class="w2"> </span>the<span class="w0"> </span>stores<span class="w2"> </span>that<span class="w0"> </span>the<span class="w2"> </span>interpreter<span class="w0"> </span>would<span class="w2"> </span>do<span class="w1"> </span>to<span class="w0"> </span>its<span class="w2"> </span>data<span class="w0"> </span>stack.</div><div class="l f2 s4 t0" style="top:241.147px;left:54px;" data-x="54" data-y="550.853">Sometimes<span class="w2"> </span>these<span class="w1"> </span>stores<span class="w1"> </span>can<span class="w2"> </span>be<span class="w1"> </span>optimized<span class="w1"> </span>away<span class="w2"> </span>as<span class="w1"> </span>the<span class="w1"> </span>stack<span class="w2"> </span>locations<span class="w1"> </span>are<span class="w1"> </span>live<span class="w2"> </span>only<span class="w1"> </span>on<span class="w2"> </span>exits<span class="w1"> </span>to<span class="w1"> </span>the<span class="w2"> </span>interpreter.<span class="w1"> </span>Finally,<span class="w2"> </span>the<span class="w2"> </span>LIR<span class="w1"> </span>records<span class="w1"> </span>guards</div><div class="l f2 s4 t0" style="top:251.109px;left:54px;" data-x="54" data-y="540.891">and<span class="w2"> </span>side<span class="w1"> </span>exits<span class="w1"> </span>to<span class="w2"> </span>verify<span class="w1"> </span>the<span class="w2"> </span>assumptions<span class="w1"> </span>made<span class="w1"> </span>in<span class="w2"> </span>this<span class="w1"> </span>recording:<span class="w1"> </span>that</div><div class="l f7 s4 t0" style="top:251.109px;left:298.295px;" data-x="298.295" data-y="540.891">primes</div><div class="l f2 s4 t0" style="top:251.109px;left:328.78px;" data-x="328.78" data-y="540.891">is<span class="w2"> </span>an<span class="w1"> </span>array<span class="w1"> </span>and<span class="w2"> </span>that<span class="w1"> </span>the<span class="w1"> </span>call<span class="w2"> </span>to<span class="w1"> </span>set<span class="w2"> </span>its<span class="w1"> </span>element<span class="w1"> </span>succeeds.</div><div class="l f7 s4 t0" style="top:277.261px;left:54px;" data-x="54" data-y="514.739">mov<span class="w0"> </span>edx,<span class="w0"> </span>ebx(748)<span class="w7"> </span>//<span class="w0"> </span>load<span class="w0"> </span>primes<span class="w0"> </span>from<span class="w0"> </span>the<span class="w4"> </span>trace<span class="w0"> </span>activation<span class="w0"> </span>record</div><div class="l f7 s4 t0" style="top:287.224px;left:54px;" data-x="54" data-y="504.776">mov<span class="w0"> </span>edi(0),<span class="w0"> </span>edx<span class="wa"> </span>//<span class="w0"> </span>(*)<span class="w0"> </span>store<span class="w0"> </span>primes<span class="w0"> </span>to<span class="w0"> </span>interpreter<span class="w0"> </span>stack</div><div class="l f7 s4 t0" style="top:297.186px;left:54px;" data-x="54" data-y="494.814">mov<span class="w0"> </span>esi,<span class="w0"> </span>ebx(764)<span class="w7"> </span>//<span class="w0"> </span>load<span class="w0"> </span>k<span class="w0"> </span>from<span class="w0"> </span>the<span class="w4"> </span>trace<span class="w0"> </span>activation<span class="w0"> </span>record</div><div class="l f7 s4 t0" style="top:307.149px;left:54px;" data-x="54" data-y="484.851">mov<span class="w0"> </span>edi(8),<span class="w0"> </span>esi<span class="wa"> </span>//<span class="w0"> </span>(*)<span class="w0"> </span>store<span class="w0"> </span>k<span class="w0"> </span>to<span class="w0"> </span>interpreter<span class="w0"> </span>stack</div><div class="l f7 s4 t0" style="top:317.112px;left:54px;" data-x="54" data-y="474.888">mov<span class="w0"> </span>edi(16),<span class="w0"> </span>0<span class="wc"> </span>//<span class="w0"> </span>(*)<span class="w0"> </span>store<span class="w0"> </span>false<span class="w0"> </span>to<span class="w4"> </span>interpreter<span class="w0"> </span>stack</div><div class="l f7 s4 t0" style="top:327.074px;left:54px;" data-x="54" data-y="464.926">mov<span class="w0"> </span>eax,<span class="w0"> </span>edx(4)<span class="wa"> </span>//<span class="w0"> </span>(*)<span class="w0"> </span>load<span class="w0"> </span>object<span class="w0"> </span>class<span class="w0"> </span>word<span class="w0"> </span>for<span class="w4"> </span>primes</div><div class="l f7 s4 t0" style="top:337.037px;left:54px;" data-x="54" data-y="454.963">and<span class="w0"> </span>eax,<span class="w0"> </span>-4<span class="wd"> </span>//<span class="w0"> </span>(*)<span class="w0"> </span>mask<span class="w0"> </span>out<span class="w0"> </span>object<span class="w4"> </span>class<span class="w0"> </span>tag<span class="w0"> </span>for<span class="w0"> </span>primes</div><div class="l f7 s4 t0" style="top:347px;left:54px;" data-x="54" data-y="445">cmp<span class="w0"> </span>eax,<span class="w0"> </span>Array<span class="wc"> </span>//<span class="w0"> </span>(*)<span class="w0"> </span>test<span class="w0"> </span>whether<span class="w0"> </span>primes<span class="w4"> </span>is<span class="w0"> </span>an<span class="w0"> </span>array</div><div class="l f7 s4 t0" style="top:356.962px;left:54px;" data-x="54" data-y="435.038">jne<span class="w0"> </span>side_exit_1<span class="wa"> </span>//<span class="w0"> </span>(*)<span class="w0"> </span>side<span class="w0"> </span>exit<span class="w0"> </span>if<span class="w0"> </span>primes<span class="w0"> </span>is<span class="w0"> </span>not<span class="w4"> </span>an<span class="w0"> </span>array</div><div class="l f7 s4 t0" style="top:366.925px;left:54px;" data-x="54" data-y="425.075">sub<span class="w0"> </span>esp,<span class="w0"> </span>8<span class="wb"> </span>//<span class="w0"> </span>bump<span class="w0"> </span>stack<span class="w0"> </span>for<span class="w4"> </span>call<span class="w0"> </span>alignment<span class="w0"> </span>convention</div><div class="l f7 s4 t0" style="top:376.888px;left:54px;" data-x="54" data-y="415.112">push<span class="w0"> </span>false<span class="wb"> </span>//<span class="w0"> </span>push<span class="w0"> </span>last<span class="w0"> </span>argument<span class="w0"> </span>for<span class="w4"> </span>call</div><div class="l f7 s4 t0" style="top:386.85px;left:54px;" data-x="54" data-y="405.15">push<span class="w0"> </span>esi<span class="we"> </span>//<span class="w0"> </span>push<span class="w0"> </span>first<span class="w0"> </span>argument<span class="w0"> </span>for<span class="w4"> </span>call</div><div class="l f7 s4 t0" style="top:396.813px;left:54px;" data-x="54" data-y="395.187">call<span class="w0"> </span>js_Array_set<span class="w7"> </span>//<span class="w0"> </span>call<span class="w0"> </span>function<span class="w0"> </span>to<span class="w0"> </span>set<span class="w0"> </span>array<span class="w4"> </span>element</div><div class="l f7 s4 t0" style="top:406.776px;left:54px;" data-x="54" data-y="385.224">add<span class="w0"> </span>esp,<span class="w0"> </span>8<span class="wb"> </span>//<span class="w0"> </span>clean<span class="w0"> </span>up<span class="w0"> </span>extra<span class="w4"> </span>stack<span class="w0"> </span>space</div><div class="l f7 s4 t0" style="top:416.738px;left:54px;" data-x="54" data-y="375.262">mov<span class="w0"> </span>ecx,<span class="w0"> </span>ebx<span class="w8"> </span>//<span class="w0"> </span>(*)<span class="w0"> </span>created<span class="w0"> </span>by<span class="w0"> </span>register<span class="w4"> </span>allocator</div><div class="l f7 s4 t0" style="top:426.701px;left:54px;" data-x="54" data-y="365.299">test<span class="w0"> </span>eax,<span class="w0"> </span>eax<span class="w9"> </span>//<span class="w0"> </span>(*)<span class="w0"> </span>test<span class="w0"> </span>return<span class="w0"> </span>value<span class="w0"> </span>of<span class="w4"> </span>js_Array_set</div><div class="l f7 s4 t0" style="top:436.663px;left:54px;" data-x="54" data-y="355.337">je<span class="w0"> </span>side_exit_2<span class="wc"> </span>//<span class="w0"> </span>(*)<span class="w0"> </span>side<span class="w0"> </span>exit<span class="w0"> </span>if<span class="w0"> </span>call<span class="w4"> </span>failed</div><div class="l f7 s4 t0" style="top:446.626px;left:54px;" data-x="54" data-y="345.374">...</div><div class="l f7 s4 t0" style="top:456.589px;left:54px;" data-x="54" data-y="335.411">side_exit_1:</div><div class="l f7 s4 t0" style="top:466.551px;left:54px;" data-x="54" data-y="325.449">mov<span class="w0"> </span>ecx,<span class="w0"> </span>ebp(-4)<span class="wf"> </span>//<span class="w0"> </span>restore<span class="w0"> </span>ecx</div><div class="l f7 s4 t0" style="top:476.514px;left:54px;" data-x="54" data-y="315.486">mov<span class="w0"> </span>esp,<span class="w0"> </span>ebp<span class="w8"> </span>//<span class="w0"> </span>restore<span class="w0"> </span>esp</div><div class="l f7 s4 t0" style="top:486.477px;left:54px;" data-x="54" data-y="305.523">jmp<span class="w0"> </span>epilog<span class="wb"> </span>//<span class="w0"> </span>jump<span class="w0"> </span>to<span class="w0"> </span>ret<span class="w0"> </span>statement</div></div><div class="t t26"></div><div class="t t0"><div class="l f1 s4 t0" style="top:509.92px;left:54px;" data-x="54" data-y="282.08">Figure<span class="w2"> </span>4.<span class="w0"> </span>x86<span class="w1"> </span>snippet<span class="w2"> </span>for<span class="w2"> </span>sample<span class="w1"> </span>program.</div><div class="l f2 s4 t0" style="top:509.92px;left:217.914px;" data-x="217.914" data-y="282.08">This<span class="w2"> </span>is<span class="w1"> </span>the<span class="w2"> </span>x86<span class="w1"> </span>code<span class="w2"> </span>compiled<span class="w1"> </span>from<span class="w2"> </span>the<span class="w2"> </span>LIR<span class="w1"> </span>snippet<span class="w2"> </span>in<span class="w1"> </span>Figure<span class="w2"> </span>3.<span class="w1"> </span>Most<span class="w2"> </span>LIR<span class="w1"> </span>instructions<span class="w2"> </span>compile</div><div class="l f2 s4 t0" style="top:519.882px;left:54px;" data-x="54" data-y="272.118">to<span class="w1"> </span>a<span class="w1"> </span>single<span class="w1"> </span>x86<span class="w1"> </span>instruction.<span class="w1"> </span>Instructions<span class="w1"> </span>marked<span class="w1"> </span>with</div><div class="l f7 s4 t0" style="top:519.882px;left:247.567px;" data-x="247.567" data-y="272.118">(*)</div><div class="l f2 s4 t0" style="top:519.882px;left:264.447px;" data-x="264.447" data-y="272.118">would<span class="w1"> </span>be<span class="w1"> </span>omitted<span class="w1"> </span>by<span class="w1"> </span>an<span class="w1"> </span>idealized<span class="w1"> </span>compiler<span class="w1"> </span>that<span class="w1"> </span>knew<span class="w1"> </span>that<span class="w1"> </span>none<span class="w1"> </span>of<span class="w1"> </span>the<span class="w1"> </span>side<span class="w1"> </span>exits</div><div class="l f2 s4 t0" style="top:529.845px;left:54px;" data-x="54" data-y="262.155">would<span class="w2"> </span>ever<span class="w1"> </span>be<span class="w1"> </span>taken.<span class="w2"> </span>The<span class="w1"> </span>17<span class="w1"> </span>instructions<span class="w2"> </span>generated<span class="w1"> </span>by<span class="w1"> </span>the<span class="w1"> </span>compiler<span class="w2"> </span>compare<span class="w1"> </span>favorably<span class="w2"> </span>with<span class="w1"> </span>the<span class="w1"> </span>100+<span class="w1"> </span>instructions<span class="w2"> </span>that<span class="w1"> </span>the<span class="w1"> </span>interpreter<span class="w2"> </span>would</div><div class="l f2 s4 t0" style="top:539.808px;left:54px;" data-x="54" data-y="252.192">execute<span class="w2"> </span>for<span class="w1"> </span>the<span class="w2"> </span>same<span class="w1"> </span>code<span class="w1"> </span>snippet,<span class="w2"> </span>including<span class="w1"> </span>4<span class="w1"> </span>indirect<span class="w2"> </span>jumps.</div><div class="l f1 s4 t0" style="top:569.644px;left:65.9552px;" data-x="65.9552" data-y="222.356">i=2.</div><div class="l f2 s4 t0" style="top:569.644px;left:83.8015px;" data-x="83.8015" data-y="222.356">This<span class="w1"> </span>is<span class="w0"> </span>the<span class="w1"> </span>first<span class="w0"> </span>iteration<span class="w1"> </span>of<span class="w0"> </span>the<span class="w1"> </span>outer<span class="w1"> </span>loop.<span class="w0"> </span>The<span class="w1"> </span>loop<span class="w0"> </span>on</div><div class="l f2 s4 t0" style="top:579.607px;left:54px;" data-x="54" data-y="212.393">lines<span class="w2"> </span>4-5<span class="w1"> </span>becomes<span class="w1"> </span>hot<span class="w1"> </span>on<span class="w2"> </span>its<span class="w1"> </span>second<span class="w1"> </span>iteration,<span class="w1"> </span>so<span class="w2"> </span>TraceMonkey<span class="w1"> </span>en-</div><div class="l f2 s4 t0" style="top:589.57px;left:54px;" data-x="54" data-y="202.43">ters<span class="w1"> </span>recording<span class="w1"> </span>mode<span class="w0"> </span>on<span class="w1"> </span>line<span class="w1"> </span>4.<span class="w0"> </span>In<span class="w1"> </span>recording<span class="w1"> </span>mode,<span class="w1"> </span>TraceMonkey</div><div class="l f2 s4 t0" style="top:599.532px;left:54px;" data-x="54" data-y="192.468">records<span class="w2"> </span>the<span class="w1"> </span>code<span class="w1"> </span>along<span class="w2"> </span>the<span class="w1"> </span>trace<span class="w1"> </span>in<span class="w1"> </span>a<span class="w2"> </span>low-level<span class="w2"> </span>compiler<span class="w1"> </span>intermedi-</div><div class="l f2 s4 t0" style="top:609.495px;left:54px;" data-x="54" data-y="182.505">ate<span class="w2"> </span>representation<span class="w1"> </span>we<span class="w1"> </span>call</div><div class="l fa s4 t0" style="top:609.495px;left:147.89px;" data-x="147.89" data-y="182.505">LIR</div><div class="l f2 s4 t0" style="top:609.495px;left:161.34px;" data-x="161.34" data-y="182.505">.<span class="w2"> </span>The<span class="w1"> </span>LIR<span class="w1"> </span>trace<span class="w2"> </span>encodes<span class="w1"> </span>all<span class="w1"> </span>the<span class="w1"> </span>oper-</div><div class="l f2 s4 t0" style="top:619.457px;left:54px;" data-x="54" data-y="172.543">ations<span class="w1"> </span>performed<span class="w2"> </span>and<span class="w1"> </span>the<span class="w1"> </span>types<span class="w2"> </span>of<span class="w1"> </span>all<span class="w1"> </span>operands.<span class="w1"> </span>The<span class="w2"> </span>LIR<span class="w1"> </span>trace<span class="w1"> </span>also</div><div class="l f2 s4 t0" style="top:629.42px;left:54px;" data-x="54" data-y="162.58">encodes</div><div class="l fa s4 t0" style="top:629.42px;left:85.4698px;" data-x="85.4698" data-y="162.58">guards</div><div class="l f2 s4 t0" style="top:629.42px;left:110.047px;" data-x="110.047" data-y="162.58">,<span class="w1"> </span>which<span class="w1"> </span>are<span class="w2"> </span>checks<span class="w1"> </span>that<span class="w1"> </span>verify<span class="w1"> </span>that<span class="w1"> </span>the<span class="w1"> </span>control<span class="w1"> </span>flow</div><div class="l f2 s4 t0" style="top:639.383px;left:54px;" data-x="54" data-y="152.617">and<span class="w1"> </span>types<span class="w0"> </span>are<span class="w1"> </span>identical<span class="w1"> </span>to<span class="w0"> </span>those<span class="w1"> </span>observed<span class="w1"> </span>during<span class="w1"> </span>trace<span class="w0"> </span>recording.</div><div class="l f2 s4 t0" style="top:649.345px;left:54px;" data-x="54" data-y="142.655">Thus,<span class="w1"> </span>on<span class="w1"> </span>later<span class="w1"> </span>executions,<span class="w1"> </span>if<span class="w1"> </span>and<span class="w1"> </span>only<span class="w1"> </span>if<span class="w1"> </span>all<span class="w1"> </span>guards<span class="w1"> </span>are<span class="w1"> </span>passed,<span class="w1"> </span>the</div><div class="l f2 s4 t0" style="top:659.308px;left:54px;" data-x="54" data-y="132.692">trace<span class="w2"> </span>has<span class="w1"> </span>the<span class="w1"> </span>required<span class="w2"> </span>program<span class="w1"> </span>semantics.</div><div class="l f2 s4 t0" style="top:669.271px;left:65.9552px;" data-x="65.9552" data-y="122.729">TraceMonkey<span class="w1"> </span>stops<span class="w0"> </span>recording<span class="w0"> </span>when<span class="w1"> </span>execution<span class="w0"> </span>returns<span class="w0"> </span>to<span class="w1"> </span>the</div><div class="l f2 s4 t0" style="top:679.233px;left:54px;" data-x="54" data-y="112.767">loop<span class="w1"> </span>header<span class="w2"> </span>or<span class="w1"> </span>exits<span class="w1"> </span>the<span class="w1"> </span>loop.<span class="w1"> </span>In<span class="w1"> </span>this<span class="w2"> </span>case,<span class="w1"> </span>execution<span class="w1"> </span>returns<span class="w1"> </span>to<span class="w1"> </span>the</div><div class="l f2 s4 t0" style="top:689.196px;left:54px;" data-x="54" data-y="102.804">loop<span class="w2"> </span>header<span class="w1"> </span>on<span class="w1"> </span>line<span class="w2"> </span>4.</div><div class="l f2 s4 t0" style="top:699.159px;left:65.9552px;" data-x="65.9552" data-y="92.8415">After<span class="w1"> </span>recording<span class="w2"> </span>is<span class="w1"> </span>finished,<span class="w1"> </span>TraceMonkey<span class="w2"> </span>compiles<span class="w1"> </span>the<span class="w1"> </span>trace<span class="w1"> </span>to</div><div class="l f2 s4 t0" style="top:709.121px;left:54px;" data-x="54" data-y="82.8788">native<span class="w1"> </span>code<span class="w1"> </span>using<span class="w1"> </span>the<span class="w1"> </span>recorded<span class="w1"> </span>type<span class="w1"> </span>information<span class="w1"> </span>for<span class="w1"> </span>optimization.</div><div class="l f2 s4 t0" style="top:719.084px;left:54px;" data-x="54" data-y="72.9162">The<span class="w0"> </span>result<span class="w1"> </span>is<span class="w0"> </span>a<span class="w0"> </span>native<span class="w1"> </span>code<span class="w0"> </span>fragment<span class="w0"> </span>that<span class="w1"> </span>can<span class="w0"> </span>be<span class="w0"> </span>entered<span class="w1"> </span>if<span class="w0"> </span>the</div><div class="l f2 s4 t0" style="top:569.644px;left:317.014px;" data-x="317.014" data-y="222.356">interpreter<span class="w1"> </span>PC<span class="w2"> </span>and<span class="w1"> </span>the<span class="w1"> </span>types<span class="w1"> </span>of<span class="w1"> </span>values<span class="w1"> </span>match<span class="w2"> </span>those<span class="w1"> </span>observed<span class="w1"> </span>when</div><div class="l f2 s4 t0" style="top:579.607px;left:317.014px;" data-x="317.014" data-y="212.393">trace<span class="w1"> </span>recording<span class="w0"> </span>was<span class="w1"> </span>started.<span class="w0"> </span>The<span class="w1"> </span>first<span class="w0"> </span>trace<span class="w1"> </span>in<span class="w1"> </span>our<span class="w0"> </span>example,</div><div class="l ff s4 t0" style="top:579.607px;left:540.696px;" data-x="540.696" data-y="212.393">T</div><div class="l f8 s5 t0" style="top:580.603px;left:546.072px;" data-x="546.072" data-y="211.397">45</div><div class="l f2 s4 t0" style="top:579.607px;left:553.875px;" data-x="553.875" data-y="212.393">,</div><div class="l f2 s4 t0" style="top:589.57px;left:317.014px;" data-x="317.014" data-y="202.43">covers<span class="w2"> </span>lines<span class="w1"> </span>4<span class="w2"> </span>and<span class="w1"> </span>5.<span class="w2"> </span>This<span class="w1"> </span>trace<span class="w2"> </span>can<span class="w1"> </span>be<span class="w1"> </span>entered<span class="w2"> </span>if<span class="w1"> </span>the<span class="w2"> </span>PC<span class="w1"> </span>is<span class="w2"> </span>at<span class="w1"> </span>line<span class="w2"> </span>4,</div><div class="l f7 s4 t0" style="top:599.532px;left:317.014px;" data-x="317.014" data-y="192.468">i</div><div class="l f2 s4 t0" style="top:599.532px;left:323.788px;" data-x="323.788" data-y="192.468">and</div><div class="l f7 s4 t0" style="top:599.532px;left:338.802px;" data-x="338.802" data-y="192.468">k</div><div class="l f2 s4 t0" style="top:599.532px;left:345.576px;" data-x="345.576" data-y="192.468">are<span class="w2"> </span>integers,<span class="w1"> </span>and</div><div class="l f7 s4 t0" style="top:599.532px;left:406.166px;" data-x="406.166" data-y="192.468">primes</div><div class="l f2 s4 t0" style="top:599.532px;left:436.476px;" data-x="436.476" data-y="192.468">is<span class="w2"> </span>an<span class="w1"> </span>object.<span class="w2"> </span>After<span class="w1"> </span>compiling</div><div class="l ff s4 t0" style="top:599.532px;left:540.696px;" data-x="540.696" data-y="192.468">T</div><div class="l f8 s5 t0" style="top:600.528px;left:546.072px;" data-x="546.072" data-y="191.472">45</div><div class="l f2 s4 t0" style="top:599.532px;left:553.875px;" data-x="553.875" data-y="192.468">,</div><div class="l f2 s4 t0" style="top:609.495px;left:317.014px;" data-x="317.014" data-y="182.505">TraceMonkey<span class="w2"> </span>returns<span class="w1"> </span>to<span class="w2"> </span>the<span class="w1"> </span>interpreter<span class="w1"> </span>and<span class="w2"> </span>loops<span class="w1"> </span>back<span class="w2"> </span>to<span class="w1"> </span>line<span class="w1"> </span>1.</div><div class="l f1 s4 t0" style="top:619.457px;left:328.969px;" data-x="328.969" data-y="172.543">i=3.</div><div class="l f2 s4 t0" style="top:619.457px;left:346.282px;" data-x="346.282" data-y="172.543">Now<span class="w1"> </span>the<span class="w1"> </span>loop<span class="w1"> </span>header<span class="w1"> </span>at<span class="w0"> </span>line<span class="w2"> </span>1<span class="w0"> </span>has<span class="w2"> </span>become<span class="w0"> </span>hot,<span class="w1"> </span>so<span class="w1"> </span>Trace-</div><div class="l f2 s4 t0" style="top:629.42px;left:317.014px;" data-x="317.014" data-y="162.58">Monkey<span class="w1"> </span>starts<span class="w0"> </span>recording.<span class="w1"> </span>When<span class="w0"> </span>recording<span class="w1"> </span>reaches<span class="w1"> </span>line<span class="w0"> </span>4,<span class="w1"> </span>Trace-</div><div class="l f2 s4 t0" style="top:639.383px;left:317.014px;" data-x="317.014" data-y="152.617">Monkey<span class="w1"> </span>observes<span class="w1"> </span>that<span class="w1"> </span>it<span class="w1"> </span>has<span class="w1"> </span>reached<span class="w1"> </span>an<span class="w1"> </span>inner<span class="w1"> </span>loop<span class="w1"> </span>header<span class="w1"> </span>that<span class="w1"> </span>al-</div><div class="l f2 s4 t0" style="top:649.345px;left:317.014px;" data-x="317.014" data-y="142.655">ready<span class="w1"> </span>has<span class="w1"> </span>a<span class="w1"> </span>compiled<span class="w1"> </span>trace,<span class="w0"> </span>so<span class="w1"> </span>TraceMonkey<span class="w2"> </span>attempts<span class="w1"> </span>to<span class="w0"> </span>nest<span class="w1"> </span>the</div><div class="l f2 s4 t0" style="top:659.308px;left:317.014px;" data-x="317.014" data-y="132.692">inner<span class="w2"> </span>loop<span class="w1"> </span>inside<span class="w1"> </span>the<span class="w2"> </span>current<span class="w1"> </span>trace.<span class="w1"> </span>The<span class="w2"> </span>first<span class="w1"> </span>step<span class="w1"> </span>is<span class="w2"> </span>to<span class="w1"> </span>call<span class="w1"> </span>the<span class="w2"> </span>inner</div><div class="l f2 s4 t0" style="top:669.271px;left:317.014px;" data-x="317.014" data-y="122.729">trace<span class="w2"> </span>as<span class="w2"> </span>a<span class="w1"> </span>subroutine.<span class="w2"> </span>This<span class="w1"> </span>executes<span class="w2"> </span>the<span class="w2"> </span>loop<span class="w2"> </span>on<span class="w1"> </span>line<span class="w2"> </span>4<span class="w1"> </span>to<span class="w2"> </span>completion</div><div class="l f2 s4 t0" style="top:679.233px;left:317.014px;" data-x="317.014" data-y="112.767">and<span class="w2"> </span>then<span class="w1"> </span>returns<span class="w1"> </span>to<span class="w2"> </span>the<span class="w1"> </span>recorder.<span class="w2"> </span>TraceMonkey<span class="w1"> </span>verifies<span class="w2"> </span>that<span class="w1"> </span>the<span class="w1"> </span>call</div><div class="l f2 s4 t0" style="top:689.196px;left:317.014px;" data-x="317.014" data-y="102.804">was<span class="w2"> </span>successful<span class="w1"> </span>and<span class="w2"> </span>then<span class="w1"> </span>records<span class="w2"> </span>the<span class="w1"> </span>call<span class="w2"> </span>to<span class="w1"> </span>the<span class="w2"> </span>inner<span class="w1"> </span>trace<span class="w2"> </span>as<span class="w1"> </span>part<span class="w2"> </span>of</div><div class="l f2 s4 t0" style="top:699.159px;left:317.014px;" data-x="317.014" data-y="92.8415">the<span class="w1"> </span>current<span class="w2"> </span>trace.<span class="w1"> </span>Recording<span class="w1"> </span>continues<span class="w1"> </span>until<span class="w1"> </span>execution<span class="w2"> </span>reaches<span class="w1"> </span>line</div><div class="l f2 s4 t0" style="top:709.121px;left:317.014px;" data-x="317.014" data-y="82.8788">1,<span class="w1"> </span>and<span class="w1"> </span>at<span class="w1"> </span>which<span class="w1"> </span>point<span class="w1"> </span>TraceMonkey<span class="w1"> </span>finishes<span class="w1"> </span>and<span class="w1"> </span>compiles<span class="w1"> </span>a<span class="w1"> </span>trace</div><div class="l f2 s4 t0" style="top:719.084px;left:317.014px;" data-x="317.014" data-y="72.9162">for<span class="w2"> </span>the<span class="w1"> </span>outer<span class="w1"> </span>loop,</div><div class="l ff s4 t0" style="top:719.084px;left:384.001px;" data-x="384.001" data-y="72.9162">T</div><div class="l f8 s5 t0" style="top:720.08px;left:389.377px;" data-x="389.377" data-y="71.92">16</div><div class="l f2 s4 t0" style="top:719.084px;left:397.181px;" data-x="397.181" data-y="72.9162">.</div></div></div><div id="page-4" class="p" style="width:612px;height:792px;"><div class="t"><div class="l f1 s4 t0" style="top:79.9701px;left:65.9552px;" data-x="65.9552" data-y="712.03">i=4.</div><div class="l f2 s4 t0" style="top:79.9701px;left:82.2805px;" data-x="82.2805" data-y="712.03">On<span class="w2"> </span>this<span class="w1"> </span>iteration,<span class="w2"> </span>TraceMonkey<span class="w2"> </span>calls</div><div class="l ff s4 t0" style="top:79.9701px;left:214.494px;" data-x="214.494" data-y="712.03">T</div><div class="l f8 s5 t0" style="top:80.9664px;left:219.87px;" data-x="219.87" data-y="711.034">16</div><div class="l f2 s4 t0" style="top:79.9701px;left:227.674px;" data-x="227.674" data-y="712.03">.<span class="w2"> </span>Because</div><div class="l f7 s4 t0" style="top:79.9701px;left:263.786px;" data-x="263.786" data-y="712.03">i=4</div><div class="l f2 s4 t0" style="top:79.9701px;left:277.908px;" data-x="277.908" data-y="712.03">,<span class="w2"> </span>the</div><div class="l f7 s4 t0" style="top:89.9328px;left:54px;" data-x="54" data-y="702.067">if</div><div class="l f2 s4 t0" style="top:89.9328px;left:66.3342px;" data-x="66.3342" data-y="702.067">statement<span class="w1"> </span>on<span class="w1"> </span>line<span class="w1"> </span>2<span class="w1"> </span>is<span class="w1"> </span>taken.<span class="w1"> </span>This<span class="w0"> </span>branch<span class="w2"> </span>was<span class="w0"> </span>not<span class="w2"> </span>taken<span class="w1"> </span>in<span class="w0"> </span>the</div><div class="l f2 s4 t0" style="top:99.8954px;left:54px;" data-x="54" data-y="692.105">original<span class="w2"> </span>trace,<span class="w1"> </span>so<span class="w2"> </span>this<span class="w1"> </span>causes</div><div class="l ff s4 t0" style="top:99.8954px;left:156.252px;" data-x="156.252" data-y="692.105">T</div><div class="l f8 s5 t0" style="top:100.892px;left:161.628px;" data-x="161.628" data-y="691.108">16</div><div class="l f2 s4 t0" style="top:99.8954px;left:171.505px;" data-x="171.505" data-y="692.105">to<span class="w2"> </span>fail<span class="w1"> </span>a<span class="w2"> </span>guard<span class="w1"> </span>and<span class="w2"> </span>take<span class="w1"> </span>a<span class="w2"> </span>side<span class="w1"> </span>exit.</div><div class="l f2 s4 t0" style="top:109.858px;left:54px;" data-x="54" data-y="682.142">The<span class="w1"> </span>exit<span class="w1"> </span>is<span class="w1"> </span>not<span class="w1"> </span>yet<span class="w1"> </span>hot,<span class="w1"> </span>so<span class="w1"> </span>TraceMonkey<span class="w2"> </span>returns<span class="w1"> </span>to<span class="w1"> </span>the<span class="w1"> </span>interpreter,</div><div class="l f2 s4 t0" style="top:119.821px;left:54px;" data-x="54" data-y="672.179">which<span class="w2"> </span>executes<span class="w1"> </span>the<span class="w2"> </span>continue<span class="w1"> </span>statement.</div><div class="l f1 s4 t0" style="top:129.783px;left:65.9552px;" data-x="65.9552" data-y="662.217">i=5.</div><div class="l f2 s4 t0" style="top:129.783px;left:82.2987px;" data-x="82.2987" data-y="662.217">TraceMonkey<span class="w2"> </span>calls</div><div class="l ff s4 t0" style="top:129.783px;left:152.518px;" data-x="152.518" data-y="662.217">T</div><div class="l f8 s5 t0" style="top:130.78px;left:157.894px;" data-x="157.894" data-y="661.22">16</div><div class="l f2 s4 t0" style="top:129.783px;left:165.698px;" data-x="165.698" data-y="662.217">,<span class="w2"> </span>which<span class="w1"> </span>in<span class="w2"> </span>turn<span class="w1"> </span>calls<span class="w2"> </span>the<span class="w1"> </span>nested<span class="w2"> </span>trace</div><div class="l ff s4 t0" style="top:139.746px;left:54px;" data-x="54" data-y="652.254">T</div><div class="l f8 s5 t0" style="top:140.742px;left:59.376px;" data-x="59.376" data-y="651.258">45</div><div class="l f2 s4 t0" style="top:139.746px;left:67.18px;" data-x="67.18" data-y="652.254">.</div><div class="l ff s4 t0" style="top:139.746px;left:72.5721px;" data-x="72.5721" data-y="652.254">T</div><div class="l f8 s5 t0" style="top:140.742px;left:77.9481px;" data-x="77.9481" data-y="651.258">16</div><div class="l f2 s4 t0" style="top:139.746px;left:88.9025px;" data-x="88.9025" data-y="652.254">loops<span class="w1"> </span>back<span class="w1"> </span>to<span class="w0"> </span>its<span class="w1"> </span>own<span class="w1"> </span>header,<span class="w1"> </span>starting<span class="w1"> </span>the<span class="w1"> </span>next<span class="w0"> </span>iteration</div><div class="l f2 s4 t0" style="top:149.709px;left:54px;" data-x="54" data-y="642.291">without<span class="w2"> </span>ever<span class="w1"> </span>returning<span class="w2"> </span>to<span class="w1"> </span>the<span class="w1"> </span>monitor.</div><div class="l f1 s4 t0" style="top:159.671px;left:65.9552px;" data-x="65.9552" data-y="632.329">i=6.</div><div class="l f2 s4 t0" style="top:159.671px;left:82.4598px;" data-x="82.4598" data-y="632.329">On<span class="w2"> </span>this<span class="w1"> </span>iteration,<span class="w1"> </span>the<span class="w2"> </span>side<span class="w1"> </span>exit<span class="w2"> </span>on<span class="w1"> </span>line<span class="w2"> </span>2<span class="w1"> </span>is<span class="w1"> </span>taken<span class="w2"> </span>again.<span class="w1"> </span>This</div><div class="l f2 s4 t0" style="top:169.634px;left:54px;" data-x="54" data-y="622.366">time,<span class="w1"> </span>the<span class="w1"> </span>side<span class="w0"> </span>exit<span class="w1"> </span>becomes<span class="w1"> </span>hot,<span class="w1"> </span>so<span class="w0"> </span>a<span class="w1"> </span>trace</div><div class="l ff s4 t0" style="top:169.634px;left:213.742px;" data-x="213.742" data-y="622.366">T</div><div class="l f8 s5 t0" style="top:170.63px;left:219.118px;" data-x="219.118" data-y="621.37">23</div><div class="l f10 s5 t0" style="top:170.63px;left:226.424px;" data-x="226.424" data-y="621.37">,</div><div class="l f8 s5 t0" style="top:170.63px;left:228.693px;" data-x="228.693" data-y="621.37">1</div><div class="l f2 s4 t0" style="top:169.634px;left:235.999px;" data-x="235.999" data-y="622.366">is<span class="w1"> </span>recorded<span class="w1"> </span>that</div><div class="l f2 s4 t0" style="top:179.596px;left:54px;" data-x="54" data-y="612.404">covers<span class="w2"> </span>line<span class="w1"> </span>3<span class="w1"> </span>and<span class="w2"> </span>returns<span class="w1"> </span>to<span class="w1"> </span>the<span class="w2"> </span>loop<span class="w1"> </span>header.<span class="w2"> </span>Thus,<span class="w1"> </span>the<span class="w1"> </span>end<span class="w2"> </span>of</div><div class="l ff s4 t0" style="top:179.596px;left:274.001px;" data-x="274.001" data-y="612.404">T</div><div class="l f8 s5 t0" style="top:180.593px;left:279.377px;" data-x="279.377" data-y="611.407">23</div><div class="l f10 s5 t0" style="top:180.593px;left:286.683px;" data-x="286.683" data-y="611.407">,</div><div class="l f8 s5 t0" style="top:180.593px;left:288.952px;" data-x="288.952" data-y="611.407">1</div><div class="l f2 s4 t0" style="top:189.559px;left:54px;" data-x="54" data-y="602.441">jumps<span class="w1"> </span>directly<span class="w1"> </span>to<span class="w1"> </span>the<span class="w1"> </span>start<span class="w1"> </span>of</div><div class="l ff s4 t0" style="top:189.559px;left:161.019px;" data-x="161.019" data-y="602.441">T</div><div class="l f8 s5 t0" style="top:190.555px;left:166.395px;" data-x="166.395" data-y="601.445">16</div><div class="l f2 s4 t0" style="top:189.559px;left:174.199px;" data-x="174.199" data-y="602.441">.<span class="w1"> </span>The<span class="w1"> </span>side<span class="w1"> </span>exit<span class="w1"> </span>is<span class="w1"> </span>patched<span class="w1"> </span>so<span class="w1"> </span>that</div><div class="l f2 s4 t0" style="top:199.522px;left:54px;" data-x="54" data-y="592.478">on<span class="w2"> </span>future<span class="w1"> </span>iterations,<span class="w1"> </span>it<span class="w2"> </span>jumps<span class="w1"> </span>directly<span class="w1"> </span>to</div><div class="l ff s4 t0" style="top:199.522px;left:196.958px;" data-x="196.958" data-y="592.478">T</div><div class="l f8 s5 t0" style="top:200.518px;left:202.334px;" data-x="202.334" data-y="591.482">23</div><div class="l f10 s5 t0" style="top:200.518px;left:209.64px;" data-x="209.64" data-y="591.482">,</div><div class="l f8 s5 t0" style="top:200.518px;left:211.909px;" data-x="211.909" data-y="591.482">1</div><div class="l f2 s4 t0" style="top:199.522px;left:216.06px;" data-x="216.06" data-y="592.478">.</div><div class="l f2 s4 t0" style="top:209.484px;left:65.9552px;" data-x="65.9552" data-y="582.516">At<span class="w2"> </span>this<span class="w2"> </span>point,<span class="w1"> </span>TraceMonkeyhas<span class="w1"> </span>compiled<span class="w2"> </span>enough<span class="w2"> </span>traces<span class="w2"> </span>to<span class="w1"> </span>cover</div><div class="l f2 s4 t0" style="top:219.447px;left:54px;" data-x="54" data-y="572.553">the<span class="w1"> </span>entire<span class="w0"> </span>nested<span class="w1"> </span>loop<span class="w0"> </span>structure,<span class="w1"> </span>so<span class="w0"> </span>the<span class="w1"> </span>rest<span class="w0"> </span>of<span class="w1"> </span>the<span class="w0"> </span>program<span class="w1"> </span>runs</div><div class="l f2 s4 t0" style="top:229.41px;left:54px;" data-x="54" data-y="562.59">entirely<span class="w2"> </span>as<span class="w1"> </span>native<span class="w2"> </span>code.</div><div class="l f1 s2 t0" style="top:256.508px;left:54px;" data-x="54" data-y="535.492">3.<span class="w3"> </span>Trace<span class="w2"> </span>Trees</div><div class="l f2 s4 t0" style="top:270.456px;left:54px;" data-x="54" data-y="521.544">In<span class="w1"> </span>this<span class="w0"> </span>section,<span class="w1"> </span>we<span class="w1"> </span>describe<span class="w0"> </span>traces,<span class="w1"> </span>trace<span class="w1"> </span>trees,<span class="w0"> </span>and<span class="w1"> </span>how<span class="w1"> </span>they<span class="w1"> </span>are</div><div class="l f2 s4 t0" style="top:280.418px;left:54px;" data-x="54" data-y="511.582">formed<span class="w2"> </span>at<span class="w1"> </span>run<span class="w1"> </span>time.<span class="w2"> </span>Although<span class="w1"> </span>our<span class="w2"> </span>techniques<span class="w1"> </span>apply<span class="w2"> </span>to<span class="w1"> </span>any<span class="w1"> </span>dynamic</div><div class="l f2 s4 t0" style="top:290.381px;left:54px;" data-x="54" data-y="501.619">language<span class="w1"> </span>interpreter,<span class="w1"> </span>we<span class="w1"> </span>will<span class="w0"> </span>describe<span class="w1"> </span>them<span class="w1"> </span>assuming<span class="w1"> </span>a<span class="w0"> </span>bytecode</div><div class="l f2 s4 t0" style="top:300.344px;left:54px;" data-x="54" data-y="491.656">interpreter<span class="w2"> </span>to<span class="w1"> </span>keep<span class="w1"> </span>the<span class="w2"> </span>exposition<span class="w1"> </span>simple.</div><div class="l f1 s4 t0" style="top:321.066px;left:54px;" data-x="54" data-y="470.934">3.1<span class="w10"> </span>Traces</div><div class="l f2 s4 t0" style="top:335.014px;left:54px;" data-x="54" data-y="456.986">A</div><div class="l fa s4 t0" style="top:335.014px;left:63.4995px;" data-x="63.4995" data-y="456.986">trace</div><div class="l f2 s4 t0" style="top:335.014px;left:84.8173px;" data-x="84.8173" data-y="456.986">is<span class="w1"> </span>simply<span class="w1"> </span>a<span class="w1"> </span>program<span class="w0"> </span>path,<span class="w1"> </span>which<span class="w1"> </span>may<span class="w1"> </span>cross<span class="w1"> </span>function<span class="w1"> </span>call</div><div class="l f2 s4 t0" style="top:344.976px;left:54px;" data-x="54" data-y="447.024">boundaries.<span class="w1"> </span>TraceMonkey<span class="w2"> </span>focuses<span class="w1"> </span>on</div><div class="l fa s4 t0" style="top:344.976px;left:191.269px;" data-x="191.269" data-y="447.024">loop<span class="w1"> </span>traces</div><div class="l f2 s4 t0" style="top:344.976px;left:231.509px;" data-x="231.509" data-y="447.024">,<span class="w1"> </span>that<span class="w2"> </span>originate<span class="w1"> </span>at</div><div class="l f2 s4 t0" style="top:354.939px;left:54px;" data-x="54" data-y="437.061">a<span class="w1"> </span>loop<span class="w2"> </span>edge<span class="w1"> </span>and<span class="w1"> </span>represent<span class="w1"> </span>a<span class="w1"> </span>single<span class="w1"> </span>iteration<span class="w1"> </span>through<span class="w2"> </span>the<span class="w1"> </span>associated</div><div class="l f2 s4 t0" style="top:364.902px;left:54px;" data-x="54" data-y="427.098">loop.</div><div class="l f2 s4 t0" style="top:374.864px;left:65.9552px;" data-x="65.9552" data-y="417.136">Similar<span class="w1"> </span>to<span class="w0"> </span>an<span class="w1"> </span>extended<span class="w1"> </span>basic<span class="w1"> </span>block,<span class="w0"> </span>a<span class="w1"> </span>trace<span class="w1"> </span>is<span class="w0"> </span>only<span class="w1"> </span>entered<span class="w1"> </span>at</div><div class="l f2 s4 t0" style="top:384.827px;left:54px;" data-x="54" data-y="407.173">the<span class="w1"> </span>top,<span class="w2"> </span>but<span class="w1"> </span>may<span class="w1"> </span>have<span class="w1"> </span>many<span class="w2"> </span>exits.<span class="w1"> </span>In<span class="w1"> </span>contrast<span class="w1"> </span>to<span class="w1"> </span>an<span class="w2"> </span>extended<span class="w1"> </span>basic</div><div class="l f2 s4 t0" style="top:394.789px;left:54px;" data-x="54" data-y="397.211">block,<span class="w1"> </span>a<span class="w0"> </span>trace<span class="w1"> </span>can<span class="w1"> </span>contain<span class="w0"> </span>join<span class="w1"> </span>nodes.<span class="w0"> </span>Since<span class="w1"> </span>a<span class="w1"> </span>trace<span class="w0"> </span>always<span class="w1"> </span>only</div><div class="l f2 s4 t0" style="top:404.752px;left:54px;" data-x="54" data-y="387.248">follows<span class="w2"> </span>one<span class="w2"> </span>single<span class="w1"> </span>path<span class="w2"> </span>through<span class="w1"> </span>the<span class="w2"> </span>original<span class="w2"> </span>program,<span class="w1"> </span>however</div><div class="l f2 s4 t0" style="top:404.752px;left:275.004px;" data-x="275.004" data-y="387.248">,<span class="w2"> </span>join</div><div class="l f2 s4 t0" style="top:414.715px;left:54px;" data-x="54" data-y="377.285">nodes<span class="w1"> </span>are<span class="w0"> </span>not<span class="w1"> </span>recognizable<span class="w0"> </span>as<span class="w1"> </span>such<span class="w0"> </span>in<span class="w1"> </span>a<span class="w0"> </span>trace<span class="w1"> </span>and<span class="w0"> </span>have<span class="w1"> </span>a<span class="w1"> </span>single</div><div class="l f2 s4 t0" style="top:424.677px;left:54px;" data-x="54" data-y="367.323">predecessor<span class="w2"> </span>node<span class="w1"> </span>like<span class="w1"> </span>regular<span class="w2"> </span>nodes.</div><div class="l f2 s4 t0" style="top:434.64px;left:65.9552px;" data-x="65.9552" data-y="357.36">A</div><div class="l fa s4 t0" style="top:434.64px;left:74.653px;" data-x="74.653" data-y="357.36">typed<span class="w2"> </span>trace</div><div class="l f2 s4 t0" style="top:434.64px;left:116.813px;" data-x="116.813" data-y="357.36">is<span class="w2"> </span>a<span class="w1"> </span>trace<span class="w1"> </span>annotated<span class="w2"> </span>with<span class="w1"> </span>a<span class="w2"> </span>type<span class="w1"> </span>for<span class="w1"> </span>every<span class="w2"> </span>variable</div><div class="l f2 s4 t0" style="top:444.603px;left:54px;" data-x="54" data-y="347.397">(including<span class="w2"> </span>temporaries)<span class="w2"> </span>on<span class="w1"> </span>the<span class="w2"> </span>trace.<span class="w2"> </span>A<span class="w1"> </span>typed<span class="w2"> </span>trace<span class="w2"> </span>also<span class="w1"> </span>has<span class="w2"> </span>an<span class="w2"> </span>entry</div><div class="l fa s4 t0" style="top:454.565px;left:54px;" data-x="54" data-y="337.435">type<span class="w1"> </span>map</div><div class="l f2 s4 t0" style="top:454.565px;left:89.813px;" data-x="89.813" data-y="337.435">giving<span class="w1"> </span>the<span class="w1"> </span>required<span class="w1"> </span>types<span class="w1"> </span>for<span class="w1"> </span>variables<span class="w2"> </span>used<span class="w1"> </span>on<span class="w1"> </span>the<span class="w1"> </span>trace</div><div class="l f2 s4 t0" style="top:464.528px;left:54px;" data-x="54" data-y="327.472">before<span class="w2"> </span>they<span class="w1"> </span>are<span class="w2"> </span>defined.<span class="w2"> </span>For<span class="w1"> </span>example,<span class="w2"> </span>a<span class="w1"> </span>trace<span class="w2"> </span>could<span class="w2"> </span>have<span class="w1"> </span>a<span class="w2"> </span>type<span class="w2"> </span>map</div><div class="l f7 s4 t0" style="top:474.491px;left:54px;" data-x="54" data-y="317.509">(x:<span class="w0"> </span>int,<span class="w0"> </span>b:<span class="w0"> </span>boolean)</div><div class="l f2 s4 t0" style="top:474.491px;left:148.146px;" data-x="148.146" data-y="317.509">,<span class="w1"> </span>meaning<span class="w1"> </span>that<span class="w1"> </span>the<span class="w1"> </span>trace<span class="w1"> </span>may<span class="w1"> </span>be<span class="w1"> </span>entered</div><div class="l f2 s4 t0" style="top:484.453px;left:54px;" data-x="54" data-y="307.547">only<span class="w2"> </span>if<span class="w1"> </span>the<span class="w1"> </span>value<span class="w2"> </span>of<span class="w1"> </span>the<span class="w1"> </span>variable</div><div class="l f7 s4 t0" style="top:484.453px;left:169.041px;" data-x="169.041" data-y="307.547">x</div><div class="l f2 s4 t0" style="top:484.453px;left:176.089px;" data-x="176.089" data-y="307.547">is<span class="w2"> </span>of<span class="w1"> </span>type</div><div class="l f7 s4 t0" style="top:484.453px;left:212.001px;" data-x="212.001" data-y="307.547">int</div><div class="l f2 s4 t0" style="top:484.453px;left:228.463px;" data-x="228.463" data-y="307.547">and<span class="w2"> </span>the<span class="w1"> </span>value<span class="w1"> </span>of</div><div class="l f7 s4 t0" style="top:484.453px;left:288.396px;" data-x="288.396" data-y="307.547">b</div><div class="l f2 s4 t0" style="top:494.416px;left:54px;" data-x="54" data-y="297.584">is<span class="w1"> </span>of<span class="w2"> </span>type</div><div class="l f7 s4 t0" style="top:494.416px;left:90.06px;" data-x="90.06" data-y="297.584">boolean</div><div class="l f2 s4 t0" style="top:494.416px;left:123.011px;" data-x="123.011" data-y="297.584">.<span class="w1"> </span>The<span class="w2"> </span>entry<span class="w1"> </span>type<span class="w1"> </span>map<span class="w2"> </span>is<span class="w1"> </span>much<span class="w1"> </span>like<span class="w1"> </span>the<span class="w2"> </span>signature</div><div class="l f2 s4 t0" style="top:504.379px;left:54px;" data-x="54" data-y="287.621">of<span class="w2"> </span>a<span class="w1"> </span>function.</div><div class="l f2 s4 t0" style="top:514.341px;left:65.9552px;" data-x="65.9552" data-y="277.659">In<span class="w1"> </span>this<span class="w0"> </span>paper,<span class="w2"> </span>we<span class="w0"> </span>only<span class="w1"> </span>discuss<span class="w1"> </span>typed<span class="w0"> </span>loop<span class="w1"> </span>traces,<span class="w1"> </span>and<span class="w0"> </span>we<span class="w1"> </span>will</div><div class="l f2 s4 t0" style="top:524.304px;left:54px;" data-x="54" data-y="267.696">refer<span class="w1"> </span>to<span class="w1"> </span>them<span class="w0"> </span>simply<span class="w2"> </span>as<span class="w0"> </span>“traces”.<span class="w1"> </span>The<span class="w1"> </span>key<span class="w1"> </span>property<span class="w1"> </span>of<span class="w0"> </span>typed<span class="w1"> </span>loop</div><div class="l f2 s4 t0" style="top:534.266px;left:54px;" data-x="54" data-y="257.734">traces<span class="w1"> </span>is<span class="w2"> </span>that<span class="w1"> </span>they<span class="w1"> </span>can<span class="w2"> </span>be<span class="w1"> </span>compiled<span class="w1"> </span>to<span class="w1"> </span>efficient<span class="w2"> </span>machine<span class="w1"> </span>code<span class="w1"> </span>using</div><div class="l f2 s4 t0" style="top:544.229px;left:54px;" data-x="54" data-y="247.771">the<span class="w2"> </span>same<span class="w1"> </span>techniques<span class="w1"> </span>used<span class="w2"> </span>for<span class="w1"> </span>typed<span class="w1"> </span>languages.</div><div class="l f2 s4 t0" style="top:554.192px;left:65.9552px;" data-x="65.9552" data-y="237.808">In<span class="w2"> </span>TraceMonkey,<span class="w2"> </span>traces<span class="w1"> </span>are<span class="w1"> </span>recorded<span class="w2"> </span>in<span class="w1"> </span>trace-flavored<span class="w1"> </span>SSA</div><div class="l fa s4 t0" style="top:554.192px;left:279.654px;" data-x="279.654" data-y="237.808">LIR</div><div class="l f2 s4 t0" style="top:564.154px;left:54px;" data-x="54" data-y="227.846">(low-level<span class="w1"> </span>intermediate<span class="w1"> </span>representation).<span class="w1"> </span>In<span class="w1"> </span>trace-flavored<span class="w1"> </span>SSA<span class="w1"> </span>(or</div><div class="l f2 s4 t0" style="top:574.117px;left:54px;" data-x="54" data-y="217.883">TSSA),<span class="w1"> </span>phi<span class="w2"> </span>nodes<span class="w1"> </span>appear<span class="w1"> </span>only<span class="w1"> </span>at<span class="w1"> </span>the<span class="w2"> </span>entry<span class="w1"> </span>point,<span class="w1"> </span>which<span class="w1"> </span>is<span class="w1"> </span>reached</div><div class="l f2 s4 t0" style="top:584.08px;left:54px;" data-x="54" data-y="207.92">both<span class="w1"> </span>on<span class="w0"> </span>entry<span class="w1"> </span>and<span class="w1"> </span>via<span class="w0"> </span>loop<span class="w1"> </span>edges.<span class="w0"> </span>The<span class="w1"> </span>important<span class="w1"> </span>LIR<span class="w0"> </span>primitives</div><div class="l f2 s4 t0" style="top:594.042px;left:54px;" data-x="54" data-y="197.958">are<span class="w0"> </span>constant<span class="w0"> </span>values,<span class="w0"> </span>memory<span class="w1"> </span>loads<span class="w0"> </span>and<span class="w0"> </span>stores<span class="w0"> </span>(by<span class="w0"> </span>address<span class="w0"> </span>and</div><div class="l f2 s4 t0" style="top:604.005px;left:54px;" data-x="54" data-y="187.995">offset),<span class="w1"> </span>integer<span class="w1"> </span>operators,<span class="w0"> </span>floating-point<span class="w1"> </span>operators,<span class="w0"> </span>function<span class="w1"> </span>calls,</div><div class="l f2 s4 t0" style="top:613.968px;left:54px;" data-x="54" data-y="178.032">and<span class="w1"> </span>conditional<span class="w2"> </span>exits.<span class="w1"> </span>Type<span class="w2"> </span>conversions,<span class="w1"> </span>such<span class="w1"> </span>as<span class="w2"> </span>integer<span class="w1"> </span>to<span class="w1"> </span>double,</div><div class="l f2 s4 t0" style="top:623.93px;left:54px;" data-x="54" data-y="168.07">are<span class="w0"> </span>represented<span class="w1"> </span>by<span class="w0"> </span>function<span class="w0"> </span>calls.<span class="w1"> </span>This<span class="w0"> </span>makes<span class="w0"> </span>the<span class="w0"> </span>LIR<span class="w1"> </span>used<span class="w0"> </span>by</div><div class="l f2 s4 t0" style="top:633.893px;left:54px;" data-x="54" data-y="158.107">TraceMonkey<span class="w1"> </span>independent<span class="w1"> </span>of<span class="w0"> </span>the<span class="w1"> </span>concrete<span class="w0"> </span>type<span class="w1"> </span>system<span class="w0"> </span>and<span class="w1"> </span>type</div><div class="l f2 s4 t0" style="top:643.855px;left:54px;" data-x="54" data-y="148.145">conversion<span class="w1"> </span>rules<span class="w1"> </span>of<span class="w0"> </span>the<span class="w1"> </span>source<span class="w1"> </span>language.<span class="w0"> </span>The<span class="w1"> </span>LIR<span class="w1"> </span>operations<span class="w0"> </span>are</div><div class="l f2 s4 t0" style="top:653.818px;left:54px;" data-x="54" data-y="138.182">generic<span class="w2"> </span>enough<span class="w1"> </span>that<span class="w2"> </span>the<span class="w1"> </span>backend<span class="w2"> </span>compiler<span class="w2"> </span>is<span class="w1"> </span>language<span class="w2"> </span>independent.</div><div class="l f2 s4 t0" style="top:663.781px;left:54px;" data-x="54" data-y="128.219">Figure<span class="w2"> </span>3<span class="w1"> </span>shows<span class="w2"> </span>an<span class="w1"> </span>example<span class="w1"> </span>LIR<span class="w2"> </span>trace.</div><div class="l f2 s4 t0" style="top:673.743px;left:65.9552px;" data-x="65.9552" data-y="118.257">Bytecode<span class="w0"> </span>interpreters<span class="w1"> </span>typically<span class="w0"> </span>represent<span class="w0"> </span>values<span class="w0"> </span>in<span class="w1"> </span>a<span class="w0"> </span>various</div><div class="l f2 s4 t0" style="top:683.706px;left:54px;" data-x="54" data-y="108.294">complex<span class="w1"> </span>data<span class="w1"> </span>structures<span class="w1"> </span>(e.g.,<span class="w1"> </span>hash<span class="w1"> </span>tables)<span class="w1"> </span>in<span class="w1"> </span>a<span class="w1"> </span>boxed<span class="w2"> </span>format<span class="w1"> </span>(i.e.,</div><div class="l f2 s4 t0" style="top:693.669px;left:54px;" data-x="54" data-y="98.3313">with<span class="w1"> </span>attached<span class="w1"> </span>type<span class="w1"> </span>tag<span class="w1"> </span>bits).<span class="w1"> </span>Since<span class="w1"> </span>a<span class="w1"> </span>trace<span class="w1"> </span>is<span class="w1"> </span>intended<span class="w1"> </span>to<span class="w1"> </span>represent</div><div class="l f2 s4 t0" style="top:703.631px;left:54px;" data-x="54" data-y="88.3686">efficient<span class="w1"> </span>code<span class="w1"> </span>that<span class="w1"> </span>eliminates<span class="w1"> </span>all<span class="w1"> </span>that<span class="w0"> </span>complexity</div><div class="l f2 s4 t0" style="top:703.631px;left:230.324px;" data-x="230.324" data-y="88.3686">,<span class="w1"> </span>our<span class="w1"> </span>traces<span class="w1"> </span>oper-</div><div class="l f2 s4 t0" style="top:713.594px;left:54px;" data-x="54" data-y="78.406">ate<span class="w1"> </span>on<span class="w1"> </span>unboxed<span class="w1"> </span>values<span class="w1"> </span>in<span class="w0"> </span>simple<span class="w1"> </span>variables<span class="w1"> </span>and<span class="w1"> </span>arrays<span class="w1"> </span>as<span class="w1"> </span>much<span class="w0"> </span>as</div><div class="l f2 s4 t0" style="top:723.557px;left:54px;" data-x="54" data-y="68.4433">possible.</div><div class="l f2 s4 t0" style="top:79.9701px;left:328.969px;" data-x="328.969" data-y="712.03">A<span class="w1"> </span>trace<span class="w1"> </span>records<span class="w1"> </span>all<span class="w1"> </span>its<span class="w2"> </span>intermediate<span class="w1"> </span>values<span class="w1"> </span>in<span class="w1"> </span>a<span class="w1"> </span>small<span class="w1"> </span>activation</div><div class="l f2 s4 t0" style="top:89.9328px;left:317.014px;" data-x="317.014" data-y="702.067">record<span class="w1"> </span>area.<span class="w2"> </span>To<span class="w1"> </span>make<span class="w2"> </span>variable<span class="w1"> </span>accesses<span class="w1"> </span>fast<span class="w1"> </span>on<span class="w2"> </span>trace,<span class="w1"> </span>the<span class="w1"> </span>trace<span class="w1"> </span>also</div><div class="l f2 s4 t0" style="top:99.8954px;left:317.014px;" data-x="317.014" data-y="692.105">imports<span class="w1"> </span>local<span class="w1"> </span>and<span class="w1"> </span>global<span class="w1"> </span>variables<span class="w2"> </span>by<span class="w1"> </span>unboxing<span class="w1"> </span>them<span class="w1"> </span>and<span class="w1"> </span>copying</div><div class="l f2 s4 t0" style="top:109.858px;left:317.014px;" data-x="317.014" data-y="682.142">them<span class="w1"> </span>to<span class="w0"> </span>its<span class="w1"> </span>activation<span class="w1"> </span>record.<span class="w0"> </span>Thus,<span class="w1"> </span>the<span class="w1"> </span>trace<span class="w0"> </span>can<span class="w1"> </span>read<span class="w0"> </span>and<span class="w1"> </span>write</div><div class="l f2 s4 t0" style="top:119.821px;left:317.014px;" data-x="317.014" data-y="672.179">these<span class="w2"> </span>variables<span class="w2"> </span>with<span class="w1"> </span>simple<span class="w2"> </span>loads<span class="w2"> </span>and<span class="w2"> </span>stores<span class="w1"> </span>from<span class="w2"> </span>a<span class="w2"> </span>native<span class="w2"> </span>activation</div><div class="l f2 s4 t0" style="top:129.783px;left:317.014px;" data-x="317.014" data-y="662.217">recording,<span class="w0"> </span>independently<span class="w1"> </span>of<span class="w0"> </span>the<span class="w0"> </span>boxing<span class="w1"> </span>mechanism<span class="w0"> </span>used<span class="w0"> </span>by<span class="w1"> </span>the</div><div class="l f2 s4 t0" style="top:139.746px;left:317.014px;" data-x="317.014" data-y="652.254">interpreter.<span class="w1"> </span>When<span class="w1"> </span>the<span class="w0"> </span>trace<span class="w1"> </span>exits,<span class="w1"> </span>the<span class="w0"> </span>VM<span class="w1"> </span>boxes<span class="w1"> </span>the<span class="w0"> </span>values<span class="w1"> </span>from</div><div class="l f2 s4 t0" style="top:149.709px;left:317.014px;" data-x="317.014" data-y="642.291">this<span class="w1"> </span>native<span class="w2"> </span>storage<span class="w1"> </span>location<span class="w2"> </span>and<span class="w1"> </span>copies<span class="w1"> </span>them<span class="w1"> </span>back<span class="w2"> </span>to<span class="w1"> </span>the<span class="w1"> </span>interpreter</div><div class="l f2 s4 t0" style="top:159.671px;left:317.014px;" data-x="317.014" data-y="632.329">structures.</div><div class="l f2 s4 t0" style="top:169.634px;left:328.969px;" data-x="328.969" data-y="622.366">For<span class="w0"> </span>every<span class="w4"> </span>control-flow<span class="w0"> </span>branch<span class="w4"> </span>in<span class="w0"> </span>the<span class="w4"> </span>source<span class="w4"> </span>program,<span class="w0"> </span>the</div><div class="l f2 s4 t0" style="top:179.596px;left:317.014px;" data-x="317.014" data-y="612.404">recorder<span class="w2"> </span>generates<span class="w1"> </span>conditional<span class="w2"> </span>exit<span class="w1"> </span>LIR<span class="w2"> </span>instructions.<span class="w1"> </span>These<span class="w2"> </span>instruc-</div><div class="l f2 s4 t0" style="top:189.559px;left:317.014px;" data-x="317.014" data-y="602.441">tions<span class="w1"> </span>exit<span class="w1"> </span>from<span class="w1"> </span>the<span class="w1"> </span>trace<span class="w1"> </span>if<span class="w1"> </span>required<span class="w0"> </span>control<span class="w2"> </span>flow<span class="w1"> </span>is<span class="w1"> </span>different<span class="w1"> </span>from</div><div class="l f2 s4 t0" style="top:199.522px;left:317.014px;" data-x="317.014" data-y="592.478">what<span class="w1"> </span>it<span class="w1"> </span>was<span class="w1"> </span>at<span class="w1"> </span>trace<span class="w1"> </span>recording,<span class="w1"> </span>ensuring<span class="w1"> </span>that<span class="w1"> </span>the<span class="w1"> </span>trace<span class="w1"> </span>instructions</div><div class="l f2 s4 t0" style="top:209.484px;left:317.014px;" data-x="317.014" data-y="582.516">are<span class="w1"> </span>run<span class="w0"> </span>only<span class="w0"> </span>if<span class="w1"> </span>they<span class="w0"> </span>are<span class="w1"> </span>supposed<span class="w0"> </span>to.<span class="w1"> </span>We<span class="w0"> </span>call<span class="w1"> </span>these<span class="w0"> </span>instructions</div><div class="l fa s4 t0" style="top:219.447px;left:317.014px;" data-x="317.014" data-y="572.553">guard</div><div class="l f2 s4 t0" style="top:219.447px;left:340.586px;" data-x="340.586" data-y="572.553">instructions.</div><div class="l f2 s4 t0" style="top:229.41px;left:328.969px;" data-x="328.969" data-y="562.59">Most<span class="w2"> </span>of<span class="w2"> </span>our<span class="w1"> </span>traces<span class="w2"> </span>represent<span class="w2"> </span>loops<span class="w1"> </span>and<span class="w2"> </span>end<span class="w2"> </span>with<span class="w2"> </span>the<span class="w1"> </span>special</div><div class="l f7 s4 t0" style="top:229.41px;left:537.288px;" data-x="537.288" data-y="562.59">loop</div><div class="l f2 s4 t0" style="top:239.372px;left:317.014px;" data-x="317.014" data-y="552.628">LIR<span class="w1"> </span>instruction.<span class="w1"> </span>This<span class="w1"> </span>is<span class="w1"> </span>just<span class="w1"> </span>an<span class="w1"> </span>unconditional<span class="w1"> </span>branch<span class="w1"> </span>to<span class="w1"> </span>the<span class="w1"> </span>top<span class="w1"> </span>of</div><div class="l f2 s4 t0" style="top:249.335px;left:317.014px;" data-x="317.014" data-y="542.665">the<span class="w2"> </span>trace.<span class="w1"> </span>Such<span class="w1"> </span>traces<span class="w2"> </span>return<span class="w1"> </span>only<span class="w1"> </span>via<span class="w2"> </span>guards.</div><div class="l f2 s4 t0" style="top:259.298px;left:328.969px;" data-x="328.969" data-y="532.702">Now,<span class="w2"> </span>we<span class="w1"> </span>describe<span class="w0"> </span>the<span class="w2"> </span>key<span class="w1"> </span>optimizations<span class="w1"> </span>that<span class="w0"> </span>are<span class="w2"> </span>performed<span class="w0"> </span>as</div><div class="l f2 s4 t0" style="top:269.26px;left:317.014px;" data-x="317.014" data-y="522.74">part<span class="w1"> </span>of<span class="w1"> </span>recording<span class="w1"> </span>LIR.<span class="w1"> </span>All<span class="w1"> </span>of<span class="w1"> </span>these<span class="w1"> </span>optimizations<span class="w0"> </span>reduce<span class="w2"> </span>complex</div><div class="l f2 s4 t0" style="top:279.223px;left:317.014px;" data-x="317.014" data-y="512.777">dynamic<span class="w1"> </span>language<span class="w0"> </span>constructs<span class="w1"> </span>to<span class="w0"> </span>simple<span class="w1"> </span>typed<span class="w0"> </span>constructs<span class="w1"> </span>by<span class="w0"> </span>spe-</div><div class="l f2 s4 t0" style="top:289.186px;left:317.014px;" data-x="317.014" data-y="502.814">cializing<span class="w2"> </span>for<span class="w1"> </span>the<span class="w2"> </span>current<span class="w1"> </span>trace.<span class="w1"> </span>Each<span class="w2"> </span>optimization<span class="w1"> </span>requires<span class="w2"> </span>guard<span class="w1"> </span>in-</div><div class="l f2 s4 t0" style="top:299.148px;left:317.014px;" data-x="317.014" data-y="492.852">structions<span class="w1"> </span>to<span class="w1"> </span>verify<span class="w1"> </span>their<span class="w0"> </span>assumptions<span class="w1"> </span>about<span class="w1"> </span>the<span class="w1"> </span>state<span class="w1"> </span>and<span class="w0"> </span>exit<span class="w2"> </span>the</div><div class="l f2 s4 t0" style="top:309.111px;left:317.014px;" data-x="317.014" data-y="482.889">trace<span class="w2"> </span>if<span class="w1"> </span>necessary.</div><div class="l f1 s4 t0" style="top:319.073px;left:328.969px;" data-x="328.969" data-y="472.927">Type<span class="w2"> </span>specialization.</div><div class="l f2 s4 t0" style="top:329.036px;left:328.969px;" data-x="328.969" data-y="462.964">All<span class="w1"> </span>LIR<span class="w0"> </span>primitives<span class="w2"> </span>apply<span class="w0"> </span>to<span class="w1"> </span>operands<span class="w1"> </span>of<span class="w0"> </span>specific<span class="w1"> </span>types.<span class="w1"> </span>Thus,</div><div class="l f2 s4 t0" style="top:338.999px;left:317.014px;" data-x="317.014" data-y="453.001">LIR<span class="w0"> </span>traces<span class="w1"> </span>are<span class="w0"> </span>necessarily<span class="w0"> </span>type-specialized,<span class="w1"> </span>and<span class="w0"> </span>a<span class="w0"> </span>compiler<span class="w1"> </span>can</div><div class="l f2 s4 t0" style="top:348.961px;left:317.014px;" data-x="317.014" data-y="443.039">easily<span class="w0"> </span>produce<span class="w1"> </span>a<span class="w0"> </span>translation<span class="w1"> </span>that<span class="w0"> </span>requires<span class="w0"> </span>no<span class="w1"> </span>type<span class="w0"> </span>dispatches.<span class="w0"> </span>A</div><div class="l f2 s4 t0" style="top:358.924px;left:317.014px;" data-x="317.014" data-y="433.076">typical<span class="w1"> </span>bytecode<span class="w1"> </span>interpreter<span class="w2"> </span>carries<span class="w1"> </span>tag<span class="w1"> </span>bits<span class="w1"> </span>along<span class="w1"> </span>with<span class="w1"> </span>each<span class="w1"> </span>value,</div><div class="l f2 s4 t0" style="top:368.887px;left:317.014px;" data-x="317.014" data-y="423.113">and<span class="w2"> </span>to<span class="w1"> </span>perform<span class="w2"> </span>any<span class="w1"> </span>operation,<span class="w1"> </span>must<span class="w2"> </span>check<span class="w1"> </span>the<span class="w2"> </span>tag<span class="w1"> </span>bits,<span class="w2"> </span>dynamically</div><div class="l f2 s4 t0" style="top:378.849px;left:317.014px;" data-x="317.014" data-y="413.151">dispatch,<span class="w0"> </span>mask<span class="w0"> </span>out<span class="w0"> </span>the<span class="w1"> </span>tag<span class="w0"> </span>bits<span class="w0"> </span>to<span class="w0"> </span>recover<span class="w0"> </span>the<span class="w0"> </span>untagged<span class="w0"> </span>value,</div><div class="l f2 s4 t0" style="top:388.812px;left:317.014px;" data-x="317.014" data-y="403.188">perform<span class="w2"> </span>the<span class="w1"> </span>operation,<span class="w2"> </span>and<span class="w1"> </span>then<span class="w2"> </span>reapply<span class="w1"> </span>tags.<span class="w2"> </span>LIR<span class="w1"> </span>omits<span class="w2"> </span>everything</div><div class="l f2 s4 t0" style="top:398.775px;left:317.014px;" data-x="317.014" data-y="393.225">except<span class="w2"> </span>the<span class="w1"> </span>operation<span class="w1"> </span>itself.</div><div class="l f2 s4 t0" style="top:408.737px;left:328.969px;" data-x="328.969" data-y="383.263">A<span class="w2"> </span>potential<span class="w1"> </span>problem<span class="w1"> </span>is<span class="w2"> </span>that<span class="w1"> </span>some<span class="w2"> </span>operations<span class="w1"> </span>can<span class="w2"> </span>produce<span class="w1"> </span>values</div><div class="l f2 s4 t0" style="top:418.7px;left:317.014px;" data-x="317.014" data-y="373.3">of<span class="w1"> </span>unpredictable<span class="w0"> </span>types.<span class="w1"> </span>For<span class="w1"> </span>example,<span class="w1"> </span>reading<span class="w0"> </span>a<span class="w1"> </span>property<span class="w1"> </span>from<span class="w0"> </span>an</div><div class="l f2 s4 t0" style="top:428.662px;left:317.014px;" data-x="317.014" data-y="363.338">object<span class="w1"> </span>could<span class="w0"> </span>yield<span class="w0"> </span>a<span class="w1"> </span>value<span class="w1"> </span>of<span class="w0"> </span>any<span class="w0"> </span>type,<span class="w1"> </span>not<span class="w0"> </span>necessarily<span class="w1"> </span>the<span class="w0"> </span>type</div><div class="l f2 s4 t0" style="top:438.625px;left:317.014px;" data-x="317.014" data-y="353.375">observed<span class="w1"> </span>during<span class="w1"> </span>recording.<span class="w1"> </span>The<span class="w0"> </span>recorder<span class="w1"> </span>emits<span class="w1"> </span>guard<span class="w1"> </span>instructions</div><div class="l f2 s4 t0" style="top:448.588px;left:317.014px;" data-x="317.014" data-y="343.412">that<span class="w1"> </span>conditionally<span class="w2"> </span>exit<span class="w1"> </span>if<span class="w1"> </span>the<span class="w1"> </span>operation<span class="w1"> </span>yields<span class="w1"> </span>a<span class="w1"> </span>value<span class="w2"> </span>of<span class="w1"> </span>a<span class="w1"> </span>different</div><div class="l f2 s4 t0" style="top:458.55px;left:317.014px;" data-x="317.014" data-y="333.45">type<span class="w0"> </span>from<span class="w0"> </span>that<span class="w1"> </span>seen<span class="w0"> </span>during<span class="w0"> </span>recording.<span class="w0"> </span>These<span class="w0"> </span>guard<span class="w1"> </span>instructions</div><div class="l f2 s4 t0" style="top:468.513px;left:317.014px;" data-x="317.014" data-y="323.487">guarantee<span class="w1"> </span>that<span class="w2"> </span>as<span class="w1"> </span>long<span class="w1"> </span>as<span class="w1"> </span>execution<span class="w1"> </span>is<span class="w1"> </span>on<span class="w2"> </span>trace,<span class="w1"> </span>the<span class="w1"> </span>types<span class="w1"> </span>of<span class="w1"> </span>values</div><div class="l f2 s4 t0" style="top:478.476px;left:317.014px;" data-x="317.014" data-y="313.524">match<span class="w1"> </span>those<span class="w2"> </span>of<span class="w1"> </span>the<span class="w1"> </span>typed<span class="w1"> </span>trace.<span class="w1"> </span>When<span class="w1"> </span>the<span class="w1"> </span>VM<span class="w2"> </span>observes<span class="w1"> </span>a<span class="w1"> </span>side<span class="w1"> </span>exit</div><div class="l f2 s4 t0" style="top:488.438px;left:317.014px;" data-x="317.014" data-y="303.562">along<span class="w1"> </span>such<span class="w2"> </span>a<span class="w1"> </span>type<span class="w1"> </span>guard,<span class="w1"> </span>a<span class="w1"> </span>new<span class="w1"> </span>typed<span class="w2"> </span>trace<span class="w1"> </span>is<span class="w1"> </span>recorded<span class="w1"> </span>originating</div><div class="l f2 s4 t0" style="top:498.401px;left:317.014px;" data-x="317.014" data-y="293.599">at<span class="w2"> </span>the<span class="w1"> </span>side<span class="w1"> </span>exit<span class="w1"> </span>location,<span class="w2"> </span>capturing<span class="w1"> </span>the<span class="w1"> </span>new<span class="w2"> </span>type<span class="w1"> </span>of<span class="w1"> </span>the<span class="w1"> </span>operation<span class="w2"> </span>in</div><div class="l f2 s4 t0" style="top:508.364px;left:317.014px;" data-x="317.014" data-y="283.636">question.</div><div class="l f1 s4 t0" style="top:518.326px;left:328.969px;" data-x="328.969" data-y="273.674">Representation<span class="w1"> </span>specialization:<span class="w0"> </span>objects.</div><div class="l f2 s4 t0" style="top:518.326px;left:482.423px;" data-x="482.423" data-y="273.674">In<span class="w0"> </span>Jav</div><div class="l f2 s4 t0" style="top:518.326px;left:505.251px;" data-x="505.251" data-y="273.674">aScript,<span class="w0"> </span>name</div><div class="l f2 s4 t0" style="top:528.289px;left:317.014px;" data-x="317.014" data-y="263.711">lookup<span class="w1"> </span>semantics<span class="w1"> </span>are<span class="w0"> </span>complex<span class="w1"> </span>and<span class="w1"> </span>potentially<span class="w1"> </span>expensive<span class="w1"> </span>because</div><div class="l f2 s4 t0" style="top:538.252px;left:317.014px;" data-x="317.014" data-y="253.748">they<span class="w2"> </span>include<span class="w1"> </span>features<span class="w1"> </span>like<span class="w2"> </span>object<span class="w1"> </span>inheritance<span class="w1"> </span>and</div><div class="l f7 s4 t0" style="top:538.252px;left:491.658px;" data-x="491.658" data-y="253.748">eval</div><div class="l f2 s4 t0" style="top:538.252px;left:510.488px;" data-x="510.488" data-y="253.748">.<span class="w2"> </span>To<span class="w1"> </span>evaluate</div><div class="l f2 s4 t0" style="top:548.214px;left:317.014px;" data-x="317.014" data-y="243.786">an<span class="w1"> </span>object<span class="w0"> </span>property<span class="w1"> </span>read<span class="w1"> </span>expression<span class="w1"> </span>like</div><div class="l f7 s4 t0" style="top:548.214px;left:464.267px;" data-x="464.267" data-y="243.786">o.x</div><div class="l f2 s4 t0" style="top:548.214px;left:478.389px;" data-x="478.389" data-y="243.786">,<span class="w1"> </span>the<span class="w0"> </span>interpreter<span class="w1"> </span>must</div><div class="l f2 s4 t0" style="top:558.177px;left:317.014px;" data-x="317.014" data-y="233.823">search<span class="w1"> </span>the<span class="w2"> </span>property<span class="w1"> </span>map<span class="w1"> </span>of</div><div class="l f7 s4 t0" style="top:558.177px;left:416.848px;" data-x="416.848" data-y="233.823">o</div><div class="l f2 s4 t0" style="top:558.177px;left:424.093px;" data-x="424.093" data-y="233.823">and<span class="w1"> </span>all<span class="w2"> </span>of<span class="w1"> </span>its<span class="w1"> </span>prototypes<span class="w1"> </span>and<span class="w1"> </span>parents.</div><div class="l f2 s4 t0" style="top:568.139px;left:317.014px;" data-x="317.014" data-y="223.861">Property<span class="w1"> </span>maps<span class="w1"> </span>can<span class="w0"> </span>be<span class="w1"> </span>implemented<span class="w1"> </span>with<span class="w1"> </span>different<span class="w1"> </span>data<span class="w0"> </span>structures</div><div class="l f2 s4 t0" style="top:578.102px;left:317.014px;" data-x="317.014" data-y="213.898">(e.g.,<span class="w1"> </span>per-object<span class="w1"> </span>hash<span class="w0"> </span>tables<span class="w1"> </span>or<span class="w1"> </span>shared<span class="w1"> </span>hash<span class="w0"> </span>tables),<span class="w1"> </span>so<span class="w1"> </span>the<span class="w0"> </span>search</div><div class="l f2 s4 t0" style="top:588.065px;left:317.014px;" data-x="317.014" data-y="203.935">process<span class="w0"> </span>also<span class="w1"> </span>must<span class="w0"> </span>dispatch<span class="w1"> </span>on<span class="w0"> </span>the<span class="w1"> </span>representation<span class="w0"> </span>of<span class="w0"> </span>each<span class="w1"> </span>object</div><div class="l f2 s4 t0" style="top:598.027px;left:317.014px;" data-x="317.014" data-y="193.973">found<span class="w2"> </span>during<span class="w2"> </span>search.<span class="w1"> </span>TraceMonkey<span class="w2"> </span>can<span class="w2"> </span>simply<span class="w1"> </span>observe<span class="w2"> </span>the<span class="w2"> </span>result<span class="w1"> </span>of</div><div class="l f2 s4 t0" style="top:607.99px;left:317.014px;" data-x="317.014" data-y="184.01">the<span class="w1"> </span>search<span class="w1"> </span>process<span class="w1"> </span>and<span class="w1"> </span>record<span class="w1"> </span>the<span class="w1"> </span>simplest<span class="w1"> </span>possible<span class="w1"> </span>LIR<span class="w1"> </span>to<span class="w1"> </span>access</div><div class="l f2 s4 t0" style="top:617.953px;left:317.014px;" data-x="317.014" data-y="174.047">the<span class="w2"> </span>property<span class="w1"> </span>value.<span class="w2"> </span>For<span class="w2"> </span>example,<span class="w1"> </span>the<span class="w2"> </span>search<span class="w2"> </span>might<span class="w1"> </span>finds<span class="w2"> </span>the<span class="w1"> </span>value<span class="w2"> </span>of</div><div class="l f7 s4 t0" style="top:627.915px;left:317.014px;" data-x="317.014" data-y="164.085">o.x</div><div class="l f2 s4 t0" style="top:627.915px;left:333.256px;" data-x="333.256" data-y="164.085">in<span class="w2"> </span>the<span class="w1"> </span>prototype<span class="w2"> </span>of</div><div class="l f7 s4 t0" style="top:627.915px;left:401.505px;" data-x="401.505" data-y="164.085">o</div><div class="l f2 s4 t0" style="top:627.915px;left:406.213px;" data-x="406.213" data-y="164.085">,<span class="w2"> </span>which<span class="w1"> </span>uses<span class="w2"> </span>a<span class="w1"> </span>shared<span class="w2"> </span>hash-table<span class="w1"> </span>represen-</div><div class="l f2 s4 t0" style="top:637.878px;left:317.014px;" data-x="317.014" data-y="154.122">tation<span class="w2"> </span>that<span class="w1"> </span>places</div><div class="l f7 s4 t0" style="top:637.878px;left:379.55px;" data-x="379.55" data-y="154.122">x</div><div class="l f2 s4 t0" style="top:637.878px;left:386.342px;" data-x="386.342" data-y="154.122">in<span class="w2"> </span>slot<span class="w1"> </span>2<span class="w2"> </span>of<span class="w1"> </span>a<span class="w2"> </span>property<span class="w1"> </span>vector.<span class="w2"> </span>Then<span class="w2"> </span>the<span class="w1"> </span>recorded</div><div class="l f2 s4 t0" style="top:647.841px;left:317.014px;" data-x="317.014" data-y="144.159">can<span class="w2"> </span>generate<span class="w1"> </span>LIR<span class="w2"> </span>that<span class="w1"> </span>reads</div><div class="l f7 s4 t0" style="top:647.841px;left:416.779px;" data-x="416.779" data-y="144.159">o.x</div><div class="l f2 s4 t0" style="top:647.841px;left:432.929px;" data-x="432.929" data-y="144.159">with<span class="w2"> </span>just<span class="w1"> </span>two<span class="w2"> </span>or<span class="w1"> </span>three<span class="w2"> </span>loads:<span class="w1"> </span>one<span class="w2"> </span>to</div><div class="l f2 s4 t0" style="top:657.803px;left:317.014px;" data-x="317.014" data-y="134.197">get<span class="w2"> </span>the<span class="w1"> </span>prototype,<span class="w2"> </span>possibly<span class="w1"> </span>one<span class="w2"> </span>to<span class="w1"> </span>get<span class="w2"> </span>the<span class="w2"> </span>property<span class="w1"> </span>value<span class="w2"> </span>vector,<span class="w2"> </span>and</div><div class="l f2 s4 t0" style="top:667.766px;left:317.014px;" data-x="317.014" data-y="124.234">one<span class="w2"> </span>more<span class="w1"> </span>to<span class="w1"> </span>get<span class="w1"> </span>slot<span class="w2"> </span>2<span class="w1"> </span>from<span class="w1"> </span>the<span class="w2"> </span>vector.<span class="w1"> </span>This<span class="w2"> </span>is<span class="w1"> </span>a<span class="w1"> </span>vast<span class="w2"> </span>simplification</div><div class="l f2 s4 t0" style="top:677.728px;left:317.014px;" data-x="317.014" data-y="114.272">and<span class="w2"> </span>speedup<span class="w1"> </span>compared<span class="w1"> </span>to<span class="w1"> </span>the<span class="w2"> </span>original<span class="w1"> </span>interpreter<span class="w1"> </span>code.<span class="w2"> </span>Inheritance</div><div class="l f2 s4 t0" style="top:687.691px;left:317.014px;" data-x="317.014" data-y="104.309">relationships<span class="w1"> </span>and<span class="w1"> </span>object<span class="w1"> </span>representations<span class="w1"> </span>can<span class="w1"> </span>change<span class="w1"> </span>during<span class="w1"> </span>execu-</div><div class="l f2 s4 t0" style="top:697.654px;left:317.014px;" data-x="317.014" data-y="94.3462">tion,<span class="w1"> </span>so<span class="w1"> </span>the<span class="w2"> </span>simplified<span class="w1"> </span>code<span class="w1"> </span>requires<span class="w1"> </span>guard<span class="w1"> </span>instructions<span class="w1"> </span>that<span class="w1"> </span>ensure</div><div class="l f2 s4 t0" style="top:707.616px;left:317.014px;" data-x="317.014" data-y="84.3836">the<span class="w2"> </span>object<span class="w2"> </span>representation<span class="w1"> </span>is<span class="w2"> </span>the<span class="w2"> </span>same.<span class="w1"> </span>In<span class="w2"> </span>TraceMonkey,objects’<span class="w1"> </span>rep-</div></div></div><div id="page-5" class="p" style="width:612px;height:792px;"><div class="t"><div class="l f2 s4 t0" style="top:79.9701px;left:54px;" data-x="54" data-y="712.03">resentations<span class="w1"> </span>are<span class="w0"> </span>assigned<span class="w1"> </span>an<span class="w0"> </span>integer<span class="w1"> </span>key<span class="w1"> </span>called<span class="w0"> </span>the</div><div class="l fa s4 t0" style="top:79.9701px;left:244.58px;" data-x="244.58" data-y="712.03">object<span class="w1"> </span>shape</div><div class="l f2 s4 t0" style="top:79.9701px;left:290.862px;" data-x="290.862" data-y="712.03">.</div><div class="l f2 s4 t0" style="top:89.9328px;left:54px;" data-x="54" data-y="702.067">Thus,<span class="w2"> </span>the<span class="w1"> </span>guard<span class="w1"> </span>is<span class="w2"> </span>a<span class="w1"> </span>simple<span class="w1"> </span>equality<span class="w2"> </span>check<span class="w1"> </span>on<span class="w2"> </span>the<span class="w1"> </span>object<span class="w1"> </span>shape.</div><div class="l f1 s4 t0" style="top:99.8954px;left:65.9552px;" data-x="65.9552" data-y="692.105">Representation<span class="w0"> </span>specialization:<span class="w1"> </span>numbers.</div><div class="l f2 s4 t0" style="top:99.8954px;left:227.131px;" data-x="227.131" data-y="692.105">JavaScript<span class="w1"> </span>has<span class="w0"> </span>no</div><div class="l f2 s4 t0" style="top:109.858px;left:54px;" data-x="54" data-y="682.142">integer<span class="w1"> </span>type,<span class="w0"> </span>only<span class="w1"> </span>a<span class="w1"> </span>Number<span class="w0"> </span>type<span class="w1"> </span>that<span class="w1"> </span>is<span class="w0"> </span>the<span class="w1"> </span>set<span class="w1"> </span>of<span class="w0"> </span>64-bit<span class="w1"> </span>IEEE-</div><div class="l f2 s4 t0" style="top:119.821px;left:54px;" data-x="54" data-y="672.179">754<span class="w0"> </span>floating-pointer<span class="w0"> </span>numbers<span class="w1"> </span>(“doubles”).<span class="w0"> </span>But<span class="w0"> </span>many<span class="w0"> </span>JavaScript</div><div class="l f2 s4 t0" style="top:129.783px;left:54px;" data-x="54" data-y="662.217">operators,<span class="w2"> </span>in<span class="w1"> </span>particular<span class="w1"> </span>array<span class="w1"> </span>accesses<span class="w2"> </span>and<span class="w1"> </span>bitwise<span class="w1"> </span>operators,<span class="w2"> </span>really</div><div class="l f2 s4 t0" style="top:139.746px;left:54px;" data-x="54" data-y="652.254">operate<span class="w1"> </span>on<span class="w1"> </span>integers,<span class="w2"> </span>so<span class="w1"> </span>they<span class="w1"> </span>first<span class="w1"> </span>convert<span class="w1"> </span>the<span class="w1"> </span>number<span class="w1"> </span>to<span class="w1"> </span>an<span class="w1"> </span>integer,</div><div class="l f2 s4 t0" style="top:150.071px;left:54px;" data-x="54" data-y="641.929">and<span class="w1"> </span>then<span class="w0"> </span>conv</div><div class="l f2 s4 t0" style="top:150.071px;left:106.005px;" data-x="106.005" data-y="641.929">ert<span class="w1"> </span>any<span class="w0"> </span>integer<span class="w1"> </span>result<span class="w1"> </span>back<span class="w0"> </span>to<span class="w1"> </span>a<span class="w1"> </span>double.</div><div class="l f2 s5 t0" style="top:146.262px;left:250.896px;" data-x="250.896" data-y="645.738">1</div><div class="l f2 s4 t0" style="top:150.071px;left:257.725px;" data-x="257.725" data-y="641.929">Clearly,<span class="w1"> </span>a</div><div class="l f2 s4 t0" style="top:160.033px;left:54px;" data-x="54" data-y="631.967">JavaScript<span class="w2"> </span>VM<span class="w1"> </span>that<span class="w1"> </span>wants<span class="w1"> </span>to<span class="w1"> </span>be<span class="w2"> </span>fast<span class="w1"> </span>must<span class="w1"> </span>find<span class="w1"> </span>a<span class="w1"> </span>way<span class="w2"> </span>to<span class="w1"> </span>operate<span class="w1"> </span>on</div><div class="l f2 s4 t0" style="top:169.996px;left:54px;" data-x="54" data-y="622.004">integers<span class="w2"> </span>directly<span class="w1"> </span>and<span class="w1"> </span>avoid<span class="w2"> </span>these<span class="w1"> </span>conversions.</div><div class="l f2 s4 t0" style="top:179.959px;left:65.9552px;" data-x="65.9552" data-y="612.041">In<span class="w1"> </span>TraceMonkey</div><div class="l f2 s4 t0" style="top:179.959px;left:125.376px;" data-x="125.376" data-y="612.041">,<span class="w1"> </span>we<span class="w1"> </span>support<span class="w1"> </span>two<span class="w1"> </span>representations<span class="w1"> </span>for<span class="w1"> </span>numbers:</div><div class="l f2 s4 t0" style="top:189.921px;left:54px;" data-x="54" data-y="602.079">integers<span class="w1"> </span>and<span class="w1"> </span>doubles.<span class="w0"> </span>The<span class="w1"> </span>interpreter<span class="w1"> </span>uses<span class="w1"> </span>integer<span class="w1"> </span>representations</div><div class="l f2 s4 t0" style="top:199.884px;left:54px;" data-x="54" data-y="592.116">as<span class="w2"> </span>much<span class="w1"> </span>as<span class="w2"> </span>it<span class="w1"> </span>can,<span class="w2"> </span>switching<span class="w1"> </span>for<span class="w2"> </span>results<span class="w2"> </span>that<span class="w1"> </span>can<span class="w2"> </span>only<span class="w1"> </span>be<span class="w2"> </span>represented</div><div class="l f2 s4 t0" style="top:209.847px;left:54px;" data-x="54" data-y="582.153">as<span class="w1"> </span>doubles.<span class="w1"> </span>When<span class="w2"> </span>a<span class="w1"> </span>trace<span class="w1"> </span>is<span class="w1"> </span>started,<span class="w1"> </span>some<span class="w1"> </span>values<span class="w1"> </span>may<span class="w1"> </span>be<span class="w1"> </span>imported</div><div class="l f2 s4 t0" style="top:219.809px;left:54px;" data-x="54" data-y="572.191">and<span class="w1"> </span>represented<span class="w0"> </span>as<span class="w1"> </span>integers.<span class="w1"> </span>Some<span class="w1"> </span>operations<span class="w0"> </span>on<span class="w1"> </span>integers<span class="w1"> </span>require</div><div class="l f2 s4 t0" style="top:229.772px;left:54px;" data-x="54" data-y="562.228">guards.<span class="w1"> </span>For<span class="w2"> </span>example,<span class="w1"> </span>adding<span class="w1"> </span>two<span class="w1"> </span>integers<span class="w1"> </span>can<span class="w1"> </span>produce<span class="w1"> </span>a<span class="w1"> </span>value<span class="w2"> </span>too</div><div class="l f2 s4 t0" style="top:239.735px;left:54px;" data-x="54" data-y="552.265">large<span class="w2"> </span>for<span class="w1"> </span>the<span class="w1"> </span>integer<span class="w2"> </span>representation.</div><div class="l f1 s4 t0" style="top:249.697px;left:65.9552px;" data-x="65.9552" data-y="542.303">Function<span class="w1"> </span>inlining.</div><div class="l f2 s4 t0" style="top:249.697px;left:139.22px;" data-x="139.22" data-y="542.303">LIR<span class="w1"> </span>traces<span class="w0"> </span>can<span class="w0"> </span>cross<span class="w1"> </span>function<span class="w0"> </span>boundaries</div><div class="l f2 s4 t0" style="top:259.66px;left:54px;" data-x="54" data-y="532.34">in<span class="w1"> </span>either<span class="w1"> </span>direction,<span class="w1"> </span>achieving<span class="w1"> </span>function<span class="w1"> </span>inlining.<span class="w1"> </span>Move<span class="w1"> </span>instructions</div><div class="l f2 s4 t0" style="top:269.623px;left:54px;" data-x="54" data-y="522.377">need<span class="w1"> </span>to<span class="w1"> </span>be<span class="w2"> </span>recorded<span class="w1"> </span>for<span class="w1"> </span>function<span class="w1"> </span>entry<span class="w1"> </span>and<span class="w1"> </span>exit<span class="w1"> </span>to<span class="w1"> </span>copy<span class="w1"> </span>arguments</div><div class="l f2 s4 t0" style="top:279.585px;left:54px;" data-x="54" data-y="512.415">in<span class="w2"> </span>and<span class="w1"> </span>return<span class="w2"> </span>values<span class="w2"> </span>out.<span class="w1"> </span>These<span class="w2"> </span>move<span class="w1"> </span>statements<span class="w2"> </span>are<span class="w1"> </span>then<span class="w2"> </span>optimized</div><div class="l f2 s4 t0" style="top:289.548px;left:54px;" data-x="54" data-y="502.452">away<span class="w1"> </span>by<span class="w1"> </span>the<span class="w1"> </span>compiler<span class="w1"> </span>using<span class="w1"> </span>copy<span class="w2"> </span>propagation.<span class="w1"> </span>In<span class="w1"> </span>order<span class="w1"> </span>to<span class="w1"> </span>be<span class="w1"> </span>able</div><div class="l f2 s4 t0" style="top:299.51px;left:54px;" data-x="54" data-y="492.49">to<span class="w0"> </span>return<span class="w1"> </span>to<span class="w0"> </span>the<span class="w1"> </span>interpreter,<span class="w0"> </span>the<span class="w1"> </span>trace<span class="w0"> </span>must<span class="w1"> </span>also<span class="w0"> </span>generate<span class="w0"> </span>LIR<span class="w1"> </span>to</div><div class="l f2 s4 t0" style="top:309.473px;left:54px;" data-x="54" data-y="482.527">record<span class="w1"> </span>that<span class="w0"> </span>a<span class="w1"> </span>call<span class="w0"> </span>frame<span class="w1"> </span>has<span class="w1"> </span>been<span class="w0"> </span>entered<span class="w1"> </span>and<span class="w0"> </span>exited.<span class="w1"> </span>The<span class="w1"> </span>frame</div><div class="l f2 s4 t0" style="top:319.436px;left:54px;" data-x="54" data-y="472.564">entry<span class="w0"> </span>and<span class="w0"> </span>exit<span class="w1"> </span>LIR<span class="w0"> </span>saves<span class="w0"> </span>just<span class="w0"> </span>enough<span class="w1"> </span>information<span class="w0"> </span>to<span class="w0"> </span>allow<span class="w0"> </span>the</div><div class="l f2 s4 t0" style="top:329.398px;left:54px;" data-x="54" data-y="462.602">intepreter<span class="w1"> </span>call<span class="w1"> </span>stack<span class="w1"> </span>to<span class="w1"> </span>be<span class="w1"> </span>restored<span class="w1"> </span>later<span class="w0"> </span>and<span class="w2"> </span>is<span class="w0"> </span>much<span class="w2"> </span>simpler<span class="w0"> </span>than</div><div class="l f2 s4 t0" style="top:339.361px;left:54px;" data-x="54" data-y="452.639">the<span class="w1"> </span>interpreter’s<span class="w1"> </span>standard<span class="w0"> </span>call<span class="w1"> </span>code.<span class="w1"> </span>If<span class="w1"> </span>the<span class="w0"> </span>function<span class="w1"> </span>being<span class="w1"> </span>entered</div><div class="l f2 s4 t0" style="top:349.324px;left:54px;" data-x="54" data-y="442.676">is<span class="w1"> </span>not<span class="w1"> </span>constant<span class="w1"> </span>(which<span class="w1"> </span>in<span class="w1"> </span>JavaScript<span class="w1"> </span>includes<span class="w1"> </span>any<span class="w1"> </span>call<span class="w1"> </span>by<span class="w1"> </span>function</div><div class="l f2 s4 t0" style="top:359.286px;left:54px;" data-x="54" data-y="432.714">name),<span class="w1"> </span>the<span class="w1"> </span>recorder<span class="w1"> </span>must<span class="w1"> </span>also<span class="w1"> </span>emit<span class="w1"> </span>LIR<span class="w1"> </span>to<span class="w1"> </span>guard<span class="w2"> </span>that<span class="w1"> </span>the<span class="w1"> </span>function</div><div class="l f2 s4 t0" style="top:369.249px;left:54px;" data-x="54" data-y="422.751">is<span class="w2"> </span>the<span class="w1"> </span>same.</div><div class="l f1 s4 t0" style="top:379.212px;left:65.9552px;" data-x="65.9552" data-y="412.788">Guards<span class="w0"> </span>and<span class="w0"> </span>side<span class="w0"> </span>exits.</div><div class="l f2 s4 t0" style="top:379.212px;left:161.308px;" data-x="161.308" data-y="412.788">Each<span class="w0"> </span>optimization<span class="w0"> </span>described<span class="w0"> </span>above</div><div class="l f2 s4 t0" style="top:389.174px;left:54px;" data-x="54" data-y="402.826">requires<span class="w0"> </span>one<span class="w1"> </span>or<span class="w0"> </span>more<span class="w1"> </span>guards<span class="w0"> </span>to<span class="w1"> </span>verify<span class="w0"> </span>the<span class="w0"> </span>assumptions<span class="w1"> </span>made<span class="w0"> </span>in</div><div class="l f2 s4 t0" style="top:399.137px;left:54px;" data-x="54" data-y="392.863">doing<span class="w2"> </span>the<span class="w1"> </span>optimization.<span class="w1"> </span>A<span class="w1"> </span>guard<span class="w2"> </span>is<span class="w1"> </span>just<span class="w1"> </span>a<span class="w2"> </span>group<span class="w1"> </span>of<span class="w1"> </span>LIR<span class="w2"> </span>instructions</div><div class="l f2 s4 t0" style="top:409.099px;left:54px;" data-x="54" data-y="382.901">that<span class="w1"> </span>performs<span class="w0"> </span>a<span class="w1"> </span>test<span class="w0"> </span>and<span class="w1"> </span>conditional<span class="w1"> </span>exit.<span class="w0"> </span>The<span class="w1"> </span>exit<span class="w1"> </span>branches<span class="w0"> </span>to<span class="w1"> </span>a</div><div class="l fa s4 t0" style="top:419.062px;left:54px;" data-x="54" data-y="372.938">side<span class="w1"> </span>exit</div><div class="l f2 s4 t0" style="top:419.062px;left:84.551px;" data-x="84.551" data-y="372.938">,<span class="w1"> </span>a<span class="w0"> </span>small<span class="w1"> </span>off-trace<span class="w1"> </span>piece<span class="w0"> </span>of<span class="w1"> </span>LIR<span class="w1"> </span>that<span class="w0"> </span>returns<span class="w1"> </span>a<span class="w1"> </span>pointer<span class="w0"> </span>to</div><div class="l f2 s4 t0" style="top:429.025px;left:54px;" data-x="54" data-y="362.975">a<span class="w1"> </span>structure<span class="w0"> </span>that<span class="w0"> </span>describes<span class="w1"> </span>the<span class="w0"> </span>reason<span class="w1"> </span>for<span class="w0"> </span>the<span class="w1"> </span>exit<span class="w0"> </span>along<span class="w0"> </span>with<span class="w1"> </span>the</div><div class="l f2 s4 t0" style="top:438.987px;left:54px;" data-x="54" data-y="353.013">interpreter<span class="w2"> </span>PC<span class="w1"> </span>at<span class="w2"> </span>the<span class="w1"> </span>exit<span class="w2"> </span>point<span class="w1"> </span>and<span class="w1"> </span>any<span class="w2"> </span>other<span class="w1"> </span>data<span class="w2"> </span>needed<span class="w1"> </span>to<span class="w2"> </span>restore</div><div class="l f2 s4 t0" style="top:448.95px;left:54px;" data-x="54" data-y="343.05">the<span class="w2"> </span>interpreter’s<span class="w1"> </span>state<span class="w2"> </span>structures.</div><div class="l f1 s4 t0" style="top:458.913px;left:65.9552px;" data-x="65.9552" data-y="333.087">Aborts.</div><div class="l f2 s4 t0" style="top:458.913px;left:97.7225px;" data-x="97.7225" data-y="333.087">Some<span class="w1"> </span>constructs<span class="w1"> </span>are<span class="w0"> </span>difficult<span class="w2"> </span>to<span class="w0"> </span>record<span class="w1"> </span>in<span class="w1"> </span>LIR<span class="w1"> </span>traces.</div><div class="l f2 s4 t0" style="top:468.875px;left:54px;" data-x="54" data-y="323.125">For<span class="w1"> </span>example,</div><div class="l f7 s4 t0" style="top:468.875px;left:105.54px;" data-x="105.54" data-y="323.125">eval</div><div class="l f2 s4 t0" style="top:468.875px;left:127.737px;" data-x="127.737" data-y="323.125">or<span class="w1"> </span>calls<span class="w0"> </span>to<span class="w1"> </span>external<span class="w1"> </span>functions<span class="w0"> </span>can<span class="w1"> </span>change<span class="w1"> </span>the</div><div class="l f2 s4 t0" style="top:478.838px;left:54px;" data-x="54" data-y="313.162">program<span class="w0"> </span>state<span class="w1"> </span>in<span class="w0"> </span>unpredictable<span class="w1"> </span>ways,<span class="w0"> </span>making<span class="w0"> </span>it<span class="w1"> </span>difficult<span class="w0"> </span>for<span class="w1"> </span>the</div><div class="l f2 s4 t0" style="top:488.801px;left:54px;" data-x="54" data-y="303.199">tracer<span class="w1"> </span>to<span class="w1"> </span>know<span class="w1"> </span>the<span class="w0"> </span>current<span class="w1"> </span>type<span class="w1"> </span>map<span class="w1"> </span>in<span class="w1"> </span>order<span class="w0"> </span>to<span class="w1"> </span>continue<span class="w1"> </span>tracing.</div><div class="l f2 s4 t0" style="top:498.763px;left:54px;" data-x="54" data-y="293.237">A<span class="w1"> </span>tracing<span class="w2"> </span>implementation<span class="w1"> </span>can<span class="w1"> </span>also<span class="w1"> </span>have<span class="w2"> </span>any<span class="w1"> </span>number<span class="w1"> </span>of<span class="w2"> </span>other<span class="w1"> </span>limi-</div><div class="l f2 s4 t0" style="top:508.726px;left:54px;" data-x="54" data-y="283.274">tations,<span class="w1"> </span>e.g.,a<span class="w2"> </span>small-memory<span class="w1"> </span>device<span class="w1"> </span>may<span class="w2"> </span>limit<span class="w1"> </span>the<span class="w1"> </span>length<span class="w1"> </span>of<span class="w1"> </span>traces.</div><div class="l f2 s4 t0" style="top:518.689px;left:54px;" data-x="54" data-y="273.311">When<span class="w1"> </span>any<span class="w1"> </span>situation<span class="w1"> </span>occurs<span class="w1"> </span>that<span class="w1"> </span>prevents<span class="w1"> </span>the<span class="w1"> </span>implementation<span class="w1"> </span>from</div><div class="l f2 s4 t0" style="top:528.651px;left:54px;" data-x="54" data-y="263.349">continuing<span class="w2"> </span>trace<span class="w1"> </span>recording,<span class="w2"> </span>the<span class="w2"> </span>implementation</div><div class="l fa s4 t0" style="top:528.651px;left:223.092px;" data-x="223.092" data-y="263.349">aborts</div><div class="l f2 s4 t0" style="top:528.651px;left:247.903px;" data-x="247.903" data-y="263.349">trace<span class="w2"> </span>record-</div><div class="l f2 s4 t0" style="top:538.614px;left:54px;" data-x="54" data-y="253.386">ing<span class="w2"> </span>and<span class="w1"> </span>returns<span class="w1"> </span>to<span class="w2"> </span>the<span class="w1"> </span>trace<span class="w1"> </span>monitor.</div><div class="l f1 s4 t0" style="top:563.065px;left:54px;" data-x="54" data-y="228.935">3.2<span class="w10"> </span>Trace<span class="w2"> </span>Trees</div><div class="l f2 s4 t0" style="top:577.013px;left:54px;" data-x="54" data-y="214.987">Especially<span class="w1"> </span>simple<span class="w0"> </span>loops,<span class="w1"> </span>namely<span class="w1"> </span>those<span class="w0"> </span>where<span class="w1"> </span>control<span class="w1"> </span>flow,<span class="w1"> </span>value</div><div class="l f2 s4 t0" style="top:586.976px;left:54px;" data-x="54" data-y="205.024">types,<span class="w2"> </span>value<span class="w1"> </span>representations,<span class="w2"> </span>and<span class="w1"> </span>inlined<span class="w1"> </span>functions<span class="w2"> </span>are<span class="w1"> </span>all<span class="w2"> </span>invariant,</div><div class="l f2 s4 t0" style="top:596.938px;left:54px;" data-x="54" data-y="195.062">can<span class="w1"> </span>be<span class="w1"> </span>represented<span class="w1"> </span>by<span class="w1"> </span>a<span class="w1"> </span>single<span class="w1"> </span>trace.<span class="w1"> </span>But<span class="w1"> </span>most<span class="w1"> </span>loops<span class="w1"> </span>have<span class="w1"> </span>at<span class="w1"> </span>least</div><div class="l f2 s4 t0" style="top:606.901px;left:54px;" data-x="54" data-y="185.099">some<span class="w1"> </span>variation,<span class="w1"> </span>and<span class="w0"> </span>so<span class="w1"> </span>the<span class="w1"> </span>program<span class="w0"> </span>will<span class="w1"> </span>take<span class="w1"> </span>side<span class="w1"> </span>exits<span class="w0"> </span>from<span class="w1"> </span>the</div><div class="l f2 s4 t0" style="top:616.864px;left:54px;" data-x="54" data-y="175.136">main<span class="w1"> </span>trace.<span class="w1"> </span>When<span class="w1"> </span>a<span class="w0"> </span>side<span class="w1"> </span>exit<span class="w1"> </span>becomes<span class="w1"> </span>hot,<span class="w1"> </span>TraceMonkey<span class="w1"> </span>starts<span class="w1"> </span>a</div><div class="l f2 s4 t0" style="top:626.826px;left:54px;" data-x="54" data-y="165.174">new</div><div class="l fa s4 t0" style="top:626.826px;left:71.021px;" data-x="71.021" data-y="165.174">branch<span class="w2"> </span>trace</div><div class="l f2 s4 t0" style="top:626.826px;left:119.059px;" data-x="119.059" data-y="165.174">from<span class="w2"> </span>that<span class="w1"> </span>point<span class="w1"> </span>and<span class="w2"> </span>patches<span class="w1"> </span>the<span class="w1"> </span>side<span class="w1"> </span>exit<span class="w2"> </span>to<span class="w1"> </span>jump</div><div class="l f2 s4 t0" style="top:636.789px;left:54px;" data-x="54" data-y="155.211">directly<span class="w2"> </span>to<span class="w1"> </span>that<span class="w2"> </span>trace.<span class="w1"> </span>In<span class="w2"> </span>this<span class="w1"> </span>way,<span class="w2"> </span>a<span class="w1"> </span>single<span class="w2"> </span>trace<span class="w1"> </span>expands<span class="w2"> </span>on<span class="w1"> </span>demand</div><div class="l f2 s4 t0" style="top:646.751px;left:54px;" data-x="54" data-y="145.249">to<span class="w2"> </span>a<span class="w1"> </span>single-entry,<span class="w2"> </span>multiple-exit</div><div class="l fa s4 t0" style="top:646.751px;left:164.608px;" data-x="164.608" data-y="145.249">trace<span class="w2"> </span>tree</div><div class="l f2 s4 t0" style="top:646.751px;left:198.751px;" data-x="198.751" data-y="145.249">.</div><div class="l f2 s4 t0" style="top:656.714px;left:65.9552px;" data-x="65.9552" data-y="135.286">This<span class="w1"> </span>section<span class="w2"> </span>explains<span class="w1"> </span>how<span class="w1"> </span>trace<span class="w1"> </span>trees<span class="w2"> </span>are<span class="w1"> </span>formed<span class="w1"> </span>during<span class="w1"> </span>execu-</div><div class="l f2 s4 t0" style="top:666.677px;left:54px;" data-x="54" data-y="125.323">tion.<span class="w1"> </span>The<span class="w2"> </span>goal<span class="w1"> </span>is<span class="w1"> </span>to<span class="w2"> </span>form<span class="w1"> </span>trace<span class="w1"> </span>trees<span class="w1"> </span>during<span class="w2"> </span>execution<span class="w1"> </span>that<span class="w1"> </span>cover<span class="w2"> </span>all</div><div class="l f2 s4 t0" style="top:676.639px;left:54px;" data-x="54" data-y="115.361">the<span class="w2"> </span>hot<span class="w1"> </span>paths<span class="w1"> </span>of<span class="w2"> </span>the<span class="w1"> </span>program.</div></div><div class="t t27"></div><div class="t t0"><div class="l f2 s5 t0" style="top:702.811px;left:54px;" data-x="54" data-y="89.1889">1</div><div class="l f2 s3 t0" style="top:705.624px;left:58.4832px;" data-x="58.4832" data-y="86.3761">Arrays<span class="w2"> </span>are<span class="w1"> </span>actually<span class="w2"> </span>worse<span class="w2"> </span>than<span class="w1"> </span>this:<span class="w2"> </span>if<span class="w1"> </span>the<span class="w2"> </span>index<span class="w2"> </span>value<span class="w1"> </span>is<span class="w2"> </span>a<span class="w1"> </span>number,<span class="w2"> </span>it<span class="w2"> </span>must</div><div class="l f2 s3 t0" style="top:714.59px;left:54px;" data-x="54" data-y="77.4097">be<span class="w2"> </span>converted<span class="w2"> </span>from<span class="w1"> </span>a<span class="w2"> </span>double<span class="w1"> </span>to<span class="w2"> </span>a<span class="w1"> </span>string<span class="w2"> </span>for<span class="w2"> </span>the<span class="w1"> </span>property<span class="w2"> </span>access<span class="w1"> </span>operator,<span class="w2"> </span>and</div><div class="l f2 s3 t0" style="top:723.557px;left:54px;" data-x="54" data-y="68.4433">then<span class="w2"> </span>to<span class="w1"> </span>an<span class="w2"> </span>integer<span class="w2"> </span>internally<span class="w1"> </span>to<span class="w2"> </span>the<span class="w1"> </span>array<span class="w2"> </span>implementation.</div><div class="l f1 s4 t0" style="top:79.9701px;left:328.969px;" data-x="328.969" data-y="712.03">Starting<span class="w2"> </span>a<span class="w1"> </span>tree.</div><div class="l f2 s4 t0" style="top:79.9701px;left:388.04px;" data-x="388.04" data-y="712.03">Tree<span class="w2"> </span>trees<span class="w1"> </span>always<span class="w2"> </span>start<span class="w2"> </span>at<span class="w1"> </span>loop<span class="w2"> </span>headers,<span class="w1"> </span>because</div><div class="l f2 s4 t0" style="top:89.9328px;left:317.014px;" data-x="317.014" data-y="702.067">they<span class="w2"> </span>are<span class="w1"> </span>a<span class="w2"> </span>natural<span class="w1"> </span>place<span class="w2"> </span>to<span class="w2"> </span>look<span class="w1"> </span>for<span class="w2"> </span>hot<span class="w1"> </span>paths.<span class="w2"> </span>In<span class="w1"> </span>TraceMonkey</div><div class="l f2 s4 t0" style="top:89.9328px;left:535.919px;" data-x="535.919" data-y="702.067">,<span class="w2"> </span>loop</div><div class="l f2 s4 t0" style="top:99.8954px;left:317.014px;" data-x="317.014" data-y="692.105">headers<span class="w1"> </span>are<span class="w0"> </span>easy<span class="w1"> </span>to<span class="w0"> </span>detect–the<span class="w1"> </span>bytecode<span class="w0"> </span>compiler<span class="w1"> </span>ensures<span class="w0"> </span>that<span class="w1"> </span>a</div><div class="l f2 s4 t0" style="top:109.858px;left:317.014px;" data-x="317.014" data-y="682.142">bytecode<span class="w1"> </span>is<span class="w1"> </span>a<span class="w2"> </span>loop<span class="w1"> </span>header<span class="w1"> </span>iff<span class="w1"> </span>it<span class="w1"> </span>is<span class="w1"> </span>the<span class="w1"> </span>target<span class="w2"> </span>of<span class="w1"> </span>a<span class="w1"> </span>backward<span class="w1"> </span>branch.</div><div class="l f2 s4 t0" style="top:119.821px;left:317.014px;" data-x="317.014" data-y="672.179">TraceMonkey<span class="w2"> </span>starts<span class="w1"> </span>a<span class="w1"> </span>tree<span class="w2"> </span>when<span class="w1"> </span>a<span class="w1"> </span>given<span class="w2"> </span>loop<span class="w1"> </span>header<span class="w1"> </span>has<span class="w2"> </span>been<span class="w1"> </span>exe-</div><div class="l f2 s4 t0" style="top:129.783px;left:317.014px;" data-x="317.014" data-y="662.217">cuted<span class="w1"> </span>a<span class="w2"> </span>certain<span class="w1"> </span>number<span class="w1"> </span>of<span class="w1"> </span>times<span class="w1"> </span>(2<span class="w2"> </span>in<span class="w1"> </span>the<span class="w1"> </span>current<span class="w1"> </span>implementation).</div><div class="l f2 s4 t0" style="top:139.746px;left:317.014px;" data-x="317.014" data-y="652.254">Starting<span class="w1"> </span>a<span class="w2"> </span>tree<span class="w1"> </span>just<span class="w1"> </span>means<span class="w1"> </span>starting<span class="w1"> </span>recording<span class="w1"> </span>a<span class="w1"> </span>trace<span class="w2"> </span>for<span class="w1"> </span>the<span class="w1"> </span>current</div><div class="l f2 s4 t0" style="top:149.709px;left:317.014px;" data-x="317.014" data-y="642.291">point<span class="w2"> </span>and<span class="w1"> </span>type<span class="w2"> </span>map<span class="w1"> </span>and<span class="w2"> </span>marking<span class="w2"> </span>the<span class="w1"> </span>trace<span class="w2"> </span>as<span class="w1"> </span>the<span class="w2"> </span>root<span class="w1"> </span>of<span class="w2"> </span>a<span class="w2"> </span>tree.<span class="w1"> </span>Each</div><div class="l f2 s4 t0" style="top:159.671px;left:317.014px;" data-x="317.014" data-y="632.329">tree<span class="w2"> </span>is<span class="w1"> </span>associated<span class="w2"> </span>with<span class="w1"> </span>a<span class="w2"> </span>loop<span class="w1"> </span>header<span class="w2"> </span>and<span class="w1"> </span>type<span class="w2"> </span>map,<span class="w1"> </span>so<span class="w1"> </span>there<span class="w2"> </span>may<span class="w1"> </span>be</div><div class="l f2 s4 t0" style="top:169.634px;left:317.014px;" data-x="317.014" data-y="622.366">several<span class="w2"> </span>trees<span class="w1"> </span>for<span class="w2"> </span>a<span class="w1"> </span>given<span class="w2"> </span>loop<span class="w1"> </span>header.</div><div class="l f1 s4 t0" style="top:179.596px;left:328.969px;" data-x="328.969" data-y="612.404">Closing<span class="w2"> </span>the<span class="w1"> </span>loop.</div><div class="l f2 s4 t0" style="top:179.596px;left:395.23px;" data-x="395.23" data-y="612.404">Trace<span class="w2"> </span>recording<span class="w1"> </span>can<span class="w2"> </span>end<span class="w1"> </span>in<span class="w1"> </span>several<span class="w2"> </span>ways.</div><div class="l f2 s4 t0" style="top:189.559px;left:328.969px;" data-x="328.969" data-y="602.441">Ideally,<span class="w2"> </span>the<span class="w1"> </span>trace<span class="w1"> </span>reaches<span class="w1"> </span>the<span class="w1"> </span>loop<span class="w0"> </span>header<span class="w2"> </span>where<span class="w1"> </span>it<span class="w1"> </span>started<span class="w1"> </span>with</div><div class="l f2 s4 t0" style="top:199.522px;left:317.014px;" data-x="317.014" data-y="592.478">the<span class="w1"> </span>same<span class="w0"> </span>type<span class="w1"> </span>map<span class="w1"> </span>as<span class="w0"> </span>on<span class="w1"> </span>entry.<span class="w1"> </span>This<span class="w1"> </span>is<span class="w0"> </span>called<span class="w1"> </span>a</div><div class="l fa s4 t0" style="top:199.522px;left:497.521px;" data-x="497.521" data-y="592.478">type-stable</div><div class="l f2 s4 t0" style="top:199.522px;left:540.175px;" data-x="540.175" data-y="592.478">loop</div><div class="l f2 s4 t0" style="top:209.484px;left:317.014px;" data-x="317.014" data-y="582.516">iteration.<span class="w1"> </span>In<span class="w0"> </span>this<span class="w1"> </span>case,<span class="w1"> </span>the<span class="w0"> </span>end<span class="w1"> </span>of<span class="w1"> </span>the<span class="w0"> </span>trace<span class="w1"> </span>can<span class="w1"> </span>jump<span class="w0"> </span>right<span class="w1"> </span>to<span class="w1"> </span>the</div><div class="l f2 s4 t0" style="top:219.447px;left:317.014px;" data-x="317.014" data-y="572.553">beginning,<span class="w2"> </span>as<span class="w1"> </span>all<span class="w1"> </span>the<span class="w1"> </span>value<span class="w2"> </span>representations<span class="w1"> </span>are<span class="w1"> </span>exactly<span class="w2"> </span>as<span class="w1"> </span>needed<span class="w1"> </span>to</div><div class="l f2 s4 t0" style="top:229.41px;left:317.014px;" data-x="317.014" data-y="562.59">enter<span class="w1"> </span>the<span class="w1"> </span>trace.<span class="w1"> </span>The<span class="w2"> </span>jump<span class="w1"> </span>can<span class="w1"> </span>even<span class="w1"> </span>skip<span class="w1"> </span>the<span class="w1"> </span>usual<span class="w1"> </span>code<span class="w1"> </span>that<span class="w1"> </span>would</div><div class="l f2 s4 t0" style="top:239.372px;left:317.014px;" data-x="317.014" data-y="552.628">copy<span class="w1"> </span>out<span class="w2"> </span>the<span class="w1"> </span>state<span class="w1"> </span>at<span class="w1"> </span>the<span class="w1"> </span>end<span class="w2"> </span>of<span class="w1"> </span>the<span class="w1"> </span>trace<span class="w1"> </span>and<span class="w1"> </span>copy<span class="w2"> </span>it<span class="w1"> </span>back<span class="w1"> </span>in<span class="w1"> </span>to<span class="w2"> </span>the</div><div class="l f2 s4 t0" style="top:249.335px;left:317.014px;" data-x="317.014" data-y="542.665">trace<span class="w2"> </span>activation<span class="w1"> </span>record<span class="w2"> </span>to<span class="w1"> </span>enter<span class="w1"> </span>a<span class="w2"> </span>trace.</div><div class="l f2 s4 t0" style="top:259.298px;left:328.969px;" data-x="328.969" data-y="532.702">In<span class="w1"> </span>certain<span class="w0"> </span>cases<span class="w1"> </span>the<span class="w1"> </span>trace<span class="w0"> </span>might<span class="w1"> </span>reach<span class="w1"> </span>the<span class="w0"> </span>loop<span class="w1"> </span>header<span class="w1"> </span>with<span class="w0"> </span>a</div><div class="l f2 s4 t0" style="top:269.26px;left:317.014px;" data-x="317.014" data-y="522.74">different<span class="w2"> </span>type<span class="w1"> </span>map.<span class="w2"> </span>This<span class="w1"> </span>scenario<span class="w2"> </span>is<span class="w1"> </span>sometime<span class="w2"> </span>observed<span class="w1"> </span>for<span class="w2"> </span>the<span class="w1"> </span>first</div><div class="l f2 s4 t0" style="top:279.223px;left:317.014px;" data-x="317.014" data-y="512.777">iteration<span class="w2"> </span>of<span class="w1"> </span>a<span class="w2"> </span>loop.<span class="w2"> </span>Some<span class="w1"> </span>variables<span class="w2"> </span>inside<span class="w2"> </span>the<span class="w1"> </span>loop<span class="w2"> </span>might<span class="w1"> </span>initially<span class="w2"> </span>be</div><div class="l fa s4 t0" style="top:289.186px;left:317.014px;" data-x="317.014" data-y="502.814">undefined</div><div class="l f2 s4 t0" style="top:289.186px;left:351.875px;" data-x="351.875" data-y="502.814">,<span class="w2"> </span>before<span class="w2"> </span>they<span class="w1"> </span>are<span class="w2"> </span>set<span class="w2"> </span>to<span class="w1"> </span>a<span class="w2"> </span>concrete<span class="w2"> </span>type<span class="w1"> </span>during<span class="w2"> </span>the<span class="w2"> </span>first<span class="w1"> </span>loop</div><div class="l f2 s4 t0" style="top:299.148px;left:317.014px;" data-x="317.014" data-y="492.852">iteration.<span class="w1"> </span>When<span class="w0"> </span>recording<span class="w0"> </span>such<span class="w1"> </span>an<span class="w0"> </span>iteration,<span class="w1"> </span>the<span class="w0"> </span>recorder<span class="w1"> </span>cannot</div><div class="l f2 s4 t0" style="top:309.111px;left:317.014px;" data-x="317.014" data-y="482.889">link<span class="w1"> </span>the<span class="w2"> </span>trace<span class="w1"> </span>back<span class="w1"> </span>to<span class="w1"> </span>its<span class="w2"> </span>own<span class="w1"> </span>loop<span class="w1"> </span>header<span class="w1"> </span>since<span class="w2"> </span>it<span class="w1"> </span>is</div><div class="l fa s4 t0" style="top:309.111px;left:505.565px;" data-x="505.565" data-y="482.889">type-unstable</div><div class="l f2 s4 t0" style="top:309.111px;left:553.875px;" data-x="553.875" data-y="482.889">.</div><div class="l f2 s4 t0" style="top:319.073px;left:317.014px;" data-x="317.014" data-y="472.927">Instead,<span class="w2"> </span>the<span class="w1"> </span>iteration<span class="w1"> </span>is<span class="w1"> </span>terminated<span class="w2"> </span>with<span class="w1"> </span>a<span class="w1"> </span>side<span class="w1"> </span>exit<span class="w2"> </span>that<span class="w1"> </span>will<span class="w1"> </span>always</div><div class="l f2 s4 t0" style="top:329.036px;left:317.014px;" data-x="317.014" data-y="462.964">fail<span class="w1"> </span>and<span class="w1"> </span>return<span class="w1"> </span>to<span class="w0"> </span>the<span class="w1"> </span>interpreter.<span class="w2"> </span>At<span class="w0"> </span>the<span class="w1"> </span>same<span class="w1"> </span>time<span class="w1"> </span>a<span class="w1"> </span>new<span class="w1"> </span>trace<span class="w1"> </span>is</div><div class="l f2 s4 t0" style="top:338.999px;left:317.014px;" data-x="317.014" data-y="453.001">recorded<span class="w1"> </span>with<span class="w0"> </span>the<span class="w1"> </span>new<span class="w1"> </span>type<span class="w1"> </span>map.<span class="w0"> </span>Every<span class="w1"> </span>time<span class="w1"> </span>an<span class="w0"> </span>additional<span class="w1"> </span>type-</div><div class="l f2 s4 t0" style="top:348.961px;left:317.014px;" data-x="317.014" data-y="443.039">unstable<span class="w2"> </span>trace<span class="w1"> </span>is<span class="w2"> </span>added<span class="w1"> </span>to<span class="w2"> </span>a<span class="w1"> </span>region,<span class="w2"> </span>its<span class="w1"> </span>exit<span class="w2"> </span>type<span class="w1"> </span>map<span class="w2"> </span>is<span class="w1"> </span>compared<span class="w1"> </span>to</div><div class="l f2 s4 t0" style="top:358.924px;left:317.014px;" data-x="317.014" data-y="433.076">the<span class="w1"> </span>entry<span class="w1"> </span>map<span class="w1"> </span>of<span class="w1"> </span>all<span class="w1"> </span>existing<span class="w1"> </span>traces<span class="w1"> </span>in<span class="w1"> </span>case<span class="w1"> </span>they<span class="w1"> </span>complement<span class="w1"> </span>each</div><div class="l f2 s4 t0" style="top:368.887px;left:317.014px;" data-x="317.014" data-y="423.113">other.<span class="w2"> </span>With<span class="w1"> </span>this<span class="w1"> </span>approach<span class="w1"> </span>we<span class="w1"> </span>are<span class="w0"> </span>able<span class="w2"> </span>to<span class="w1"> </span>cover<span class="w1"> </span>type-unstable<span class="w1"> </span>loop</div><div class="l f2 s4 t0" style="top:378.849px;left:317.014px;" data-x="317.014" data-y="413.151">iterations<span class="w2"> </span>as<span class="w1"> </span>long<span class="w1"> </span>they<span class="w2"> </span>eventually<span class="w1"> </span>form<span class="w2"> </span>a<span class="w1"> </span>stable<span class="w2"> </span>equilibrium.</div><div class="l f2 s4 t0" style="top:388.812px;left:328.969px;" data-x="328.969" data-y="403.188">Finally,<span class="w1"> </span>the<span class="w1"> </span>trace<span class="w1"> </span>might<span class="w1"> </span>exit<span class="w1"> </span>the<span class="w1"> </span>loop<span class="w0"> </span>before<span class="w2"> </span>reaching<span class="w0"> </span>the<span class="w2"> </span>loop</div><div class="l f2 s4 t0" style="top:398.775px;left:317.014px;" data-x="317.014" data-y="393.225">header,<span class="w2"> </span>for<span class="w1"> </span>example<span class="w2"> </span>because<span class="w1"> </span>execution<span class="w2"> </span>reaches<span class="w1"> </span>a</div><div class="l f7 s4 t0" style="top:398.775px;left:492.524px;" data-x="492.524" data-y="393.225">break</div><div class="l f2 s4 t0" style="top:398.775px;left:518.233px;" data-x="518.233" data-y="393.225">or</div><div class="l f7 s4 t0" style="top:398.775px;left:527.873px;" data-x="527.873" data-y="393.225">return</div><div class="l f2 s4 t0" style="top:408.737px;left:317.014px;" data-x="317.014" data-y="383.263">statement.<span class="w1"> </span>In<span class="w1"> </span>this<span class="w1"> </span>case,<span class="w1"> </span>the<span class="w1"> </span>VM<span class="w2"> </span>simply<span class="w1"> </span>ends<span class="w1"> </span>the<span class="w1"> </span>trace<span class="w1"> </span>with<span class="w1"> </span>an<span class="w1"> </span>exit</div><div class="l f2 s4 t0" style="top:418.7px;left:317.014px;" data-x="317.014" data-y="373.3">to<span class="w2"> </span>the<span class="w1"> </span>trace<span class="w1"> </span>monitor.</div><div class="l f2 s4 t0" style="top:428.662px;left:328.969px;" data-x="328.969" data-y="363.338">As<span class="w1"> </span>mentioned<span class="w1"> </span>previously,<span class="w1"> </span>we<span class="w1"> </span>may<span class="w0"> </span>speculatively<span class="w1"> </span>chose<span class="w1"> </span>to<span class="w1"> </span>rep-</div><div class="l f2 s4 t0" style="top:438.625px;left:317.014px;" data-x="317.014" data-y="353.375">resent<span class="w1"> </span>certain<span class="w2"> </span>Number-typed<span class="w1"> </span>values<span class="w1"> </span>as<span class="w1"> </span>integers<span class="w1"> </span>on<span class="w2"> </span>trace.<span class="w1"> </span>We<span class="w1"> </span>do<span class="w2"> </span>so</div><div class="l f2 s4 t0" style="top:448.588px;left:317.014px;" data-x="317.014" data-y="343.412">when<span class="w1"> </span>we<span class="w1"> </span>observe<span class="w1"> </span>that<span class="w1"> </span>Number-typed<span class="w0"> </span>variables<span class="w2"> </span>contain<span class="w0"> </span>an<span class="w2"> </span>integer</div><div class="l f2 s4 t0" style="top:458.55px;left:317.014px;" data-x="317.014" data-y="333.45">value<span class="w1"> </span>at<span class="w2"> </span>trace<span class="w1"> </span>entry.<span class="w1"> </span>If<span class="w1"> </span>during<span class="w1"> </span>trace<span class="w1"> </span>recording<span class="w2"> </span>the<span class="w1"> </span>variable<span class="w1"> </span>is<span class="w1"> </span>unex-</div><div class="l f2 s4 t0" style="top:468.513px;left:317.014px;" data-x="317.014" data-y="323.487">pectedly<span class="w1"> </span>assigned<span class="w1"> </span>a<span class="w1"> </span>non-integer<span class="w1"> </span>value,<span class="w1"> </span>we<span class="w1"> </span>have<span class="w1"> </span>to<span class="w1"> </span>widen<span class="w1"> </span>the<span class="w1"> </span>type</div><div class="l f2 s4 t0" style="top:478.476px;left:317.014px;" data-x="317.014" data-y="313.524">of<span class="w2"> </span>the<span class="w1"> </span>variable<span class="w1"> </span>to<span class="w2"> </span>a<span class="w1"> </span>double.<span class="w2"> </span>As<span class="w1"> </span>a<span class="w1"> </span>result,<span class="w2"> </span>the<span class="w1"> </span>recorded<span class="w1"> </span>trace<span class="w2"> </span>becomes</div><div class="l f2 s4 t0" style="top:488.438px;left:317.014px;" data-x="317.014" data-y="303.562">inherently<span class="w1"> </span>type-unstable<span class="w0"> </span>since<span class="w1"> </span>it<span class="w0"> </span>starts<span class="w1"> </span>with<span class="w0"> </span>an<span class="w1"> </span>integer<span class="w0"> </span>value<span class="w1"> </span>but</div><div class="l f2 s4 t0" style="top:498.401px;left:317.014px;" data-x="317.014" data-y="293.599">ends<span class="w1"> </span>with<span class="w1"> </span>a<span class="w2"> </span>double<span class="w1"> </span>value.<span class="w1"> </span>This<span class="w1"> </span>represents<span class="w1"> </span>a<span class="w1"> </span>mis-speculation,<span class="w1"> </span>since</div><div class="l f2 s4 t0" style="top:508.364px;left:317.014px;" data-x="317.014" data-y="283.636">at<span class="w2"> </span>trace<span class="w1"> </span>entry<span class="w1"> </span>we<span class="w2"> </span>specialized<span class="w1"> </span>the<span class="w2"> </span>Number-typed<span class="w1"> </span>value<span class="w2"> </span>to<span class="w1"> </span>an<span class="w1"> </span>integer,</div><div class="l f2 s4 t0" style="top:518.326px;left:317.014px;" data-x="317.014" data-y="273.674">assuming<span class="w2"> </span>that<span class="w1"> </span>at<span class="w2"> </span>the<span class="w2"> </span>loop<span class="w1"> </span>edge<span class="w2"> </span>we<span class="w2"> </span>would<span class="w1"> </span>again<span class="w2"> </span>find<span class="w1"> </span>an<span class="w2"> </span>integer<span class="w2"> </span>value</div><div class="l f2 s4 t0" style="top:528.289px;left:317.014px;" data-x="317.014" data-y="263.711">in<span class="w2"> </span>the<span class="w1"> </span>variable,<span class="w1"> </span>allowing<span class="w2"> </span>us<span class="w1"> </span>to<span class="w2"> </span>close<span class="w1"> </span>the<span class="w1"> </span>loop.<span class="w2"> </span>To<span class="w1"> </span>avoid<span class="w2"> </span>future<span class="w1"> </span>spec-</div><div class="l f2 s4 t0" style="top:538.252px;left:317.014px;" data-x="317.014" data-y="253.748">ulative<span class="w1"> </span>failures<span class="w2"> </span>involving<span class="w1"> </span>this<span class="w1"> </span>variable,<span class="w1"> </span>and<span class="w1"> </span>to<span class="w1"> </span>obtain<span class="w1"> </span>a<span class="w1"> </span>type-stable</div><div class="l f2 s4 t0" style="top:548.214px;left:317.014px;" data-x="317.014" data-y="243.786">trace<span class="w2"> </span>we<span class="w1"> </span>note<span class="w2"> </span>the<span class="w1"> </span>fact<span class="w2"> </span>that<span class="w1"> </span>the<span class="w2"> </span>variable<span class="w2"> </span>in<span class="w1"> </span>question<span class="w2"> </span>as<span class="w1"> </span>been<span class="w2"> </span>observed</div><div class="l f2 s4 t0" style="top:558.177px;left:317.014px;" data-x="317.014" data-y="233.823">to<span class="w2"> </span>sometimes<span class="w1"> </span>hold<span class="w1"> </span>non-integer<span class="w1"> </span>values<span class="w2"> </span>in<span class="w1"> </span>an<span class="w1"> </span>advisory<span class="w2"> </span>data<span class="w1"> </span>structure</div><div class="l f2 s4 t0" style="top:568.139px;left:317.014px;" data-x="317.014" data-y="223.861">which<span class="w2"> </span>we<span class="w1"> </span>call<span class="w1"> </span>the<span class="w2"> </span>“oracle”.</div><div class="l f2 s4 t0" style="top:578.102px;left:328.969px;" data-x="328.969" data-y="213.898">When<span class="w1"> </span>compiling<span class="w1"> </span>loops,<span class="w1"> </span>we<span class="w1"> </span>consult<span class="w2"> </span>the<span class="w1"> </span>oracle<span class="w1"> </span>before<span class="w1"> </span>specializ-</div><div class="l f2 s4 t0" style="top:588.065px;left:317.014px;" data-x="317.014" data-y="203.935">ing<span class="w1"> </span>values<span class="w1"> </span>to<span class="w0"> </span>integers.<span class="w1"> </span>Speculation<span class="w1"> </span>towards<span class="w1"> </span>integers<span class="w1"> </span>is<span class="w0"> </span>performed</div><div class="l f2 s4 t0" style="top:598.027px;left:317.014px;" data-x="317.014" data-y="193.973">only<span class="w1"> </span>if<span class="w0"> </span>no<span class="w1"> </span>adverse<span class="w1"> </span>information<span class="w1"> </span>is<span class="w0"> </span>known<span class="w1"> </span>to<span class="w1"> </span>the<span class="w1"> </span>oracle<span class="w0"> </span>about<span class="w1"> </span>that</div><div class="l f2 s4 t0" style="top:607.99px;left:317.014px;" data-x="317.014" data-y="184.01">particular<span class="w1"> </span>variable.<span class="w2"> </span>Whenever<span class="w1"> </span>we<span class="w1"> </span>accidentally<span class="w1"> </span>compile<span class="w1"> </span>a<span class="w1"> </span>loop<span class="w1"> </span>that</div><div class="l f2 s4 t0" style="top:617.953px;left:317.014px;" data-x="317.014" data-y="174.047">is<span class="w1"> </span>type-unstable<span class="w0"> </span>due<span class="w1"> </span>to<span class="w0"> </span>mis-speculation<span class="w1"> </span>of<span class="w1"> </span>a<span class="w0"> </span>Number-typed<span class="w1"> </span>vari-</div><div class="l f2 s4 t0" style="top:627.915px;left:317.014px;" data-x="317.014" data-y="164.085">able,<span class="w1"> </span>we<span class="w1"> </span>immediately<span class="w1"> </span>trigger<span class="w1"> </span>the<span class="w0"> </span>recording<span class="w2"> </span>of<span class="w0"> </span>a<span class="w1"> </span>new<span class="w1"> </span>trace,<span class="w1"> </span>which</div><div class="l f2 s4 t0" style="top:637.878px;left:317.014px;" data-x="317.014" data-y="154.122">based<span class="w2"> </span>on<span class="w1"> </span>the<span class="w1"> </span>now<span class="w2"> </span>updated<span class="w1"> </span>oracle<span class="w1"> </span>information<span class="w2"> </span>will<span class="w1"> </span>start<span class="w1"> </span>with<span class="w2"> </span>a<span class="w1"> </span>dou-</div><div class="l f2 s4 t0" style="top:647.841px;left:317.014px;" data-x="317.014" data-y="144.159">ble<span class="w2"> </span>value<span class="w1"> </span>and<span class="w2"> </span>thus<span class="w1"> </span>become<span class="w1"> </span>type<span class="w2"> </span>stable.</div><div class="l f1 s4 t0" style="top:657.803px;left:328.969px;" data-x="328.969" data-y="134.197">Extending<span class="w0"> </span>a<span class="w1"> </span>tree.</div><div class="l f2 s4 t0" style="top:657.803px;left:401.212px;" data-x="401.212" data-y="134.197">Side<span class="w0"> </span>exits<span class="w1"> </span>lead<span class="w0"> </span>to<span class="w1"> </span>different<span class="w0"> </span>paths<span class="w1"> </span>through</div><div class="l f2 s4 t0" style="top:667.766px;left:317.014px;" data-x="317.014" data-y="124.234">the<span class="w1"> </span>loop,<span class="w1"> </span>or<span class="w1"> </span>paths<span class="w1"> </span>with<span class="w1"> </span>different<span class="w2"> </span>types<span class="w1"> </span>or<span class="w1"> </span>representations.<span class="w1"> </span>Thus,<span class="w1"> </span>to</div><div class="l f2 s4 t0" style="top:677.728px;left:317.014px;" data-x="317.014" data-y="114.272">completely<span class="w2"> </span>cover<span class="w2"> </span>the<span class="w1"> </span>loop,<span class="w2"> </span>the<span class="w1"> </span>VM<span class="w2"> </span>must<span class="w1"> </span>record<span class="w2"> </span>traces<span class="w2"> </span>starting<span class="w1"> </span>at<span class="w2"> </span>all</div><div class="l f2 s4 t0" style="top:687.691px;left:317.014px;" data-x="317.014" data-y="104.309">side<span class="w2"> </span>exits.<span class="w1"> </span>These<span class="w1"> </span>traces<span class="w1"> </span>are<span class="w2"> </span>recorded<span class="w1"> </span>much<span class="w1"> </span>like<span class="w2"> </span>root<span class="w1"> </span>traces:<span class="w1"> </span>there<span class="w1"> </span>is</div><div class="l f2 s4 t0" style="top:697.654px;left:317.014px;" data-x="317.014" data-y="94.3462">a<span class="w2"> </span>counter<span class="w1"> </span>for<span class="w2"> </span>each<span class="w2"> </span>side<span class="w1"> </span>exit,<span class="w2"> </span>and<span class="w1"> </span>when<span class="w2"> </span>the<span class="w2"> </span>counter<span class="w1"> </span>reaches<span class="w2"> </span>a<span class="w1"> </span>hotness</div><div class="l f2 s4 t0" style="top:707.616px;left:317.014px;" data-x="317.014" data-y="84.3835">threshold,<span class="w1"> </span>recording<span class="w1"> </span>starts.<span class="w2"> </span>Recording<span class="w1"> </span>stops<span class="w1"> </span>exactly<span class="w1"> </span>as<span class="w1"> </span>for<span class="w1"> </span>the<span class="w1"> </span>root</div><div class="l f2 s4 t0" style="top:717.579px;left:317.014px;" data-x="317.014" data-y="74.4209">trace,<span class="w2"> </span>using<span class="w1"> </span>the<span class="w1"> </span>loop<span class="w2"> </span>header<span class="w1"> </span>of<span class="w1"> </span>the<span class="w2"> </span>root<span class="w1"> </span>trace<span class="w2"> </span>as<span class="w1"> </span>the<span class="w1"> </span>target<span class="w2"> </span>to<span class="w1"> </span>reach.</div></div></div><div id="page-6" class="p" style="width:612px;height:792px;"><div class="t"><div class="l f2 s4 t0" style="top:79.9701px;left:65.9552px;" data-x="65.9552" data-y="712.03">Our<span class="w2"> </span>implementation<span class="w1"> </span>does<span class="w1"> </span>not<span class="w1"> </span>extend<span class="w2"> </span>at<span class="w1"> </span>all<span class="w1"> </span>side<span class="w2"> </span>exits.<span class="w1"> </span>It<span class="w1"> </span>extends</div><div class="l f2 s4 t0" style="top:89.9328px;left:54px;" data-x="54" data-y="702.067">only<span class="w2"> </span>if<span class="w1"> </span>the<span class="w2"> </span>side<span class="w1"> </span>exit<span class="w2"> </span>is<span class="w2"> </span>for<span class="w1"> </span>a<span class="w2"> </span>control-flow<span class="w1"> </span>branch,<span class="w2"> </span>and<span class="w1"> </span>only<span class="w2"> </span>if<span class="w2"> </span>the<span class="w1"> </span>side</div><div class="l f2 s4 t0" style="top:99.8954px;left:54px;" data-x="54" data-y="692.105">exit<span class="w2"> </span>does<span class="w1"> </span>not<span class="w1"> </span>leave<span class="w2"> </span>the<span class="w1"> </span>loop.<span class="w2"> </span>In<span class="w1"> </span>particular<span class="w1"> </span>we<span class="w2"> </span>do<span class="w1"> </span>not<span class="w1"> </span>want<span class="w2"> </span>to<span class="w1"> </span>extend</div><div class="l f2 s4 t0" style="top:109.858px;left:54px;" data-x="54" data-y="682.142">a<span class="w1"> </span>trace<span class="w0"> </span>tree<span class="w1"> </span>along<span class="w1"> </span>a<span class="w1"> </span>path<span class="w0"> </span>that<span class="w1"> </span>leads<span class="w1"> </span>to<span class="w0"> </span>an<span class="w1"> </span>outer<span class="w1"> </span>loop,<span class="w1"> </span>because<span class="w0"> </span>we</div><div class="l f2 s4 t0" style="top:119.821px;left:54px;" data-x="54" data-y="672.179">want<span class="w2"> </span>to<span class="w1"> </span>cover<span class="w2"> </span>such<span class="w1"> </span>paths<span class="w1"> </span>in<span class="w2"> </span>an<span class="w1"> </span>outer<span class="w1"> </span>tree<span class="w2"> </span>through<span class="w1"> </span>tree</div><div class="l fa s4 t0" style="top:119.821px;left:246.623px;" data-x="246.623" data-y="672.179">nesting</div><div class="l f2 s4 t0" style="top:119.821px;left:272.527px;" data-x="272.527" data-y="672.179">.</div><div class="l f1 s4 t0" style="top:137.355px;left:54px;" data-x="54" data-y="654.645">3.3<span class="w10"> </span>Blacklisting</div><div class="l f2 s4 t0" style="top:151.303px;left:54px;" data-x="54" data-y="640.697">Sometimes,<span class="w0"> </span>a<span class="w0"> </span>program<span class="w1"> </span>follows<span class="w0"> </span>a<span class="w0"> </span>path<span class="w0"> </span>that<span class="w1"> </span>cannot<span class="w0"> </span>be<span class="w0"> </span>compiled</div><div class="l f2 s4 t0" style="top:161.265px;left:54px;" data-x="54" data-y="630.735">into<span class="w1"> </span>a<span class="w1"> </span>trace,<span class="w1"> </span>usually<span class="w1"> </span>because<span class="w1"> </span>of<span class="w1"> </span>limitations<span class="w1"> </span>in<span class="w1"> </span>the<span class="w1"> </span>implementation.</div><div class="l f2 s4 t0" style="top:171.228px;left:54px;" data-x="54" data-y="620.772">TraceMonkey<span class="w1"> </span>does<span class="w1"> </span>not<span class="w1"> </span>currently<span class="w0"> </span>support<span class="w1"> </span>recording<span class="w1"> </span>throwing<span class="w0"> </span>and</div><div class="l f2 s4 t0" style="top:181.191px;left:54px;" data-x="54" data-y="610.809">catching<span class="w1"> </span>of<span class="w2"> </span>arbitrary<span class="w1"> </span>exceptions.<span class="w1"> </span>This<span class="w2"> </span>design<span class="w1"> </span>trade<span class="w1"> </span>off<span class="w2"> </span>was<span class="w1"> </span>chosen,</div><div class="l f2 s4 t0" style="top:191.153px;left:54px;" data-x="54" data-y="600.847">because<span class="w1"> </span>exceptions<span class="w0"> </span>are<span class="w1"> </span>usually<span class="w0"> </span>rare<span class="w1"> </span>in<span class="w0"> </span>JavaScript.<span class="w1"> </span>However</div><div class="l f2 s4 t0" style="top:191.153px;left:274.304px;" data-x="274.304" data-y="600.847">,<span class="w1"> </span>if<span class="w0"> </span>a</div><div class="l f2 s4 t0" style="top:201.116px;left:54px;" data-x="54" data-y="590.884">program<span class="w0"> </span>opts<span class="w1"> </span>to<span class="w0"> </span>use<span class="w1"> </span>exceptions<span class="w0"> </span>intensively,<span class="w1"> </span>we<span class="w0"> </span>would<span class="w1"> </span>suddenly</div><div class="l f2 s4 t0" style="top:211.079px;left:54px;" data-x="54" data-y="580.921">incur<span class="w1"> </span>a<span class="w1"> </span>punishing<span class="w1"> </span>runtime<span class="w1"> </span>overhead<span class="w1"> </span>if<span class="w1"> </span>we<span class="w1"> </span>repeatedly<span class="w1"> </span>try<span class="w1"> </span>to<span class="w1"> </span>record</div><div class="l f2 s4 t0" style="top:221.041px;left:54px;" data-x="54" data-y="570.959">a<span class="w1"> </span>trace<span class="w0"> </span>for<span class="w1"> </span>this<span class="w1"> </span>path<span class="w0"> </span>and<span class="w1"> </span>repeatedly<span class="w1"> </span>fail<span class="w0"> </span>to<span class="w1"> </span>do<span class="w1"> </span>so,<span class="w0"> </span>since<span class="w1"> </span>we<span class="w1"> </span>abort</div><div class="l f2 s4 t0" style="top:231.004px;left:54px;" data-x="54" data-y="560.996">tracing<span class="w2"> </span>every<span class="w1"> </span>time<span class="w2"> </span>we<span class="w1"> </span>observe<span class="w1"> </span>an<span class="w2"> </span>exception<span class="w1"> </span>being<span class="w2"> </span>thrown.</div><div class="l f2 s4 t0" style="top:240.966px;left:65.9552px;" data-x="65.9552" data-y="551.034">As<span class="w2"> </span>a<span class="w1"> </span>result,<span class="w2"> </span>if<span class="w1"> </span>a<span class="w2"> </span>hot<span class="w2"> </span>loop<span class="w1"> </span>contains<span class="w2"> </span>traces<span class="w1"> </span>that<span class="w2"> </span>always<span class="w2"> </span>fail,<span class="w1"> </span>the<span class="w2"> </span>VM</div><div class="l f2 s4 t0" style="top:250.929px;left:54px;" data-x="54" data-y="541.071">could<span class="w1"> </span>potentially<span class="w1"> </span>run<span class="w1"> </span>much<span class="w1"> </span>more<span class="w1"> </span>slowly<span class="w1"> </span>than<span class="w1"> </span>the<span class="w1"> </span>base<span class="w1"> </span>interpreter:</div><div class="l f2 s4 t0" style="top:260.892px;left:54px;" data-x="54" data-y="531.108">the<span class="w2"> </span>VM<span class="w1"> </span>repeatedly<span class="w1"> </span>spends<span class="w2"> </span>time<span class="w1"> </span>trying<span class="w1"> </span>to<span class="w2"> </span>record<span class="w1"> </span>traces,<span class="w1"> </span>but<span class="w2"> </span>is<span class="w1"> </span>never</div><div class="l f2 s4 t0" style="top:270.854px;left:54px;" data-x="54" data-y="521.146">able<span class="w1"> </span>to<span class="w1"> </span>run<span class="w2"> </span>any.<span class="w1"> </span>To<span class="w2"> </span>avoid<span class="w1"> </span>this<span class="w1"> </span>problem,<span class="w1"> </span>whenever<span class="w2"> </span>the<span class="w1"> </span>VM<span class="w1"> </span>is<span class="w1"> </span>about</div><div class="l f2 s4 t0" style="top:280.817px;left:54px;" data-x="54" data-y="511.183">to<span class="w2"> </span>start<span class="w1"> </span>tracing,<span class="w2"> </span>it<span class="w1"> </span>must<span class="w2"> </span>try<span class="w1"> </span>to<span class="w2"> </span>predict<span class="w1"> </span>whether<span class="w2"> </span>it<span class="w1"> </span>will<span class="w2"> </span>finish<span class="w1"> </span>the<span class="w2"> </span>trace.</div><div class="l f2 s4 t0" style="top:290.78px;left:65.9552px;" data-x="65.9552" data-y="501.22">Our<span class="w0"> </span>prediction<span class="w1"> </span>algorithm<span class="w0"> </span>is<span class="w1"> </span>based<span class="w0"> </span>on</div><div class="l fa s4 t0" style="top:290.78px;left:209.431px;" data-x="209.431" data-y="501.22">blacklisting</div><div class="l f2 s4 t0" style="top:290.78px;left:254.921px;" data-x="254.921" data-y="501.22">traces<span class="w0"> </span>that</div><div class="l f2 s4 t0" style="top:300.742px;left:54px;" data-x="54" data-y="491.258">have<span class="w2"> </span>been<span class="w2"> </span>tried<span class="w1"> </span>and<span class="w2"> </span>failed.<span class="w2"> </span>When<span class="w1"> </span>the<span class="w2"> </span>VM<span class="w1"> </span>fails<span class="w2"> </span>to<span class="w2"> </span>finish<span class="w1"> </span>a<span class="w2"> </span>trace<span class="w2"> </span>start-</div><div class="l f2 s4 t0" style="top:310.705px;left:54px;" data-x="54" data-y="481.295">ing<span class="w2"> </span>at<span class="w1"> </span>a<span class="w2"> </span>given<span class="w2"> </span>point,<span class="w2"> </span>the<span class="w1"> </span>VM<span class="w2"> </span>records<span class="w1"> </span>that<span class="w2"> </span>a<span class="w2"> </span>failure<span class="w1"> </span>has<span class="w2"> </span>occurred.<span class="w1"> </span>The</div><div class="l f2 s4 t0" style="top:320.667px;left:54px;" data-x="54" data-y="471.333">VM<span class="w2"> </span>also<span class="w2"> </span>sets<span class="w1"> </span>a<span class="w2"> </span>counter<span class="w2"> </span>so<span class="w2"> </span>that<span class="w1"> </span>it<span class="w2"> </span>will<span class="w2"> </span>not<span class="w2"> </span>try<span class="w1"> </span>to<span class="w2"> </span>record<span class="w2"> </span>a<span class="w2"> </span>trace<span class="w1"> </span>starting</div><div class="l f2 s4 t0" style="top:330.63px;left:54px;" data-x="54" data-y="461.37">at<span class="w1"> </span>that<span class="w1"> </span>point<span class="w1"> </span>until<span class="w1"> </span>it<span class="w1"> </span>is<span class="w1"> </span>passed<span class="w1"> </span>a<span class="w1"> </span>few<span class="w1"> </span>more<span class="w0"> </span>times<span class="w2"> </span>(32<span class="w1"> </span>in<span class="w1"> </span>our<span class="w0"> </span>imple-</div><div class="l f2 s4 t0" style="top:340.593px;left:54px;" data-x="54" data-y="451.407">mentation).<span class="w1"> </span>This</div><div class="l fa s4 t0" style="top:340.593px;left:117.226px;" data-x="117.226" data-y="451.407">backoff</div><div class="l f2 s4 t0" style="top:340.593px;left:147.597px;" data-x="147.597" data-y="451.407">counter<span class="w1"> </span>gives<span class="w1"> </span>temporary<span class="w1"> </span>conditions<span class="w0"> </span>that</div><div class="l f2 s4 t0" style="top:350.555px;left:54px;" data-x="54" data-y="441.445">prevent<span class="w1"> </span>tracing<span class="w1"> </span>a<span class="w1"> </span>chance<span class="w1"> </span>to<span class="w1"> </span>end.<span class="w1"> </span>For<span class="w1"> </span>example,<span class="w1"> </span>a<span class="w1"> </span>loop<span class="w1"> </span>may<span class="w1"> </span>behave</div><div class="l f2 s4 t0" style="top:360.518px;left:54px;" data-x="54" data-y="431.482">differently<span class="w2"> </span>during<span class="w2"> </span>startup<span class="w1"> </span>than<span class="w2"> </span>during<span class="w2"> </span>its<span class="w1"> </span>steady-state<span class="w2"> </span>execution.<span class="w2"> </span>Af-</div><div class="l f2 s4 t0" style="top:370.481px;left:54px;" data-x="54" data-y="421.519">ter<span class="w1"> </span>a<span class="w1"> </span>given<span class="w1"> </span>number<span class="w1"> </span>of<span class="w1"> </span>failures<span class="w1"> </span>(2<span class="w1"> </span>in<span class="w1"> </span>our<span class="w1"> </span>implementation),<span class="w1"> </span>the<span class="w1"> </span>VM</div><div class="l f2 s4 t0" style="top:380.443px;left:54px;" data-x="54" data-y="411.557">marks<span class="w2"> </span>the<span class="w1"> </span>fragment<span class="w2"> </span>as<span class="w1"> </span>blacklisted,<span class="w1"> </span>which<span class="w2"> </span>means<span class="w1"> </span>the<span class="w2"> </span>VM<span class="w1"> </span>will<span class="w2"> </span>never</div><div class="l f2 s4 t0" style="top:390.406px;left:54px;" data-x="54" data-y="401.594">again<span class="w2"> </span>start<span class="w1"> </span>recording<span class="w1"> </span>at<span class="w2"> </span>that<span class="w1"> </span>point.</div><div class="l f2 s4 t0" style="top:400.369px;left:65.9552px;" data-x="65.9552" data-y="391.631">After<span class="w0"> </span>implementing<span class="w1"> </span>this<span class="w0"> </span>basic<span class="w1"> </span>strategy,<span class="w0"> </span>we<span class="w1"> </span>observed<span class="w0"> </span>that<span class="w1"> </span>for</div><div class="l f2 s4 t0" style="top:410.331px;left:54px;" data-x="54" data-y="381.669">small<span class="w1"> </span>loops<span class="w2"> </span>that<span class="w1"> </span>get<span class="w1"> </span>blacklisted,<span class="w1"> </span>the<span class="w1"> </span>system<span class="w2"> </span>can<span class="w1"> </span>spend<span class="w1"> </span>a<span class="w1"> </span>noticeable</div><div class="l f2 s4 t0" style="top:420.294px;left:54px;" data-x="54" data-y="371.706">amount<span class="w2"> </span>of<span class="w1"> </span>time<span class="w2"> </span>just<span class="w1"> </span>finding<span class="w1"> </span>the<span class="w2"> </span>loop<span class="w1"> </span>fragment<span class="w2"> </span>and<span class="w1"> </span>determining<span class="w2"> </span>that</div><div class="l f2 s4 t0" style="top:430.256px;left:54px;" data-x="54" data-y="361.744">it<span class="w2"> </span>has<span class="w1"> </span>been<span class="w2"> </span>blacklisted.<span class="w1"> </span>We<span class="w2"> </span>now<span class="w2"> </span>avoid<span class="w1"> </span>that<span class="w2"> </span>problem<span class="w1"> </span>by<span class="w2"> </span>patching<span class="w1"> </span>the</div><div class="l f2 s4 t0" style="top:440.219px;left:54px;" data-x="54" data-y="351.781">bytecode.<span class="w1"> </span>We<span class="w2"> </span>define<span class="w1"> </span>an<span class="w1"> </span>extra<span class="w1"> </span>no-op<span class="w1"> </span>bytecode<span class="w2"> </span>that<span class="w1"> </span>indicates<span class="w1"> </span>a<span class="w1"> </span>loop</div><div class="l f2 s4 t0" style="top:450.182px;left:54px;" data-x="54" data-y="341.818">header.<span class="w1"> </span>The<span class="w1"> </span>VM<span class="w1"> </span>calls<span class="w1"> </span>into<span class="w1"> </span>the<span class="w1"> </span>trace<span class="w1"> </span>monitor<span class="w0"> </span>ev</div><div class="l f2 s4 t0" style="top:450.182px;left:226.729px;" data-x="226.729" data-y="341.818">ery<span class="w1"> </span>time<span class="w1"> </span>the<span class="w1"> </span>inter-</div><div class="l f2 s4 t0" style="top:460.144px;left:54px;" data-x="54" data-y="331.856">preter<span class="w1"> </span>executes<span class="w1"> </span>a<span class="w0"> </span>loop<span class="w1"> </span>header<span class="w1"> </span>no-op.<span class="w1"> </span>To<span class="w1"> </span>blacklist<span class="w1"> </span>a<span class="w0"> </span>fragment,<span class="w1"> </span>we</div><div class="l f2 s4 t0" style="top:470.107px;left:54px;" data-x="54" data-y="321.893">simply<span class="w1"> </span>replace<span class="w1"> </span>the<span class="w1"> </span>loop<span class="w1"> </span>header<span class="w1"> </span>no-op<span class="w1"> </span>with<span class="w1"> </span>a<span class="w1"> </span>regular<span class="w1"> </span>no-op.<span class="w0"> </span>Thus,</div><div class="l f2 s4 t0" style="top:480.07px;left:54px;" data-x="54" data-y="311.93">the<span class="w2"> </span>interpreter<span class="w1"> </span>will<span class="w1"> </span>never<span class="w2"> </span>again<span class="w1"> </span>even<span class="w2"> </span>call<span class="w1"> </span>into<span class="w2"> </span>the<span class="w1"> </span>trace<span class="w1"> </span>monitor.</div><div class="l f2 s4 t0" style="top:490.032px;left:65.9552px;" data-x="65.9552" data-y="301.968">There<span class="w2"> </span>is<span class="w1"> </span>a<span class="w2"> </span>related<span class="w2"> </span>problem<span class="w1"> </span>we<span class="w2"> </span>have<span class="w1"> </span>not<span class="w2"> </span>yet<span class="w2"> </span>solved,<span class="w1"> </span>which<span class="w2"> </span>occurs</div><div class="l f2 s4 t0" style="top:499.995px;left:54px;" data-x="54" data-y="292.005">when<span class="w2"> </span>a<span class="w1"> </span>loop<span class="w1"> </span>meets<span class="w2"> </span>all<span class="w1"> </span>of<span class="w1"> </span>these<span class="w2"> </span>conditions:</div><div class="l f3 s3 t0" style="top:513.941px;left:59.2303px;" data-x="59.2303" data-y="278.059">•</div><div class="l f2 s4 t0" style="top:514.839px;left:66.9514px;" data-x="66.9514" data-y="277.161">The<span class="w2"> </span>VM<span class="w1"> </span>can<span class="w1"> </span>form<span class="w2"> </span>at<span class="w1"> </span>least<span class="w1"> </span>one<span class="w2"> </span>root<span class="w1"> </span>trace<span class="w2"> </span>for<span class="w1"> </span>the<span class="w1"> </span>loop.</div><div class="l f3 s3 t0" style="top:527.889px;left:59.2303px;" data-x="59.2303" data-y="264.111">•</div><div class="l f2 s4 t0" style="top:528.787px;left:66.9514px;" data-x="66.9514" data-y="263.213">There<span class="w1"> </span>is<span class="w0"> </span>at<span class="w1"> </span>least<span class="w0"> </span>one<span class="w1"> </span>hot<span class="w0"> </span>side<span class="w1"> </span>exit<span class="w0"> </span>for<span class="w1"> </span>which<span class="w1"> </span>the<span class="w0"> </span>VM<span class="w1"> </span>cannot</div><div class="l f2 s4 t0" style="top:538.75px;left:66.9514px;" data-x="66.9514" data-y="253.25">complete<span class="w2"> </span>a<span class="w1"> </span>trace.</div><div class="l f3 s3 t0" style="top:551.799px;left:59.2303px;" data-x="59.2303" data-y="240.201">•</div><div class="l f2 s4 t0" style="top:552.697px;left:66.9514px;" data-x="66.9514" data-y="239.303">The<span class="w2"> </span>loop<span class="w1"> </span>body<span class="w1"> </span>is<span class="w2"> </span>short.</div><div class="l f2 s4 t0" style="top:567.542px;left:65.9551px;" data-x="65.9551" data-y="224.458">In<span class="w2"> </span>this<span class="w1"> </span>case,<span class="w2"> </span>the<span class="w2"> </span>VM<span class="w1"> </span>will<span class="w2"> </span>repeatedly<span class="w1"> </span>pass<span class="w2"> </span>the<span class="w2"> </span>loop<span class="w1"> </span>header,<span class="w2"> </span>search</div><div class="l f2 s4 t0" style="top:577.504px;left:54px;" data-x="54" data-y="214.496">for<span class="w0"> </span>a<span class="w0"> </span>trace,<span class="w1"> </span>find<span class="w0"> </span>it,<span class="w0"> </span>execute<span class="w0"> </span>it,<span class="w0"> </span>and<span class="w0"> </span>fall<span class="w1"> </span>back<span class="w0"> </span>to<span class="w0"> </span>the<span class="w0"> </span>interpreter.</div><div class="l f2 s4 t0" style="top:587.467px;left:54px;" data-x="54" data-y="204.533">With<span class="w1"> </span>a<span class="w0"> </span>short<span class="w1"> </span>loop<span class="w0"> </span>body</div><div class="l f2 s4 t0" style="top:587.467px;left:141.091px;" data-x="141.091" data-y="204.533">,<span class="w1"> </span>the<span class="w0"> </span>overhead<span class="w1"> </span>of<span class="w0"> </span>finding<span class="w1"> </span>and<span class="w0"> </span>calling<span class="w1"> </span>the</div><div class="l f2 s4 t0" style="top:597.43px;left:54px;" data-x="54" data-y="194.57">trace<span class="w1"> </span>is<span class="w1"> </span>high,<span class="w1"> </span>and<span class="w0"> </span>causes<span class="w1"> </span>performance<span class="w1"> </span>to<span class="w1"> </span>be<span class="w1"> </span>even<span class="w1"> </span>slower<span class="w1"> </span>than<span class="w0"> </span>the</div><div class="l f2 s4 t0" style="top:607.392px;left:54px;" data-x="54" data-y="184.608">basic<span class="w1"> </span>interpreter.<span class="w0"> </span>So<span class="w1"> </span>far,<span class="w0"> </span>in<span class="w1"> </span>this<span class="w0"> </span>situation<span class="w1"> </span>we<span class="w0"> </span>have<span class="w1"> </span>improved<span class="w0"> </span>the</div><div class="l f2 s4 t0" style="top:617.355px;left:54px;" data-x="54" data-y="174.645">implementation<span class="w0"> </span>so<span class="w1"> </span>that<span class="w0"> </span>the<span class="w0"> </span>VM<span class="w1"> </span>can<span class="w0"> </span>complete<span class="w0"> </span>the<span class="w0"> </span>branch<span class="w1"> </span>trace.</div><div class="l f2 s4 t0" style="top:627.317px;left:54px;" data-x="54" data-y="164.683">But<span class="w1"> </span>it<span class="w0"> </span>is<span class="w1"> </span>hard<span class="w0"> </span>to<span class="w1"> </span>guarantee<span class="w0"> </span>that<span class="w1"> </span>this<span class="w1"> </span>situation<span class="w0"> </span>will<span class="w1"> </span>never<span class="w0"> </span>happen.</div><div class="l f2 s4 t0" style="top:637.28px;left:54px;" data-x="54" data-y="154.72">As<span class="w1"> </span>future<span class="w1"> </span>work,<span class="w0"> </span>this<span class="w1"> </span>situation<span class="w1"> </span>could<span class="w1"> </span>be<span class="w0"> </span>avoided<span class="w1"> </span>by<span class="w1"> </span>detecting<span class="w1"> </span>and</div><div class="l f2 s4 t0" style="top:647.243px;left:54px;" data-x="54" data-y="144.757">blacklisting<span class="w1"> </span>loops<span class="w0"> </span>for<span class="w1"> </span>which<span class="w0"> </span>the<span class="w0"> </span>av</div><div class="l f2 s4 t0" style="top:647.243px;left:184.945px;" data-x="184.945" data-y="144.757">erage<span class="w1"> </span>trace<span class="w0"> </span>call<span class="w1"> </span>executes<span class="w0"> </span>few</div><div class="l f2 s4 t0" style="top:657.206px;left:54px;" data-x="54" data-y="134.794">bytecodes<span class="w2"> </span>before<span class="w1"> </span>returning<span class="w1"> </span>to<span class="w2"> </span>the<span class="w1"> </span>interpreter.</div><div class="l f1 s2 t0" style="top:679.721px;left:54px;" data-x="54" data-y="112.279">4.<span class="w3"> </span>Nested<span class="w1"> </span>Trace<span class="w2"> </span>Tree<span class="w2"> </span>Formation</div><div class="l f2 s4 t0" style="top:693.669px;left:54px;" data-x="54" data-y="98.3313">Figure<span class="w2"> </span>7<span class="w1"> </span>shows<span class="w2"> </span>basic<span class="w2"> </span>trace<span class="w1"> </span>tree<span class="w2"> </span>compilation<span class="w1"> </span>(11)<span class="w2"> </span>applied<span class="w2"> </span>to<span class="w1"> </span>a<span class="w2"> </span>nested</div><div class="l f2 s4 t0" style="top:703.631px;left:54px;" data-x="54" data-y="88.3686">loop<span class="w1"> </span>where<span class="w0"> </span>the<span class="w1"> </span>inner<span class="w1"> </span>loop<span class="w1"> </span>contains<span class="w0"> </span>two<span class="w1"> </span>paths.<span class="w1"> </span>Usually,<span class="w1"> </span>the<span class="w0"> </span>inner</div><div class="l f2 s4 t0" style="top:713.594px;left:54px;" data-x="54" data-y="78.406">loop<span class="w2"> </span>(with<span class="w1"> </span>header<span class="w2"> </span>at</div><div class="l ff s4 t0" style="top:713.594px;left:127.814px;" data-x="127.814" data-y="78.406">i</div><div class="l f8 s5 t0" style="top:714.59px;left:130.967px;" data-x="130.967" data-y="77.4098">2</div><div class="l f2 s4 t0" style="top:713.594px;left:135.118px;" data-x="135.118" data-y="78.406">)<span class="w2"> </span>becomes<span class="w1"> </span>hot<span class="w2"> </span>first,<span class="w1"> </span>and<span class="w1"> </span>a<span class="w2"> </span>trace<span class="w1"> </span>tree<span class="w2"> </span>is<span class="w1"> </span>rooted</div><div class="l f2 s4 t0" style="top:723.557px;left:54px;" data-x="54" data-y="68.4434">at<span class="w1"> </span>that<span class="w1"> </span>point.<span class="w1"> </span>For<span class="w1"> </span>example,<span class="w1"> </span>the<span class="w1"> </span>first<span class="w1"> </span>recorded<span class="w1"> </span>trace<span class="w1"> </span>may<span class="w1"> </span>be<span class="w1"> </span>a<span class="w1"> </span>cycle</div></div><div class="t t28"></div><div class="t t29"></div><div class="t t2a"></div><div class="t t2b"><div class="l f11 s7 t2c" style="top:783.5px;left:-5.94141px;" data-x="407.908" data-y="702.485">T</div></div><div class="t t2a"></div><div class="t t2d"><div class="l f11 s7 t10" style="top:788px;left:-28.6289px;" data-x="449.541" data-y="683.903">T</div><div class="l f11 s7 t10" style="top:788px;left:-23.3027px;" data-x="451.523" data-y="683.903">runk
T</div><div class="l f11 s7 t10" style="top:788px;left:7.64062px;" data-x="463.038" data-y="683.903">r</div><div class="l f11 s7 t10" style="top:788px;left:11.6426px;" data-x="464.527" data-y="683.903">ace</div></div><div class="t t2a"></div><div class="t t2e"><div class="l f11 s7 t10" style="top:788px;left:-30.0703px;" data-x="449.004" data-y="693.951">T</div><div class="l f11 s7 t10" style="top:788px;left:-24.7441px;" data-x="450.986" data-y="693.951">r</div><div class="l f11 s7 t10" style="top:788px;left:-20.6133px;" data-x="452.524" data-y="693.951">ee
Anchor</div></div><div class="t t2a"></div><div class="t t2f"><div class="l f11 s7 t10" style="top:788px;left:-32.458px;" data-x="448.116" data-y="673.856">T</div><div class="l f11 s7 t10" style="top:788px;left:-27.1318px;" data-x="450.098" data-y="673.856">r</div><div class="l f11 s7 t10" style="top:788px;left:-23.1299px;" data-x="451.587" data-y="673.856">ace
Anchor</div></div><div class="t t2a"></div><div class="t t30"><div class="l f11 s7 t10" style="top:788px;left:-31.79px;" data-x="448.364" data-y="663.808">Br</div><div class="l f11 s7 t10" style="top:788px;left:-21.0615px;" data-x="452.357" data-y="663.808">anch
T</div><div class="l f11 s7 t10" style="top:788px;left:10.8018px;" data-x="464.214" data-y="663.808">r</div><div class="l f11 s7 t10" style="top:788px;left:14.8037px;" data-x="465.703" data-y="663.808">ace</div></div><div class="t t2a"></div><div class="t t31"><div class="l f11 s7 t10" style="top:788px;left:-15.2842px;" data-x="454.507" data-y="653.761">Guar</div><div class="l f11 s7 t10" style="top:788px;left:8.84473px;" data-x="463.486" data-y="653.761">d</div></div><div class="t t2a"></div><div class="t t32"><div class="l f11 s7 t10" style="top:788px;left:-21.1436px;" data-x="452.326" data-y="643.713">Side
Exit</div></div><div class="t t2a"></div><div class="t t33"></div><div class="t t0"><div class="l f1 s4 t0" style="top:229.65px;left:317.014px;" data-x="317.014" data-y="562.35">Figure<span class="w1"> </span>5.</div><div class="l f2 s4 t0" style="top:229.65px;left:357.068px;" data-x="357.068" data-y="562.35">A<span class="w1"> </span>tree<span class="w0"> </span>with<span class="w1"> </span>two<span class="w0"> </span>traces,<span class="w1"> </span>a<span class="w0"> </span>trunk<span class="w1"> </span>trace<span class="w0"> </span>and<span class="w1"> </span>one<span class="w0"> </span>branch</div><div class="l f2 s4 t0" style="top:239.613px;left:317.014px;" data-x="317.014" data-y="552.387">trace.<span class="w2"> </span>The<span class="w1"> </span>trunk<span class="w1"> </span>trace<span class="w2"> </span>contains<span class="w1"> </span>a<span class="w2"> </span>guard<span class="w1"> </span>to<span class="w1"> </span>which<span class="w2"> </span>a<span class="w1"> </span>branch<span class="w2"> </span>trace<span class="w1"> </span>was</div><div class="l f2 s4 t0" style="top:249.576px;left:317.014px;" data-x="317.014" data-y="542.424">attached.<span class="w2"> </span>The<span class="w1"> </span>branch<span class="w2"> </span>trace<span class="w1"> </span>contain<span class="w2"> </span>a<span class="w1"> </span>guard<span class="w2"> </span>that<span class="w1"> </span>may<span class="w2"> </span>fail<span class="w1"> </span>and<span class="w2"> </span>trigger</div><div class="l f2 s4 t0" style="top:259.538px;left:317.014px;" data-x="317.014" data-y="532.462">a<span class="w2"> </span>side<span class="w1"> </span>exit.<span class="w2"> </span>Both<span class="w2"> </span>the<span class="w1"> </span>trunk<span class="w2"> </span>and<span class="w1"> </span>the<span class="w2"> </span>branch<span class="w1"> </span>trace<span class="w2"> </span>loop<span class="w1"> </span>back<span class="w2"> </span>to<span class="w2"> </span>the<span class="w1"> </span>tree</div><div class="l f2 s4 t0" style="top:269.501px;left:317.014px;" data-x="317.014" data-y="522.499">anchor,<span class="w2"> </span>which<span class="w1"> </span>is<span class="w2"> </span>the<span class="w1"> </span>beginning<span class="w1"> </span>of<span class="w2"> </span>the<span class="w1"> </span>trace<span class="w2"> </span>tree.</div></div><div class="t t34"></div><div class="t t35"></div><div class="t t36"></div><div class="t t37"><div class="l f12 s7 t38" style="top:788.5px;left:-14.6289px;" data-x="400.607" data-y="492.915">T</div><div class="l f12 s7 t38" style="top:788.5px;left:-10.1904px;" data-x="402.676" data-y="492.915">r</div><div class="l f12 s7 t38" style="top:788.5px;left:-6.85547px;" data-x="404.231" data-y="492.915">ace
2</div></div><div class="t t36"></div><div class="t t39"><div class="l f12 s7 t38" style="top:788.5px;left:-14.6289px;" data-x="367.039" data-y="492.916">T</div><div class="l f12 s7 t38" style="top:788.5px;left:-10.1904px;" data-x="369.109" data-y="492.916">r</div><div class="l f12 s7 t38" style="top:788.5px;left:-6.85547px;" data-x="370.663" data-y="492.916">ace
1</div></div><div class="t t36"></div><div class="t t3a"><div class="l f12 s7 t38" style="top:788.5px;left:-14.6289px;" data-x="490.121" data-y="492.916">T</div><div class="l f12 s7 t38" style="top:788.5px;left:-10.1904px;" data-x="492.191" data-y="492.916">r</div><div class="l f12 s7 t38" style="top:788.5px;left:-6.85547px;" data-x="493.745" data-y="492.916">ace
2</div></div><div class="t t36"></div><div class="t t3b"><div class="l f12 s7 t38" style="top:788.5px;left:-14.6289px;" data-x="456.553" data-y="492.916">T</div><div class="l f12 s7 t38" style="top:788.5px;left:-10.1904px;" data-x="458.623" data-y="492.916">r</div><div class="l f12 s7 t38" style="top:788.5px;left:-6.85547px;" data-x="460.178" data-y="492.916">ace
1</div></div><div class="t t3c"><div class="l f12 s7 t38" style="top:788.5px;left:-13.7573px;" data-x="367.446" data-y="426.237">Closed</div></div><div class="t t3d"><div class="l f12 s7 t38" style="top:788.5px;left:-13.4888px;" data-x="401.139" data-y="426.238">Link</div><div class="l f12 s7 t38" style="top:788.5px;left:3.08838px;" data-x="408.867" data-y="426.238">ed</div></div><div class="t t3e"><div class="l f12 s7 t38" style="top:788.5px;left:-13.4888px;" data-x="457.085" data-y="426.238">Link</div><div class="l f12 s7 t38" style="top:788.5px;left:3.08838px;" data-x="464.814" data-y="426.238">ed</div></div><div class="t t3f"><div class="l f12 s7 t38" style="top:788.5px;left:-13.4888px;" data-x="490.653" data-y="426.238">Link</div><div class="l f12 s7 t38" style="top:788.5px;left:3.08838px;" data-x="498.381" data-y="426.238">ed</div></div><div class="t t36"></div><div class="t t40"><div class="l f12 s7 t41" style="top:789px;left:-19px;" data-x="358.474" data-y="386.695">Number</div></div><div class="t t36"></div><div class="t t42"><div class="l f12 s7 t41" style="top:789px;left:-19px;" data-x="397.637" data-y="348.759">Number</div></div><div class="t t43"><div class="l f12 s7 t41" style="top:789px;left:-15px;" data-x="485.924" data-y="384.83">String</div></div><div class="t t44"><div class="l f12 s7 t41" style="top:789px;left:-4.44922px;" data-x="441.718" data-y="348.759">String</div></div><div class="t t45"><div class="l f12 s7 t41" style="top:789px;left:-15px;" data-x="485.924" data-y="349.398">String</div></div><div class="t t46"><div class="l f12 s7 t41" style="top:789px;left:-15px;" data-x="362.204" data-y="341.938">String</div></div><div class="t t47"><div class="l f12 s7 t41" style="top:789px;left:-6.32031px;" data-x="441.778" data-y="386.056">Boolean</div></div><div class="t t36"></div><div class="t t48"><div class="l f12 s7 t38" style="top:788.5px;left:-14.6289px;" data-x="431.112" data-y="402.176">T</div><div class="l f12 s7 t38" style="top:788.5px;left:-10.1904px;" data-x="433.182" data-y="402.176">r</div><div class="l f12 s7 t38" style="top:788.5px;left:-6.85547px;" data-x="434.736" data-y="402.176">ace
2</div></div><div class="t t36"></div><div class="t t49"><div class="l f12 s7 t38" style="top:788.5px;left:-14.6289px;" data-x="367.039" data-y="402.176">T</div><div class="l f12 s7 t38" style="top:788.5px;left:-10.1904px;" data-x="369.109" data-y="402.176">r</div><div class="l f12 s7 t38" style="top:788.5px;left:-6.85547px;" data-x="370.663" data-y="402.176">ace
1</div></div><div class="t t36"></div><div class="t t4a"><div class="l f12 s7 t38" style="top:788.5px;left:-14.6289px;" data-x="490.76" data-y="402.176">T</div><div class="l f12 s7 t38" style="top:788.5px;left:-10.1904px;" data-x="492.829" data-y="402.176">r</div><div class="l f12 s7 t38" style="top:788.5px;left:-6.85547px;" data-x="494.384" data-y="402.176">ace
3</div></div><div class="t t4b"><div class="l f12 s7 t38" style="top:788.5px;left:-13.4888px;" data-x="367.571" data-y="328.504">Link</div><div class="l f12 s7 t38" style="top:788.5px;left:3.08838px;" data-x="375.299" data-y="328.504">ed</div></div><div class="t t4c"><div class="l f12 s7 t38" style="top:788.5px;left:-13.4888px;" data-x="406.733" data-y="332.234">Link</div><div class="l f12 s7 t38" style="top:788.5px;left:3.08838px;" data-x="414.462" data-y="332.234">ed</div></div><div class="t t4d"><div class="l f12 s7 t38" style="top:788.5px;left:-13.4888px;" data-x="431.644" data-y="332.234">Link</div><div class="l f12 s7 t38" style="top:788.5px;left:3.08838px;" data-x="439.372" data-y="332.234">ed</div></div><div class="t t4e"><div class="l f12 s7 t38" style="top:788.5px;left:-13.7573px;" data-x="490.528" data-y="332.009">Closed</div></div><div class="t t4f"><div class="l f12 s7 t41" style="top:789px;left:-19px;" data-x="358.474" data-y="477.435">Number</div></div><div class="t t50"><div class="l f12 s7 t41" style="top:789px;left:-19px;" data-x="358.474" data-y="438.273">Number</div></div><div class="t t51"><div class="l f12 s7 t41" style="top:789px;left:-6.23438px;" data-x="410.115" data-y="438.273">Number</div></div><div class="t t52"><div class="l f12 s7 t41" style="top:789px;left:-6.32031px;" data-x="410.075" data-y="477.435">Boolean</div></div><div class="t t53"><div class="l f12 s7 t41" style="top:789px;left:-19px;" data-x="447.988" data-y="477.435">Number</div></div><div class="t t54"><div class="l f12 s7 t41" style="top:789px;left:-19px;" data-x="447.988" data-y="438.273">Boolean</div></div><div class="t t55"><div class="l f12 s7 t41" style="top:789px;left:-6.23438px;" data-x="499.63" data-y="438.273">Number</div></div><div class="t t56"><div class="l f12 s7 t41" style="top:789px;left:-6.32031px;" data-x="499.59" data-y="477.435">Boolean</div></div><div class="t t57"><div class="l f12 s7 t58" style="top:787.5px;left:-7.63379px;" data-x="387.084" data-y="418.458">(a)</div></div><div class="t t59"><div class="l f12 s7 t58" style="top:787.5px;left:-7.73535px;" data-x="476.151" data-y="419.073">(b)</div></div><div class="t t5a"><div class="l f12 s7 t58" style="top:787.5px;left:-7.08106px;" data-x="436.062" data-y="321.891">(c)</div></div><div class="t t5b"></div><div class="t t0"><div class="l f1 s4 t0" style="top:498.26px;left:317.014px;" data-x="317.014" data-y="293.74">Figure<span class="w0"> </span>6.</div><div class="l f2 s4 t0" style="top:498.26px;left:357.371px;" data-x="357.371" data-y="293.74">We<span class="w1"> </span>handle<span class="w0"> </span>type-unstable<span class="w0"> </span>loops<span class="w1"> </span>by<span class="w0"> </span>allowing<span class="w1"> </span>traces<span class="w0"> </span>to</div><div class="l f2 s4 t0" style="top:508.222px;left:317.014px;" data-x="317.014" data-y="283.778">compile<span class="w1"> </span>that<span class="w0"> </span>cannot<span class="w1"> </span>loop<span class="w0"> </span>back<span class="w1"> </span>to<span class="w1"> </span>themselves<span class="w0"> </span>due<span class="w1"> </span>to<span class="w0"> </span>a<span class="w1"> </span>type<span class="w1"> </span>mis-</div><div class="l f2 s4 t0" style="top:518.185px;left:317.014px;" data-x="317.014" data-y="273.815">match.<span class="w2"> </span>As<span class="w1"> </span>such<span class="w2"> </span>traces<span class="w1"> </span>accumulate,<span class="w2"> </span>we<span class="w2"> </span>attempt<span class="w1"> </span>to<span class="w2"> </span>connect<span class="w1"> </span>their<span class="w2"> </span>loop</div><div class="l f2 s4 t0" style="top:528.148px;left:317.014px;" data-x="317.014" data-y="263.852">edges<span class="w2"> </span>to<span class="w1"> </span>form<span class="w2"> </span>groups<span class="w1"> </span>of<span class="w1"> </span>trace<span class="w2"> </span>trees<span class="w1"> </span>that<span class="w2"> </span>can<span class="w1"> </span>execute<span class="w2"> </span>without<span class="w1"> </span>having</div><div class="l f2 s4 t0" style="top:538.11px;left:317.014px;" data-x="317.014" data-y="253.89">to<span class="w1"> </span>side-exit<span class="w1"> </span>to<span class="w1"> </span>the<span class="w1"> </span>interpreter<span class="w1"> </span>to<span class="w1"> </span>cover<span class="w1"> </span>odd<span class="w1"> </span>type<span class="w1"> </span>cases.<span class="w1"> </span>This<span class="w1"> </span>is<span class="w1"> </span>par-</div><div class="l f2 s4 t0" style="top:548.073px;left:317.014px;" data-x="317.014" data-y="243.927">ticularly<span class="w2"> </span>important<span class="w1"> </span>for<span class="w2"> </span>nested<span class="w1"> </span>trace<span class="w2"> </span>trees<span class="w2"> </span>where<span class="w1"> </span>an<span class="w2"> </span>outer<span class="w1"> </span>tree<span class="w2"> </span>tries<span class="w1"> </span>to</div><div class="l f2 s4 t0" style="top:558.036px;left:317.014px;" data-x="317.014" data-y="233.964">call<span class="w2"> </span>an<span class="w1"> </span>inner<span class="w1"> </span>tree<span class="w2"> </span>(or<span class="w1"> </span>in<span class="w2"> </span>this<span class="w1"> </span>case<span class="w1"> </span>a<span class="w2"> </span>forest<span class="w1"> </span>of<span class="w2"> </span>inner<span class="w1"> </span>trees),<span class="w1"> </span>since<span class="w2"> </span>inner</div><div class="l f2 s4 t0" style="top:567.998px;left:317.014px;" data-x="317.014" data-y="224.002">loops<span class="w2"> </span>frequently<span class="w1"> </span>have<span class="w2"> </span>initially<span class="w1"> </span>undefined<span class="w2"> </span>values<span class="w1"> </span>which<span class="w1"> </span>change<span class="w2"> </span>type</div><div class="l f2 s4 t0" style="top:577.961px;left:317.014px;" data-x="317.014" data-y="214.039">to<span class="w2"> </span>a<span class="w1"> </span>concrete<span class="w1"> </span>value<span class="w2"> </span>after<span class="w1"> </span>the<span class="w2"> </span>first<span class="w1"> </span>iteration.</div><div class="l f2 s4 t0" style="top:604.005px;left:317.014px;" data-x="317.014" data-y="187.995">through<span class="w1"> </span>the<span class="w0"> </span>inner<span class="w1"> </span>loop,</div><div class="l f6 s4 t0" style="top:604.005px;left:407.042px;" data-x="407.042" data-y="187.995">{</div><div class="l ff s4 t0" style="top:604.005px;left:411.65px;" data-x="411.65" data-y="187.995">i</div><div class="l f8 s5 t0" style="top:605.001px;left:414.803px;" data-x="414.803" data-y="186.999">2</div><div class="l ff s4 t0" style="top:604.005px;left:418.954px;" data-x="418.954" data-y="187.995">,<span class="w2"> </span>i</div><div class="l f8 s5 t0" style="top:605.001px;left:426.203px;" data-x="426.203" data-y="186.999">3</div><div class="l ff s4 t0" style="top:604.005px;left:430.354px;" data-x="430.354" data-y="187.995">,<span class="w2"> </span>i</div><div class="l f8 s5 t0" style="top:605.001px;left:437.603px;" data-x="437.604" data-y="186.999">5</div><div class="l ff s4 t0" style="top:604.005px;left:441.755px;" data-x="441.755" data-y="187.995">,<span class="w2"> </span>α</div><div class="l f6 s4 t0" style="top:604.005px;left:451.763px;" data-x="451.763" data-y="187.995">}</div><div class="l f2 s4 t0" style="top:604.005px;left:456.371px;" data-x="456.371" data-y="187.995">.<span class="w1"> </span>The</div><div class="l ff s4 t0" style="top:604.005px;left:479.839px;" data-x="479.839" data-y="187.995">α</div><div class="l f2 s4 t0" style="top:604.005px;left:489.394px;" data-x="489.394" data-y="187.995">symbol<span class="w1"> </span>is<span class="w0"> </span>used<span class="w1"> </span>to</div><div class="l f2 s4 t0" style="top:613.968px;left:317.014px;" data-x="317.014" data-y="178.032">indicate<span class="w2"> </span>that<span class="w1"> </span>the<span class="w1"> </span>trace<span class="w2"> </span>loops<span class="w1"> </span>back<span class="w1"> </span>the<span class="w2"> </span>tree<span class="w1"> </span>anchor.</div><div class="l f2 s4 t0" style="top:623.93px;left:328.969px;" data-x="328.969" data-y="168.07">When<span class="w2"> </span>execution<span class="w1"> </span>leaves<span class="w2"> </span>the<span class="w1"> </span>inner<span class="w1"> </span>loop,<span class="w1"> </span>the<span class="w2"> </span>basic<span class="w1"> </span>design<span class="w1"> </span>has<span class="w2"> </span>two</div><div class="l f2 s4 t0" style="top:633.893px;left:317.014px;" data-x="317.014" data-y="158.107">choices.<span class="w2"> </span>First,<span class="w1"> </span>the<span class="w2"> </span>system<span class="w2"> </span>can<span class="w1"> </span>stop<span class="w2"> </span>tracing<span class="w2"> </span>and<span class="w1"> </span>give<span class="w2"> </span>up<span class="w2"> </span>on<span class="w1"> </span>compiling</div><div class="l f2 s4 t0" style="top:643.856px;left:317.014px;" data-x="317.014" data-y="148.144">the<span class="w1"> </span>outer<span class="w2"> </span>loop,<span class="w1"> </span>clearly<span class="w1"> </span>an<span class="w1"> </span>undesirable<span class="w2"> </span>solution.<span class="w1"> </span>The<span class="w1"> </span>other<span class="w1"> </span>choice<span class="w1"> </span>is</div><div class="l f2 s4 t0" style="top:653.818px;left:317.014px;" data-x="317.014" data-y="138.182">to<span class="w1"> </span>continue<span class="w1"> </span>tracing,<span class="w1"> </span>compiling<span class="w1"> </span>traces<span class="w1"> </span>for<span class="w1"> </span>the<span class="w1"> </span>outer<span class="w0"> </span>loop<span class="w2"> </span>inside<span class="w1"> </span>the</div><div class="l f2 s4 t0" style="top:663.781px;left:317.014px;" data-x="317.014" data-y="128.219">inner<span class="w2"> </span>loop’s<span class="w1"> </span>trace<span class="w2"> </span>tree.</div><div class="l f2 s4 t0" style="top:673.744px;left:328.969px;" data-x="328.969" data-y="118.257">For<span class="w1"> </span>example,<span class="w2"> </span>the<span class="w1"> </span>program<span class="w1"> </span>might<span class="w1"> </span>exit<span class="w1"> </span>at</div><div class="l ff s4 t0" style="top:673.744px;left:474.128px;" data-x="474.128" data-y="118.257">i</div><div class="l f8 s5 t0" style="top:674.74px;left:477.281px;" data-x="477.281" data-y="117.26">5</div><div class="l f2 s4 t0" style="top:673.744px;left:484.047px;" data-x="484.047" data-y="118.257">and<span class="w1"> </span>record<span class="w1"> </span>a<span class="w2"> </span>branch</div><div class="l f2 s4 t0" style="top:683.706px;left:317.014px;" data-x="317.014" data-y="108.294">trace<span class="w0"> </span>that<span class="w4"> </span>incorporates<span class="w0"> </span>the<span class="w4"> </span>outer<span class="w0"> </span>loop:</div><div class="l f6 s4 t0" style="top:683.706px;left:470.346px;" data-x="470.346" data-y="108.294">{</div><div class="l ff s4 t0" style="top:683.706px;left:474.954px;" data-x="474.954" data-y="108.294">i</div><div class="l f8 s5 t0" style="top:684.702px;left:478.108px;" data-x="478.108" data-y="107.298">5</div><div class="l ff s4 t0" style="top:683.706px;left:482.259px;" data-x="482.259" data-y="108.294">,<span class="w2"> </span>i</div><div class="l f8 s5 t0" style="top:684.702px;left:489.508px;" data-x="489.508" data-y="107.298">7</div><div class="l ff s4 t0" style="top:683.706px;left:493.659px;" data-x="493.659" data-y="108.294">,<span class="w2"> </span>i</div><div class="l f8 s5 t0" style="top:684.702px;left:500.908px;" data-x="500.908" data-y="107.298">1</div><div class="l ff s4 t0" style="top:683.706px;left:505.059px;" data-x="505.059" data-y="108.294">,<span class="w2"> </span>i</div><div class="l f8 s5 t0" style="top:684.702px;left:512.308px;" data-x="512.308" data-y="107.298">6</div><div class="l ff s4 t0" style="top:683.706px;left:516.459px;" data-x="516.459" data-y="108.294">,<span class="w2"> </span>i</div><div class="l f8 s5 t0" style="top:684.702px;left:523.708px;" data-x="523.708" data-y="107.298">7</div><div class="l ff s4 t0" style="top:683.706px;left:527.859px;" data-x="527.859" data-y="108.294">,<span class="w2"> </span>i</div><div class="l f8 s5 t0" style="top:684.702px;left:535.108px;" data-x="535.108" data-y="107.298">1</div><div class="l ff s4 t0" style="top:683.706px;left:539.259px;" data-x="539.259" data-y="108.294">,<span class="w2"> </span>α</div><div class="l f6 s4 t0" style="top:683.706px;left:549.268px;" data-x="549.268" data-y="108.294">}</div><div class="l f2 s4 t0" style="top:683.706px;left:553.875px;" data-x="553.875" data-y="108.294">.</div><div class="l f2 s4 t0" style="top:693.669px;left:317.014px;" data-x="317.014" data-y="98.3312">Later,<span class="w0"> </span>the<span class="w1"> </span>program<span class="w0"> </span>might<span class="w0"> </span>take<span class="w0"> </span>the<span class="w1"> </span>other<span class="w0"> </span>branch<span class="w0"> </span>at</div><div class="l ff s4 t0" style="top:693.669px;left:512.199px;" data-x="512.199" data-y="98.3312">i</div><div class="l f8 s5 t0" style="top:694.665px;left:515.352px;" data-x="515.352" data-y="97.335">2</div><div class="l f2 s4 t0" style="top:693.669px;left:523.616px;" data-x="523.616" data-y="98.3312">and<span class="w0"> </span>then</div><div class="l f2 s4 t0" style="top:703.631px;left:317.014px;" data-x="317.014" data-y="88.3686">exit,<span class="w1"> </span>recording<span class="w1"> </span>another<span class="w1"> </span>branch<span class="w0"> </span>trace<span class="w2"> </span>incorporating<span class="w0"> </span>the<span class="w1"> </span>outer<span class="w1"> </span>loop:</div><div class="l f6 s4 t0" style="top:713.594px;left:317.014px;" data-x="317.014" data-y="78.406">{</div><div class="l ff s4 t0" style="top:713.594px;left:321.621px;" data-x="321.621" data-y="78.406">i</div><div class="l f8 s5 t0" style="top:714.59px;left:324.775px;" data-x="324.775" data-y="77.4097">2</div><div class="l ff s4 t0" style="top:713.594px;left:328.926px;" data-x="328.926" data-y="78.406">,<span class="w2"> </span>i</div><div class="l f8 s5 t0" style="top:714.59px;left:336.175px;" data-x="336.175" data-y="77.4097">4</div><div class="l ff s4 t0" style="top:713.594px;left:340.326px;" data-x="340.326" data-y="78.406">,<span class="w2"> </span>i</div><div class="l f8 s5 t0" style="top:714.59px;left:347.575px;" data-x="347.575" data-y="77.4097">5</div><div class="l ff s4 t0" style="top:713.594px;left:351.726px;" data-x="351.726" data-y="78.406">,<span class="w2"> </span>i</div><div class="l f8 s5 t0" style="top:714.59px;left:358.975px;" data-x="358.975" data-y="77.4097">7</div><div class="l ff s4 t0" style="top:713.594px;left:363.126px;" data-x="363.126" data-y="78.406">,<span class="w2"> </span>i</div><div class="l f8 s5 t0" style="top:714.59px;left:370.375px;" data-x="370.375" data-y="77.4097">1</div><div class="l ff s4 t0" style="top:713.594px;left:374.526px;" data-x="374.526" data-y="78.406">,<span class="w2"> </span>i</div><div class="l f8 s5 t0" style="top:714.59px;left:381.775px;" data-x="381.775" data-y="77.4097">6</div><div class="l ff s4 t0" style="top:713.594px;left:385.926px;" data-x="385.926" data-y="78.406">,<span class="w2"> </span>i</div><div class="l f8 s5 t0" style="top:714.59px;left:393.176px;" data-x="393.176" data-y="77.4097">7</div><div class="l ff s4 t0" style="top:713.594px;left:397.327px;" data-x="397.327" data-y="78.406">,<span class="w2"> </span>i</div><div class="l f8 s5 t0" style="top:714.59px;left:404.576px;" data-x="404.576" data-y="77.4097">1</div><div class="l ff s4 t0" style="top:713.594px;left:408.727px;" data-x="408.727" data-y="78.406">,<span class="w2"> </span>α</div><div class="l f6 s4 t0" style="top:713.594px;left:418.735px;" data-x="418.735" data-y="78.406">}</div><div class="l f2 s4 t0" style="top:713.594px;left:423.343px;" data-x="423.343" data-y="78.406">.<span class="w2"> </span>Thus,<span class="w1"> </span>the<span class="w2"> </span>outer<span class="w1"> </span>loop<span class="w2"> </span>is<span class="w1"> </span>recorded<span class="w2"> </span>and</div><div class="l f2 s4 t0" style="top:723.557px;left:317.014px;" data-x="317.014" data-y="68.4433">compiled<span class="w2"> </span>twice,<span class="w2"> </span>and<span class="w1"> </span>both<span class="w2"> </span>copies<span class="w2"> </span>must<span class="w2"> </span>be<span class="w1"> </span>retained<span class="w2"> </span>in<span class="w2"> </span>the<span class="w1"> </span>trace<span class="w2"> </span>cache.</div></div></div><div id="page-7" class="p" style="width:612px;height:792px;"><div class="t"></div><div class="t t5c"></div><div class="t t5d"></div><div class="t t5e"></div><div class="t t5f"><div class="l f13 s7 t58" style="top:787.5px;left:-4.25343px;" data-x="133.648" data-y="685.424">i</div><div class="l f13 s7 t38" style="top:787.5px;left:-0.814957px;" data-x="134.852" data-y="685.424">2</div></div><div class="t t5e"></div><div class="t t60"><div class="l f13 s7 t58" style="top:787.5px;left:-4.25342px;" data-x="120.938" data-y="659.087">i</div><div class="l f13 s7 t38" style="top:787.5px;left:-0.814941px;" data-x="122.141" data-y="659.087">3</div></div><div class="t t5e"></div><div class="t t61"><div class="l f13 s7 t58" style="top:787.5px;left:-4.25343px;" data-x="146.138" data-y="659.087">i</div><div class="l f13 s7 t38" style="top:787.5px;left:-0.814957px;" data-x="147.341" data-y="659.087">4</div></div><div class="t t5e"></div><div class="t t62"><div class="l f13 s7 t58" style="top:787.5px;left:-4.25343px;" data-x="133.823" data-y="637.276">i</div><div class="l f13 s7 t38" style="top:787.5px;left:-0.814957px;" data-x="135.027" data-y="637.276">5</div></div><div class="t t5e"></div><div class="t t63"><div class="l f13 s7 t58" style="top:787.5px;left:-4.25343px;" data-x="133.363" data-y="707.212">i</div><div class="l f13 s7 t38" style="top:787.5px;left:-0.814957px;" data-x="134.566" data-y="707.212">1</div></div><div class="t t5e"></div><div class="t t64"><div class="l f13 s7 t58" style="top:787.5px;left:-4.25342px;" data-x="102.522" data-y="659.973">i</div><div class="l f13 s7 t38" style="top:787.5px;left:-0.814941px;" data-x="103.726" data-y="659.973">6</div></div><div class="t t5e"></div><div class="t t65"><div class="l f13 s7 t58" style="top:787.5px;left:-4.25343px;" data-x="133.363" data-y="615.53">i</div><div class="l f13 s7 t38" style="top:787.5px;left:-0.814957px;" data-x="134.566" data-y="615.53">7</div></div><div class="t t5e"></div><div class="t t66"><div class="l f13 s7 t58" style="top:787.5px;left:-4.96094px;" data-x="178.122" data-y="706.102">t</div><div class="l f13 s7 t38" style="top:787.5px;left:-0.107422px;" data-x="179.82" data-y="706.102">1</div></div><div class="t t5e"></div><div class="t t67"><div class="l f13 s7 t58" style="top:787.5px;left:-4.96094px;" data-x="209.557" data-y="662.287">t</div><div class="l f13 s7 t38" style="top:787.5px;left:-0.107422px;" data-x="211.256" data-y="662.287">2</div></div><div class="t t5e"></div><div class="t t68"><div class="l f13 s7 t10" style="top:788px;left:-21.2109px;" data-x="222.77" data-y="696.967">T</div><div class="l f13 s7 t10" style="top:788px;left:-15.8848px;" data-x="224.634" data-y="696.967">r</div><div class="l f13 s7 t10" style="top:788px;left:-11.7539px;" data-x="226.079" data-y="696.967">ee
Call</div></div><div class="t t5e"></div><div class="t t69"><div class="l f13 s7 t10" style="top:788px;left:-26.5635px;" data-x="211.446" data-y="709.556">Out</div><div class="l f13 s7 t10" style="top:788px;left:-7.99512px;" data-x="217.945" data-y="709.556">er
T</div><div class="l f13 s7 t10" style="top:788px;left:10.3506px;" data-x="224.366" data-y="709.556">r</div><div class="l f13 s7 t10" style="top:788px;left:14.4815px;" data-x="225.812" data-y="709.556">ee</div></div><div class="t t5e"></div><div class="t t6a"><div class="l f13 s7 t10" style="top:788px;left:-29.6719px;" data-x="222.958" data-y="678.085">Nes</div><div class="l f13 s7 t10" style="top:788px;left:-11.0742px;" data-x="229.467" data-y="678.085">t</div><div class="l f13 s7 t10" style="top:788px;left:-7.06055px;" data-x="230.872" data-y="678.085">ed
T</div><div class="l f13 s7 t10" style="top:788px;left:13.459px;" data-x="238.054" data-y="678.085">r</div><div class="l f13 s7 t10" style="top:788px;left:17.5898px;" data-x="239.5" data-y="678.085">ee</div></div><div class="t t5e"></div><div class="t t6b"><div class="l f13 s7 t10" style="top:788px;left:-25.8779px;" data-x="224.286" data-y="617.81">Exit
Guar</div><div class="l f13 s7 t10" style="top:788px;left:19.4385px;" data-x="240.147" data-y="617.81">d</div></div><div class="t t6c"><div class="l f13 s7 t6d" style="top:786px;left:-9.60059px;" data-x="131.69" data-y="586.823">(a)</div></div><div class="t t5e"></div><div class="t t6e"><div class="l f13 s7 t6d" style="top:786px;left:-10.374px;" data-x="203.52" data-y="588.223">(b)</div></div><div class="t t6f"></div><div class="t t0"><div class="l f1 s4 t0" style="top:232.053px;left:54px;" data-x="54" data-y="559.947">Figure<span class="w2"> </span>7.</div><div class="l f2 s4 t0" style="top:232.053px;left:92.6815px;" data-x="92.6815" data-y="559.947">Control<span class="w2"> </span>flow<span class="w1"> </span>graph<span class="w2"> </span>of<span class="w1"> </span>a<span class="w1"> </span>nested<span class="w2"> </span>loop<span class="w1"> </span>with<span class="w1"> </span>an<span class="w2"> </span>if<span class="w1"> </span>statement</div><div class="l f2 s4 t0" style="top:242.015px;left:54px;" data-x="54" data-y="549.985">inside<span class="w1"> </span>the<span class="w0"> </span>inner<span class="w0"> </span>most<span class="w1"> </span>loop<span class="w0"> </span>(a).<span class="w1"> </span>An<span class="w0"> </span>inner<span class="w1"> </span>tree<span class="w0"> </span>captures<span class="w1"> </span>the<span class="w0"> </span>inner</div><div class="l f2 s4 t0" style="top:251.978px;left:54px;" data-x="54" data-y="540.022">loop,<span class="w2"> </span>and<span class="w1"> </span>is<span class="w2"> </span>nested<span class="w1"> </span>inside<span class="w1"> </span>an<span class="w2"> </span>outer<span class="w1"> </span>tree<span class="w2"> </span>which<span class="w1"> </span>“calls”<span class="w1"> </span>the<span class="w2"> </span>inner<span class="w1"> </span>tree.</div><div class="l f2 s4 t0" style="top:261.941px;left:54px;" data-x="54" data-y="530.059">The<span class="w1"> </span>inner<span class="w1"> </span>tree<span class="w1"> </span>returns<span class="w1"> </span>to<span class="w1"> </span>the<span class="w1"> </span>outer<span class="w1"> </span>tree<span class="w1"> </span>once<span class="w1"> </span>it<span class="w1"> </span>exits<span class="w1"> </span>along<span class="w1"> </span>its<span class="w1"> </span>loop</div><div class="l f2 s4 t0" style="top:271.903px;left:54px;" data-x="54" data-y="520.097">condition<span class="w2"> </span>guard<span class="w1"> </span>(b).</div><div class="l f2 s4 t0" style="top:300.587px;left:54px;" data-x="54" data-y="491.413">In<span class="w2"> </span>general,<span class="w1"> </span>if<span class="w2"> </span>loops<span class="w1"> </span>are<span class="w2"> </span>nested<span class="w1"> </span>to<span class="w2"> </span>depth</div><div class="l ff s4 t0" style="top:300.587px;left:191.924px;" data-x="191.924" data-y="491.413">k</div><div class="l f2 s4 t0" style="top:300.587px;left:196.985px;" data-x="196.985" data-y="491.413">,<span class="w2"> </span>and<span class="w1"> </span>each<span class="w2"> </span>loop<span class="w1"> </span>has</div><div class="l ff s4 t0" style="top:300.587px;left:266.596px;" data-x="266.596" data-y="491.413">n</div><div class="l f2 s4 t0" style="top:300.587px;left:274.176px;" data-x="274.176" data-y="491.413">paths</div><div class="l f2 s4 t0" style="top:310.987px;left:54px;" data-x="54" data-y="481.013">(on<span class="w1"> </span>geometric<span class="w0"> </span>average),<span class="w1"> </span>this<span class="w0"> </span>na¨</div><div class="l f2 s4 t0" style="top:310.987px;left:170.454px;" data-x="170.454" data-y="481.013">ıve<span class="w1"> </span>strategy<span class="w0"> </span>yields</div><div class="l ff s4 t0" style="top:310.987px;left:241.776px;" data-x="241.776" data-y="481.013">O</div><div class="l f14 s4 t0" style="top:310.987px;left:249.044px;" data-x="249.044" data-y="481.013">(</div><div class="l ff s4 t0" style="top:310.987px;left:252.628px;" data-x="252.628" data-y="481.013">n</div><div class="l f10 s5 t0" style="top:307.178px;left:258.187px;" data-x="258.187" data-y="484.822">k</div><div class="l f14 s4 t0" style="top:310.987px;left:262.76px;" data-x="262.76" data-y="481.013">)</div><div class="l f2 s4 t0" style="top:310.987px;left:269.953px;" data-x="269.953" data-y="481.013">traces,</div><div class="l f2 s4 t0" style="top:320.949px;left:54px;" data-x="54" data-y="471.051">which<span class="w2"> </span>can<span class="w1"> </span>easily<span class="w1"> </span>fill<span class="w2"> </span>the<span class="w1"> </span>trace<span class="w1"> </span>cache.</div><div class="l f2 s4 t0" style="top:330.912px;left:65.9552px;" data-x="65.9552" data-y="461.088">In<span class="w1"> </span>order<span class="w0"> </span>to<span class="w1"> </span>execute<span class="w0"> </span>programs<span class="w1"> </span>with<span class="w0"> </span>nested<span class="w1"> </span>loops<span class="w0"> </span>efficiently,<span class="w1"> </span>a</div><div class="l f2 s4 t0" style="top:340.874px;left:54px;" data-x="54" data-y="451.126">tracing<span class="w2"> </span>system<span class="w1"> </span>needs<span class="w2"> </span>a<span class="w2"> </span>technique<span class="w1"> </span>for<span class="w2"> </span>covering<span class="w2"> </span>the<span class="w1"> </span>nested<span class="w2"> </span>loops<span class="w1"> </span>with</div><div class="l f2 s4 t0" style="top:350.837px;left:54px;" data-x="54" data-y="441.163">native<span class="w2"> </span>code<span class="w1"> </span>without<span class="w2"> </span>exponential<span class="w1"> </span>trace<span class="w1"> </span>duplication.</div><div class="l f1 s4 t0" style="top:369.19px;left:54px;" data-x="54" data-y="422.81">4.1<span class="w10"> </span>Nesting<span class="w2"> </span>Algorithm</div><div class="l f2 s4 t0" style="top:383.138px;left:54px;" data-x="54" data-y="408.862">The<span class="w1"> </span>key<span class="w2"> </span>insight<span class="w1"> </span>is<span class="w1"> </span>that<span class="w1"> </span>if<span class="w1"> </span>each<span class="w1"> </span>loop<span class="w1"> </span>is<span class="w2"> </span>represented<span class="w1"> </span>by<span class="w1"> </span>its<span class="w1"> </span>own<span class="w1"> </span>trace</div><div class="l f2 s4 t0" style="top:393.1px;left:54px;" data-x="54" data-y="398.9">tree,<span class="w1"> </span>the<span class="w1"> </span>code<span class="w1"> </span>for<span class="w1"> </span>each<span class="w2"> </span>loop<span class="w1"> </span>can<span class="w1"> </span>be<span class="w1"> </span>contained<span class="w1"> </span>only<span class="w1"> </span>in<span class="w1"> </span>its<span class="w1"> </span>own<span class="w1"> </span>tree,</div><div class="l f2 s4 t0" style="top:403.063px;left:54px;" data-x="54" data-y="388.937">and<span class="w2"> </span>outer<span class="w1"> </span>loop<span class="w2"> </span>paths<span class="w1"> </span>will<span class="w2"> </span>not<span class="w1"> </span>be<span class="w2"> </span>duplicated.<span class="w1"> </span>Another<span class="w2"> </span>key<span class="w2"> </span>fact<span class="w1"> </span>is<span class="w2"> </span>that</div><div class="l f2 s4 t0" style="top:413.025px;left:54px;" data-x="54" data-y="378.975">we<span class="w2"> </span>are<span class="w1"> </span>not<span class="w2"> </span>tracing<span class="w1"> </span>arbitrary<span class="w1"> </span>bytecodes<span class="w2"> </span>that<span class="w1"> </span>might<span class="w2"> </span>have<span class="w1"> </span>irreduceable</div><div class="l f2 s4 t0" style="top:422.988px;left:54px;" data-x="54" data-y="369.012">control<span class="w1"> </span>flow<span class="w1"> </span>graphs,<span class="w1"> </span>but<span class="w1"> </span>rather<span class="w1"> </span>bytecodes<span class="w1"> </span>produced<span class="w1"> </span>by<span class="w1"> </span>a<span class="w1"> </span>compiler</div><div class="l f2 s4 t0" style="top:432.951px;left:54px;" data-x="54" data-y="359.049">for<span class="w1"> </span>a<span class="w1"> </span>language<span class="w1"> </span>with<span class="w1"> </span>structured<span class="w1"> </span>control<span class="w1"> </span>flow.<span class="w1"> </span>Thus,<span class="w1"> </span>given<span class="w1"> </span>two<span class="w1"> </span>loop</div><div class="l f2 s4 t0" style="top:442.913px;left:54px;" data-x="54" data-y="349.087">edges,<span class="w1"> </span>the<span class="w0"> </span>system<span class="w0"> </span>can<span class="w1"> </span>easily<span class="w0"> </span>determine<span class="w1"> </span>whether<span class="w0"> </span>they<span class="w1"> </span>are<span class="w0"> </span>nested</div><div class="l f2 s4 t0" style="top:452.876px;left:54px;" data-x="54" data-y="339.124">and<span class="w1"> </span>which<span class="w2"> </span>is<span class="w1"> </span>the<span class="w1"> </span>inner<span class="w1"> </span>loop.<span class="w2"> </span>Using<span class="w1"> </span>this<span class="w1"> </span>knowledge,<span class="w2"> </span>the<span class="w1"> </span>system<span class="w1"> </span>can</div><div class="l f2 s4 t0" style="top:462.839px;left:54px;" data-x="54" data-y="329.161">compile<span class="w2"> </span>inner<span class="w1"> </span>and<span class="w2"> </span>outer<span class="w2"> </span>loops<span class="w1"> </span>separately,<span class="w2"> </span>and<span class="w2"> </span>make<span class="w1"> </span>the<span class="w2"> </span>outer<span class="w2"> </span>loop’s</div><div class="l f2 s4 t0" style="top:472.801px;left:54px;" data-x="54" data-y="319.199">traces</div><div class="l fa s4 t0" style="top:472.801px;left:77.1508px;" data-x="77.1508" data-y="319.199">call</div><div class="l f2 s4 t0" style="top:472.801px;left:92.8506px;" data-x="92.8506" data-y="319.199">the<span class="w2"> </span>inner<span class="w1"> </span>loop’s<span class="w2"> </span>trace<span class="w1"> </span>tree.</div><div class="l f2 s4 t0" style="top:482.764px;left:65.9552px;" data-x="65.9552" data-y="309.236">The<span class="w1"> </span>algorithm<span class="w1"> </span>for<span class="w1"> </span>building<span class="w2"> </span>nested<span class="w1"> </span>trace<span class="w1"> </span>trees<span class="w1"> </span>is<span class="w1"> </span>as<span class="w1"> </span>follows.<span class="w1"> </span>We</div><div class="l f2 s4 t0" style="top:492.727px;left:54px;" data-x="54" data-y="299.273">start<span class="w1"> </span>tracing<span class="w2"> </span>at<span class="w1"> </span>loop<span class="w1"> </span>headers<span class="w1"> </span>exactly<span class="w1"> </span>as<span class="w2"> </span>in<span class="w1"> </span>the<span class="w1"> </span>basic<span class="w1"> </span>tracing<span class="w1"> </span>system.</div><div class="l f2 s4 t0" style="top:502.689px;left:54px;" data-x="54" data-y="289.311">When<span class="w1"> </span>we<span class="w0"> </span>exit<span class="w1"> </span>a<span class="w1"> </span>loop<span class="w0"> </span>(detected<span class="w1"> </span>by<span class="w0"> </span>comparing<span class="w1"> </span>the<span class="w0"> </span>interpreter<span class="w1"> </span>PC</div><div class="l f2 s4 t0" style="top:512.652px;left:54px;" data-x="54" data-y="279.348">with<span class="w1"> </span>the<span class="w0"> </span>range<span class="w0"> </span>given<span class="w1"> </span>by<span class="w0"> </span>the<span class="w1"> </span>loop<span class="w0"> </span>edge),<span class="w1"> </span>we<span class="w0"> </span>stop<span class="w1"> </span>the<span class="w0"> </span>trace.<span class="w0"> </span>The</div><div class="l f2 s4 t0" style="top:522.614px;left:54px;" data-x="54" data-y="269.386">key<span class="w1"> </span>step<span class="w0"> </span>of<span class="w1"> </span>the<span class="w0"> </span>algorithm<span class="w1"> </span>occurs<span class="w1"> </span>when<span class="w0"> </span>we<span class="w1"> </span>are<span class="w0"> </span>recording<span class="w1"> </span>a<span class="w0"> </span>trace</div><div class="l f2 s4 t0" style="top:532.577px;left:54px;" data-x="54" data-y="259.423">for<span class="w1"> </span>loop</div><div class="l ff s4 t0" style="top:532.577px;left:85.7379px;" data-x="85.7379" data-y="259.423">L</div><div class="l f10 s5 t0" style="top:533.573px;left:92.0088px;" data-x="92.0088" data-y="258.427">R</div><div class="l f2 s4 t0" style="top:532.577px;left:100.712px;" data-x="100.712" data-y="259.423">(</div><div class="l ff s4 t0" style="top:532.577px;left:103.697px;" data-x="103.697" data-y="259.423">R</div><div class="l f2 s4 t0" style="top:532.577px;left:113.403px;" data-x="113.403" data-y="259.423">for<span class="w1"> </span>loop<span class="w1"> </span>being<span class="w1"> </span>recorded)<span class="w1"> </span>and<span class="w1"> </span>we<span class="w2"> </span>reach<span class="w1"> </span>the<span class="w1"> </span>header</div><div class="l f2 s4 t0" style="top:542.54px;left:54.0001px;" data-x="54.0001" data-y="249.46">of<span class="w2"> </span>a<span class="w1"> </span>different<span class="w2"> </span>loop</div><div class="l ff s4 t0" style="top:542.54px;left:120.731px;" data-x="120.731" data-y="249.46">L</div><div class="l f10 s5 t0" style="top:543.536px;left:127.001px;" data-x="127.001" data-y="248.464">O</div><div class="l f2 s4 t0" style="top:542.54px;left:135.45px;" data-x="135.45" data-y="249.46">(</div><div class="l ff s4 t0" style="top:542.54px;left:138.435px;" data-x="138.435" data-y="249.46">O</div><div class="l f2 s4 t0" style="top:542.54px;left:147.877px;" data-x="147.877" data-y="249.46">for<span class="w2"> </span>other<span class="w1"> </span>loop).<span class="w1"> </span>Note<span class="w2"> </span>that</div><div class="l ff s4 t0" style="top:542.54px;left:239.671px;" data-x="239.671" data-y="249.46">L</div><div class="l f10 s5 t0" style="top:543.536px;left:245.942px;" data-x="245.942" data-y="248.464">O</div><div class="l f2 s4 t0" style="top:542.54px;left:254.39px;" data-x="254.39" data-y="249.46">must<span class="w2"> </span>be<span class="w1"> </span>an</div><div class="l f2 s4 t0" style="top:552.502px;left:54.0001px;" data-x="54.0001" data-y="239.498">inner<span class="w2"> </span>loop<span class="w1"> </span>of</div><div class="l ff s4 t0" style="top:552.502px;left:102.562px;" data-x="102.562" data-y="239.498">L</div><div class="l f10 s5 t0" style="top:553.499px;left:108.833px;" data-x="108.833" data-y="238.501">R</div><div class="l f2 s4 t0" style="top:552.502px;left:117.106px;" data-x="117.106" data-y="239.498">because<span class="w2"> </span>we<span class="w1"> </span>stop<span class="w1"> </span>the<span class="w2"> </span>trace<span class="w1"> </span>when<span class="w1"> </span>we<span class="w2"> </span>exit<span class="w1"> </span>a<span class="w2"> </span>loop.</div><div class="l f3 s3 t0" style="top:566.758px;left:59.2304px;" data-x="59.2304" data-y="225.242">•</div><div class="l f2 s4 t0" style="top:567.656px;left:66.9516px;" data-x="66.9516" data-y="224.344">If</div><div class="l ff s4 t0" style="top:567.656px;left:75.6513px;" data-x="75.6513" data-y="224.344">L</div><div class="l f10 s5 t0" style="top:568.653px;left:81.9222px;" data-x="81.9222" data-y="223.347">O</div><div class="l f2 s4 t0" style="top:567.656px;left:90.9257px;" data-x="90.9257" data-y="224.344">has<span class="w1"> </span>a<span class="w1"> </span>type-matching<span class="w1"> </span>compiled<span class="w1"> </span>trace<span class="w1"> </span>tree,<span class="w1"> </span>we<span class="w1"> </span>call</div><div class="l ff s4 t0" style="top:567.656px;left:270.36px;" data-x="270.36" data-y="224.344">L</div><div class="l f10 s5 t0" style="top:568.653px;left:276.631px;" data-x="276.631" data-y="223.347">O</div><div class="l f2 s4 t0" style="top:567.656px;left:285.635px;" data-x="285.635" data-y="224.344">as</div><div class="l f2 s4 t0" style="top:577.619px;left:66.9516px;" data-x="66.9516" data-y="214.381">a<span class="w1"> </span>nested<span class="w2"> </span>trace<span class="w1"> </span>tree.<span class="w1"> </span>If<span class="w1"> </span>the<span class="w1"> </span>call<span class="w2"> </span>succeeds,<span class="w1"> </span>then<span class="w1"> </span>we<span class="w1"> </span>record<span class="w2"> </span>the<span class="w1"> </span>call</div><div class="l f2 s4 t0" style="top:587.582px;left:66.9516px;" data-x="66.9516" data-y="204.418">in<span class="w2"> </span>the<span class="w1"> </span>trace<span class="w1"> </span>for</div><div class="l ff s4 t0" style="top:587.582px;left:122.101px;" data-x="122.101" data-y="204.418">L</div><div class="l f10 s5 t0" style="top:588.578px;left:128.372px;" data-x="128.372" data-y="203.422">R</div><div class="l f2 s4 t0" style="top:587.582px;left:134.404px;" data-x="134.404" data-y="204.418">.<span class="w2"> </span>On<span class="w1"> </span>future<span class="w1"> </span>executions,<span class="w2"> </span>the<span class="w1"> </span>trace<span class="w1"> </span>for</div><div class="l ff s4 t0" style="top:587.582px;left:264.514px;" data-x="264.514" data-y="204.418">L</div><div class="l f10 s5 t0" style="top:588.578px;left:270.785px;" data-x="270.785" data-y="203.422">R</div><div class="l f2 s4 t0" style="top:587.582px;left:279.152px;" data-x="279.152" data-y="204.418">will</div><div class="l f2 s4 t0" style="top:597.544px;left:66.9516px;" data-x="66.9516" data-y="194.456">call<span class="w2"> </span>the<span class="w1"> </span>inner<span class="w1"> </span>trace<span class="w2"> </span>directly.</div><div class="l f3 s3 t0" style="top:610.594px;left:59.2305px;" data-x="59.2305" data-y="181.406">•</div><div class="l f2 s4 t0" style="top:611.492px;left:66.9516px;" data-x="66.9516" data-y="180.508">If</div><div class="l ff s4 t0" style="top:611.492px;left:75.9145px;" data-x="75.9145" data-y="180.508">L</div><div class="l f10 s5 t0" style="top:612.488px;left:82.1854px;" data-x="82.1854" data-y="179.512">O</div><div class="l f2 s4 t0" style="top:611.492px;left:91.4521px;" data-x="91.4521" data-y="180.508">does<span class="w1"> </span>not<span class="w1"> </span>have<span class="w1"> </span>a<span class="w1"> </span>type-matching<span class="w1"> </span>compiled<span class="w0"> </span>trace<span class="w1"> </span>tree<span class="w1"> </span>yet,</div><div class="l f2 s4 t0" style="top:621.454px;left:66.9516px;" data-x="66.9516" data-y="170.546">we<span class="w1"> </span>have<span class="w0"> </span>to<span class="w1"> </span>obtain<span class="w1"> </span>it<span class="w0"> </span>before<span class="w1"> </span>we<span class="w0"> </span>are<span class="w1"> </span>able<span class="w1"> </span>to<span class="w0"> </span>proceed.<span class="w1"> </span>In<span class="w0"> </span>order</div><div class="l f2 s4 t0" style="top:631.417px;left:66.9516px;" data-x="66.9516" data-y="160.583">to<span class="w1"> </span>do<span class="w1"> </span>this,<span class="w1"> </span>we<span class="w1"> </span>simply<span class="w1"> </span>abort<span class="w1"> </span>recording<span class="w1"> </span>the<span class="w1"> </span>first<span class="w0"> </span>trace.<span class="w2"> </span>The<span class="w1"> </span>trace</div><div class="l f2 s4 t0" style="top:641.38px;left:66.9516px;" data-x="66.9516" data-y="150.62">monitor<span class="w1"> </span>will<span class="w0"> </span>see<span class="w1"> </span>the<span class="w1"> </span>inner<span class="w1"> </span>loop<span class="w0"> </span>header,<span class="w1"> </span>and<span class="w1"> </span>will<span class="w0"> </span>immediately</div><div class="l f2 s4 t0" style="top:651.705px;left:66.9516px;" data-x="66.9516" data-y="140.295">start<span class="w2"> </span>recording<span class="w1"> </span>the<span class="w1"> </span>inner<span class="w2"> </span>loop.</div><div class="l f2 s5 t0" style="top:647.896px;left:175.524px;" data-x="175.524" data-y="144.104">2</div><div class="l f2 s4 t0" style="top:666.859px;left:65.9554px;" data-x="65.9554" data-y="125.141">If<span class="w2"> </span>all<span class="w2"> </span>the<span class="w1"> </span>loops<span class="w2"> </span>in<span class="w2"> </span>a<span class="w1"> </span>nest<span class="w2"> </span>are<span class="w2"> </span>type-stable,<span class="w1"> </span>then<span class="w2"> </span>loop<span class="w2"> </span>nesting<span class="w1"> </span>creates</div><div class="l f2 s4 t0" style="top:676.821px;left:54.0002px;" data-x="54.0002" data-y="115.179">no<span class="w2"> </span>duplication.<span class="w2"> </span>Otherwise,<span class="w1"> </span>if<span class="w2"> </span>loops<span class="w2"> </span>are<span class="w1"> </span>nested<span class="w2"> </span>to<span class="w2"> </span>a<span class="w1"> </span>depth</div><div class="l ff s4 t0" style="top:676.821px;left:252.739px;" data-x="252.739" data-y="115.179">k</div><div class="l f2 s4 t0" style="top:676.821px;left:257.799px;" data-x="257.799" data-y="115.179">,<span class="w2"> </span>and<span class="w2"> </span>each</div></div><div class="t t70"></div><div class="t t0"><div class="l f2 s5 t0" style="top:693.845px;left:54px;" data-x="54" data-y="98.1552">2</div><div class="l f2 s3 t0" style="top:696.658px;left:58.4832px;" data-x="58.4832" data-y="95.3424">Instead<span class="w2"> </span>of<span class="w1"> </span>aborting<span class="w1"> </span>the<span class="w1"> </span>outer<span class="w2"> </span>recording,<span class="w1"> </span>we<span class="w1"> </span>could<span class="w2"> </span>principally<span class="w1"> </span>merely<span class="w1"> </span>sus-</div><div class="l f2 s3 t0" style="top:705.624px;left:54px;" data-x="54" data-y="86.376">pend<span class="w1"> </span>the<span class="w1"> </span>recording,<span class="w1"> </span>but<span class="w1"> </span>that<span class="w1"> </span>would<span class="w1"> </span>require<span class="w1"> </span>the<span class="w1"> </span>implementation<span class="w1"> </span>to<span class="w1"> </span>be<span class="w1"> </span>able</div><div class="l f2 s3 t0" style="top:714.59px;left:54px;" data-x="54" data-y="77.4097">to<span class="w1"> </span>record<span class="w1"> </span>several<span class="w2"> </span>traces<span class="w1"> </span>simultaneously,<span class="w1"> </span>complicating<span class="w1"> </span>the<span class="w1"> </span>implementation,</div><div class="l f2 s3 t0" style="top:723.557px;left:54px;" data-x="54" data-y="68.4433">while<span class="w2"> </span>saving<span class="w1"> </span>only<span class="w2"> </span>a<span class="w2"> </span>few<span class="w1"> </span>iterations<span class="w2"> </span>in<span class="w1"> </span>the<span class="w2"> </span>interpreter.</div></div><div class="t t71"></div><div class="t t72"></div><div class="t t73"></div><div class="t t74"><div class="l f15 s7 t58" style="top:787.5px;left:-4.25342px;" data-x="398.856" data-y="686.831">i</div><div class="l f15 s7 t38" style="top:787.5px;left:-0.814941px;" data-x="399.991" data-y="686.831">2</div></div><div class="t t73"></div><div class="t t75"><div class="l f15 s7 t58" style="top:787.5px;left:-4.25342px;" data-x="398.856" data-y="667.028">i</div><div class="l f15 s7 t38" style="top:787.5px;left:-0.814941px;" data-x="399.991" data-y="667.028">3</div></div><div class="t t73"></div><div class="t t76"><div class="l f15 s7 t58" style="top:787.5px;left:-4.25342px;" data-x="398.856" data-y="707.954">i</div><div class="l f15 s7 t38" style="top:787.5px;left:-0.814941px;" data-x="399.991" data-y="707.954">1</div></div><div class="t t73"></div><div class="t t77"><div class="l f15 s7 t58" style="top:787.5px;left:-4.25342px;" data-x="398.856" data-y="607.619">i</div><div class="l f15 s7 t38" style="top:787.5px;left:-0.814941px;" data-x="399.991" data-y="607.619">6</div></div><div class="t t73"></div><div class="t t78"><div class="l f15 s7 t58" style="top:787.5px;left:-4.25342px;" data-x="398.856" data-y="645.905">i</div><div class="l f15 s7 t38" style="top:787.5px;left:-0.814941px;" data-x="399.991" data-y="645.905">4</div></div><div class="t t73"></div><div class="t t79"><div class="l f15 s7 t58" style="top:787.5px;left:-4.25342px;" data-x="398.856" data-y="626.102">i</div><div class="l f15 s7 t38" style="top:787.5px;left:-0.814941px;" data-x="399.991" data-y="626.102">5</div></div><div class="t t73"></div><div class="t t7a"><div class="l f15 s7 t58" style="top:787.5px;left:-4.96094px;" data-x="447.409" data-y="686.978">t</div><div class="l f15 s7 t38" style="top:787.5px;left:-0.107422px;" data-x="449.011" data-y="686.978">2</div></div><div class="t t73"></div><div class="t t7b"><div class="l f15 s7 t58" style="top:787.5px;left:-4.96094px;" data-x="430.308" data-y="709.275">t</div><div class="l f15 s7 t38" style="top:787.5px;left:-0.107422px;" data-x="431.909" data-y="709.275">1</div></div><div class="t t73"></div><div class="t t7c"><div class="l f15 s7 t58" style="top:787.5px;left:-4.96094px;" data-x="447.409" data-y="643.925">t</div><div class="l f15 s7 t38" style="top:787.5px;left:-0.107422px;" data-x="449.011" data-y="643.925">4</div></div><div class="t t73"></div><div class="t t7d"><div class="l f15 s7 t10" style="top:788px;left:-25.8779px;" data-x="463.34" data-y="652.341">Exit
Guar</div><div class="l f15 s7 t10" style="top:788px;left:19.4385px;" data-x="478.297" data-y="652.341">d</div></div><div class="t t73"></div><div class="t t7e"><div class="l f15 s7 t10" style="top:788px;left:-29.6719px;" data-x="459.447" data-y="702.509">Nes</div><div class="l f15 s7 t10" style="top:788px;left:-11.0742px;" data-x="465.586" data-y="702.509">t</div><div class="l f15 s7 t10" style="top:788px;left:-7.06055px;" data-x="466.91" data-y="702.509">ed
T</div><div class="l f15 s7 t10" style="top:788px;left:13.459px;" data-x="473.683" data-y="702.509">r</div><div class="l f15 s7 t10" style="top:788px;left:17.5898px;" data-x="475.046" data-y="702.509">ee</div></div><div class="t t7f"></div><div class="t t0"><div class="l f1 s4 t0" style="top:213.258px;left:317.014px;" data-x="317.014" data-y="578.743">Figure<span class="w2"> </span>8.</div><div class="l f2 s4 t0" style="top:213.258px;left:355.477px;" data-x="355.477" data-y="578.743">Control<span class="w2"> </span>flow<span class="w1"> </span>graph<span class="w2"> </span>of<span class="w2"> </span>a<span class="w1"> </span>loop<span class="w2"> </span>with<span class="w1"> </span>two<span class="w2"> </span>nested<span class="w1"> </span>loops<span class="w2"> </span>(left)</div><div class="l f2 s4 t0" style="top:223.22px;left:317.014px;" data-x="317.014" data-y="568.78">and<span class="w1"> </span>its<span class="w1"> </span>nested<span class="w1"> </span>trace<span class="w1"> </span>tree<span class="w1"> </span>configuration<span class="w1"> </span>(right).<span class="w1"> </span>The<span class="w0"> </span>outer<span class="w2"> </span>tree<span class="w1"> </span>calls</div><div class="l f2 s4 t0" style="top:233.183px;left:317.014px;" data-x="317.014" data-y="558.817">the<span class="w1"> </span>two<span class="w2"> </span>inner<span class="w1"> </span>nested<span class="w1"> </span>trace<span class="w1"> </span>trees<span class="w2"> </span>and<span class="w1"> </span>places<span class="w1"> </span>guards<span class="w1"> </span>at<span class="w2"> </span>their<span class="w1"> </span>side<span class="w1"> </span>exit</div><div class="l f2 s4 t0" style="top:243.145px;left:317.014px;" data-x="317.014" data-y="548.855">locations.</div><div class="l f2 s4 t0" style="top:276.533px;left:317.014px;" data-x="317.014" data-y="515.467">loop<span class="w2"> </span>is<span class="w1"> </span>entered<span class="w2"> </span>with</div><div class="l ff s4 t0" style="top:276.533px;left:389.714px;" data-x="389.714" data-y="515.467">m</div><div class="l f2 s4 t0" style="top:276.533px;left:399.945px;" data-x="399.945" data-y="515.467">different<span class="w2"> </span>type<span class="w1"> </span>maps<span class="w2"> </span>(on<span class="w1"> </span>geometric<span class="w2"> </span>average),</div><div class="l f2 s4 t0" style="top:286.932px;left:317.014px;" data-x="317.014" data-y="505.068">then<span class="w1"> </span>we<span class="w1"> </span>compile</div><div class="l ff s4 t0" style="top:286.932px;left:379.553px;" data-x="379.553" data-y="505.068">O</div><div class="l f14 s4 t0" style="top:286.932px;left:386.821px;" data-x="386.821" data-y="505.068">(</div><div class="l ff s4 t0" style="top:286.932px;left:390.405px;" data-x="390.405" data-y="505.068">m</div><div class="l f10 s5 t0" style="top:283.123px;left:398.524px;" data-x="398.524" data-y="508.877">k</div><div class="l f14 s4 t0" style="top:286.932px;left:403.097px;" data-x="403.097" data-y="505.068">)</div><div class="l f2 s4 t0" style="top:286.932px;left:409.266px;" data-x="409.266" data-y="505.068">copies<span class="w1"> </span>of<span class="w1"> </span>the<span class="w2"> </span>innermost<span class="w1"> </span>loop.<span class="w1"> </span>As<span class="w1"> </span>long<span class="w1"> </span>as</div><div class="l ff s4 t0" style="top:296.895px;left:317.014px;" data-x="317.014" data-y="495.105">m</div><div class="l f2 s4 t0" style="top:296.895px;left:327.374px;" data-x="327.374" data-y="495.105">is<span class="w2"> </span>close<span class="w1"> </span>to<span class="w1"> </span>1,<span class="w2"> </span>the<span class="w1"> </span>resulting<span class="w1"> </span>trace<span class="w2"> </span>trees<span class="w1"> </span>will<span class="w2"> </span>be<span class="w1"> </span>tractable.</div><div class="l f2 s4 t0" style="top:306.858px;left:328.969px;" data-x="328.969" data-y="485.142">An<span class="w2"> </span>important<span class="w2"> </span>detail<span class="w1"> </span>is<span class="w2"> </span>that<span class="w2"> </span>the<span class="w2"> </span>call<span class="w1"> </span>to<span class="w2"> </span>the<span class="w2"> </span>inner<span class="w1"> </span>trace<span class="w2"> </span>tree<span class="w2"> </span>must<span class="w2"> </span>act</div><div class="l f2 s4 t0" style="top:316.82px;left:317.014px;" data-x="317.014" data-y="475.18">like<span class="w2"> </span>a<span class="w1"> </span>function<span class="w2"> </span>call<span class="w1"> </span>site:<span class="w2"> </span>it<span class="w1"> </span>must<span class="w1"> </span>return<span class="w2"> </span>to<span class="w1"> </span>the<span class="w2"> </span>same<span class="w1"> </span>point<span class="w2"> </span>every<span class="w1"> </span>time.</div><div class="l f2 s4 t0" style="top:326.783px;left:317.014px;" data-x="317.014" data-y="465.217">The<span class="w1"> </span>goal<span class="w1"> </span>of<span class="w2"> </span>nesting<span class="w1"> </span>is<span class="w1"> </span>to<span class="w1"> </span>make<span class="w1"> </span>inner<span class="w1"> </span>and<span class="w1"> </span>outer<span class="w1"> </span>loops<span class="w2"> </span>independent;</div><div class="l f2 s4 t0" style="top:336.746px;left:317.014px;" data-x="317.014" data-y="455.254">thus<span class="w1"> </span>when<span class="w1"> </span>the<span class="w0"> </span>inner<span class="w1"> </span>tree<span class="w1"> </span>is<span class="w0"> </span>called,<span class="w1"> </span>it<span class="w1"> </span>must<span class="w1"> </span>exit<span class="w0"> </span>to<span class="w1"> </span>the<span class="w1"> </span>same<span class="w1"> </span>point</div><div class="l f2 s4 t0" style="top:346.708px;left:317.014px;" data-x="317.014" data-y="445.292">in<span class="w1"> </span>the<span class="w1"> </span>outer<span class="w1"> </span>tree<span class="w1"> </span>every<span class="w1"> </span>time<span class="w1"> </span>with<span class="w1"> </span>the<span class="w0"> </span>same<span class="w2"> </span>type<span class="w0"> </span>map.<span class="w2"> </span>Because<span class="w0"> </span>we</div><div class="l f2 s4 t0" style="top:356.671px;left:317.014px;" data-x="317.014" data-y="435.329">cannot<span class="w1"> </span>actually<span class="w1"> </span>guarantee<span class="w1"> </span>this<span class="w1"> </span>property,<span class="w1"> </span>we<span class="w1"> </span>must<span class="w1"> </span>guard<span class="w1"> </span>on<span class="w1"> </span>it<span class="w1"> </span>after</div><div class="l f2 s4 t0" style="top:366.634px;left:317.014px;" data-x="317.014" data-y="425.367">the<span class="w1"> </span>call,<span class="w0"> </span>and<span class="w1"> </span>side<span class="w0"> </span>exit<span class="w1"> </span>if<span class="w1"> </span>the<span class="w0"> </span>property<span class="w1"> </span>does<span class="w0"> </span>not<span class="w1"> </span>hold.<span class="w1"> </span>A<span class="w0"> </span>common</div><div class="l f2 s4 t0" style="top:376.596px;left:317.014px;" data-x="317.014" data-y="415.404">reason<span class="w0"> </span>for<span class="w1"> </span>the<span class="w0"> </span>inner<span class="w1"> </span>tree<span class="w0"> </span>not<span class="w0"> </span>to<span class="w1"> </span>return<span class="w0"> </span>to<span class="w1"> </span>the<span class="w0"> </span>same<span class="w0"> </span>point<span class="w1"> </span>would</div><div class="l f2 s4 t0" style="top:386.559px;left:317.014px;" data-x="317.014" data-y="405.441">be<span class="w1"> </span>if<span class="w0"> </span>the<span class="w1"> </span>inner<span class="w0"> </span>tree<span class="w1"> </span>took<span class="w0"> </span>a<span class="w1"> </span>new<span class="w0"> </span>side<span class="w1"> </span>exit<span class="w0"> </span>for<span class="w1"> </span>which<span class="w1"> </span>it<span class="w0"> </span>had<span class="w1"> </span>never</div><div class="l f2 s4 t0" style="top:396.521px;left:317.014px;" data-x="317.014" data-y="395.479">compiled<span class="w1"> </span>a<span class="w1"> </span>trace.<span class="w0"> </span>At<span class="w1"> </span>this<span class="w1"> </span>point,<span class="w1"> </span>the<span class="w0"> </span>interpreter<span class="w1"> </span>PC<span class="w1"> </span>is<span class="w1"> </span>in<span class="w0"> </span>the<span class="w1"> </span>inner</div><div class="l f2 s4 t0" style="top:406.484px;left:317.014px;" data-x="317.014" data-y="385.516">tree,<span class="w1"> </span>so<span class="w1"> </span>we<span class="w1"> </span>cannot<span class="w1"> </span>continue<span class="w1"> </span>recording<span class="w1"> </span>or<span class="w1"> </span>executing<span class="w1"> </span>the<span class="w1"> </span>outer<span class="w0"> </span>tree.</div><div class="l f2 s4 t0" style="top:416.447px;left:317.014px;" data-x="317.014" data-y="375.553">If<span class="w1"> </span>this<span class="w1"> </span>happens<span class="w1"> </span>during<span class="w1"> </span>recording,<span class="w1"> </span>we<span class="w1"> </span>abort<span class="w1"> </span>the<span class="w1"> </span>outer<span class="w1"> </span>trace,<span class="w1"> </span>to<span class="w1"> </span>give</div><div class="l f2 s4 t0" style="top:426.409px;left:317.014px;" data-x="317.014" data-y="365.591">the<span class="w2"> </span>inner<span class="w1"> </span>tree<span class="w1"> </span>a<span class="w2"> </span>chance<span class="w1"> </span>to<span class="w1"> </span>finish<span class="w1"> </span>growing.<span class="w2"> </span>A<span class="w1"> </span>future<span class="w2"> </span>execution<span class="w1"> </span>of<span class="w1"> </span>the</div><div class="l f2 s4 t0" style="top:436.372px;left:317.014px;" data-x="317.014" data-y="355.628">outer<span class="w2"> </span>tree<span class="w1"> </span>would<span class="w1"> </span>then<span class="w2"> </span>be<span class="w1"> </span>able<span class="w2"> </span>to<span class="w1"> </span>properly<span class="w1"> </span>finish<span class="w2"> </span>and<span class="w1"> </span>record<span class="w1"> </span>a<span class="w2"> </span>call<span class="w1"> </span>to</div><div class="l f2 s4 t0" style="top:446.335px;left:317.014px;" data-x="317.014" data-y="345.665">the<span class="w2"> </span>inner<span class="w1"> </span>tree.<span class="w2"> </span>If<span class="w1"> </span>an<span class="w2"> </span>inner<span class="w1"> </span>tree<span class="w2"> </span>side<span class="w1"> </span>exit<span class="w2"> </span>happens<span class="w1"> </span>during<span class="w2"> </span>execution<span class="w1"> </span>of</div><div class="l f2 s4 t0" style="top:456.297px;left:317.014px;" data-x="317.014" data-y="335.703">a<span class="w1"> </span>compiled<span class="w1"> </span>trace<span class="w1"> </span>for<span class="w1"> </span>the<span class="w1"> </span>outer<span class="w1"> </span>tree,<span class="w1"> </span>we<span class="w1"> </span>simply<span class="w1"> </span>exit<span class="w1"> </span>the<span class="w1"> </span>outer<span class="w1"> </span>trace</div><div class="l f2 s4 t0" style="top:466.26px;left:317.014px;" data-x="317.014" data-y="325.74">and<span class="w2"> </span>start<span class="w1"> </span>recording<span class="w1"> </span>a<span class="w2"> </span>new<span class="w1"> </span>branch<span class="w2"> </span>in<span class="w1"> </span>the<span class="w1"> </span>inner<span class="w2"> </span>tree.</div><div class="l f1 s4 t0" style="top:487.884px;left:317.014px;" data-x="317.014" data-y="304.117">4.2<span class="w10"> </span>Blacklisting<span class="w2"> </span>with<span class="w1"> </span>Nesting</div><div class="l f2 s4 t0" style="top:501.831px;left:317.014px;" data-x="317.014" data-y="290.169">The<span class="w1"> </span>blacklisting<span class="w0"> </span>algorithm<span class="w1"> </span>needs<span class="w1"> </span>modification<span class="w1"> </span>to<span class="w0"> </span>work<span class="w1"> </span>well<span class="w1"> </span>with</div><div class="l f2 s4 t0" style="top:511.794px;left:317.014px;" data-x="317.014" data-y="280.206">nesting.<span class="w1"> </span>The<span class="w1"> </span>problem<span class="w0"> </span>is<span class="w1"> </span>that<span class="w1"> </span>outer<span class="w0"> </span>loop<span class="w1"> </span>traces<span class="w1"> </span>often<span class="w1"> </span>abort<span class="w0"> </span>during</div><div class="l f2 s4 t0" style="top:521.756px;left:317.014px;" data-x="317.014" data-y="270.244">startup<span class="w2"> </span>(because<span class="w1"> </span>the<span class="w1"> </span>inner<span class="w1"> </span>tree<span class="w2"> </span>is<span class="w1"> </span>not<span class="w1"> </span>available<span class="w2"> </span>or<span class="w1"> </span>takes<span class="w1"> </span>a<span class="w2"> </span>side<span class="w1"> </span>exit),</div><div class="l f2 s4 t0" style="top:531.719px;left:317.014px;" data-x="317.014" data-y="260.281">which<span class="w1"> </span>would<span class="w1"> </span>lead<span class="w0"> </span>to<span class="w1"> </span>their<span class="w1"> </span>being<span class="w0"> </span>quickly<span class="w1"> </span>blacklisted<span class="w1"> </span>by<span class="w0"> </span>the<span class="w1"> </span>basic</div><div class="l f2 s4 t0" style="top:541.682px;left:317.014px;" data-x="317.014" data-y="250.318">algorithm.</div><div class="l f2 s4 t0" style="top:551.644px;left:328.969px;" data-x="328.969" data-y="240.356">The<span class="w1"> </span>key<span class="w2"> </span>observation<span class="w1"> </span>is<span class="w1"> </span>that<span class="w1"> </span>when<span class="w1"> </span>an<span class="w2"> </span>outer<span class="w1"> </span>trace<span class="w1"> </span>aborts<span class="w1"> </span>because</div><div class="l f2 s4 t0" style="top:561.607px;left:317.014px;" data-x="317.014" data-y="230.393">the<span class="w1"> </span>inner<span class="w1"> </span>tree<span class="w1"> </span>is<span class="w1"> </span>not<span class="w1"> </span>ready,<span class="w2"> </span>this<span class="w1"> </span>is<span class="w1"> </span>probably<span class="w1"> </span>a<span class="w1"> </span>temporary<span class="w1"> </span>condition.</div><div class="l f2 s4 t0" style="top:571.57px;left:317.014px;" data-x="317.014" data-y="220.43">Thus,<span class="w1"> </span>we<span class="w2"> </span>should<span class="w1"> </span>not<span class="w1"> </span>count<span class="w1"> </span>such<span class="w1"> </span>aborts<span class="w1"> </span>toward<span class="w2"> </span>blacklisting<span class="w1"> </span>as<span class="w1"> </span>long</div><div class="l f2 s4 t0" style="top:581.532px;left:317.014px;" data-x="317.014" data-y="210.468">as<span class="w2"> </span>we<span class="w1"> </span>are<span class="w1"> </span>able<span class="w2"> </span>to<span class="w1"> </span>build<span class="w2"> </span>up<span class="w1"> </span>more<span class="w1"> </span>traces<span class="w2"> </span>for<span class="w1"> </span>the<span class="w1"> </span>inner<span class="w2"> </span>tree.</div><div class="l f2 s4 t0" style="top:591.495px;left:328.969px;" data-x="328.969" data-y="200.505">In<span class="w1"> </span>our<span class="w1"> </span>implementation,<span class="w1"> </span>when<span class="w1"> </span>an<span class="w1"> </span>outer<span class="w0"> </span>tree<span class="w2"> </span>aborts<span class="w0"> </span>on<span class="w2"> </span>the<span class="w0"> </span>inner</div><div class="l f2 s4 t0" style="top:601.458px;left:317.014px;" data-x="317.014" data-y="190.542">tree,<span class="w1"> </span>we<span class="w1"> </span>increment<span class="w0"> </span>the<span class="w1"> </span>outer<span class="w1"> </span>tree’s<span class="w1"> </span>blacklist<span class="w1"> </span>counter<span class="w0"> </span>as<span class="w1"> </span>usual<span class="w1"> </span>and</div><div class="l f2 s4 t0" style="top:611.42px;left:317.014px;" data-x="317.014" data-y="180.58">back<span class="w1"> </span>off<span class="w1"> </span>on<span class="w1"> </span>compiling<span class="w1"> </span>it.<span class="w1"> </span>When<span class="w1"> </span>the<span class="w1"> </span>inner<span class="w1"> </span>tree<span class="w1"> </span>finishes<span class="w1"> </span>a<span class="w1"> </span>trace,<span class="w1"> </span>we</div><div class="l f2 s4 t0" style="top:621.383px;left:317.014px;" data-x="317.014" data-y="170.617">decrement<span class="w1"> </span>the<span class="w1"> </span>blacklist<span class="w1"> </span>counter<span class="w1"> </span>on<span class="w1"> </span>the<span class="w1"> </span>outer<span class="w1"> </span>loop,<span class="w1"> </span>“forgiving”<span class="w1"> </span>the</div><div class="l f2 s4 t0" style="top:631.346px;left:317.014px;" data-x="317.014" data-y="160.654">outer<span class="w2"> </span>loop<span class="w1"> </span>for<span class="w2"> </span>aborting<span class="w2"> </span>previously.<span class="w2"> </span>We<span class="w2"> </span>also<span class="w1"> </span>undo<span class="w2"> </span>the<span class="w2"> </span>backoff<span class="w1"> </span>so<span class="w2"> </span>that</div><div class="l f2 s4 t0" style="top:641.308px;left:317.014px;" data-x="317.014" data-y="150.692">the<span class="w2"> </span>outer<span class="w1"> </span>tree<span class="w1"> </span>can<span class="w2"> </span>start<span class="w1"> </span>immediately<span class="w2"> </span>trying<span class="w1"> </span>to<span class="w1"> </span>compile<span class="w2"> </span>the<span class="w1"> </span>next<span class="w2"> </span>time</div><div class="l f2 s4 t0" style="top:651.271px;left:317.014px;" data-x="317.014" data-y="140.729">we<span class="w2"> </span>reach<span class="w1"> </span>it.</div><div class="l f1 s2 t0" style="top:679.721px;left:317.014px;" data-x="317.014" data-y="112.279">5.<span class="w3"> </span>Trace<span class="w2"> </span>Tree<span class="w2"> </span>Optimization</div><div class="l f2 s4 t0" style="top:693.669px;left:317.014px;" data-x="317.014" data-y="98.3312">This<span class="w0"> </span>section<span class="w0"> </span>explains<span class="w0"> </span>how<span class="w1"> </span>a<span class="w0"> </span>recorded<span class="w0"> </span>trace<span class="w0"> </span>is<span class="w0"> </span>translated<span class="w0"> </span>to<span class="w0"> </span>an</div><div class="l f2 s4 t0" style="top:703.631px;left:317.014px;" data-x="317.014" data-y="88.3686">optimized<span class="w1"> </span>machine<span class="w1"> </span>code<span class="w0"> </span>trace.<span class="w1"> </span>The<span class="w1"> </span>trace<span class="w0"> </span>compilation<span class="w1"> </span>subsystem,</div><div class="l f2 s8 t0" style="top:713.594px;left:317.238px;" data-x="317.238" data-y="78.4059">NAN<span class="w2"> </span>OJI<span class="w2"> </span>T</div><div class="l f2 s4 t0" style="top:713.594px;left:350.153px;" data-x="350.153" data-y="78.4059">,<span class="w0"> </span>is<span class="w0"> </span>separate<span class="w1"> </span>from<span class="w0"> </span>the<span class="w0"> </span>VM<span class="w0"> </span>and<span class="w0"> </span>can<span class="w0"> </span>be<span class="w0"> </span>used<span class="w1"> </span>for<span class="w0"> </span>other</div><div class="l f2 s4 t0" style="top:723.557px;left:317.014px;" data-x="317.014" data-y="68.4433">applications.</div></div></div><div id="page-8" class="p" style="width:612px;height:792px;"><div class="t"><div class="l f1 s4 t0" style="top:79.9701px;left:54px;" data-x="54" data-y="712.03">5.1<span class="w10"> </span>Optimizations</div><div class="l f2 s4 t0" style="top:93.9178px;left:54px;" data-x="54" data-y="698.082">Because<span class="w0"> </span>traces<span class="w1"> </span>are<span class="w0"> </span>in<span class="w1"> </span>SSA<span class="w0"> </span>form<span class="w0"> </span>and<span class="w1"> </span>have<span class="w0"> </span>no<span class="w1"> </span>join<span class="w0"> </span>points<span class="w0"> </span>or</div><div class="l ff s4 t0" style="top:93.9178px;left:284.633px;" data-x="284.633" data-y="698.082">φ</div><div class="l f2 s4 t0" style="top:93.9178px;left:290.118px;" data-x="290.118" data-y="698.082">-</div><div class="l f2 s4 t0" style="top:103.88px;left:54px;" data-x="54" data-y="688.12">nodes,<span class="w0"> </span>certain<span class="w1"> </span>optimizations<span class="w0"> </span>are<span class="w0"> </span>easy<span class="w1"> </span>to<span class="w0"> </span>implement.<span class="w1"> </span>In<span class="w0"> </span>order<span class="w0"> </span>to</div><div class="l f2 s4 t0" style="top:113.843px;left:54px;" data-x="54" data-y="678.157">get<span class="w1"> </span>good<span class="w1"> </span>startup<span class="w2"> </span>performance,<span class="w1"> </span>the<span class="w1"> </span>optimizations<span class="w1"> </span>must<span class="w1"> </span>run<span class="w1"> </span>quickly,</div><div class="l f2 s4 t0" style="top:123.806px;left:54px;" data-x="54" data-y="668.194">so<span class="w0"> </span>we<span class="w1"> </span>chose<span class="w0"> </span>a<span class="w0"> </span>small<span class="w1"> </span>set<span class="w0"> </span>of<span class="w0"> </span>optimizations.<span class="w1"> </span>We<span class="w1"> </span>implemented<span class="w0"> </span>the</div><div class="l f2 s4 t0" style="top:133.768px;left:54px;" data-x="54" data-y="658.232">optimizations<span class="w1"> </span>as<span class="w2"> </span>pipelined<span class="w1"> </span>filters<span class="w1"> </span>so<span class="w1"> </span>that<span class="w2"> </span>they<span class="w1"> </span>can<span class="w1"> </span>be<span class="w2"> </span>turned<span class="w1"> </span>on<span class="w1"> </span>and</div><div class="l f2 s4 t0" style="top:143.731px;left:54px;" data-x="54" data-y="648.269">off<span class="w1"> </span>independently,<span class="w2"> </span>and<span class="w1"> </span>yet<span class="w1"> </span>all<span class="w1"> </span>run<span class="w1"> </span>in<span class="w1"> </span>just<span class="w1"> </span>two<span class="w1"> </span>loop<span class="w1"> </span>passes<span class="w1"> </span>over<span class="w1"> </span>the</div><div class="l f2 s4 t0" style="top:153.694px;left:54px;" data-x="54" data-y="638.306">trace:<span class="w2"> </span>one<span class="w1"> </span>forward<span class="w1"> </span>and<span class="w2"> </span>one<span class="w1"> </span>backward.</div><div class="l f2 s4 t0" style="top:163.656px;left:65.9552px;" data-x="65.9552" data-y="628.344">Every<span class="w1"> </span>time<span class="w1"> </span>the<span class="w0"> </span>trace<span class="w1"> </span>recorder<span class="w1"> </span>emits<span class="w0"> </span>a<span class="w1"> </span>LIR<span class="w1"> </span>instruction,<span class="w1"> </span>the<span class="w0"> </span>in-</div><div class="l f2 s4 t0" style="top:173.619px;left:54px;" data-x="54" data-y="618.381">struction<span class="w0"> </span>is<span class="w1"> </span>immediately<span class="w0"> </span>passed<span class="w1"> </span>to<span class="w0"> </span>the<span class="w0"> </span>first<span class="w1"> </span>filter<span class="w0"> </span>in<span class="w1"> </span>the<span class="w0"> </span>forward</div><div class="l f2 s4 t0" style="top:183.582px;left:54px;" data-x="54" data-y="608.418">pipeline.<span class="w1"> </span>Thus,<span class="w0"> </span>forward<span class="w1"> </span>filter<span class="w1"> </span>optimizations<span class="w0"> </span>are<span class="w1"> </span>performed<span class="w1"> </span>as<span class="w0"> </span>the</div><div class="l f2 s4 t0" style="top:193.544px;left:54px;" data-x="54" data-y="598.456">trace<span class="w1"> </span>is<span class="w1"> </span>recorded.<span class="w2"> </span>Each<span class="w1"> </span>filter<span class="w1"> </span>may<span class="w1"> </span>pass<span class="w1"> </span>each<span class="w1"> </span>instruction<span class="w1"> </span>to<span class="w1"> </span>the<span class="w2"> </span>next</div><div class="l f2 s4 t0" style="top:203.507px;left:54px;" data-x="54" data-y="588.493">filter<span class="w1"> </span>unchanged,<span class="w1"> </span>write<span class="w1"> </span>a<span class="w0"> </span>different<span class="w2"> </span>instruction<span class="w0"> </span>to<span class="w2"> </span>the<span class="w0"> </span>next<span class="w2"> </span>filter,<span class="w1"> </span>or</div><div class="l f2 s4 t0" style="top:213.469px;left:54px;" data-x="54" data-y="578.531">write<span class="w1"> </span>no<span class="w1"> </span>instruction<span class="w1"> </span>at<span class="w1"> </span>all.<span class="w1"> </span>For<span class="w1"> </span>example,<span class="w2"> </span>the<span class="w1"> </span>constant<span class="w1"> </span>folding<span class="w1"> </span>filter</div><div class="l f2 s4 t0" style="top:223.432px;left:54px;" data-x="54" data-y="568.568">can<span class="w1"> </span>replace<span class="w1"> </span>a<span class="w1"> </span>multiply<span class="w1"> </span>instruction<span class="w1"> </span>like</div><div class="l ff s4 t0" style="top:223.432px;left:195.046px;" data-x="195.046" data-y="568.568">v</div><div class="l f8 s5 t0" style="top:224.428px;left:199.522px;" data-x="199.522" data-y="567.572">13</div><div class="l f14 s4 t0" style="top:223.432px;left:210.892px;" data-x="210.892" data-y="568.568">:=</div><div class="l ff s4 t0" style="top:223.432px;left:224.185px;" data-x="224.185" data-y="568.568">mul</div><div class="l f14 s4 t0" style="top:223.432px;left:240.506px;" data-x="240.506" data-y="568.568">3</div><div class="l ff s4 t0" style="top:223.432px;left:245.114px;" data-x="245.114" data-y="568.568">,</div><div class="l f14 s4 t0" style="top:223.432px;left:249.209px;" data-x="249.209" data-y="568.568">1000</div><div class="l f2 s4 t0" style="top:223.432px;left:270.41px;" data-x="270.41" data-y="568.568">with<span class="w1"> </span>a</div><div class="l f2 s4 t0" style="top:233.395px;left:54px;" data-x="54" data-y="558.605">constant<span class="w2"> </span>instruction</div><div class="l ff s4 t0" style="top:233.395px;left:126.725px;" data-x="126.725" data-y="558.605">v</div><div class="l f8 s5 t0" style="top:234.391px;left:131.202px;" data-x="131.202" data-y="557.609">13</div><div class="l f14 s4 t0" style="top:233.395px;left:141.565px;" data-x="141.565" data-y="558.605">=<span class="w1"> </span>3000</div><div class="l f2 s4 t0" style="top:233.395px;left:169.723px;" data-x="169.723" data-y="558.605">.</div><div class="l f2 s4 t0" style="top:243.357px;left:65.9551px;" data-x="65.9551" data-y="548.643">We<span class="w2"> </span>currently<span class="w2"> </span>apply<span class="w1"> </span>four<span class="w1"> </span>forward<span class="w2"> </span>filters:</div><div class="l f3 s3 t0" style="top:259.794px;left:59.2303px;" data-x="59.2303" data-y="532.206">•</div><div class="l f2 s4 t0" style="top:260.692px;left:66.9514px;" data-x="66.9514" data-y="531.308">On<span class="w1"> </span>ISAs<span class="w0"> </span>without<span class="w1"> </span>floating-point<span class="w1"> </span>instructions,<span class="w0"> </span>a<span class="w1"> </span>soft-float<span class="w1"> </span>filter</div><div class="l f2 s4 t0" style="top:270.655px;left:66.9514px;" data-x="66.9514" data-y="521.345">converts<span class="w2"> </span>floating-point<span class="w1"> </span>LIR<span class="w2"> </span>instructions<span class="w1"> </span>to<span class="w1"> </span>sequences<span class="w2"> </span>of<span class="w1"> </span>integer</div><div class="l f2 s4 t0" style="top:280.618px;left:66.9514px;" data-x="66.9514" data-y="511.382">instructions.</div><div class="l f3 s3 t0" style="top:293.667px;left:59.2303px;" data-x="59.2303" data-y="498.333">•</div><div class="l f2 s4 t0" style="top:294.565px;left:66.9514px;" data-x="66.9514" data-y="497.435">CSE<span class="w2"> </span>(constant<span class="w1"> </span>subexpression<span class="w1"> </span>elimination),</div><div class="l f3 s3 t0" style="top:307.615px;left:59.2303px;" data-x="59.2303" data-y="484.385">•</div><div class="l f2 s4 t0" style="top:308.513px;left:66.9514px;" data-x="66.9514" data-y="483.487">expression<span class="w2"> </span>simplification,<span class="w1"> </span>including<span class="w1"> </span>constant<span class="w1"> </span>folding<span class="w2"> </span>and<span class="w1"> </span>a<span class="w1"> </span>few</div><div class="l f2 s4 t0" style="top:318.476px;left:66.9514px;" data-x="66.9514" data-y="473.524">algebraic<span class="w2"> </span>identities<span class="w1"> </span>(e.g.,</div><div class="l ff s4 t0" style="top:318.476px;left:157.591px;" data-x="157.591" data-y="473.524">a</div><div class="l f6 s4 t0" style="top:318.476px;left:164.521px;" data-x="164.521" data-y="473.524">−</div><div class="l ff s4 t0" style="top:318.476px;left:173.736px;" data-x="173.736" data-y="473.524">a</div><div class="l f14 s4 t0" style="top:318.476px;left:181.178px;" data-x="181.178" data-y="473.524">=<span class="w1"> </span>0</div><div class="l f2 s4 t0" style="top:318.476px;left:195.513px;" data-x="195.513" data-y="473.524">),<span class="w2"> </span>and</div><div class="l f3 s3 t0" style="top:331.525px;left:59.2303px;" data-x="59.2303" data-y="460.475">•</div><div class="l f2 s4 t0" style="top:332.423px;left:66.9514px;" data-x="66.9514" data-y="459.577">source<span class="w0"> </span>language<span class="w0"> </span>semantic-specific<span class="w0"> </span>expression<span class="w0"> </span>simplification,</div><div class="l f2 s4 t0" style="top:342.386px;left:66.9514px;" data-x="66.9514" data-y="449.614">primarily<span class="w2"> </span>algebraic<span class="w1"> </span>identities<span class="w2"> </span>that<span class="w1"> </span>allow</div><div class="l f2 s8 t0" style="top:342.386px;left:209.65px;" data-x="209.65" data-y="449.614">DOU<span class="w2"> </span>BLE</div><div class="l f2 s4 t0" style="top:342.386px;left:243.209px;" data-x="243.209" data-y="449.614">to<span class="w2"> </span>be<span class="w1"> </span>replaced</div><div class="l f2 s4 t0" style="top:352.349px;left:66.9514px;" data-x="66.9514" data-y="439.651">with</div><div class="l f2 s8 t0" style="top:352.349px;left:85.6326px;" data-x="85.6326" data-y="439.651">INT</div><div class="l f2 s4 t0" style="top:352.349px;left:98.6874px;" data-x="98.6874" data-y="439.651">.<span class="w1"> </span>For<span class="w2"> </span>example,<span class="w1"> </span>LIR<span class="w1"> </span>that<span class="w1"> </span>converts<span class="w2"> </span>an</div><div class="l f2 s8 t0" style="top:352.349px;left:229.806px;" data-x="229.806" data-y="439.651">INT</div><div class="l f2 s4 t0" style="top:352.349px;left:245.376px;" data-x="245.376" data-y="439.651">to<span class="w1"> </span>a</div><div class="l f2 s8 t0" style="top:352.349px;left:261.587px;" data-x="261.587" data-y="439.651">DOU<span class="w2"> </span>BLE</div><div class="l f2 s4 t0" style="top:362.311px;left:66.9514px;" data-x="66.9514" data-y="429.689">and<span class="w2"> </span>then<span class="w1"> </span>back<span class="w1"> </span>again<span class="w2"> </span>would<span class="w1"> </span>be<span class="w2"> </span>removed<span class="w1"> </span>by<span class="w1"> </span>this<span class="w2"> </span>filter.</div><div class="l f2 s4 t0" style="top:379.646px;left:65.9551px;" data-x="65.9551" data-y="412.354">When<span class="w1"> </span>trace<span class="w1"> </span>recording<span class="w1"> </span>is<span class="w1"> </span>completed,<span class="w1"> </span>nanojit<span class="w1"> </span>runs<span class="w1"> </span>the<span class="w1"> </span>backward</div><div class="l f2 s4 t0" style="top:389.609px;left:54px;" data-x="54" data-y="402.391">optimization<span class="w1"> </span>filters.<span class="w1"> </span>These<span class="w1"> </span>are<span class="w0"> </span>used<span class="w1"> </span>for<span class="w1"> </span>optimizations<span class="w1"> </span>that<span class="w1"> </span>require</div><div class="l f2 s4 t0" style="top:399.572px;left:54px;" data-x="54" data-y="392.428">backward<span class="w1"> </span>program<span class="w0"> </span>analysis.<span class="w1"> </span>When<span class="w0"> </span>running<span class="w1"> </span>the<span class="w0"> </span>backward<span class="w1"> </span>filters,</div><div class="l f2 s4 t0" style="top:409.534px;left:54px;" data-x="54" data-y="382.466">nanojit<span class="w2"> </span>reads<span class="w1"> </span>one<span class="w2"> </span>LIR<span class="w2"> </span>instruction<span class="w1"> </span>at<span class="w2"> </span>a<span class="w1"> </span>time,<span class="w2"> </span>and<span class="w2"> </span>the<span class="w1"> </span>reads<span class="w2"> </span>are<span class="w1"> </span>passed</div><div class="l f2 s4 t0" style="top:419.497px;left:54px;" data-x="54" data-y="372.503">through<span class="w2"> </span>the<span class="w1"> </span>pipeline.</div><div class="l f2 s4 t0" style="top:429.459px;left:65.9551px;" data-x="65.9551" data-y="362.541">We<span class="w2"> </span>currently<span class="w2"> </span>apply<span class="w1"> </span>three<span class="w1"> </span>backward<span class="w2"> </span>filters:</div><div class="l f3 s3 t0" style="top:445.896px;left:59.2303px;" data-x="59.2303" data-y="346.104">•</div><div class="l f2 s4 t0" style="top:446.794px;left:66.9514px;" data-x="66.9514" data-y="345.206">Dead<span class="w2"> </span>data-stack<span class="w1"> </span>store<span class="w2"> </span>elimination.<span class="w1"> </span>The<span class="w2"> </span>LIR<span class="w2"> </span>trace<span class="w1"> </span>encodes<span class="w2"> </span>many</div><div class="l f2 s4 t0" style="top:456.757px;left:66.9514px;" data-x="66.9514" data-y="335.243">stores<span class="w1"> </span>to<span class="w2"> </span>locations<span class="w1"> </span>in<span class="w1"> </span>the<span class="w1"> </span>interpreter<span class="w1"> </span>stack.<span class="w2"> </span>But<span class="w1"> </span>these<span class="w1"> </span>values<span class="w1"> </span>are</div><div class="l f2 s4 t0" style="top:466.72px;left:66.9514px;" data-x="66.9514" data-y="325.28">never<span class="w1"> </span>read<span class="w1"> </span>back<span class="w1"> </span>before<span class="w1"> </span>exiting<span class="w0"> </span>the<span class="w2"> </span>trace<span class="w0"> </span>(by<span class="w1"> </span>the<span class="w1"> </span>interpreter<span class="w1"> </span>or</div><div class="l f2 s4 t0" style="top:476.682px;left:66.9514px;" data-x="66.9514" data-y="315.318">another<span class="w0"> </span>trace).<span class="w1"> </span>Thus,<span class="w0"> </span>stores<span class="w1"> </span>to<span class="w0"> </span>the<span class="w1"> </span>stack<span class="w0"> </span>that<span class="w0"> </span>are<span class="w1"> </span>overwritten</div><div class="l f2 s4 t0" style="top:486.645px;left:66.9514px;" data-x="66.9514" data-y="305.355">before<span class="w1"> </span>the<span class="w0"> </span>next<span class="w1"> </span>exit<span class="w1"> </span>are<span class="w0"> </span>dead.<span class="w1"> </span>Stores<span class="w1"> </span>to<span class="w0"> </span>locations<span class="w1"> </span>that<span class="w1"> </span>are<span class="w0"> </span>off</div><div class="l f2 s4 t0" style="top:496.608px;left:66.9514px;" data-x="66.9514" data-y="295.392">the<span class="w2"> </span>top<span class="w1"> </span>of<span class="w1"> </span>the<span class="w2"> </span>interpreter<span class="w1"> </span>stack<span class="w1"> </span>at<span class="w2"> </span>future<span class="w1"> </span>exits<span class="w2"> </span>are<span class="w1"> </span>also<span class="w1"> </span>dead.</div><div class="l f3 s3 t0" style="top:509.657px;left:59.2303px;" data-x="59.2303" data-y="282.343">•</div><div class="l f2 s4 t0" style="top:510.555px;left:66.9514px;" data-x="66.9514" data-y="281.445">Dead<span class="w2"> </span>call-stack<span class="w1"> </span>store<span class="w2"> </span>elimination.<span class="w2"> </span>This<span class="w1"> </span>is<span class="w2"> </span>the<span class="w1"> </span>same<span class="w2"> </span>optimization</div><div class="l f2 s4 t0" style="top:520.518px;left:66.9514px;" data-x="66.9514" data-y="271.482">as<span class="w1"> </span>above,<span class="w2"> </span>except<span class="w1"> </span>applied<span class="w1"> </span>to<span class="w1"> </span>the<span class="w1"> </span>interpreter’s<span class="w2"> </span>call<span class="w1"> </span>stack<span class="w1"> </span>used<span class="w1"> </span>for</div><div class="l f2 s4 t0" style="top:530.481px;left:66.9514px;" data-x="66.9514" data-y="261.519">function<span class="w2"> </span>call<span class="w1"> </span>inlining.</div><div class="l f3 s3 t0" style="top:543.53px;left:59.2303px;" data-x="59.2303" data-y="248.47">•</div><div class="l f2 s4 t0" style="top:544.428px;left:66.9514px;" data-x="66.9514" data-y="247.572">Dead<span class="w0"> </span>code<span class="w0"> </span>elimination.<span class="w4"> </span>This<span class="w0"> </span>eliminates<span class="w0"> </span>any<span class="w4"> </span>operation<span class="w0"> </span>that</div><div class="l f2 s4 t0" style="top:554.391px;left:66.9514px;" data-x="66.9514" data-y="237.609">stores<span class="w2"> </span>to<span class="w1"> </span>a<span class="w1"> </span>value<span class="w2"> </span>that<span class="w1"> </span>is<span class="w2"> </span>never<span class="w1"> </span>used.</div><div class="l f2 s4 t0" style="top:571.726px;left:65.9551px;" data-x="65.9551" data-y="220.274">After<span class="w0"> </span>a<span class="w1"> </span>LIR<span class="w0"> </span>instruction<span class="w0"> </span>is<span class="w0"> </span>successfully<span class="w1"> </span>read<span class="w0"> </span>(“pulled”)<span class="w0"> </span>from</div><div class="l f2 s4 t0" style="top:581.689px;left:54px;" data-x="54" data-y="210.311">the<span class="w1"> </span>backward<span class="w1"> </span>filter<span class="w1"> </span>pipeline,<span class="w1"> </span>nanojit’s<span class="w1"> </span>code<span class="w1"> </span>generator<span class="w1"> </span>emits<span class="w1"> </span>native</div><div class="l f2 s4 t0" style="top:591.651px;left:54px;" data-x="54" data-y="200.349">machine<span class="w2"> </span>instruction(s)<span class="w1"> </span>for<span class="w1"> </span>it.</div><div class="l f1 s4 t0" style="top:609.982px;left:54px;" data-x="54" data-y="182.018">5.2<span class="w10"> </span>Register<span class="w2"> </span>Allocation</div><div class="l f2 s4 t0" style="top:623.93px;left:54px;" data-x="54" data-y="168.07">We<span class="w1"> </span>use<span class="w0"> </span>a<span class="w0"> </span>simple<span class="w0"> </span>greedy<span class="w0"> </span>register<span class="w0"> </span>allocator<span class="w0"> </span>that<span class="w0"> </span>makes<span class="w0"> </span>a<span class="w0"> </span>single</div><div class="l f2 s4 t0" style="top:633.893px;left:54px;" data-x="54" data-y="158.107">backward<span class="w1"> </span>pass<span class="w1"> </span>over<span class="w0"> </span>the<span class="w1"> </span>trace<span class="w1"> </span>(it<span class="w1"> </span>is<span class="w0"> </span>integrated<span class="w1"> </span>with<span class="w1"> </span>the<span class="w1"> </span>code<span class="w0"> </span>gen-</div><div class="l f2 s4 t0" style="top:643.855px;left:54px;" data-x="54" data-y="148.145">erator).<span class="w1"> </span>By<span class="w0"> </span>the<span class="w1"> </span>time<span class="w1"> </span>the<span class="w0"> </span>allocator<span class="w1"> </span>has<span class="w1"> </span>reached<span class="w0"> </span>an<span class="w1"> </span>instruction<span class="w1"> </span>like</div><div class="l ff s4 t0" style="top:653.818px;left:54px;" data-x="54" data-y="138.182">v</div><div class="l f8 s5 t0" style="top:654.814px;left:58.4762px;" data-x="58.4762" data-y="137.186">3</div><div class="l f14 s4 t0" style="top:653.818px;left:65.5404px;" data-x="65.5404" data-y="138.182">=</div><div class="l ff s4 t0" style="top:653.818px;left:75.6211px;" data-x="75.6211" data-y="138.182">add<span class="w1"> </span>v</div><div class="l f8 s5 t0" style="top:654.814px;left:96.9561px;" data-x="96.9561" data-y="137.186">1</div><div class="l ff s4 t0" style="top:653.818px;left:101.107px;" data-x="101.107" data-y="138.182">,<span class="w2"> </span>v</div><div class="l f8 s5 t0" style="top:654.814px;left:109.679px;" data-x="109.679" data-y="137.186">2</div><div class="l f2 s4 t0" style="top:653.818px;left:113.83px;" data-x="113.83" data-y="138.182">,<span class="w1"> </span>it<span class="w2"> </span>has<span class="w1"> </span>already<span class="w1"> </span>assigned<span class="w1"> </span>a<span class="w2"> </span>register<span class="w1"> </span>to</div><div class="l ff s4 t0" style="top:653.818px;left:247.407px;" data-x="247.407" data-y="138.182">v</div><div class="l f8 s5 t0" style="top:654.814px;left:251.883px;" data-x="251.883" data-y="137.186">3</div><div class="l f2 s4 t0" style="top:653.818px;left:256.034px;" data-x="256.034" data-y="138.182">.<span class="w1"> </span>If</div><div class="l ff s4 t0" style="top:653.818px;left:269.101px;" data-x="269.101" data-y="138.182">v</div><div class="l f8 s5 t0" style="top:654.814px;left:273.578px;" data-x="273.578" data-y="137.186">1</div><div class="l f2 s4 t0" style="top:653.818px;left:280.156px;" data-x="280.156" data-y="138.182">and</div><div class="l ff s4 t0" style="top:663.781px;left:53.9999px;" data-x="53.9999" data-y="128.219">v</div><div class="l f8 s5 t0" style="top:664.777px;left:58.4762px;" data-x="58.4762" data-y="127.223">2</div><div class="l f2 s4 t0" style="top:663.781px;left:64.9004px;" data-x="64.9004" data-y="128.219">have<span class="w2"> </span>not<span class="w1"> </span>yet<span class="w1"> </span>been<span class="w2"> </span>assigned<span class="w1"> </span>registers,<span class="w2"> </span>the<span class="w1"> </span>allocator<span class="w1"> </span>assigns<span class="w2"> </span>a<span class="w1"> </span>free</div><div class="l f2 s4 t0" style="top:673.743px;left:53.9999px;" data-x="53.9999" data-y="118.257">register<span class="w2"> </span>to<span class="w1"> </span>each.<span class="w2"> </span>If<span class="w1"> </span>there<span class="w2"> </span>are<span class="w1"> </span>no<span class="w1"> </span>free<span class="w2"> </span>registers,<span class="w1"> </span>a<span class="w2"> </span>value<span class="w1"> </span>is<span class="w2"> </span>selected<span class="w1"> </span>for</div><div class="l f2 s4 t0" style="top:683.706px;left:53.9999px;" data-x="53.9999" data-y="108.294">spilling.<span class="w1"> </span>We<span class="w2"> </span>use<span class="w1"> </span>a<span class="w1"> </span>class<span class="w1"> </span>heuristic<span class="w1"> </span>that<span class="w1"> </span>selects<span class="w1"> </span>the<span class="w1"> </span>“oldest”<span class="w1"> </span>register-</div><div class="l f2 s4 t0" style="top:693.669px;left:53.9999px;" data-x="53.9999" data-y="98.3313">carried<span class="w2"> </span>value<span class="w1"> </span>(6).</div><div class="l f2 s4 t0" style="top:703.631px;left:65.9551px;" data-x="65.9551" data-y="88.3687">The<span class="w2"> </span>heuristic<span class="w1"> </span>considers<span class="w1"> </span>the<span class="w2"> </span>set</div><div class="l ff s4 t0" style="top:703.631px;left:176.891px;" data-x="176.891" data-y="88.3687">R</div><div class="l f2 s4 t0" style="top:703.631px;left:186.192px;" data-x="186.192" data-y="88.3687">of<span class="w2"> </span>values</div><div class="l ff s4 t0" style="top:703.631px;left:220.878px;" data-x="220.878" data-y="88.3687">v</div><div class="l f2 s4 t0" style="top:703.631px;left:227.942px;" data-x="227.942" data-y="88.3687">in<span class="w2"> </span>registers<span class="w1"> </span>imme-</div><div class="l f2 s4 t0" style="top:713.594px;left:53.9999px;" data-x="53.9999" data-y="78.406">diately<span class="w1"> </span>after<span class="w1"> </span>the<span class="w2"> </span>current<span class="w1"> </span>instruction<span class="w1"> </span>for<span class="w1"> </span>spilling.<span class="w1"> </span>Let</div><div class="l ff s4 t0" style="top:713.594px;left:241.91px;" data-x="241.91" data-y="78.406">v</div><div class="l f10 s5 t0" style="top:714.59px;left:246.387px;" data-x="246.387" data-y="77.4098">m</div><div class="l f2 s4 t0" style="top:713.594px;left:256.025px;" data-x="256.025" data-y="78.406">be<span class="w1"> </span>the<span class="w1"> </span>last</div><div class="l f2 s4 t0" style="top:723.557px;left:53.9999px;" data-x="53.9999" data-y="68.4434">instruction<span class="w2"> </span>before<span class="w1"> </span>the<span class="w1"> </span>current<span class="w2"> </span>where<span class="w1"> </span>each</div><div class="l ff s4 t0" style="top:723.557px;left:203.802px;" data-x="203.802" data-y="68.4434">v</div><div class="l f2 s4 t0" style="top:723.557px;left:210.911px;" data-x="210.911" data-y="68.4434">is<span class="w2"> </span>referred<span class="w1"> </span>to.<span class="w1"> </span>Then<span class="w2"> </span>the</div><div class="l f2 s4 t0" style="top:78.9738px;left:323.551px;" data-x="323.551" data-y="713.026">Tag</div></div><div class="t t80"></div><div class="t t0"><div class="l f2 s4 t0" style="top:78.9738px;left:348.956px;" data-x="348.956" data-y="713.026">JS<span class="w2"> </span>Type</div></div><div class="t t81"></div><div class="t t0"><div class="l f2 s4 t0" style="top:78.9738px;left:396.274px;" data-x="396.274" data-y="713.026">Description</div></div><div class="t t82"></div><div class="t t0"><div class="l f2 s4 t0" style="top:89.335px;left:323.551px;" data-x="323.551" data-y="702.665">xx1</div></div><div class="t t83"></div><div class="t t0"><div class="l f2 s4 t0" style="top:89.335px;left:348.956px;" data-x="348.956" data-y="702.665">number</div></div><div class="t t84"></div><div class="t t0"><div class="l f2 s4 t0" style="top:89.335px;left:396.274px;" data-x="396.274" data-y="702.665">31-bit<span class="w2"> </span>integer<span class="w1"> </span>representation</div><div class="l f2 s4 t0" style="top:99.2976px;left:323.551px;" data-x="323.551" data-y="692.702">000</div></div><div class="t t85"></div><div class="t t0"><div class="l f2 s4 t0" style="top:99.2976px;left:348.956px;" data-x="348.956" data-y="692.702">object</div></div><div class="t t86"></div><div class="t t0"><div class="l f2 s4 t0" style="top:99.2976px;left:396.274px;" data-x="396.274" data-y="692.702">pointer<span class="w2"> </span>to<span class="w1"> </span>JSObject<span class="w1"> </span>handle</div><div class="l f2 s4 t0" style="top:109.26px;left:323.551px;" data-x="323.551" data-y="682.74">010</div></div><div class="t t87"></div><div class="t t0"><div class="l f2 s4 t0" style="top:109.26px;left:348.956px;" data-x="348.956" data-y="682.74">number</div></div><div class="t t88"></div><div class="t t0"><div class="l f2 s4 t0" style="top:109.26px;left:396.274px;" data-x="396.274" data-y="682.74">pointer<span class="w2"> </span>to<span class="w1"> </span>double<span class="w1"> </span>handle</div><div class="l f2 s4 t0" style="top:119.223px;left:323.551px;" data-x="323.551" data-y="672.777">100</div></div><div class="t t89"></div><div class="t t0"><div class="l f2 s4 t0" style="top:119.223px;left:348.956px;" data-x="348.956" data-y="672.777">string</div></div><div class="t t8a"></div><div class="t t0"><div class="l f2 s4 t0" style="top:119.223px;left:396.274px;" data-x="396.274" data-y="672.777">pointer<span class="w2"> </span>to<span class="w1"> </span>JSString<span class="w1"> </span>handle</div><div class="l f2 s4 t0" style="top:129.185px;left:323.551px;" data-x="323.551" data-y="662.815">110</div></div><div class="t t8b"></div><div class="t t0"><div class="l f2 s4 t0" style="top:129.186px;left:348.956px;" data-x="348.956" data-y="662.814">boolean</div></div><div class="t t8c"></div><div class="t t0"><div class="l f2 s4 t0" style="top:129.186px;left:396.274px;" data-x="396.274" data-y="662.814">enumeration<span class="w2"> </span>for<span class="w1"> </span>null,<span class="w1"> </span>undefined,<span class="w2"> </span>true,<span class="w1"> </span>false</div></div><div class="t t8d"></div><div class="t t0"><div class="l f2 s4 t0" style="top:139.148px;left:348.956px;" data-x="348.956" data-y="652.852">null,<span class="w2"> </span>or</div></div><div class="t t8e"></div><div class="t t8f"></div><div class="t t0"><div class="l f2 s4 t0" style="top:149.111px;left:348.956px;" data-x="348.956" data-y="642.889">undefined</div></div><div class="t t90"></div><div class="t t91"></div><div class="t t0"><div class="l f1 s4 t0" style="top:166.576px;left:317.014px;" data-x="317.014" data-y="625.424">Figure<span class="w1"> </span>9.<span class="w0"> </span>Tagged<span class="w1"> </span>values<span class="w1"> </span>in<span class="w1"> </span>the<span class="w0"> </span>SpiderMonkey<span class="w1"> </span>JS<span class="w1"> </span>interpreter.</div><div class="l f2 s4 t0" style="top:176.539px;left:317.014px;" data-x="317.014" data-y="615.461">Testing<span class="w2"> </span>tags,<span class="w1"> </span>unboxing<span class="w1"> </span>(extracting<span class="w2"> </span>the<span class="w1"> </span>untagged<span class="w1"> </span>value)<span class="w1"> </span>and<span class="w2"> </span>boxing</div><div class="l f2 s4 t0" style="top:186.502px;left:317.014px;" data-x="317.014" data-y="605.498">(creating<span class="w1"> </span>tagged<span class="w2"> </span>values)<span class="w1"> </span>are<span class="w1"> </span>significant<span class="w1"> </span>costs.<span class="w2"> </span>Avoiding<span class="w1"> </span>these<span class="w2"> </span>costs</div><div class="l f2 s4 t0" style="top:196.464px;left:317.014px;" data-x="317.014" data-y="595.536">is<span class="w2"> </span>a<span class="w1"> </span>key<span class="w2"> </span>benefit<span class="w1"> </span>of<span class="w1"> </span>tracing.</div><div class="l f2 s4 t0" style="top:233.549px;left:317.014px;" data-x="317.014" data-y="558.451">heuristic<span class="w1"> </span>selects</div><div class="l ff s4 t0" style="top:233.549px;left:377.839px;" data-x="377.839" data-y="558.451">v</div><div class="l f2 s4 t0" style="top:233.549px;left:385.657px;" data-x="385.657" data-y="558.451">with<span class="w1"> </span>minimum</div><div class="l ff s4 t0" style="top:233.549px;left:442.52px;" data-x="442.52" data-y="558.451">v</div><div class="l f10 s5 t0" style="top:234.546px;left:446.996px;" data-x="446.996" data-y="557.454">m</div><div class="l f2 s4 t0" style="top:233.549px;left:454.032px;" data-x="454.032" data-y="558.451">.<span class="w1"> </span>The<span class="w1"> </span>motivation<span class="w1"> </span>is<span class="w1"> </span>that<span class="w1"> </span>this</div><div class="l f2 s4 t0" style="top:243.512px;left:317.014px;" data-x="317.014" data-y="548.488">frees<span class="w2"> </span>up<span class="w1"> </span>a<span class="w1"> </span>register<span class="w2"> </span>for<span class="w1"> </span>as<span class="w2"> </span>long<span class="w1"> </span>as<span class="w1"> </span>possible<span class="w2"> </span>given<span class="w1"> </span>a<span class="w2"> </span>single<span class="w1"> </span>spill.</div><div class="l f2 s4 t0" style="top:253.475px;left:328.969px;" data-x="328.969" data-y="538.525">If<span class="w1"> </span>we<span class="w0"> </span>need<span class="w0"> </span>to<span class="w1"> </span>spill<span class="w0"> </span>a<span class="w1"> </span>value</div><div class="l ff s4 t0" style="top:253.475px;left:433.684px;" data-x="433.684" data-y="538.525">v</div><div class="l f10 s5 t0" style="top:254.471px;left:438.16px;" data-x="438.16" data-y="537.529">s</div><div class="l f2 s4 t0" style="top:253.475px;left:445.832px;" data-x="445.832" data-y="538.525">at<span class="w1"> </span>this<span class="w0"> </span>point,<span class="w0"> </span>we<span class="w1"> </span>generate<span class="w0"> </span>the</div><div class="l f2 s4 t0" style="top:263.437px;left:317.014px;" data-x="317.014" data-y="528.563">restore<span class="w0"> </span>code<span class="w1"> </span>just<span class="w0"> </span>after<span class="w0"> </span>the<span class="w1"> </span>code<span class="w0"> </span>for<span class="w0"> </span>the<span class="w1"> </span>current<span class="w0"> </span>instruction.<span class="w0"> </span>The</div><div class="l f2 s4 t0" style="top:273.4px;left:317.014px;" data-x="317.014" data-y="518.6">corresponding<span class="w2"> </span>spill<span class="w1"> </span>code<span class="w2"> </span>is<span class="w1"> </span>generated<span class="w1"> </span>just<span class="w2"> </span>after<span class="w1"> </span>the<span class="w2"> </span>last<span class="w1"> </span>point<span class="w2"> </span>where</div><div class="l ff s4 t0" style="top:283.363px;left:317.014px;" data-x="317.014" data-y="508.637">v</div><div class="l f10 s5 t0" style="top:284.359px;left:321.49px;" data-x="321.49" data-y="507.641">s</div><div class="l f2 s4 t0" style="top:283.363px;left:327.529px;" data-x="327.529" data-y="508.637">was<span class="w2"> </span>used.<span class="w1"> </span>The<span class="w2"> </span>register<span class="w1"> </span>that<span class="w2"> </span>was<span class="w2"> </span>assigned<span class="w1"> </span>to</div><div class="l ff s4 t0" style="top:283.363px;left:482.291px;" data-x="482.291" data-y="508.637">v</div><div class="l f10 s5 t0" style="top:284.359px;left:486.768px;" data-x="486.768" data-y="507.641">s</div><div class="l f2 s4 t0" style="top:283.363px;left:492.807px;" data-x="492.807" data-y="508.637">is<span class="w2"> </span>marked<span class="w1"> </span>free<span class="w2"> </span>for</div><div class="l f2 s4 t0" style="top:293.325px;left:317.014px;" data-x="317.014" data-y="498.675">the<span class="w1"> </span>preceding<span class="w1"> </span>code,<span class="w0"> </span>because<span class="w1"> </span>that<span class="w1"> </span>register<span class="w1"> </span>can<span class="w0"> </span>now<span class="w2"> </span>be<span class="w0"> </span>used<span class="w1"> </span>freely</div><div class="l f2 s4 t0" style="top:303.288px;left:317.014px;" data-x="317.014" data-y="488.712">without<span class="w2"> </span>affecting<span class="w1"> </span>the<span class="w2"> </span>following<span class="w1"> </span>code</div><div class="l f1 s2 t0" style="top:327.902px;left:317.014px;" data-x="317.014" data-y="464.098">6.<span class="w3"> </span>Implementation</div><div class="l f2 s4 t0" style="top:341.85px;left:317.014px;" data-x="317.014" data-y="450.15">To<span class="w1"> </span>demonstrate<span class="w0"> </span>the<span class="w1"> </span>effectiveness<span class="w0"> </span>of<span class="w1"> </span>our<span class="w0"> </span>approach,<span class="w0"> </span>we<span class="w1"> </span>have<span class="w0"> </span>im-</div><div class="l f2 s4 t0" style="top:351.813px;left:317.014px;" data-x="317.014" data-y="440.187">plemented<span class="w1"> </span>a<span class="w1"> </span>trace-based<span class="w1"> </span>dynamic<span class="w1"> </span>compiler<span class="w1"> </span>for<span class="w1"> </span>the<span class="w1"> </span>SpiderMonkey</div><div class="l f2 s4 t0" style="top:361.775px;left:317.014px;" data-x="317.014" data-y="430.225">JavaScript<span class="w1"> </span>Virtual<span class="w0"> </span>Machine<span class="w1"> </span>(4).<span class="w0"> </span>SpiderMonkey<span class="w1"> </span>is<span class="w0"> </span>the<span class="w1"> </span>JavaScript</div><div class="l f2 s4 t0" style="top:371.738px;left:317.014px;" data-x="317.014" data-y="420.262">VM<span class="w1"> </span>embedded<span class="w2"> </span>in<span class="w1"> </span>Mozilla’s<span class="w1"> </span>Firefox<span class="w1"> </span>open-source<span class="w1"> </span>web<span class="w2"> </span>browser<span class="w1"> </span>(2),</div><div class="l f2 s4 t0" style="top:381.701px;left:317.014px;" data-x="317.014" data-y="410.299">which<span class="w2"> </span>is<span class="w1"> </span>used<span class="w2"> </span>by<span class="w2"> </span>more<span class="w1"> </span>than<span class="w2"> </span>200<span class="w1"> </span>million<span class="w2"> </span>users<span class="w2"> </span>world-wide.<span class="w1"> </span>The<span class="w2"> </span>core</div><div class="l f2 s4 t0" style="top:391.663px;left:317.014px;" data-x="317.014" data-y="400.337">of<span class="w2"> </span>SpiderMonkey<span class="w1"> </span>is<span class="w2"> </span>a<span class="w1"> </span>bytecode<span class="w1"> </span>interpreter<span class="w2"> </span>implemented<span class="w1"> </span>in<span class="w1"> </span>C++.</div><div class="l f2 s4 t0" style="top:401.626px;left:328.969px;" data-x="328.969" data-y="390.374">In<span class="w1"> </span>SpiderMonkey,<span class="w1"> </span>all<span class="w1"> </span>JavaScript<span class="w1"> </span>values<span class="w1"> </span>are<span class="w1"> </span>represented<span class="w1"> </span>by<span class="w1"> </span>the</div><div class="l f2 s4 t0" style="top:411.589px;left:317.014px;" data-x="317.014" data-y="380.411">type</div><div class="l f7 s4 t0" style="top:411.589px;left:334.917px;" data-x="334.917" data-y="380.411">jsval</div><div class="l f2 s4 t0" style="top:411.589px;left:358.453px;" data-x="358.453" data-y="380.411">.<span class="w1"> </span>A</div><div class="l f7 s4 t0" style="top:411.589px;left:372.095px;" data-x="372.095" data-y="380.411">jsval</div><div class="l f2 s4 t0" style="top:411.589px;left:398.094px;" data-x="398.094" data-y="380.411">is<span class="w1"> </span>machine<span class="w2"> </span>word<span class="w1"> </span>in<span class="w1"> </span>which<span class="w1"> </span>up<span class="w2"> </span>to<span class="w1"> </span>the<span class="w1"> </span>3<span class="w1"> </span>of<span class="w1"> </span>the</div><div class="l f2 s4 t0" style="top:421.551px;left:317.014px;" data-x="317.014" data-y="370.449">least<span class="w2"> </span>significant<span class="w1"> </span>bits<span class="w1"> </span>are<span class="w2"> </span>a<span class="w1"> </span>type<span class="w1"> </span>tag,<span class="w2"> </span>and<span class="w1"> </span>the<span class="w1"> </span>remaining<span class="w2"> </span>bits<span class="w1"> </span>are<span class="w1"> </span>data.</div><div class="l f2 s4 t0" style="top:431.514px;left:317.014px;" data-x="317.014" data-y="360.486">See<span class="w1"> </span>Figure<span class="w2"> </span>6<span class="w1"> </span>for<span class="w1"> </span>details.<span class="w2"> </span>All<span class="w1"> </span>pointers<span class="w1"> </span>contained<span class="w1"> </span>in</div><div class="l f7 s4 t0" style="top:431.514px;left:497.678px;" data-x="497.678" data-y="360.486">jsvals</div><div class="l f2 s4 t0" style="top:431.514px;left:528.314px;" data-x="528.314" data-y="360.486">point<span class="w1"> </span>to</div><div class="l f2 s4 t0" style="top:441.477px;left:317.014px;" data-x="317.014" data-y="350.523">GC-controlled<span class="w2"> </span>blocks<span class="w1"> </span>aligned<span class="w1"> </span>on<span class="w2"> </span>8-byte<span class="w1"> </span>boundaries.</div><div class="l f2 s4 t0" style="top:451.439px;left:328.969px;" data-x="328.969" data-y="340.561">JavaScript</div><div class="l fa s4 t0" style="top:451.439px;left:368.016px;" data-x="368.016" data-y="340.561">object</div><div class="l f2 s4 t0" style="top:451.439px;left:392.189px;" data-x="392.189" data-y="340.561">values<span class="w2"> </span>are<span class="w1"> </span>mappings<span class="w2"> </span>of<span class="w1"> </span>string-valued<span class="w2"> </span>property</div><div class="l f2 s4 t0" style="top:461.402px;left:317.014px;" data-x="317.014" data-y="330.598">names<span class="w2"> </span>to<span class="w1"> </span>arbitrary<span class="w2"> </span>values.<span class="w1"> </span>They<span class="w2"> </span>are<span class="w1"> </span>represented<span class="w1"> </span>in<span class="w2"> </span>one<span class="w1"> </span>of<span class="w2"> </span>two<span class="w1"> </span>ways</div><div class="l f2 s4 t0" style="top:471.364px;left:317.014px;" data-x="317.014" data-y="320.636">in<span class="w1"> </span>SpiderMonkey.<span class="w2"> </span>Most<span class="w1"> </span>objects<span class="w1"> </span>are<span class="w1"> </span>represented<span class="w1"> </span>by<span class="w1"> </span>a<span class="w1"> </span>shared<span class="w1"> </span>struc-</div><div class="l f2 s4 t0" style="top:481.327px;left:317.014px;" data-x="317.014" data-y="310.673">tural<span class="w2"> </span>description,<span class="w1"> </span>called<span class="w2"> </span>the</div><div class="l fa s4 t0" style="top:481.327px;left:415.671px;" data-x="415.671" data-y="310.673">object<span class="w2"> </span>shape</div><div class="l f2 s4 t0" style="top:481.327px;left:460.445px;" data-x="460.445" data-y="310.673">,<span class="w2"> </span>that<span class="w1"> </span>maps<span class="w2"> </span>property<span class="w2"> </span>names</div><div class="l f2 s4 t0" style="top:491.29px;left:317.014px;" data-x="317.014" data-y="300.71">to<span class="w1"> </span>array<span class="w1"> </span>indexes<span class="w1"> </span>using<span class="w1"> </span>a<span class="w1"> </span>hash<span class="w1"> </span>table.<span class="w1"> </span>The<span class="w1"> </span>object<span class="w1"> </span>stores<span class="w1"> </span>a<span class="w1"> </span>pointer<span class="w1"> </span>to</div><div class="l f2 s4 t0" style="top:501.252px;left:317.014px;" data-x="317.014" data-y="290.748">the<span class="w1"> </span>shape<span class="w1"> </span>and<span class="w0"> </span>the<span class="w1"> </span>array<span class="w1"> </span>of<span class="w0"> </span>its<span class="w1"> </span>own<span class="w1"> </span>property<span class="w1"> </span>values.<span class="w0"> </span>Objects<span class="w1"> </span>with</div><div class="l f2 s4 t0" style="top:511.215px;left:317.014px;" data-x="317.014" data-y="280.785">large,<span class="w1"> </span>unique<span class="w2"> </span>sets<span class="w1"> </span>of<span class="w1"> </span>property<span class="w1"> </span>names<span class="w1"> </span>store<span class="w1"> </span>their<span class="w1"> </span>properties<span class="w1"> </span>directly</div><div class="l f2 s4 t0" style="top:521.178px;left:317.014px;" data-x="317.014" data-y="270.822">in<span class="w2"> </span>a<span class="w1"> </span>hash<span class="w1"> </span>table.</div><div class="l f2 s4 t0" style="top:531.14px;left:328.969px;" data-x="328.969" data-y="260.86">The<span class="w1"> </span>garbage<span class="w0"> </span>collector<span class="w1"> </span>is<span class="w1"> </span>an<span class="w0"> </span>exact,<span class="w1"> </span>non-generational,<span class="w1"> </span>stop-the-</div><div class="l f2 s4 t0" style="top:541.103px;left:317.014px;" data-x="317.014" data-y="250.897">world<span class="w2"> </span>mark-and-sweep<span class="w1"> </span>collector.</div><div class="l f2 s4 t0" style="top:551.066px;left:328.969px;" data-x="328.969" data-y="240.934">In<span class="w2"> </span>the<span class="w1"> </span>rest<span class="w2"> </span>of<span class="w1"> </span>this<span class="w2"> </span>section<span class="w2"> </span>we<span class="w1"> </span>discuss<span class="w2"> </span>key<span class="w1"> </span>areas<span class="w2"> </span>of<span class="w1"> </span>the<span class="w2"> </span>TraceMon-</div><div class="l f2 s4 t0" style="top:561.028px;left:317.014px;" data-x="317.014" data-y="230.972">key<span class="w2"> </span>implementation.</div><div class="l f1 s4 t0" style="top:580.095px;left:317.014px;" data-x="317.014" data-y="211.905">6.1<span class="w10"> </span>Calling<span class="w2"> </span>Compiled<span class="w1"> </span>Traces</div><div class="l f2 s4 t0" style="top:594.042px;left:317.014px;" data-x="317.014" data-y="197.958">Compiled<span class="w1"> </span>traces<span class="w1"> </span>are<span class="w1"> </span>stored<span class="w2"> </span>in<span class="w1"> </span>a</div><div class="l fa s4 t0" style="top:594.042px;left:432.865px;" data-x="432.865" data-y="197.958">trace<span class="w1"> </span>cache</div><div class="l f2 s4 t0" style="top:594.042px;left:474.556px;" data-x="474.556" data-y="197.958">,<span class="w1"> </span>indexed<span class="w2"> </span>by<span class="w1"> </span>intepreter</div><div class="l f2 s4 t0" style="top:604.005px;left:317.014px;" data-x="317.014" data-y="187.995">PC<span class="w0"> </span>and<span class="w0"> </span>type<span class="w4"> </span>map.<span class="w0"> </span>Traces<span class="w0"> </span>are<span class="w0"> </span>compiled<span class="w4"> </span>so<span class="w0"> </span>that<span class="w0"> </span>they<span class="w4"> </span>may<span class="w0"> </span>be</div><div class="l f2 s4 t0" style="top:613.968px;left:317.014px;" data-x="317.014" data-y="178.032">called<span class="w1"> </span>as<span class="w2"> </span>functions<span class="w1"> </span>using<span class="w1"> </span>standard<span class="w1"> </span>native<span class="w2"> </span>calling<span class="w1"> </span>conventions<span class="w1"> </span>(e.g.,</div><div class="l f7 s4 t0" style="top:623.93px;left:317.014px;" data-x="317.014" data-y="168.07">FASTCALL</div><div class="l f2 s4 t0" style="top:623.93px;left:356.914px;" data-x="356.914" data-y="168.07">on<span class="w2"> </span>x86).</div><div class="l f2 s4 t0" style="top:633.893px;left:328.969px;" data-x="328.969" data-y="158.107">The<span class="w1"> </span>interpreter<span class="w1"> </span>must<span class="w0"> </span>hit<span class="w1"> </span>a<span class="w1"> </span>loop<span class="w1"> </span>edge<span class="w0"> </span>and<span class="w1"> </span>enter<span class="w1"> </span>the<span class="w1"> </span>monitor<span class="w0"> </span>in</div><div class="l f2 s4 t0" style="top:643.855px;left:317.014px;" data-x="317.014" data-y="148.145">order<span class="w2"> </span>to<span class="w1"> </span>call<span class="w1"> </span>a<span class="w2"> </span>native<span class="w1"> </span>trace<span class="w2"> </span>for<span class="w1"> </span>the<span class="w1"> </span>first<span class="w2"> </span>time.<span class="w1"> </span>The<span class="w1"> </span>monitor<span class="w2"> </span>computes</div><div class="l f2 s4 t0" style="top:653.818px;left:317.014px;" data-x="317.014" data-y="138.182">the<span class="w1"> </span>current<span class="w0"> </span>type<span class="w1"> </span>map,<span class="w0"> </span>checks<span class="w1"> </span>the<span class="w0"> </span>trace<span class="w1"> </span>cache<span class="w0"> </span>for<span class="w1"> </span>a<span class="w0"> </span>trace<span class="w1"> </span>for<span class="w0"> </span>the</div><div class="l f2 s4 t0" style="top:663.781px;left:317.014px;" data-x="317.014" data-y="128.219">current<span class="w2"> </span>PC<span class="w1"> </span>and<span class="w1"> </span>type<span class="w2"> </span>map,<span class="w1"> </span>and<span class="w1"> </span>if<span class="w2"> </span>it<span class="w1"> </span>finds<span class="w2"> </span>one,<span class="w1"> </span>executes<span class="w1"> </span>the<span class="w2"> </span>trace.</div><div class="l f2 s4 t0" style="top:673.743px;left:328.969px;" data-x="328.969" data-y="118.257">To<span class="w1"> </span>execute<span class="w1"> </span>a<span class="w0"> </span>trace,<span class="w1"> </span>the<span class="w0"> </span>monitor<span class="w1"> </span>must<span class="w0"> </span>build<span class="w1"> </span>a<span class="w0"> </span>trace<span class="w1"> </span>activation</div><div class="l f2 s4 t0" style="top:683.706px;left:317.014px;" data-x="317.014" data-y="108.294">record<span class="w1"> </span>containing<span class="w1"> </span>imported<span class="w0"> </span>local<span class="w1"> </span>and<span class="w1"> </span>global<span class="w1"> </span>variables,<span class="w1"> </span>temporary</div><div class="l f2 s4 t0" style="top:693.669px;left:317.014px;" data-x="317.014" data-y="98.3313">stack<span class="w1"> </span>space,<span class="w2"> </span>and<span class="w1"> </span>space<span class="w1"> </span>for<span class="w1"> </span>arguments<span class="w2"> </span>to<span class="w1"> </span>native<span class="w2"> </span>calls.<span class="w1"> </span>The<span class="w1"> </span>local<span class="w1"> </span>and</div><div class="l f2 s4 t0" style="top:703.631px;left:317.014px;" data-x="317.014" data-y="88.3686">global<span class="w1"> </span>values<span class="w2"> </span>are<span class="w1"> </span>then<span class="w1"> </span>copied<span class="w2"> </span>from<span class="w1"> </span>the<span class="w1"> </span>interpreter<span class="w2"> </span>state<span class="w1"> </span>to<span class="w1"> </span>the<span class="w1"> </span>trace</div><div class="l f2 s4 t0" style="top:713.594px;left:317.014px;" data-x="317.014" data-y="78.406">activation<span class="w2"> </span>record.<span class="w1"> </span>Then,<span class="w2"> </span>the<span class="w1"> </span>trace<span class="w2"> </span>is<span class="w1"> </span>called<span class="w1"> </span>like<span class="w2"> </span>a<span class="w1"> </span>normal<span class="w2"> </span>C<span class="w1"> </span>function</div><div class="l f2 s4 t0" style="top:723.557px;left:317.014px;" data-x="317.014" data-y="68.4434">pointer.</div></div></div><div id="page-9" class="p" style="width:612px;height:792px;"><div class="t"><div class="l f2 s4 t0" style="top:79.9701px;left:65.9552px;" data-x="65.9552" data-y="712.03">When<span class="w1"> </span>a<span class="w1"> </span>trace<span class="w0"> </span>call<span class="w1"> </span>returns,<span class="w1"> </span>the<span class="w1"> </span>monitor<span class="w0"> </span>restores<span class="w1"> </span>the<span class="w1"> </span>interpreter</div><div class="l f2 s4 t0" style="top:89.9328px;left:54px;" data-x="54" data-y="702.067">state.<span class="w1"> </span>First,<span class="w0"> </span>the<span class="w1"> </span>monitor<span class="w0"> </span>checks<span class="w1"> </span>the<span class="w0"> </span>reason<span class="w1"> </span>for<span class="w1"> </span>the<span class="w0"> </span>trace<span class="w1"> </span>exit<span class="w0"> </span>and</div><div class="l f2 s4 t0" style="top:99.8954px;left:54px;" data-x="54" data-y="692.105">applies<span class="w1"> </span>blacklisting<span class="w1"> </span>if<span class="w0"> </span>needed.<span class="w1"> </span>Then,<span class="w1"> </span>it<span class="w1"> </span>pops<span class="w0"> </span>or<span class="w1"> </span>synthesizes<span class="w1"> </span>inter-</div><div class="l f2 s4 t0" style="top:109.858px;left:54px;" data-x="54" data-y="682.142">preter<span class="w1"> </span>JavaScript<span class="w2"> </span>call<span class="w1"> </span>stack<span class="w1"> </span>frames<span class="w2"> </span>as<span class="w1"> </span>needed.<span class="w1"> </span>Finally,<span class="w2"> </span>it<span class="w1"> </span>copies<span class="w1"> </span>the</div><div class="l f2 s4 t0" style="top:119.821px;left:54px;" data-x="54" data-y="672.179">imported<span class="w1"> </span>variables<span class="w2"> </span>back<span class="w1"> </span>from<span class="w1"> </span>the<span class="w1"> </span>trace<span class="w1"> </span>activation<span class="w1"> </span>record<span class="w1"> </span>to<span class="w2"> </span>the<span class="w1"> </span>in-</div><div class="l f2 s4 t0" style="top:129.783px;left:54px;" data-x="54" data-y="662.217">terpreter<span class="w2"> </span>state.</div><div class="l f2 s4 t0" style="top:139.746px;left:65.9552px;" data-x="65.9552" data-y="652.254">At<span class="w1"> </span>least<span class="w1"> </span>in<span class="w1"> </span>the<span class="w2"> </span>current<span class="w1"> </span>implementation,<span class="w1"> </span>these<span class="w1"> </span>steps<span class="w1"> </span>have<span class="w1"> </span>a<span class="w1"> </span>non-</div><div class="l f2 s4 t0" style="top:149.709px;left:54px;" data-x="54" data-y="642.291">negligible<span class="w1"> </span>runtime<span class="w1"> </span>cost,<span class="w1"> </span>so<span class="w1"> </span>minimizing<span class="w1"> </span>the<span class="w0"> </span>number<span class="w2"> </span>of<span class="w0"> </span>interpreter-</div><div class="l f2 s4 t0" style="top:159.671px;left:54px;" data-x="54" data-y="632.329">to-trace<span class="w1"> </span>and<span class="w1"> </span>trace-to-interpreter<span class="w0"> </span>transitions<span class="w1"> </span>is<span class="w1"> </span>essential<span class="w1"> </span>for<span class="w1"> </span>perfor-</div><div class="l f2 s4 t0" style="top:169.634px;left:54px;" data-x="54" data-y="622.366">mance.<span class="w0"> </span>(see<span class="w1"> </span>also<span class="w0"> </span>Section<span class="w1"> </span>3.3).<span class="w0"> </span>Our<span class="w1"> </span>experiments<span class="w0"> </span>(see<span class="w0"> </span>Figure<span class="w1"> </span>12)</div><div class="l f2 s4 t0" style="top:179.596px;left:54px;" data-x="54" data-y="612.404">show<span class="w1"> </span>that<span class="w0"> </span>for<span class="w1"> </span>programs<span class="w0"> </span>we<span class="w0"> </span>can<span class="w1"> </span>trace<span class="w0"> </span>well<span class="w1"> </span>such<span class="w0"> </span>transitions<span class="w1"> </span>hap-</div><div class="l f2 s4 t0" style="top:189.559px;left:54px;" data-x="54" data-y="602.441">pen<span class="w1"> </span>infrequently<span class="w1"> </span>and<span class="w1"> </span>hence<span class="w1"> </span>do<span class="w1"> </span>not<span class="w1"> </span>contribute<span class="w1"> </span>significantly<span class="w1"> </span>to<span class="w1"> </span>total</div><div class="l f2 s4 t0" style="top:199.522px;left:54px;" data-x="54" data-y="592.478">runtime.<span class="w1"> </span>In<span class="w1"> </span>a<span class="w0"> </span>few<span class="w1"> </span>programs,<span class="w1"> </span>where<span class="w1"> </span>the<span class="w0"> </span>system<span class="w1"> </span>is<span class="w1"> </span>prevented<span class="w1"> </span>from</div><div class="l f2 s4 t0" style="top:209.484px;left:54px;" data-x="54" data-y="582.516">recording<span class="w1"> </span>branch<span class="w1"> </span>traces<span class="w1"> </span>for<span class="w0"> </span>hot<span class="w1"> </span>side<span class="w1"> </span>exits<span class="w1"> </span>by<span class="w1"> </span>aborts,<span class="w1"> </span>this<span class="w0"> </span>cost<span class="w2"> </span>can</div><div class="l f2 s4 t0" style="top:219.447px;left:54px;" data-x="54" data-y="572.553">rise<span class="w2"> </span>to<span class="w1"> </span>up<span class="w1"> </span>to<span class="w2"> </span>10%<span class="w1"> </span>of<span class="w1"> </span>total<span class="w2"> </span>execution<span class="w1"> </span>time.</div><div class="l f1 s4 t0" style="top:238.376px;left:54px;" data-x="54" data-y="553.624">6.2<span class="w10"> </span>Trace<span class="w2"> </span>Stitching</div><div class="l f2 s4 t0" style="top:252.324px;left:54px;" data-x="54" data-y="539.676">Transitions<span class="w1"> </span>from<span class="w1"> </span>a<span class="w1"> </span>trace<span class="w1"> </span>to<span class="w1"> </span>a<span class="w0"> </span>branch<span class="w2"> </span>trace<span class="w0"> </span>at<span class="w1"> </span>a<span class="w1"> </span>side<span class="w1"> </span>exit<span class="w1"> </span>avoid<span class="w1"> </span>the</div><div class="l f2 s4 t0" style="top:262.286px;left:54px;" data-x="54" data-y="529.714">costs<span class="w1"> </span>of<span class="w1"> </span>calling<span class="w0"> </span>traces<span class="w1"> </span>from<span class="w1"> </span>the<span class="w1"> </span>monitor,<span class="w1"> </span>in<span class="w1"> </span>a<span class="w0"> </span>feature<span class="w1"> </span>called</div><div class="l fa s4 t0" style="top:262.286px;left:274.812px;" data-x="274.812" data-y="529.714">trace</div><div class="l fa s4 t0" style="top:272.249px;left:54px;" data-x="54" data-y="519.751">stitching</div><div class="l f2 s4 t0" style="top:272.249px;left:84.7542px;" data-x="84.7542" data-y="519.751">.<span class="w1"> </span>At<span class="w1"> </span>a<span class="w1"> </span>side<span class="w1"> </span>exit,<span class="w1"> </span>the<span class="w0"> </span>exiting<span class="w2"> </span>trace<span class="w1"> </span>only<span class="w0"> </span>needs<span class="w2"> </span>to<span class="w0"> </span>write<span class="w2"> </span>live</div><div class="l f2 s4 t0" style="top:282.212px;left:54px;" data-x="54" data-y="509.788">register-carried<span class="w2"> </span>values<span class="w2"> </span>back<span class="w1"> </span>to<span class="w2"> </span>its<span class="w1"> </span>trace<span class="w2"> </span>activation<span class="w2"> </span>record.<span class="w1"> </span>In<span class="w2"> </span>our<span class="w1"> </span>im-</div><div class="l f2 s4 t0" style="top:292.174px;left:54px;" data-x="54" data-y="499.826">plementation,<span class="w1"> </span>identical<span class="w1"> </span>type<span class="w2"> </span>maps<span class="w1"> </span>yield<span class="w1"> </span>identical<span class="w1"> </span>activation<span class="w1"> </span>record</div><div class="l f2 s4 t0" style="top:302.137px;left:54px;" data-x="54" data-y="489.863">layouts,<span class="w1"> </span>so<span class="w1"> </span>the<span class="w1"> </span>trace<span class="w0"> </span>activation<span class="w2"> </span>record<span class="w0"> </span>can<span class="w1"> </span>be<span class="w1"> </span>reused<span class="w1"> </span>immediately</div><div class="l f2 s4 t0" style="top:312.1px;left:54px;" data-x="54" data-y="479.9">by<span class="w2"> </span>the<span class="w1"> </span>branch<span class="w1"> </span>trace.</div><div class="l f2 s4 t0" style="top:322.062px;left:65.9552px;" data-x="65.9552" data-y="469.938">In<span class="w1"> </span>programs<span class="w0"> </span>with<span class="w1"> </span>branchy<span class="w1"> </span>trace<span class="w0"> </span>trees<span class="w1"> </span>with<span class="w0"> </span>small<span class="w1"> </span>traces,<span class="w1"> </span>trace</div><div class="l f2 s4 t0" style="top:332.025px;left:54px;" data-x="54" data-y="459.975">stitching<span class="w1"> </span>has<span class="w0"> </span>a<span class="w1"> </span>noticeable<span class="w1"> </span>cost.<span class="w1"> </span>Although<span class="w0"> </span>writing<span class="w1"> </span>to<span class="w1"> </span>memory<span class="w0"> </span>and</div><div class="l f2 s4 t0" style="top:341.988px;left:54px;" data-x="54" data-y="450.012">then<span class="w0"> </span>soon<span class="w0"> </span>reading<span class="w0"> </span>back<span class="w1"> </span>would<span class="w0"> </span>be<span class="w0"> </span>expected<span class="w0"> </span>to<span class="w0"> </span>have<span class="w1"> </span>a<span class="w0"> </span>high<span class="w0"> </span>L1</div><div class="l f2 s4 t0" style="top:351.95px;left:54px;" data-x="54" data-y="440.05">cache<span class="w1"> </span>hit<span class="w1"> </span>rate,<span class="w1"> </span>for<span class="w1"> </span>small<span class="w1"> </span>traces<span class="w1"> </span>the<span class="w1"> </span>increased<span class="w1"> </span>instruction<span class="w1"> </span>count<span class="w1"> </span>has</div><div class="l f2 s4 t0" style="top:361.913px;left:54px;" data-x="54" data-y="430.087">a<span class="w0"> </span>noticeable<span class="w0"> </span>cost.<span class="w0"> </span>Also,<span class="w1"> </span>if<span class="w0"> </span>the<span class="w0"> </span>writes<span class="w0"> </span>and<span class="w0"> </span>reads<span class="w0"> </span>are<span class="w0"> </span>very<span class="w0"> </span>close</div><div class="l f2 s4 t0" style="top:371.875px;left:54px;" data-x="54" data-y="420.125">in<span class="w0"> </span>the<span class="w0"> </span>dynamic<span class="w0"> </span>instruction<span class="w0"> </span>stream,<span class="w1"> </span>we<span class="w0"> </span>have<span class="w0"> </span>found<span class="w0"> </span>that<span class="w0"> </span>current</div><div class="l f2 s4 t0" style="top:381.838px;left:54px;" data-x="54" data-y="410.162">x86<span class="w1"> </span>processors<span class="w1"> </span>often<span class="w0"> </span>incur<span class="w1"> </span>penalties<span class="w1"> </span>of<span class="w0"> </span>6<span class="w1"> </span>cycles<span class="w1"> </span>or<span class="w1"> </span>more<span class="w0"> </span>(e.g.,<span class="w1"> </span>if</div><div class="l f2 s4 t0" style="top:391.801px;left:54px;" data-x="54" data-y="400.199">the<span class="w1"> </span>instructions<span class="w1"> </span>use<span class="w1"> </span>different<span class="w1"> </span>base<span class="w1"> </span>registers<span class="w1"> </span>with<span class="w1"> </span>equal<span class="w0"> </span>values,<span class="w2"> </span>the</div><div class="l f2 s4 t0" style="top:401.763px;left:54px;" data-x="54" data-y="390.237">processor<span class="w2"> </span>may<span class="w1"> </span>not<span class="w1"> </span>be<span class="w2"> </span>able<span class="w1"> </span>to<span class="w1"> </span>detect<span class="w2"> </span>that<span class="w1"> </span>the<span class="w2"> </span>addresses<span class="w1"> </span>are<span class="w1"> </span>the<span class="w2"> </span>same</div><div class="l f2 s4 t0" style="top:411.726px;left:54px;" data-x="54" data-y="380.274">right<span class="w2"> </span>away).</div><div class="l f2 s4 t0" style="top:421.689px;left:65.9552px;" data-x="65.9552" data-y="370.311">The<span class="w1"> </span>alternate<span class="w1"> </span>solution<span class="w1"> </span>is<span class="w1"> </span>to<span class="w1"> </span>recompile<span class="w1"> </span>an<span class="w1"> </span>entire<span class="w1"> </span>trace<span class="w1"> </span>tree,<span class="w1"> </span>thus</div><div class="l f2 s4 t0" style="top:431.651px;left:54px;" data-x="54" data-y="360.349">achieving<span class="w1"> </span>inter-trace<span class="w1"> </span>register<span class="w1"> </span>allocation<span class="w0"> </span>(10).<span class="w1"> </span>The<span class="w1"> </span>disadvantage<span class="w1"> </span>is</div><div class="l f2 s4 t0" style="top:441.614px;left:54px;" data-x="54" data-y="350.386">that<span class="w2"> </span>tree<span class="w2"> </span>recompilation<span class="w1"> </span>takes<span class="w2"> </span>time<span class="w1"> </span>quadratic<span class="w2"> </span>in<span class="w2"> </span>the<span class="w1"> </span>number<span class="w2"> </span>of<span class="w2"> </span>traces.</div><div class="l f2 s4 t0" style="top:451.577px;left:54px;" data-x="54" data-y="340.423">We<span class="w1"> </span>believe<span class="w0"> </span>that<span class="w1"> </span>the<span class="w0"> </span>cost<span class="w1"> </span>of<span class="w0"> </span>recompiling<span class="w0"> </span>a<span class="w1"> </span>trace<span class="w0"> </span>tree<span class="w1"> </span>every<span class="w0"> </span>time</div><div class="l f2 s4 t0" style="top:461.539px;left:54px;" data-x="54" data-y="330.461">a<span class="w1"> </span>branch<span class="w0"> </span>is<span class="w1"> </span>added<span class="w0"> </span>would<span class="w1"> </span>be<span class="w0"> </span>prohibitive.<span class="w1"> </span>That<span class="w1"> </span>problem<span class="w0"> </span>might<span class="w1"> </span>be</div><div class="l f2 s4 t0" style="top:471.502px;left:54px;" data-x="54" data-y="320.498">mitigated<span class="w1"> </span>by<span class="w1"> </span>recompiling<span class="w0"> </span>only<span class="w1"> </span>at<span class="w1"> </span>certain<span class="w0"> </span>points,<span class="w1"> </span>or<span class="w1"> </span>only<span class="w1"> </span>for<span class="w0"> </span>very</div><div class="l f2 s4 t0" style="top:481.464px;left:54px;" data-x="54" data-y="310.536">hot,<span class="w2"> </span>stable<span class="w1"> </span>trees.</div><div class="l f2 s4 t0" style="top:491.427px;left:65.9552px;" data-x="65.9552" data-y="300.573">In<span class="w1"> </span>the<span class="w0"> </span>future,<span class="w1"> </span>multicore<span class="w1"> </span>hardware<span class="w0"> </span>is<span class="w1"> </span>expected<span class="w1"> </span>to<span class="w0"> </span>be<span class="w1"> </span>common,</div><div class="l f2 s4 t0" style="top:501.39px;left:54px;" data-x="54" data-y="290.61">making<span class="w1"> </span>background<span class="w1"> </span>tree<span class="w1"> </span>recompilation<span class="w0"> </span>attractive.<span class="w2"> </span>In<span class="w0"> </span>a<span class="w1"> </span>closely<span class="w1"> </span>re-</div><div class="l f2 s4 t0" style="top:511.352px;left:54px;" data-x="54" data-y="280.648">lated<span class="w1"> </span>project<span class="w0"> </span>(13)<span class="w1"> </span>background<span class="w1"> </span>recompilation<span class="w1"> </span>yielded<span class="w0"> </span>speedups<span class="w1"> </span>of</div><div class="l f2 s4 t0" style="top:521.315px;left:54px;" data-x="54" data-y="270.685">up<span class="w1"> </span>to<span class="w1"> </span>1.25x<span class="w1"> </span>on<span class="w0"> </span>benchmarks<span class="w1"> </span>with<span class="w1"> </span>many<span class="w1"> </span>branch<span class="w1"> </span>traces.<span class="w1"> </span>We<span class="w1"> </span>plan<span class="w1"> </span>to</div><div class="l f2 s4 t0" style="top:531.278px;left:54px;" data-x="54" data-y="260.722">apply<span class="w2"> </span>this<span class="w1"> </span>technique<span class="w1"> </span>to<span class="w2"> </span>TraceMonkey<span class="w1"> </span>as<span class="w2"> </span>future<span class="w1"> </span>work.</div><div class="l f1 s4 t0" style="top:550.207px;left:54px;" data-x="54" data-y="241.793">6.3<span class="w10"> </span>Trace<span class="w2"> </span>Recording</div><div class="l f2 s4 t0" style="top:564.154px;left:54px;" data-x="54" data-y="227.846">The<span class="w2"> </span>job<span class="w2"> </span>of<span class="w1"> </span>the<span class="w2"> </span>trace<span class="w1"> </span>recorder<span class="w2"> </span>is<span class="w2"> </span>to<span class="w1"> </span>emit<span class="w2"> </span>LIR<span class="w2"> </span>with<span class="w1"> </span>identical<span class="w2"> </span>semantics</div><div class="l f2 s4 t0" style="top:574.117px;left:54px;" data-x="54" data-y="217.883">to<span class="w1"> </span>the<span class="w1"> </span>currently<span class="w1"> </span>running<span class="w2"> </span>interpreter<span class="w1"> </span>bytecode<span class="w1"> </span>trace.<span class="w1"> </span>A<span class="w1"> </span>good<span class="w1"> </span>imple-</div><div class="l f2 s4 t0" style="top:584.08px;left:54px;" data-x="54" data-y="207.92">mentation<span class="w1"> </span>should<span class="w1"> </span>have<span class="w1"> </span>low<span class="w1"> </span>impact<span class="w1"> </span>on<span class="w1"> </span>non-tracing<span class="w1"> </span>interpreter<span class="w1"> </span>per-</div><div class="l f2 s4 t0" style="top:594.042px;left:54px;" data-x="54" data-y="197.958">formance<span class="w1"> </span>and<span class="w1"> </span>a<span class="w1"> </span>convenient<span class="w1"> </span>way<span class="w1"> </span>for<span class="w1"> </span>implementers<span class="w1"> </span>to<span class="w0"> </span>maintain<span class="w2"> </span>se-</div><div class="l f2 s4 t0" style="top:604.005px;left:54px;" data-x="54" data-y="187.995">mantic<span class="w2"> </span>equivalence.</div><div class="l f2 s4 t0" style="top:613.968px;left:65.9552px;" data-x="65.9552" data-y="178.032">In<span class="w2"> </span>our<span class="w1"> </span>implementation,<span class="w2"> </span>the<span class="w1"> </span>only<span class="w1"> </span>direct<span class="w2"> </span>modification<span class="w1"> </span>to<span class="w2"> </span>the<span class="w1"> </span>inter-</div><div class="l f2 s4 t0" style="top:623.93px;left:54px;" data-x="54" data-y="168.07">preter<span class="w2"> </span>is<span class="w1"> </span>a<span class="w2"> </span>call<span class="w1"> </span>to<span class="w2"> </span>the<span class="w1"> </span>trace<span class="w2"> </span>monitor<span class="w1"> </span>at<span class="w2"> </span>loop<span class="w1"> </span>edges.<span class="w1"> </span>In<span class="w2"> </span>our<span class="w1"> </span>benchmark</div><div class="l f2 s4 t0" style="top:633.893px;left:54px;" data-x="54" data-y="158.107">results<span class="w1"> </span>(see<span class="w1"> </span>Figure<span class="w1"> </span>12)<span class="w1"> </span>the<span class="w0"> </span>total<span class="w2"> </span>time<span class="w0"> </span>spent<span class="w2"> </span>in<span class="w0"> </span>the<span class="w2"> </span>monitor<span class="w0"> </span>(for<span class="w2"> </span>all</div><div class="l f2 s4 t0" style="top:643.855px;left:54px;" data-x="54" data-y="148.145">activities)<span class="w1"> </span>is<span class="w1"> </span>usually<span class="w0"> </span>less<span class="w1"> </span>than<span class="w1"> </span>5%,<span class="w1"> </span>so<span class="w0"> </span>we<span class="w1"> </span>consider<span class="w1"> </span>the<span class="w1"> </span>interpreter</div><div class="l f2 s4 t0" style="top:653.818px;left:54px;" data-x="54" data-y="138.182">impact<span class="w1"> </span>requirement<span class="w1"> </span>met.<span class="w1"> </span>Incrementing<span class="w0"> </span>the<span class="w1"> </span>loop<span class="w1"> </span>hit<span class="w1"> </span>counter<span class="w1"> </span>is<span class="w1"> </span>ex-</div><div class="l f2 s4 t0" style="top:663.781px;left:54px;" data-x="54" data-y="128.219">pensive<span class="w2"> </span>because<span class="w2"> </span>it<span class="w1"> </span>requires<span class="w2"> </span>us<span class="w1"> </span>to<span class="w2"> </span>look<span class="w2"> </span>up<span class="w1"> </span>the<span class="w2"> </span>loop<span class="w1"> </span>in<span class="w2"> </span>the<span class="w2"> </span>trace<span class="w1"> </span>cache,</div><div class="l f2 s4 t0" style="top:673.743px;left:54px;" data-x="54" data-y="118.257">but<span class="w2"> </span>we<span class="w1"> </span>have<span class="w1"> </span>tuned<span class="w1"> </span>our<span class="w1"> </span>loops<span class="w2"> </span>to<span class="w1"> </span>become<span class="w1"> </span>hot<span class="w1"> </span>and<span class="w1"> </span>trace<span class="w2"> </span>very<span class="w1"> </span>quickly</div><div class="l f2 s4 t0" style="top:683.706px;left:54px;" data-x="54" data-y="108.294">(on<span class="w2"> </span>the<span class="w1"> </span>second<span class="w1"> </span>iteration).<span class="w1"> </span>The<span class="w2"> </span>hit<span class="w1"> </span>counter<span class="w1"> </span>implementation<span class="w2"> </span>could<span class="w1"> </span>be</div><div class="l f2 s4 t0" style="top:693.669px;left:54px;" data-x="54" data-y="98.3313">improved,<span class="w1"> </span>which<span class="w1"> </span>might<span class="w1"> </span>give<span class="w2"> </span>us<span class="w1"> </span>a<span class="w1"> </span>small<span class="w1"> </span>increase<span class="w0"> </span>in<span class="w2"> </span>overall<span class="w1"> </span>perfor-</div><div class="l f2 s4 t0" style="top:703.631px;left:54px;" data-x="54" data-y="88.3686">mance,<span class="w1"> </span>as<span class="w1"> </span>well<span class="w1"> </span>as<span class="w1"> </span>more<span class="w1"> </span>flexibility<span class="w1"> </span>with<span class="w1"> </span>tuning<span class="w1"> </span>hotness<span class="w1"> </span>thresholds.</div><div class="l f2 s4 t0" style="top:713.594px;left:54px;" data-x="54" data-y="78.406">Once<span class="w1"> </span>a<span class="w1"> </span>loop<span class="w2"> </span>is<span class="w1"> </span>blacklisted<span class="w1"> </span>we<span class="w1"> </span>never<span class="w1"> </span>call<span class="w1"> </span>into<span class="w1"> </span>the<span class="w1"> </span>trace<span class="w2"> </span>monitor<span class="w1"> </span>for</div><div class="l f2 s4 t0" style="top:723.557px;left:54px;" data-x="54" data-y="68.4433">that<span class="w2"> </span>loop<span class="w1"> </span>(see<span class="w1"> </span>Section<span class="w2"> </span>3.3).</div><div class="l f2 s4 t0" style="top:79.9701px;left:328.969px;" data-x="328.969" data-y="712.03">Recording<span class="w0"> </span>is<span class="w1"> </span>activated<span class="w0"> </span>by<span class="w1"> </span>a<span class="w0"> </span>pointer<span class="w1"> </span>swap<span class="w0"> </span>that<span class="w0"> </span>sets<span class="w1"> </span>the<span class="w0"> </span>inter-</div><div class="l f2 s4 t0" style="top:89.9328px;left:317.014px;" data-x="317.014" data-y="702.067">preter’s<span class="w1"> </span>dispatch<span class="w1"> </span>table<span class="w0"> </span>to<span class="w1"> </span>call<span class="w1"> </span>a<span class="w0"> </span>single<span class="w1"> </span>“interrupt”<span class="w0"> </span>routine<span class="w1"> </span>for<span class="w1"> </span>ev-</div><div class="l f2 s4 t0" style="top:99.8954px;left:317.014px;" data-x="317.014" data-y="692.105">ery<span class="w1"> </span>bytecode.<span class="w1"> </span>The<span class="w0"> </span>interrupt<span class="w1"> </span>routine<span class="w1"> </span>first<span class="w0"> </span>calls<span class="w1"> </span>a<span class="w1"> </span>bytecode-specific</div><div class="l f2 s4 t0" style="top:109.858px;left:317.014px;" data-x="317.014" data-y="682.142">recording<span class="w1"> </span>routine.<span class="w0"> </span>Then,<span class="w1"> </span>it<span class="w1"> </span>turns<span class="w0"> </span>off<span class="w1"> </span>recording<span class="w1"> </span>if<span class="w0"> </span>necessary<span class="w1"> </span>(e.g.,</div><div class="l f2 s4 t0" style="top:119.821px;left:317.014px;" data-x="317.014" data-y="672.179">the<span class="w1"> </span>trace<span class="w1"> </span>ended).<span class="w2"> </span>Finally,<span class="w1"> </span>it<span class="w1"> </span>jumps<span class="w1"> </span>to<span class="w1"> </span>the<span class="w1"> </span>standard<span class="w2"> </span>interpreter<span class="w1"> </span>byte-</div><div class="l f2 s4 t0" style="top:129.783px;left:317.014px;" data-x="317.014" data-y="662.217">code<span class="w2"> </span>implementation.<span class="w2"> </span>Some<span class="w1"> </span>bytecodes<span class="w2"> </span>have<span class="w2"> </span>effects<span class="w2"> </span>on<span class="w1"> </span>the<span class="w2"> </span>type<span class="w2"> </span>map</div><div class="l f2 s4 t0" style="top:139.746px;left:317.014px;" data-x="317.014" data-y="652.254">that<span class="w1"> </span>cannot<span class="w1"> </span>be<span class="w1"> </span>predicted<span class="w1"> </span>before<span class="w1"> </span>executing<span class="w1"> </span>the<span class="w1"> </span>bytecode<span class="w1"> </span>(e.g.,<span class="w1"> </span>call-</div><div class="l f2 s4 t0" style="top:149.709px;left:317.014px;" data-x="317.014" data-y="642.291">ing</div><div class="l f7 s4 t0" style="top:149.709px;left:331.189px;" data-x="331.189" data-y="642.291">String.charCodeAt</div><div class="l f2 s4 t0" style="top:149.709px;left:411.213px;" data-x="411.213" data-y="642.291">,<span class="w1"> </span>which<span class="w1"> </span>returns<span class="w1"> </span>an<span class="w1"> </span>integer<span class="w1"> </span>or</div><div class="l fa s4 t0" style="top:149.709px;left:517.267px;" data-x="517.267" data-y="642.291">NaN</div><div class="l f2 s4 t0" style="top:149.709px;left:536.965px;" data-x="536.965" data-y="642.291">if<span class="w1"> </span>the</div><div class="l f2 s4 t0" style="top:159.671px;left:317.014px;" data-x="317.014" data-y="632.329">index<span class="w2"> </span>argument<span class="w1"> </span>is<span class="w2"> </span>out<span class="w1"> </span>of<span class="w2"> </span>range).<span class="w2"> </span>For<span class="w1"> </span>these,<span class="w2"> </span>we<span class="w1"> </span>arrange<span class="w2"> </span>for<span class="w1"> </span>the<span class="w2"> </span>inter-</div><div class="l f2 s4 t0" style="top:169.634px;left:317.014px;" data-x="317.014" data-y="622.366">preter<span class="w1"> </span>to<span class="w1"> </span>call<span class="w1"> </span>into<span class="w1"> </span>the<span class="w1"> </span>recorder<span class="w1"> </span>again<span class="w1"> </span>after<span class="w1"> </span>executing<span class="w1"> </span>the<span class="w1"> </span>bytecode.</div><div class="l f2 s4 t0" style="top:179.596px;left:317.014px;" data-x="317.014" data-y="612.404">Since<span class="w1"> </span>such<span class="w1"> </span>hooks<span class="w1"> </span>are<span class="w1"> </span>relatively<span class="w2"> </span>rare,<span class="w1"> </span>we<span class="w1"> </span>embed<span class="w1"> </span>them<span class="w1"> </span>directly<span class="w1"> </span>into</div><div class="l f2 s4 t0" style="top:189.559px;left:317.014px;" data-x="317.014" data-y="602.441">the<span class="w1"> </span>interpreter,<span class="w1"> </span>with<span class="w1"> </span>an<span class="w1"> </span>additional<span class="w1"> </span>runtime<span class="w1"> </span>check<span class="w1"> </span>to<span class="w1"> </span>see<span class="w1"> </span>whether<span class="w1"> </span>a</div><div class="l f2 s4 t0" style="top:199.522px;left:317.014px;" data-x="317.014" data-y="592.478">recorder<span class="w2"> </span>is<span class="w1"> </span>currently<span class="w1"> </span>active.</div><div class="l f2 s4 t0" style="top:209.484px;left:328.969px;" data-x="328.969" data-y="582.516">While<span class="w2"> </span>separating<span class="w1"> </span>the<span class="w1"> </span>interpreter<span class="w2"> </span>from<span class="w1"> </span>the<span class="w2"> </span>recorder<span class="w1"> </span>reduces<span class="w1"> </span>indi-</div><div class="l f2 s4 t0" style="top:219.447px;left:317.014px;" data-x="317.014" data-y="572.553">vidual<span class="w2"> </span>code<span class="w1"> </span>complexity,it<span class="w1"> </span>also<span class="w2"> </span>requires<span class="w1"> </span>careful<span class="w2"> </span>implementation<span class="w2"> </span>and</div><div class="l f2 s4 t0" style="top:229.41px;left:317.014px;" data-x="317.014" data-y="562.59">extensive<span class="w2"> </span>testing<span class="w1"> </span>to<span class="w2"> </span>achieve<span class="w1"> </span>semantic<span class="w2"> </span>equivalence.</div><div class="l f2 s4 t0" style="top:239.372px;left:328.969px;" data-x="328.969" data-y="552.628">In<span class="w1"> </span>some<span class="w1"> </span>cases<span class="w1"> </span>achieving<span class="w2"> </span>this<span class="w1"> </span>equivalence<span class="w1"> </span>is<span class="w1"> </span>difficult<span class="w1"> </span>since<span class="w1"> </span>Spi-</div><div class="l f2 s4 t0" style="top:249.335px;left:317.014px;" data-x="317.014" data-y="542.665">derMonkey<span class="w1"> </span>follows<span class="w1"> </span>a</div><div class="l fa s4 t0" style="top:249.335px;left:397.193px;" data-x="397.193" data-y="542.665">fat-bytecode</div><div class="l f2 s4 t0" style="top:249.335px;left:444.318px;" data-x="444.318" data-y="542.665">design,<span class="w1"> </span>which<span class="w1"> </span>was<span class="w1"> </span>found<span class="w1"> </span>to<span class="w1"> </span>be</div><div class="l f2 s4 t0" style="top:259.298px;left:317.014px;" data-x="317.014" data-y="532.702">beneficial<span class="w2"> </span>to<span class="w1"> </span>pure<span class="w1"> </span>interpreter<span class="w2"> </span>performance.</div><div class="l f2 s4 t0" style="top:269.26px;left:328.969px;" data-x="328.969" data-y="522.74">In<span class="w0"> </span>fat-bytecode<span class="w1"> </span>designs,<span class="w0"> </span>individual<span class="w1"> </span>bytecodes<span class="w0"> </span>can<span class="w0"> </span>implement</div><div class="l f2 s4 t0" style="top:279.223px;left:317.014px;" data-x="317.014" data-y="512.777">complex<span class="w0"> </span>processing<span class="w1"> </span>(e.g.,<span class="w0"> </span>the</div><div class="l f7 s4 t0" style="top:279.223px;left:431.235px;" data-x="431.235" data-y="512.777">getprop</div><div class="l f2 s4 t0" style="top:279.223px;left:468.185px;" data-x="468.185" data-y="512.777">bytecode,<span class="w0"> </span>which<span class="w1"> </span>imple-</div><div class="l f2 s4 t0" style="top:289.186px;left:317.014px;" data-x="317.014" data-y="502.814">ments<span class="w2"> </span>full<span class="w1"> </span>JavaScript<span class="w2"> </span>property<span class="w2"> </span>value<span class="w1"> </span>access,<span class="w2"> </span>including<span class="w2"> </span>special<span class="w1"> </span>cases</div><div class="l f2 s4 t0" style="top:299.148px;left:317.014px;" data-x="317.014" data-y="492.852">for<span class="w2"> </span>cached<span class="w1"> </span>and<span class="w1"> </span>dense<span class="w2"> </span>array<span class="w1"> </span>access).</div><div class="l f2 s4 t0" style="top:309.111px;left:328.969px;" data-x="328.969" data-y="482.889">Fat<span class="w0"> </span>bytecodes<span class="w1"> </span>have<span class="w0"> </span>two<span class="w0"> </span>advantages:<span class="w1"> </span>fewer<span class="w0"> </span>bytecodes<span class="w0"> </span>means</div><div class="l f2 s4 t0" style="top:319.073px;left:317.014px;" data-x="317.014" data-y="472.927">lower<span class="w2"> </span>dispatch<span class="w1"> </span>cost,<span class="w1"> </span>and<span class="w2"> </span>bigger<span class="w1"> </span>bytecode<span class="w1"> </span>implementations<span class="w2"> </span>give<span class="w1"> </span>the</div><div class="l f2 s4 t0" style="top:329.036px;left:317.014px;" data-x="317.014" data-y="462.964">compiler<span class="w2"> </span>more<span class="w1"> </span>opportunities<span class="w1"> </span>to<span class="w2"> </span>optimize<span class="w1"> </span>the<span class="w1"> </span>interpreter.</div><div class="l f2 s4 t0" style="top:338.999px;left:328.969px;" data-x="328.969" data-y="453.001">Fat<span class="w0"> </span>bytecodes<span class="w1"> </span>are<span class="w0"> </span>a<span class="w0"> </span>problem<span class="w1"> </span>for<span class="w0"> </span>TraceMonkey<span class="w1"> </span>because<span class="w0"> </span>they</div><div class="l f2 s4 t0" style="top:348.961px;left:317.014px;" data-x="317.014" data-y="443.039">require<span class="w1"> </span>the<span class="w0"> </span>recorder<span class="w0"> </span>to<span class="w1"> </span>reimplement<span class="w0"> </span>the<span class="w1"> </span>same<span class="w0"> </span>special<span class="w1"> </span>case<span class="w0"> </span>logic</div><div class="l f2 s4 t0" style="top:358.924px;left:317.014px;" data-x="317.014" data-y="433.076">in<span class="w0"> </span>the<span class="w1"> </span>same<span class="w0"> </span>way.<span class="w1"> </span>Also,<span class="w0"> </span>the<span class="w1"> </span>advantages<span class="w0"> </span>are<span class="w0"> </span>reduced<span class="w1"> </span>because<span class="w0"> </span>(a)</div><div class="l f2 s4 t0" style="top:368.887px;left:317.014px;" data-x="317.014" data-y="423.113">dispatch<span class="w1"> </span>costs<span class="w0"> </span>are<span class="w1"> </span>eliminated<span class="w1"> </span>entirely<span class="w0"> </span>in<span class="w1"> </span>compiled<span class="w1"> </span>traces,<span class="w0"> </span>(b)<span class="w1"> </span>the</div><div class="l f2 s4 t0" style="top:378.849px;left:317.014px;" data-x="317.014" data-y="413.151">traces<span class="w0"> </span>contain<span class="w1"> </span>only<span class="w0"> </span>one<span class="w0"> </span>special<span class="w0"> </span>case,<span class="w0"> </span>not<span class="w1"> </span>the<span class="w0"> </span>interpreter’s<span class="w0"> </span>large</div><div class="l f2 s4 t0" style="top:388.812px;left:317.014px;" data-x="317.014" data-y="403.188">chunk<span class="w1"> </span>of<span class="w2"> </span>code,<span class="w1"> </span>and<span class="w1"> </span>(c)<span class="w1"> </span>TraceMonkey<span class="w2"> </span>spends<span class="w1"> </span>less<span class="w1"> </span>time<span class="w1"> </span>running<span class="w1"> </span>the</div><div class="l f2 s4 t0" style="top:398.775px;left:317.014px;" data-x="317.014" data-y="393.225">base<span class="w2"> </span>interpreter.</div><div class="l f2 s4 t0" style="top:408.737px;left:328.969px;" data-x="328.969" data-y="383.263">One<span class="w2"> </span>way<span class="w1"> </span>we<span class="w1"> </span>have<span class="w2"> </span>mitigated<span class="w2"> </span>these<span class="w1"> </span>problems<span class="w1"> </span>is<span class="w2"> </span>by<span class="w1"> </span>implementing</div><div class="l f2 s4 t0" style="top:418.7px;left:317.014px;" data-x="317.014" data-y="373.3">certain<span class="w1"> </span>complex<span class="w1"> </span>bytecodes<span class="w1"> </span>in<span class="w1"> </span>the<span class="w1"> </span>recorder<span class="w1"> </span>as<span class="w1"> </span>sequences<span class="w1"> </span>of<span class="w1"> </span>simple</div><div class="l f2 s4 t0" style="top:428.662px;left:317.014px;" data-x="317.014" data-y="363.338">bytecodes.<span class="w2"> </span>Expressing<span class="w2"> </span>the<span class="w1"> </span>original<span class="w2"> </span>semantics<span class="w2"> </span>this<span class="w2"> </span>way<span class="w2"> </span>is<span class="w1"> </span>not<span class="w2"> </span>too<span class="w2"> </span>dif-</div><div class="l f2 s4 t0" style="top:438.625px;left:317.014px;" data-x="317.014" data-y="353.375">ficult,<span class="w2"> </span>and<span class="w1"> </span>recording<span class="w1"> </span>simple<span class="w2"> </span>bytecodes<span class="w1"> </span>is<span class="w2"> </span>much<span class="w1"> </span>easier.<span class="w2"> </span>This<span class="w1"> </span>enables</div><div class="l f2 s4 t0" style="top:448.588px;left:317.014px;" data-x="317.014" data-y="343.412">us<span class="w2"> </span>to<span class="w1"> </span>retain<span class="w2"> </span>the<span class="w1"> </span>advantages<span class="w2"> </span>of<span class="w1"> </span>fat<span class="w2"> </span>bytecodes<span class="w1"> </span>while<span class="w2"> </span>avoiding<span class="w1"> </span>some<span class="w2"> </span>of</div><div class="l f2 s4 t0" style="top:458.55px;left:317.014px;" data-x="317.014" data-y="333.45">their<span class="w2"> </span>problems<span class="w1"> </span>for<span class="w1"> </span>trace<span class="w2"> </span>recording.<span class="w1"> </span>This<span class="w1"> </span>is<span class="w2"> </span>particularly<span class="w1"> </span>effective<span class="w2"> </span>for</div><div class="l f2 s4 t0" style="top:468.513px;left:317.014px;" data-x="317.014" data-y="323.487">fat<span class="w1"> </span>bytecodes<span class="w2"> </span>that<span class="w1"> </span>recurse<span class="w1"> </span>back<span class="w1"> </span>into<span class="w1"> </span>the<span class="w1"> </span>interpreter,<span class="w2"> </span>for<span class="w1"> </span>example<span class="w1"> </span>to</div><div class="l f2 s4 t0" style="top:478.476px;left:317.014px;" data-x="317.014" data-y="313.524">convert<span class="w2"> </span>an<span class="w1"> </span>object<span class="w1"> </span>into<span class="w1"> </span>a<span class="w1"> </span>primitive<span class="w2"> </span>value<span class="w1"> </span>by<span class="w1"> </span>invoking<span class="w2"> </span>a<span class="w1"> </span>well-known</div><div class="l f2 s4 t0" style="top:488.438px;left:317.014px;" data-x="317.014" data-y="303.562">method<span class="w2"> </span>on<span class="w1"> </span>the<span class="w1"> </span>object,<span class="w2"> </span>since<span class="w1"> </span>it<span class="w1"> </span>lets<span class="w2"> </span>us<span class="w1"> </span>inline<span class="w2"> </span>this<span class="w1"> </span>function<span class="w1"> </span>call.</div><div class="l f2 s4 t0" style="top:498.401px;left:328.969px;" data-x="328.969" data-y="293.599">It<span class="w1"> </span>is<span class="w2"> </span>important<span class="w1"> </span>to<span class="w1"> </span>note<span class="w1"> </span>that<span class="w2"> </span>we<span class="w1"> </span>split<span class="w1"> </span>fat<span class="w1"> </span>opcodes<span class="w2"> </span>into<span class="w1"> </span>thinner<span class="w1"> </span>op-</div><div class="l f2 s4 t0" style="top:508.364px;left:317.014px;" data-x="317.014" data-y="283.636">codes<span class="w2"> </span>only<span class="w1"> </span>during<span class="w1"> </span>recording.<span class="w2"> </span>When<span class="w1"> </span>running<span class="w1"> </span>purely<span class="w2"> </span>interpretatively</div><div class="l f2 s4 t0" style="top:518.326px;left:317.014px;" data-x="317.014" data-y="273.674">(i.e.<span class="w2"> </span>code<span class="w1"> </span>that<span class="w1"> </span>has<span class="w1"> </span>been<span class="w2"> </span>blacklisted),<span class="w1"> </span>the<span class="w1"> </span>interpreter<span class="w2"> </span>directly<span class="w1"> </span>and<span class="w1"> </span>ef-</div><div class="l f2 s4 t0" style="top:528.289px;left:317.014px;" data-x="317.014" data-y="263.711">ficiently<span class="w2"> </span>executes<span class="w1"> </span>the<span class="w2"> </span>fat<span class="w1"> </span>opcodes.</div><div class="l f1 s4 t0" style="top:560.169px;left:317.014px;" data-x="317.014" data-y="231.831">6.4<span class="w10"> </span>Preemption</div><div class="l f2 s4 t0" style="top:574.117px;left:317.014px;" data-x="317.014" data-y="217.883">SpiderMonkey,<span class="w2"> </span>like<span class="w2"> </span>many<span class="w2"> </span>VMs,<span class="w1"> </span>needs<span class="w2"> </span>to<span class="w1"> </span>preempt<span class="w2"> </span>the<span class="w1"> </span>user<span class="w2"> </span>program</div><div class="l f2 s4 t0" style="top:584.08px;left:317.014px;" data-x="317.014" data-y="207.92">periodically.<span class="w1"> </span>The<span class="w0"> </span>main<span class="w0"> </span>reasons<span class="w1"> </span>are<span class="w0"> </span>to<span class="w0"> </span>prevent<span class="w1"> </span>infinitely<span class="w0"> </span>looping</div><div class="l f2 s4 t0" style="top:594.042px;left:317.014px;" data-x="317.014" data-y="197.958">scripts<span class="w2"> </span>from<span class="w1"> </span>locking<span class="w1"> </span>up<span class="w2"> </span>the<span class="w1"> </span>host<span class="w1"> </span>system<span class="w2"> </span>and<span class="w1"> </span>to<span class="w2"> </span>schedule<span class="w1"> </span>GC.</div><div class="l f2 s4 t0" style="top:604.005px;left:328.969px;" data-x="328.969" data-y="187.995">In<span class="w1"> </span>the<span class="w2"> </span>interpreter,<span class="w1"> </span>this<span class="w1"> </span>had<span class="w2"> </span>been<span class="w1"> </span>implemented<span class="w1"> </span>by<span class="w1"> </span>setting<span class="w1"> </span>a<span class="w2"> </span>“pre-</div><div class="l f2 s4 t0" style="top:613.968px;left:317.014px;" data-x="317.014" data-y="178.032">empt<span class="w1"> </span>now”<span class="w1"> </span>flag<span class="w0"> </span>that<span class="w1"> </span>was<span class="w1"> </span>checked<span class="w1"> </span>on<span class="w0"> </span>ev</div><div class="l f2 s4 t0" style="top:613.968px;left:463.677px;" data-x="463.677" data-y="178.032">ery<span class="w1"> </span>backward<span class="w1"> </span>jump.<span class="w0"> </span>This</div><div class="l f2 s4 t0" style="top:623.93px;left:317.014px;" data-x="317.014" data-y="168.07">strategy<span class="w2"> </span>carried<span class="w1"> </span>over<span class="w2"> </span>into<span class="w1"> </span>TraceMonkey:<span class="w2"> </span>the<span class="w1"> </span>VM<span class="w2"> </span>inserts<span class="w1"> </span>a<span class="w2"> </span>guard<span class="w1"> </span>on</div><div class="l f2 s4 t0" style="top:633.893px;left:317.014px;" data-x="317.014" data-y="158.107">the<span class="w1"> </span>preemption<span class="w1"> </span>flag<span class="w1"> </span>at<span class="w0"> </span>every<span class="w2"> </span>loop<span class="w0"> </span>edge.<span class="w1"> </span>We<span class="w2"> </span>measured<span class="w0"> </span>less<span class="w1"> </span>than<span class="w1"> </span>a</div><div class="l f2 s4 t0" style="top:643.855px;left:317.014px;" data-x="317.014" data-y="148.145">1%<span class="w1"> </span>increase<span class="w1"> </span>in<span class="w1"> </span>runtime<span class="w1"> </span>on<span class="w1"> </span>most<span class="w0"> </span>benchmarks<span class="w2"> </span>for<span class="w0"> </span>this<span class="w2"> </span>extra<span class="w0"> </span>guard.</div><div class="l f2 s4 t0" style="top:653.818px;left:317.014px;" data-x="317.014" data-y="138.182">In<span class="w2"> </span>practice,<span class="w1"> </span>the<span class="w2"> </span>cost<span class="w1"> </span>is<span class="w2"> </span>detectable<span class="w1"> </span>only<span class="w1"> </span>for<span class="w2"> </span>programs<span class="w1"> </span>with<span class="w2"> </span>very<span class="w1"> </span>short</div><div class="l f2 s4 t0" style="top:663.781px;left:317.014px;" data-x="317.014" data-y="128.219">loops.</div><div class="l f2 s4 t0" style="top:673.743px;left:328.969px;" data-x="328.969" data-y="118.257">We<span class="w1"> </span>tested<span class="w1"> </span>and<span class="w0"> </span>rejected<span class="w1"> </span>a<span class="w0"> </span>solution<span class="w1"> </span>that<span class="w0"> </span>avoided<span class="w1"> </span>the<span class="w1"> </span>guards<span class="w0"> </span>by</div><div class="l f2 s4 t0" style="top:683.706px;left:317.014px;" data-x="317.014" data-y="108.294">compiling<span class="w1"> </span>the<span class="w0"> </span>loop<span class="w1"> </span>edge<span class="w1"> </span>as<span class="w1"> </span>an<span class="w0"> </span>unconditional<span class="w1"> </span>jump,<span class="w1"> </span>and<span class="w0"> </span>patching</div><div class="l f2 s4 t0" style="top:693.669px;left:317.014px;" data-x="317.014" data-y="98.3313">the<span class="w1"> </span>jump<span class="w0"> </span>target<span class="w1"> </span>to<span class="w0"> </span>an<span class="w0"> </span>exit<span class="w1"> </span>routine<span class="w0"> </span>when<span class="w1"> </span>preemption<span class="w0"> </span>is<span class="w1"> </span>required.</div><div class="l f2 s4 t0" style="top:703.631px;left:317.014px;" data-x="317.014" data-y="88.3686">This<span class="w1"> </span>solution<span class="w0"> </span>can<span class="w1"> </span>make<span class="w0"> </span>the<span class="w1"> </span>normal<span class="w0"> </span>case<span class="w1"> </span>slightly<span class="w0"> </span>faster</div><div class="l f2 s4 t0" style="top:703.631px;left:520.085px;" data-x="520.085" data-y="88.3686">,<span class="w1"> </span>but<span class="w0"> </span>then</div><div class="l f2 s4 t0" style="top:713.594px;left:317.014px;" data-x="317.014" data-y="78.406">preemption<span class="w2"> </span>becomes<span class="w1"> </span>very<span class="w1"> </span>slow.<span class="w2"> </span>The<span class="w2"> </span>implementation<span class="w1"> </span>was<span class="w1"> </span>also<span class="w2"> </span>very</div><div class="l f2 s4 t0" style="top:723.557px;left:317.014px;" data-x="317.014" data-y="68.4433">complex,<span class="w2"> </span>especially<span class="w2"> </span>trying<span class="w1"> </span>to<span class="w2"> </span>restart<span class="w2"> </span>execution<span class="w2"> </span>after<span class="w1"> </span>the<span class="w2"> </span>preemption.</div></div></div><div id="page-10" class="p" style="width:612px;height:792px;"><div class="t"><div class="l f1 s4 t0" style="top:79.9701px;left:54px;" data-x="54" data-y="712.03">6.5<span class="w10"> </span>Calling<span class="w2"> </span>External<span class="w1"> </span>Functions</div><div class="l f2 s4 t0" style="top:93.9178px;left:54px;" data-x="54" data-y="698.082">Like<span class="w2"> </span>most<span class="w1"> </span>interpreters,<span class="w1"> </span>SpiderMonkey<span class="w2"> </span>has<span class="w1"> </span>a<span class="w2"> </span>foreign<span class="w1"> </span>function<span class="w1"> </span>inter-</div><div class="l f2 s4 t0" style="top:103.88px;left:54px;" data-x="54" data-y="688.12">face<span class="w2"> </span>(FFI)<span class="w1"> </span>that<span class="w2"> </span>allows<span class="w1"> </span>it<span class="w2"> </span>to<span class="w1"> </span>call<span class="w2"> </span>C<span class="w1"> </span>builtins<span class="w2"> </span>and<span class="w2"> </span>host<span class="w1"> </span>system<span class="w1"> </span>functions</div><div class="l f2 s4 t0" style="top:113.843px;left:54px;" data-x="54" data-y="678.157">(e.g.,<span class="w1"> </span>web<span class="w1"> </span>browser<span class="w1"> </span>control<span class="w2"> </span>and<span class="w1"> </span>DOM<span class="w1"> </span>access).<span class="w1"> </span>The<span class="w1"> </span>FFI<span class="w1"> </span>has<span class="w1"> </span>a<span class="w1"> </span>stan-</div><div class="l f2 s4 t0" style="top:123.806px;left:54px;" data-x="54" data-y="668.194">dard<span class="w2"> </span>signature<span class="w1"> </span>for<span class="w2"> </span>JS-callable<span class="w1"> </span>functions,<span class="w2"> </span>the<span class="w1"> </span>key<span class="w2"> </span>argument<span class="w2"> </span>of<span class="w1"> </span>which</div><div class="l f2 s4 t0" style="top:133.768px;left:54px;" data-x="54" data-y="658.232">is<span class="w1"> </span>an<span class="w1"> </span>array<span class="w1"> </span>of<span class="w1"> </span>boxed<span class="w1"> </span>values.<span class="w1"> </span>External<span class="w1"> </span>functions<span class="w1"> </span>called<span class="w1"> </span>through<span class="w1"> </span>the</div><div class="l f2 s4 t0" style="top:143.731px;left:54px;" data-x="54" data-y="648.269">FFI<span class="w2"> </span>interact<span class="w1"> </span>with<span class="w2"> </span>the<span class="w2"> </span>program<span class="w1"> </span>state<span class="w2"> </span>through<span class="w1"> </span>an<span class="w2"> </span>interpreter<span class="w2"> </span>API<span class="w1"> </span>(e.g.,</div><div class="l f2 s4 t0" style="top:153.694px;left:54px;" data-x="54" data-y="638.306">to<span class="w1"> </span>read<span class="w2"> </span>a<span class="w1"> </span>property<span class="w1"> </span>from<span class="w1"> </span>an<span class="w1"> </span>argument).<span class="w2"> </span>There<span class="w1"> </span>are<span class="w1"> </span>also<span class="w1"> </span>certain<span class="w1"> </span>inter-</div><div class="l f2 s4 t0" style="top:163.656px;left:54px;" data-x="54" data-y="628.344">preter<span class="w2"> </span>builtins<span class="w1"> </span>that<span class="w2"> </span>do<span class="w2"> </span>not<span class="w1"> </span>use<span class="w2"> </span>the<span class="w1"> </span>FFI,<span class="w2"> </span>but<span class="w1"> </span>interact<span class="w2"> </span>with<span class="w1"> </span>the<span class="w2"> </span>program</div><div class="l f2 s4 t0" style="top:173.619px;left:54px;" data-x="54" data-y="618.381">state<span class="w1"> </span>in<span class="w0"> </span>the<span class="w1"> </span>same<span class="w1"> </span>way,<span class="w1"> </span>such<span class="w1"> </span>as<span class="w0"> </span>the</div><div class="l f7 s4 t0" style="top:173.619px;left:184.597px;" data-x="184.597" data-y="618.381">CallIteratorNext</div><div class="l f2 s4 t0" style="top:173.619px;left:263.219px;" data-x="263.219" data-y="618.381">function</div><div class="l f2 s4 t0" style="top:183.582px;left:54px;" data-x="54" data-y="608.418">used<span class="w1"> </span>with<span class="w1"> </span>iterator<span class="w1"> </span>objects.<span class="w1"> </span>TraceMonkey<span class="w1"> </span>must<span class="w1"> </span>support<span class="w1"> </span>this<span class="w1"> </span>FFI<span class="w0"> </span>in</div><div class="l f2 s4 t0" style="top:193.544px;left:54px;" data-x="54" data-y="598.456">order<span class="w2"> </span>to<span class="w1"> </span>speed<span class="w2"> </span>up<span class="w2"> </span>code<span class="w1"> </span>that<span class="w2"> </span>interacts<span class="w1"> </span>with<span class="w2"> </span>the<span class="w1"> </span>host<span class="w2"> </span>system<span class="w2"> </span>inside<span class="w1"> </span>hot</div><div class="l f2 s4 t0" style="top:203.507px;left:54px;" data-x="54" data-y="588.493">loops.</div><div class="l f2 s4 t0" style="top:213.469px;left:65.9552px;" data-x="65.9552" data-y="578.531">Calling<span class="w2"> </span>external<span class="w1"> </span>functions<span class="w2"> </span>from<span class="w1"> </span>TraceMonkey<span class="w2"> </span>is<span class="w2"> </span>potentially<span class="w1"> </span>dif-</div><div class="l f2 s4 t0" style="top:223.432px;left:54px;" data-x="54" data-y="568.568">ficult<span class="w1"> </span>because<span class="w1"> </span>traces<span class="w1"> </span>do<span class="w1"> </span>not<span class="w0"> </span>update<span class="w2"> </span>the<span class="w0"> </span>interpreter<span class="w2"> </span>state<span class="w0"> </span>until<span class="w1"> </span>exit-</div><div class="l f2 s4 t0" style="top:233.395px;left:54px;" data-x="54" data-y="558.605">ing.<span class="w1"> </span>In<span class="w2"> </span>particular,<span class="w1"> </span>external<span class="w2"> </span>functions<span class="w1"> </span>may<span class="w1"> </span>need<span class="w1"> </span>the<span class="w2"> </span>call<span class="w1"> </span>stack<span class="w1"> </span>or<span class="w1"> </span>the</div><div class="l f2 s4 t0" style="top:243.357px;left:54px;" data-x="54" data-y="548.643">global<span class="w2"> </span>variables,<span class="w1"> </span>but<span class="w2"> </span>they<span class="w1"> </span>may<span class="w1"> </span>be<span class="w2"> </span>out<span class="w1"> </span>of<span class="w2"> </span>date.</div><div class="l f2 s4 t0" style="top:253.32px;left:65.9552px;" data-x="65.9552" data-y="538.68">For<span class="w1"> </span>the<span class="w1"> </span>out-of-date<span class="w1"> </span>call<span class="w0"> </span>stack<span class="w1"> </span>problem,<span class="w1"> </span>we<span class="w1"> </span>refactored<span class="w1"> </span>some<span class="w1"> </span>of</div><div class="l f2 s4 t0" style="top:263.283px;left:54px;" data-x="54" data-y="528.717">the<span class="w1"> </span>interpreter<span class="w1"> </span>API<span class="w1"> </span>implementation<span class="w1"> </span>functions<span class="w1"> </span>to<span class="w1"> </span>re-materialize<span class="w1"> </span>the</div><div class="l f2 s4 t0" style="top:273.245px;left:54px;" data-x="54" data-y="518.755">interpreter<span class="w2"> </span>call<span class="w1"> </span>stack<span class="w1"> </span>on<span class="w2"> </span>demand.</div><div class="l f2 s4 t0" style="top:283.208px;left:65.9552px;" data-x="65.9552" data-y="508.792">We<span class="w2"> </span>developed<span class="w1"> </span>a<span class="w1"> </span>C++<span class="w1"> </span>static<span class="w1"> </span>analysis<span class="w1"> </span>and<span class="w1"> </span>annotated<span class="w1"> </span>some<span class="w1"> </span>inter-</div><div class="l f2 s4 t0" style="top:293.171px;left:54px;" data-x="54" data-y="498.829">preter<span class="w1"> </span>functions<span class="w1"> </span>in<span class="w0"> </span>order<span class="w1"> </span>to<span class="w1"> </span>verify<span class="w0"> </span>that<span class="w1"> </span>the<span class="w1"> </span>call<span class="w1"> </span>stack<span class="w0"> </span>is<span class="w1"> </span>refreshed</div><div class="l f2 s4 t0" style="top:303.133px;left:54px;" data-x="54" data-y="488.867">at<span class="w1"> </span>any<span class="w1"> </span>point<span class="w1"> </span>it<span class="w1"> </span>needs<span class="w1"> </span>to<span class="w0"> </span>be<span class="w2"> </span>used.<span class="w0"> </span>In<span class="w2"> </span>order<span class="w1"> </span>to<span class="w0"> </span>access<span class="w2"> </span>the<span class="w0"> </span>call<span class="w2"> </span>stack,</div><div class="l f2 s4 t0" style="top:313.096px;left:54px;" data-x="54" data-y="478.904">a<span class="w0"> </span>function<span class="w0"> </span>must<span class="w1"> </span>be<span class="w0"> </span>annotated<span class="w0"> </span>as<span class="w0"> </span>either<span class="w0"> </span>F</div><div class="l f2 s8 t0" style="top:313.096px;left:211.644px;" data-x="211.644" data-y="478.904">ORC<span class="w2"> </span>ES</div><div class="l f2 s4 t0" style="top:313.096px;left:236.974px;" data-x="236.974" data-y="478.904">S</div><div class="l f2 s8 t0" style="top:313.096px;left:242.407px;" data-x="242.407" data-y="478.904">TACK</div><div class="l f2 s4 t0" style="top:313.096px;left:266.738px;" data-x="266.738" data-y="478.904">or<span class="w0"> </span>R</div><div class="l f2 s8 t0" style="top:313.096px;left:285.07px;" data-x="285.07" data-y="478.904">E</div><div class="l f2 s4 t0" style="top:313.096px;left:289.893px;" data-x="289.893" data-y="478.904">-</div><div class="l f2 s8 t0" style="top:323.058px;left:54.2241px;" data-x="54.2241" data-y="468.942">QUI<span class="w2"> </span>RES</div><div class="l f2 s4 t0" style="top:323.058px;left:82.7098px;" data-x="82.7098" data-y="468.942">S</div><div class="l f2 s8 t0" style="top:323.058px;left:88.1434px;" data-x="88.1434" data-y="468.942">TACK</div><div class="l f2 s4 t0" style="top:323.058px;left:108.264px;" data-x="108.264" data-y="468.942">.<span class="w2"> </span>These<span class="w1"> </span>annotations<span class="w2"> </span>are<span class="w1"> </span>also<span class="w2"> </span>required<span class="w1"> </span>in<span class="w2"> </span>order<span class="w1"> </span>to<span class="w2"> </span>call</div><div class="l f2 s4 t0" style="top:333.021px;left:54.2241px;" data-x="54.2241" data-y="458.979">R</div><div class="l f2 s8 t0" style="top:333.021px;left:60.6529px;" data-x="60.6529" data-y="458.979">EQU<span class="w2"> </span>IRE<span class="w2"> </span>S</div><div class="l f2 s4 t0" style="top:333.021px;left:93.9624px;" data-x="93.9624" data-y="458.979">S</div><div class="l f2 s8 t0" style="top:333.021px;left:99.396px;" data-x="99.396" data-y="458.979">TACK</div><div class="l f2 s4 t0" style="top:333.021px;left:121.575px;" data-x="121.575" data-y="458.979">functions,<span class="w2"> </span>which<span class="w1"> </span>are<span class="w2"> </span>presumed<span class="w1"> </span>to<span class="w2"> </span>access<span class="w1"> </span>the<span class="w2"> </span>call</div><div class="l f2 s4 t0" style="top:342.984px;left:54px;" data-x="54" data-y="449.016">stack<span class="w1"> </span>transitively.<span class="w1"> </span>F</div><div class="l f2 s8 t0" style="top:342.984px;left:125.911px;" data-x="125.911" data-y="449.016">ORC<span class="w2"> </span>ES</div><div class="l f2 s4 t0" style="top:342.984px;left:151.24px;" data-x="151.24" data-y="449.016">S</div><div class="l f2 s8 t0" style="top:342.984px;left:156.674px;" data-x="156.674" data-y="449.016">TACK</div><div class="l f2 s4 t0" style="top:342.984px;left:179.884px;" data-x="179.884" data-y="449.016">is<span class="w1"> </span>a<span class="w1"> </span>trusted<span class="w0"> </span>annotation,<span class="w1"> </span>applied</div><div class="l f2 s4 t0" style="top:352.946px;left:54px;" data-x="54" data-y="439.054">to<span class="w2"> </span>only<span class="w1"> </span>5<span class="w2"> </span>functions,<span class="w1"> </span>that<span class="w2"> </span>means<span class="w2"> </span>the<span class="w1"> </span>function<span class="w2"> </span>refreshes<span class="w1"> </span>the<span class="w2"> </span>call<span class="w1"> </span>stack.</div><div class="l f2 s4 t0" style="top:362.909px;left:54.2241px;" data-x="54.2241" data-y="429.091">R</div><div class="l f2 s8 t0" style="top:362.909px;left:60.6529px;" data-x="60.6529" data-y="429.091">EQU<span class="w2"> </span>IRE<span class="w2"> </span>S</div><div class="l f2 s4 t0" style="top:362.909px;left:93.9625px;" data-x="93.9625" data-y="429.091">S</div><div class="l f2 s8 t0" style="top:362.909px;left:99.396px;" data-x="99.396" data-y="429.091">TACK</div><div class="l f2 s4 t0" style="top:362.909px;left:122.226px;" data-x="122.226" data-y="429.091">is<span class="w1"> </span>an<span class="w1"> </span>untrusted<span class="w1"> </span>annotation<span class="w1"> </span>that<span class="w1"> </span>means<span class="w1"> </span>the<span class="w1"> </span>func-</div><div class="l f2 s4 t0" style="top:372.872px;left:54px;" data-x="54" data-y="419.128">tion<span class="w2"> </span>may<span class="w1"> </span>only<span class="w2"> </span>be<span class="w1"> </span>called<span class="w2"> </span>if<span class="w1"> </span>the<span class="w2"> </span>call<span class="w1"> </span>stack<span class="w1"> </span>has<span class="w2"> </span>already<span class="w1"> </span>been<span class="w2"> </span>refreshed.</div><div class="l f2 s4 t0" style="top:382.834px;left:65.9551px;" data-x="65.9551" data-y="409.166">Similarly,<span class="w1"> </span>we<span class="w0"> </span>detect<span class="w0"> </span>when<span class="w1"> </span>host<span class="w0"> </span>functions<span class="w0"> </span>attempt<span class="w1"> </span>to<span class="w0"> </span>directly</div><div class="l f2 s4 t0" style="top:392.797px;left:54px;" data-x="54" data-y="399.203">read<span class="w2"> </span>or<span class="w1"> </span>write<span class="w2"> </span>global<span class="w1"> </span>variables,<span class="w2"> </span>and<span class="w1"> </span>force<span class="w2"> </span>the<span class="w1"> </span>currently<span class="w2"> </span>running<span class="w1"> </span>trace</div><div class="l f2 s4 t0" style="top:402.76px;left:54px;" data-x="54" data-y="389.24">to<span class="w1"> </span>side<span class="w0"> </span>exit.<span class="w1"> </span>This<span class="w0"> </span>is<span class="w1"> </span>necessary<span class="w1"> </span>since<span class="w0"> </span>we<span class="w1"> </span>cache<span class="w0"> </span>and<span class="w1"> </span>unbox<span class="w0"> </span>global</div><div class="l f2 s4 t0" style="top:412.722px;left:54px;" data-x="54" data-y="379.278">variables<span class="w2"> </span>into<span class="w1"> </span>the<span class="w2"> </span>activation<span class="w1"> </span>record<span class="w2"> </span>during<span class="w1"> </span>trace<span class="w1"> </span>execution.</div><div class="l f2 s4 t0" style="top:422.685px;left:65.9551px;" data-x="65.9551" data-y="369.315">Since<span class="w0"> </span>both<span class="w0"> </span>call-stack<span class="w0"> </span>access<span class="w0"> </span>and<span class="w0"> </span>global<span class="w0"> </span>variable<span class="w0"> </span>access<span class="w0"> </span>are</div><div class="l f2 s4 t0" style="top:432.648px;left:54px;" data-x="54" data-y="359.352">rarely<span class="w2"> </span>performed<span class="w2"> </span>by<span class="w1"> </span>host<span class="w2"> </span>functions,<span class="w2"> </span>performance<span class="w1"> </span>is<span class="w2"> </span>not<span class="w2"> </span>significantly</div><div class="l f2 s4 t0" style="top:442.61px;left:54px;" data-x="54" data-y="349.39">affected<span class="w2"> </span>by<span class="w1"> </span>these<span class="w2"> </span>safety<span class="w1"> </span>mechanisms.</div><div class="l f2 s4 t0" style="top:452.573px;left:65.9551px;" data-x="65.9551" data-y="339.427">Another<span class="w2"> </span>problem<span class="w1"> </span>is<span class="w2"> </span>that<span class="w1"> </span>external<span class="w2"> </span>functions<span class="w1"> </span>can<span class="w2"> </span>reenter<span class="w1"> </span>the<span class="w2"> </span>inter-</div><div class="l f2 s4 t0" style="top:462.535px;left:54px;" data-x="54" data-y="329.465">preter<span class="w1"> </span>by<span class="w1"> </span>calling<span class="w2"> </span>scripts,<span class="w1"> </span>which<span class="w1"> </span>in<span class="w1"> </span>turn<span class="w1"> </span>again<span class="w1"> </span>might<span class="w1"> </span>want<span class="w2"> </span>to<span class="w1"> </span>access</div><div class="l f2 s4 t0" style="top:472.498px;left:54px;" data-x="54" data-y="319.502">the<span class="w2"> </span>call<span class="w1"> </span>stack<span class="w2"> </span>or<span class="w2"> </span>global<span class="w1"> </span>variables.<span class="w2"> </span>To<span class="w2"> </span>address<span class="w2"> </span>this<span class="w1"> </span>problem,<span class="w2"> </span>we<span class="w1"> </span>made</div><div class="l f2 s4 t0" style="top:482.461px;left:54px;" data-x="54" data-y="309.539">the<span class="w2"> </span>VM<span class="w2"> </span>set<span class="w1"> </span>a<span class="w2"> </span>flag<span class="w2"> </span>whenever<span class="w2"> </span>the<span class="w1"> </span>interpreter<span class="w2"> </span>is<span class="w2"> </span>reentered<span class="w1"> </span>while<span class="w2"> </span>a<span class="w2"> </span>com-</div><div class="l f2 s4 t0" style="top:492.423px;left:54px;" data-x="54" data-y="299.577">piled<span class="w2"> </span>trace<span class="w1"> </span>is<span class="w1"> </span>running.</div><div class="l f2 s4 t0" style="top:502.386px;left:65.9551px;" data-x="65.9551" data-y="289.614">Every<span class="w2"> </span>call<span class="w1"> </span>to<span class="w2"> </span>an<span class="w1"> </span>external<span class="w2"> </span>function<span class="w1"> </span>then<span class="w2"> </span>checks<span class="w1"> </span>this<span class="w2"> </span>flag<span class="w1"> </span>and<span class="w2"> </span>exits</div><div class="l f2 s4 t0" style="top:512.349px;left:54px;" data-x="54" data-y="279.651">the<span class="w2"> </span>trace<span class="w2"> </span>immediately<span class="w1"> </span>after<span class="w2"> </span>returning<span class="w2"> </span>from<span class="w1"> </span>the<span class="w2"> </span>external<span class="w2"> </span>function<span class="w1"> </span>call</div><div class="l f2 s4 t0" style="top:522.311px;left:54px;" data-x="54" data-y="269.689">if<span class="w1"> </span>it<span class="w2"> </span>is<span class="w1"> </span>set.<span class="w1"> </span>There<span class="w1"> </span>are<span class="w1"> </span>many<span class="w1"> </span>external<span class="w2"> </span>functions<span class="w1"> </span>that<span class="w1"> </span>seldom<span class="w1"> </span>or<span class="w1"> </span>never</div><div class="l f2 s4 t0" style="top:532.274px;left:54px;" data-x="54" data-y="259.726">reenter,<span class="w1"> </span>and<span class="w0"> </span>they<span class="w1"> </span>can<span class="w1"> </span>be<span class="w0"> </span>called<span class="w1"> </span>without<span class="w0"> </span>problem,<span class="w1"> </span>and<span class="w0"> </span>will<span class="w1"> </span>cause</div><div class="l f2 s4 t0" style="top:542.237px;left:54px;" data-x="54" data-y="249.763">trace<span class="w2"> </span>exit<span class="w1"> </span>only<span class="w1"> </span>if<span class="w2"> </span>necessary.</div><div class="l f2 s4 t0" style="top:552.199px;left:65.9551px;" data-x="65.9551" data-y="239.801">The<span class="w0"> </span>FFI’</div><div class="l f2 s4 t0" style="top:552.199px;left:99.1397px;" data-x="99.1397" data-y="239.801">s<span class="w0"> </span>boxed<span class="w1"> </span>value<span class="w0"> </span>array<span class="w1"> </span>requirement<span class="w0"> </span>has<span class="w1"> </span>a<span class="w0"> </span>performance</div><div class="l f2 s4 t0" style="top:562.162px;left:54px;" data-x="54" data-y="229.838">cost,<span class="w1"> </span>so<span class="w0"> </span>we<span class="w1"> </span>defined<span class="w1"> </span>a<span class="w0"> </span>new<span class="w1"> </span>FFI<span class="w1"> </span>that<span class="w1"> </span>allows<span class="w0"> </span>C<span class="w1"> </span>functions<span class="w1"> </span>to<span class="w0"> </span>be<span class="w1"> </span>an-</div><div class="l f2 s4 t0" style="top:572.124px;left:54px;" data-x="54" data-y="219.876">notated<span class="w1"> </span>with<span class="w1"> </span>their<span class="w1"> </span>argument<span class="w1"> </span>types<span class="w1"> </span>so<span class="w1"> </span>that<span class="w1"> </span>the<span class="w1"> </span>tracer<span class="w0"> </span>can<span class="w2"> </span>call<span class="w1"> </span>them</div><div class="l f2 s4 t0" style="top:582.087px;left:54px;" data-x="54" data-y="209.913">directly,<span class="w2"> </span>without<span class="w1"> </span>unnecessary<span class="w2"> </span>argument<span class="w1"> </span>conversions.</div><div class="l f2 s4 t0" style="top:592.05px;left:65.9551px;" data-x="65.9551" data-y="199.95">Currently,<span class="w2"> </span>we<span class="w1"> </span>do<span class="w2"> </span>not<span class="w1"> </span>support<span class="w1"> </span>calling<span class="w2"> </span>native<span class="w1"> </span>property<span class="w1"> </span>get<span class="w2"> </span>and<span class="w1"> </span>set</div><div class="l f2 s4 t0" style="top:602.012px;left:54px;" data-x="54" data-y="189.988">override<span class="w1"> </span>functions<span class="w2"> </span>or<span class="w1"> </span>DOM<span class="w1"> </span>functions<span class="w1"> </span>directly<span class="w1"> </span>from<span class="w1"> </span>trace.<span class="w1"> </span>Support</div><div class="l f2 s4 t0" style="top:611.975px;left:54px;" data-x="54" data-y="180.025">is<span class="w2"> </span>planned<span class="w1"> </span>future<span class="w1"> </span>work.</div><div class="l f1 s4 t0" style="top:629.908px;left:54px;" data-x="54" data-y="162.092">6.6<span class="w10"> </span>Correctness</div><div class="l f2 s4 t0" style="top:643.855px;left:54px;" data-x="54" data-y="148.145">During<span class="w0"> </span>development,<span class="w0"> </span>we<span class="w1"> </span>had<span class="w0"> </span>access<span class="w0"> </span>to<span class="w0"> </span>existing<span class="w0"> </span>JavaScript<span class="w0"> </span>test</div><div class="l f2 s4 t0" style="top:653.818px;left:54px;" data-x="54" data-y="138.182">suites,<span class="w1"> </span>but<span class="w1"> </span>most<span class="w0"> </span>of<span class="w1"> </span>them<span class="w1"> </span>were<span class="w0"> </span>not<span class="w1"> </span>designed<span class="w1"> </span>with<span class="w1"> </span>tracing<span class="w0"> </span>VMs<span class="w1"> </span>in</div><div class="l f2 s4 t0" style="top:663.781px;left:54px;" data-x="54" data-y="128.219">mind<span class="w2"> </span>and<span class="w1"> </span>contained<span class="w1"> </span>few<span class="w2"> </span>loops.</div><div class="l f2 s4 t0" style="top:673.743px;left:65.9551px;" data-x="65.9551" data-y="118.257">One<span class="w1"> </span>tool<span class="w1"> </span>that<span class="w0"> </span>helped<span class="w1"> </span>us<span class="w1"> </span>greatly<span class="w1"> </span>was<span class="w1"> </span>Mozilla’s<span class="w1"> </span>JavaScript<span class="w1"> </span>fuzz</div><div class="l f2 s4 t0" style="top:683.706px;left:54px;" data-x="54" data-y="108.294">tester,</div><div class="l f2 s8 t0" style="top:683.706px;left:78.6182px;" data-x="78.6182" data-y="108.294">JSF<span class="w2"> </span>UNF<span class="w2"> </span>UZZ</div><div class="l f2 s4 t0" style="top:683.706px;left:121.432px;" data-x="121.432" data-y="108.294">,<span class="w1"> </span>which<span class="w1"> </span>generates<span class="w0"> </span>random<span class="w1"> </span>JavaScript<span class="w2"> </span>programs</div><div class="l f2 s4 t0" style="top:693.669px;left:54px;" data-x="54" data-y="98.3313">by<span class="w1"> </span>nesting<span class="w0"> </span>random<span class="w1"> </span>language<span class="w1"> </span>elements.<span class="w0"> </span>We<span class="w1"> </span>modified</div><div class="l f2 s8 t0" style="top:693.669px;left:250.29px;" data-x="250.29" data-y="98.3313">JSF<span class="w2"> </span>UNF<span class="w2"> </span>UZZ</div><div class="l f2 s4 t0" style="top:703.631px;left:54px;" data-x="54" data-y="88.3686">to<span class="w1"> </span>generate<span class="w1"> </span>loops,<span class="w1"> </span>and<span class="w1"> </span>also<span class="w1"> </span>to<span class="w1"> </span>test<span class="w1"> </span>more<span class="w1"> </span>heavily<span class="w1"> </span>certain<span class="w1"> </span>constructs</div><div class="l f2 s4 t0" style="top:713.594px;left:54px;" data-x="54" data-y="78.406">we<span class="w2"> </span>suspected<span class="w1"> </span>would<span class="w2"> </span>reveal<span class="w1"> </span>flaws<span class="w2"> </span>in<span class="w1"> </span>our<span class="w2"> </span>implementation.<span class="w1"> </span>For<span class="w2"> </span>exam-</div><div class="l f2 s4 t0" style="top:723.557px;left:54px;" data-x="54" data-y="68.4434">ple,<span class="w2"> </span>we<span class="w2"> </span>suspected<span class="w1"> </span>bugs<span class="w2"> </span>in<span class="w2"> </span>TraceMonkey’shandling<span class="w1"> </span>of<span class="w2"> </span>type-unstable</div></div><div class="t t92"></div><div class="t t93"></div><div class="t t94"></div><div class="t t95"></div><div class="t t96"><div class="l f16 s7 t97" style="top:802px;left:0px;" data-x="377.215" data-y="532.302">!"#</div></div><div class="t t98"><div class="l f16 s7 t97" style="top:802px;left:0px;" data-x="393.004" data-y="532.302">$!"#</div></div><div class="t t99"><div class="l f16 s7 t97" style="top:802px;left:0px;" data-x="410.187" data-y="532.302">%!"#</div></div><div class="t t9a"><div class="l f16 s7 t97" style="top:802px;left:0px;" data-x="427.37" data-y="532.302">&!"#</div></div><div class="t t9b"><div class="l f16 s7 t97" style="top:802px;left:0px;" data-x="444.554" data-y="532.302">'!"#</div></div><div class="t t9c"><div class="l f16 s7 t97" style="top:802px;left:0px;" data-x="461.737" data-y="532.302">(!"#</div></div><div class="t t9d"><div class="l f16 s7 t97" style="top:802px;left:0px;" data-x="478.92" data-y="532.302">)!"#</div></div><div class="t t9e"><div class="l f16 s7 t97" style="top:802px;left:0px;" data-x="496.103" data-y="532.302">*!"#</div></div><div class="t t9f"><div class="l f16 s7 t97" style="top:802px;left:0px;" data-x="513.286" data-y="532.302">+!"#</div></div><div class="t ta0"><div class="l f16 s7 t97" style="top:802px;left:0px;" data-x="530.469" data-y="532.302">,!"#</div></div><div class="t ta1"><div class="l f16 s7 t97" style="top:802px;left:0px;" data-x="546.258" data-y="532.302">$!!"#</div></div><div class="t ta2"><div class="l f16 s7 ta3" style="top:800px;left:80.5461px;" data-x="350.177" data-y="544.441">&-./012#3%4%56#</div></div><div class="t ta4"><div class="l f16 s7 ta3" style="top:800px;left:77.5285px;" data-x="346.857" data-y="551.035">&-.789:;#3%4,56#</div></div><div class="t ta5"><div class="l f16 s7 ta3" style="top:800px;left:75.1965px;" data-x="344.292" data-y="557.628">&-.9<=>9</2#3$4%56#</div></div><div class="t ta6"><div class="l f16 s7 ta3" style="top:800px;left:62.5168px;" data-x="330.344" data-y="564.222"><//2??.1@A<9=.>922?#3!4,56#</div></div><div class="t ta7"><div class="l f16 s7 ta3" style="top:800px;left:67.2531px;" data-x="335.554" data-y="570.816"><//2??.B<AAC0/;#3%4%56#</div></div><div class="t ta8"><div class="l f16 s7 ta3" style="top:800px;left:71.9172px;" data-x="340.685" data-y="577.409"><//2??.A18-=#3'4%56#</div></div><div class="t ta9"><div class="l f16 s7 ta3" style="top:800px;left:71.8293px;" data-x="340.584" data-y="584.003"><//2??.A?@2D2#3&4!56#</div></div><div class="t taa"><div class="l f16 s7 ta3" style="top:800px;left:54.3761px;" data-x="321.39" data-y="590.597">1@>8:?.&1@>.1@>?.@A.1=>2#3%(4(56#</div></div><div class="t tab"><div class="l f16 s7 ta3" style="top:800px;left:63.8918px;" data-x="331.819" data-y="597.19">1@>8:?.1@>?.@A.1=>2#3+4*56#</div></div><div class="t tac"><div class="l f16 s7 ta3" style="top:800px;left:61.4211px;" data-x="329.139" data-y="603.784">1@>8:?.1@>E@?2.<A-#3%(4%56#</div></div><div class="t tad"><div class="l f16 s7 ta3" style="top:800px;left:65.0226px;" data-x="333.101" data-y="610.378">1@>8:?.A?@2D2.1@>?#3%4*56#</div></div><div class="t tae"><div class="l f16 s7 ta3" style="top:800px;left:59.3527px;" data-x="326.864" data-y="616.971">/8A>98FG8E.92/09?@D2#3$4!56#</div></div><div class="t taf"><div class="l f16 s7 ta3" style="top:800px;left:76.6789px;" data-x="345.923" data-y="623.565">/9=:>8.<2?#3$4)56#</div></div><div class="t tb0"><div class="l f16 s7 ta3" style="top:800px;left:74.8254px;" data-x="343.882" data-y="630.159">/9=:>8.7-(#3%4&56#</div></div><div class="t tb1"><div class="l f16 s7 ta3" style="top:800px;left:74.5402px;" data-x="343.57" data-y="636.752">/9=:>8.?;<$#3(4,56#</div></div><div class="t tb2"><div class="l f16 s7 ta3" style="top:800px;left:65.3078px;" data-x="333.415" data-y="643.346">-<>2.B897<>.>8H2#3$4$56#</div></div><div class="t tb3"><div class="l f16 s7 ta3" style="top:800px;left:63.9992px;" data-x="331.975" data-y="649.94">-<>2.B897<>.5:<91#3$4!56#</div></div><div class="t tb4"><div class="l f16 s7 ta3" style="top:800px;left:74.2257px;" data-x="343.224" data-y="656.533">7<>;./89-@/#3'4,56#</div></div><div class="t tb5"><div class="l f16 s7 ta3" style="top:800px;left:63.9191px;" data-x="331.887" data-y="663.127">7<>;.:<9I<F.?07?#3(4,56#</div></div><div class="t tb6"><div class="l f16 s7 ta3" style="top:800px;left:61.1847px;" data-x="328.879" data-y="669.721">7<>;.?:2/>9<F.A897#3*4$56#</div></div><div class="t tb7"><div class="l f16 s7 ta3" style="top:800px;left:75.4953px;" data-x="344.621" data-y="676.314">92J25:.-A<#3'4%56#</div></div><div class="t tb8"><div class="l f16 s7 ta3" style="top:800px;left:71.7765px;" data-x="340.53" data-y="682.908">?>9@AJ.1<?2)'#3%4(56#</div></div><div class="t tb9"><div class="l f16 s7 ta3" style="top:800px;left:75.6535px;" data-x="344.795" data-y="689.502">?>9@AJ.B<?><#3$4(56#</div></div><div class="t tba"><div class="l f16 s7 ta3" style="top:800px;left:69.4152px;" data-x="337.933" data-y="696.095">?>9@AJ.><J/F80-#3$4$56#</div></div><div class="t tbb"><div class="l f16 s7 ta3" style="top:800px;left:62.7394px;" data-x="330.589" data-y="702.689">?>9@AJ.0A:</C./8-2#3$4%56#</div></div><div class="t tbc"><div class="l f16 s7 ta3" style="top:800px;left:60.884px;" data-x="328.515" data-y="709.282">?>9@AJ.D<F@-<>2.@A:0>#3$4,56#</div></div><div class="t t95"></div><div class="t tbd"><div class="l f16 s7 t97" style="top:802px;left:0px;" data-x="411.5" data-y="515.326">KA>29:92>#</div></div><div class="t t95"></div><div class="t tbe"><div class="l f16 s7 t97" style="top:802px;left:0px;" data-x="459.26" data-y="515.326">L<ID2#</div></div><div class="t t95"></div><div class="t tbf"></div><div class="t t0"><div class="l f1 s4 t0" style="top:307.269px;left:317.014px;" data-x="317.014" data-y="484.731">Figure<span class="w1"> </span>11.<span class="w0"> </span>Fraction<span class="w0"> </span>of<span class="w1"> </span>dynamic<span class="w1"> </span>bytecodes<span class="w0"> </span>executed<span class="w1"> </span>by<span class="w1"> </span>inter-</div><div class="l f1 s4 t0" style="top:317.232px;left:317.014px;" data-x="317.014" data-y="474.768">preter<span class="w2"> </span>and<span class="w1"> </span>on<span class="w1"> </span>native<span class="w2"> </span>traces.</div><div class="l f2 s4 t0" style="top:317.232px;left:424.555px;" data-x="424.555" data-y="474.768">The<span class="w2"> </span>speedup<span class="w1"> </span>vs.<span class="w1"> </span>interpreter<span class="w2"> </span>is<span class="w1"> </span>shown</div><div class="l f2 s4 t0" style="top:327.194px;left:317.014px;" data-x="317.014" data-y="464.806">in<span class="w1"> </span>parentheses<span class="w0"> </span>next<span class="w1"> </span>to<span class="w0"> </span>each<span class="w1"> </span>test.<span class="w0"> </span>The<span class="w0"> </span>fraction<span class="w1"> </span>of<span class="w0"> </span>bytecodes<span class="w1"> </span>exe-</div><div class="l f2 s4 t0" style="top:337.157px;left:317.014px;" data-x="317.014" data-y="454.843">cuted<span class="w0"> </span>while<span class="w1"> </span>recording<span class="w0"> </span>is<span class="w0"> </span>too<span class="w1"> </span>small<span class="w0"> </span>to<span class="w0"> </span>see<span class="w0"> </span>in<span class="w1"> </span>this<span class="w0"> </span>figure,<span class="w0"> </span>except</div><div class="l f2 s4 t0" style="top:347.12px;left:317.014px;" data-x="317.014" data-y="444.88">for</div><div class="l f7 s4 t0" style="top:347.12px;left:329.996px;" data-x="329.996" data-y="444.88">crypto-md5</div><div class="l f2 s4 t0" style="top:347.12px;left:377.069px;" data-x="377.069" data-y="444.88">,<span class="w1"> </span>where<span class="w2"> </span>fully<span class="w1"> </span>3%<span class="w1"> </span>of<span class="w1"> </span>bytecodes<span class="w1"> </span>are<span class="w1"> </span>executed<span class="w2"> </span>while</div><div class="l f2 s4 t0" style="top:357.082px;left:317.014px;" data-x="317.014" data-y="434.918">recording.<span class="w1"> </span>In<span class="w1"> </span>most<span class="w0"> </span>of<span class="w1"> </span>the<span class="w1"> </span>tests,<span class="w0"> </span>almost<span class="w1"> </span>all<span class="w1"> </span>the<span class="w1"> </span>bytecodes<span class="w0"> </span>are<span class="w1"> </span>exe-</div><div class="l f2 s4 t0" style="top:367.045px;left:317.014px;" data-x="317.014" data-y="424.955">cuted<span class="w1"> </span>by<span class="w1"> </span>compiled<span class="w1"> </span>traces.<span class="w1"> </span>Three<span class="w1"> </span>of<span class="w1"> </span>the<span class="w1"> </span>benchmarks<span class="w1"> </span>are<span class="w1"> </span>not<span class="w1"> </span>traced</div><div class="l f2 s4 t0" style="top:377.008px;left:317.014px;" data-x="317.014" data-y="414.992">at<span class="w2"> </span>all<span class="w1"> </span>and<span class="w1"> </span>run<span class="w2"> </span>in<span class="w1"> </span>the<span class="w1"> </span>interpreter.</div><div class="l f2 s4 t0" style="top:406.503px;left:317.014px;" data-x="317.014" data-y="385.497">loops<span class="w1"> </span>and<span class="w2"> </span>heavily<span class="w1"> </span>branching<span class="w1"> </span>code,<span class="w2"> </span>and<span class="w1"> </span>a<span class="w1"> </span>specialized<span class="w1"> </span>fuzz<span class="w2"> </span>tester<span class="w1"> </span>in-</div><div class="l f2 s4 t0" style="top:416.465px;left:317.014px;" data-x="317.014" data-y="375.535">deed<span class="w2"> </span>revealed<span class="w2"> </span>several<span class="w2"> </span>regressions<span class="w2"> </span>which<span class="w2"> </span>we<span class="w1"> </span>subsequently<span class="w2"> </span>corrected.</div><div class="l f1 s2 t0" style="top:440.618px;left:317.014px;" data-x="317.014" data-y="351.382">7.<span class="w3"> </span>Evaluation</div><div class="l f2 s4 t0" style="top:454.565px;left:317.014px;" data-x="317.014" data-y="337.435">We<span class="w1"> </span>evaluated<span class="w0"> </span>our<span class="w1"> </span>JavaScript<span class="w0"> </span>tracing<span class="w1"> </span>implementation<span class="w0"> </span>using<span class="w0"> </span>Sun-</div><div class="l f2 s4 t0" style="top:464.528px;left:317.014px;" data-x="317.014" data-y="327.472">Spider,<span class="w2"> </span>the<span class="w1"> </span>industry<span class="w1"> </span>standard<span class="w1"> </span>JavaScript<span class="w1"> </span>benchmark<span class="w1"> </span>suite.<span class="w2"> </span>SunSpi-</div><div class="l f2 s4 t0" style="top:474.491px;left:317.014px;" data-x="317.014" data-y="317.509">der<span class="w1"> </span>consists<span class="w1"> </span>of<span class="w1"> </span>26<span class="w1"> </span>short-running<span class="w1"> </span>(less<span class="w1"> </span>than<span class="w0"> </span>250ms,<span class="w2"> </span>average<span class="w1"> </span>26ms)</div><div class="l f2 s4 t0" style="top:484.453px;left:317.014px;" data-x="317.014" data-y="307.547">JavaScript<span class="w2"> </span>programs.<span class="w1"> </span>This<span class="w1"> </span>is<span class="w1"> </span>in<span class="w1"> </span>stark<span class="w1"> </span>contrast<span class="w1"> </span>to<span class="w1"> </span>benchmark<span class="w1"> </span>suites</div><div class="l f2 s4 t0" style="top:494.416px;left:317.014px;" data-x="317.014" data-y="297.584">such<span class="w1"> </span>as<span class="w1"> </span>SpecJVM98<span class="w1"> </span>(3)<span class="w1"> </span>used<span class="w0"> </span>to<span class="w2"> </span>evaluate<span class="w1"> </span>desktop<span class="w1"> </span>and<span class="w1"> </span>server<span class="w0"> </span>Jav</div><div class="l f2 s4 t0" style="top:494.416px;left:552.14px;" data-x="552.14" data-y="297.584">a</div><div class="l f2 s4 t0" style="top:504.379px;left:317.014px;" data-x="317.014" data-y="287.621">VMs.<span class="w1"> </span>Many<span class="w2"> </span>programs<span class="w1"> </span>in<span class="w1"> </span>those<span class="w2"> </span>benchmarks<span class="w1"> </span>use<span class="w1"> </span>large<span class="w1"> </span>data<span class="w2"> </span>sets<span class="w1"> </span>and</div><div class="l f2 s4 t0" style="top:514.341px;left:317.014px;" data-x="317.014" data-y="277.659">execute<span class="w2"> </span>for<span class="w2"> </span>minutes.<span class="w1"> </span>The<span class="w2"> </span>SunSpider<span class="w1"> </span>programs<span class="w2"> </span>carry<span class="w1"> </span>out<span class="w2"> </span>a<span class="w2"> </span>variety<span class="w1"> </span>of</div><div class="l f2 s4 t0" style="top:524.304px;left:317.014px;" data-x="317.014" data-y="267.696">tasks,<span class="w2"> </span>primarily<span class="w1"> </span>3d<span class="w2"> </span>rendering,<span class="w1"> </span>bit-bashing,<span class="w2"> </span>cryptographic<span class="w1"> </span>encoding,</div><div class="l f2 s4 t0" style="top:534.266px;left:317.014px;" data-x="317.014" data-y="257.733">math<span class="w2"> </span>kernels,<span class="w1"> </span>and<span class="w1"> </span>string<span class="w2"> </span>processing.</div><div class="l f2 s4 t0" style="top:544.229px;left:328.969px;" data-x="328.969" data-y="247.771">All<span class="w1"> </span>experiments<span class="w1"> </span>were<span class="w0"> </span>performed<span class="w1"> </span>on<span class="w1"> </span>a<span class="w0"> </span>MacBook<span class="w1"> </span>Pro<span class="w1"> </span>with<span class="w0"> </span>2.2</div><div class="l f2 s4 t0" style="top:554.192px;left:317.014px;" data-x="317.014" data-y="237.808">GHz<span class="w2"> </span>Core<span class="w1"> </span>2<span class="w1"> </span>processor<span class="w2"> </span>and<span class="w1"> </span>2<span class="w1"> </span>GB<span class="w2"> </span>RAM<span class="w1"> </span>running<span class="w2"> </span>MacOS<span class="w1"> </span>10.5.</div><div class="l f1 s4 t0" style="top:564.154px;left:328.969px;" data-x="328.969" data-y="227.846">Benchmark<span class="w1"> </span>results.</div><div class="l f2 s4 t0" style="top:564.154px;left:408.095px;" data-x="408.095" data-y="227.846">The<span class="w1"> </span>main<span class="w0"> </span>question<span class="w1"> </span>is<span class="w1"> </span>whether<span class="w0"> </span>programs</div><div class="l f2 s4 t0" style="top:574.117px;left:317.014px;" data-x="317.014" data-y="217.883">run<span class="w2"> </span>faster<span class="w1"> </span>with<span class="w2"> </span>tracing.<span class="w1"> </span>For<span class="w2"> </span>this,<span class="w1"> </span>we<span class="w1"> </span>ran<span class="w2"> </span>the<span class="w1"> </span>standard<span class="w2"> </span>SunSpider<span class="w1"> </span>test</div><div class="l f2 s4 t0" style="top:584.08px;left:317.014px;" data-x="317.014" data-y="207.92">driver,<span class="w1"> </span>which<span class="w1"> </span>starts<span class="w0"> </span>a<span class="w1"> </span>JavaScript<span class="w1"> </span>interpreter,<span class="w0"> </span>loads<span class="w1"> </span>and<span class="w0"> </span>runs<span class="w1"> </span>each</div><div class="l f2 s4 t0" style="top:594.042px;left:317.014px;" data-x="317.014" data-y="197.958">program<span class="w1"> </span>once<span class="w1"> </span>for<span class="w0"> </span>warmup,<span class="w1"> </span>then<span class="w1"> </span>loads<span class="w1"> </span>and<span class="w1"> </span>runs<span class="w0"> </span>each<span class="w1"> </span>program<span class="w1"> </span>10</div><div class="l f2 s4 t0" style="top:604.005px;left:317.014px;" data-x="317.014" data-y="187.995">times<span class="w1"> </span>and<span class="w2"> </span>reports<span class="w1"> </span>the<span class="w1"> </span>average<span class="w1"> </span>time<span class="w1"> </span>taken<span class="w2"> </span>by<span class="w1"> </span>each.<span class="w1"> </span>We<span class="w2"> </span>ran<span class="w1"> </span>4<span class="w1"> </span>differ-</div><div class="l f2 s4 t0" style="top:613.968px;left:317.014px;" data-x="317.014" data-y="178.032">ent<span class="w1"> </span>configurations<span class="w2"> </span>for<span class="w1"> </span>comparison:<span class="w1"> </span>(a)<span class="w1"> </span>SpiderMonkey,<span class="w2"> </span>the<span class="w1"> </span>baseline</div><div class="l f2 s4 t0" style="top:623.93px;left:317.014px;" data-x="317.014" data-y="168.07">interpreter,<span class="w2"> </span>(b)<span class="w1"> </span>TraceMonkey,<span class="w2"> </span>(d)<span class="w1"> </span>SquirrelFish<span class="w1"> </span>Extreme<span class="w2"> </span>(SFX),<span class="w1"> </span>the</div><div class="l f2 s4 t0" style="top:633.893px;left:317.014px;" data-x="317.014" data-y="158.107">call-threaded<span class="w1"> </span>JavaScript<span class="w1"> </span>interpreter<span class="w0"> </span>used<span class="w1"> </span>in<span class="w0"> </span>Apple’</div><div class="l f2 s4 t0" style="top:633.893px;left:502.959px;" data-x="502.959" data-y="158.107">s<span class="w1"> </span>WebKit,<span class="w1"> </span>and</div><div class="l f2 s4 t0" style="top:643.856px;left:317.014px;" data-x="317.014" data-y="148.144">(e)<span class="w2"> </span>V8,<span class="w1"> </span>the<span class="w1"> </span>method-compiling<span class="w2"> </span>JavaScript<span class="w1"> </span>VM<span class="w2"> </span>from<span class="w1"> </span>Google.</div><div class="l f2 s4 t0" style="top:653.818px;left:328.969px;" data-x="328.969" data-y="138.182">Figure<span class="w2"> </span>10<span class="w2"> </span>shows<span class="w2"> </span>the<span class="w1"> </span>relative<span class="w2"> </span>speedups<span class="w2"> </span>achieved<span class="w2"> </span>by<span class="w2"> </span>tracing,<span class="w1"> </span>SFX,</div><div class="l f2 s4 t0" style="top:663.781px;left:317.014px;" data-x="317.014" data-y="128.219">and<span class="w1"> </span>V8<span class="w2"> </span>against<span class="w1"> </span>the<span class="w1"> </span>baseline<span class="w2"> </span>(SpiderMonkey).<span class="w1"> </span>Tracing<span class="w1"> </span>achieves<span class="w2"> </span>the</div><div class="l f2 s4 t0" style="top:673.744px;left:317.014px;" data-x="317.014" data-y="118.256">best<span class="w2"> </span>speedups<span class="w1"> </span>in<span class="w1"> </span>integer-heavy<span class="w2"> </span>benchmarks,<span class="w1"> </span>up<span class="w2"> </span>to<span class="w1"> </span>the<span class="w1"> </span>25x<span class="w2"> </span>speedup</div><div class="l f2 s4 t0" style="top:683.706px;left:317.014px;" data-x="317.014" data-y="108.294">on</div><div class="l f7 s4 t0" style="top:683.706px;left:328.222px;" data-x="328.222" data-y="108.294">bitops-bitwise-and</div><div class="l f2 s4 t0" style="top:683.706px;left:412.953px;" data-x="412.953" data-y="108.294">.</div><div class="l f2 s4 t0" style="top:693.669px;left:328.969px;" data-x="328.969" data-y="98.3312">TraceMonkey<span class="w1"> </span>is<span class="w0"> </span>the<span class="w0"> </span>fastest<span class="w1"> </span>VM<span class="w0"> </span>on<span class="w0"> </span>9<span class="w1"> </span>of<span class="w0"> </span>the<span class="w0"> </span>26<span class="w1"> </span>benchmarks</div><div class="l f2 s4 t0" style="top:703.631px;left:317.014px;" data-x="317.014" data-y="88.3686">(</div><div class="l f7 s4 t0" style="top:703.631px;left:319.999px;" data-x="319.999" data-y="88.3686">3d-morph</div><div class="l f2 s4 t0" style="top:703.631px;left:357.658px;" data-x="357.658" data-y="88.3686">,</div><div class="l f7 s4 t0" style="top:703.631px;left:365.095px;" data-x="365.095" data-y="88.3686">bitops-3bit-bits-in-byte</div><div class="l f2 s4 t0" style="top:703.631px;left:478.07px;" data-x="478.07" data-y="88.3686">,</div><div class="l f7 s4 t0" style="top:703.631px;left:485.508px;" data-x="485.508" data-y="88.3686">bitops-bitwise-</div><div class="l f7 s4 t0" style="top:713.594px;left:317.014px;" data-x="317.014" data-y="78.406">and</div><div class="l f2 s4 t0" style="top:713.594px;left:331.136px;" data-x="331.136" data-y="78.406">,</div><div class="l f7 s4 t0" style="top:713.594px;left:335.601px;" data-x="335.601" data-y="78.406">crypto-sha1</div><div class="l f2 s4 t0" style="top:713.594px;left:387.381px;" data-x="387.381" data-y="78.406">,</div><div class="l f7 s4 t0" style="top:713.594px;left:391.846px;" data-x="391.846" data-y="78.406">math-cordic</div><div class="l f2 s4 t0" style="top:713.594px;left:443.626px;" data-x="443.626" data-y="78.406">,</div><div class="l f7 s4 t0" style="top:713.594px;left:448.091px;" data-x="448.091" data-y="78.406">math-partial-sums</div><div class="l f2 s4 t0" style="top:713.594px;left:528.115px;" data-x="528.115" data-y="78.406">,</div><div class="l f7 s4 t0" style="top:713.594px;left:532.581px;" data-x="532.581" data-y="78.406">math-</div><div class="l f7 s4 t0" style="top:723.557px;left:317.014px;" data-x="317.014" data-y="68.4433">spectral-norm</div><div class="l f2 s4 t0" style="top:723.557px;left:378.208px;" data-x="378.208" data-y="68.4433">,</div><div class="l f7 s4 t0" style="top:723.557px;left:384.525px;" data-x="384.525" data-y="68.4433">string-base64</div><div class="l f2 s4 t0" style="top:723.557px;left:445.72px;" data-x="445.72" data-y="68.4433">,</div><div class="l f7 s4 t0" style="top:723.557px;left:452.036px;" data-x="452.036" data-y="68.4433">string-validate-input</div><div class="l f2 s4 t0" style="top:723.557px;left:550.89px;" data-x="550.89" data-y="68.4433">).</div></div></div><div id="page-11" class="p" style="width:612px;height:792px;"><div class="t"></div><div class="t tc0"></div><div class="t tc1"></div><div class="t tc2"></div><div class="t tc3"></div><div class="t tc4"></div><div class="t tc5"></div><div class="t tc6"></div><div class="t tc7"></div><div class="t tc8"></div><div class="t tc9"></div><div class="t tca"></div><div class="t tcb"></div><div class="t tcc"></div><div class="t tcd"></div><div class="t tce"></div><div class="t tcf"></div><div class="t td0"></div><div class="t td1"></div><div class="t td2"></div><div class="t td3"></div><div class="t td4"></div><div class="t td5"></div><div class="t td6"></div><div class="t td7"></div><div class="t td8"></div><div class="t td9"></div><div class="t tda"></div><div class="t tdb"></div><div class="t tdc"></div><div class="t tdd"></div><div class="t tde"></div><div class="t tdf"></div><div class="t te0"></div><div class="t te1"></div><div class="t te2"></div><div class="t te3"></div><div class="t te4"></div><div class="t te5"></div><div class="t te6"></div><div class="t te7"></div><div class="t te8"></div><div class="t te9"></div><div class="t tea"></div><div class="t teb"></div><div class="t tec"></div><div class="t ted"></div><div class="t tee"></div><div class="t tef"></div><div class="t tf0"></div><div class="t tf1"></div><div class="t tf2"></div><div class="t tf3"></div><div class="t tf4"></div><div class="t tf5"></div><div class="t tf6"></div><div class="t tf7"></div><div class="t tf8"></div><div class="t tf9"></div><div class="t tfa"></div><div class="t tfb"></div><div class="t tfc"></div><div class="t tfd"></div><div class="t tfe"></div><div class="t tff"></div><div class="t t100"></div><div class="t t101"></div><div class="t t102"></div><div class="t t103"></div><div class="t t104"></div><div class="t t105"></div><div class="t t106"></div><div class="t t107"></div><div class="t t108"></div><div class="t t109"></div><div class="t t10a"></div><div class="t t10b"></div><div class="t t10c"></div><div class="t t10d"></div><div class="t t10e"></div><div class="t t10f"></div><div class="t t110"></div><div class="t t111"></div><div class="t tc3"></div><div class="t t112"><div class="l f17 s7 t97" style="top:802px;left:0px;" data-x="66.5497" data-y="546.539">!"</div></div><div class="t t113"><div class="l f17 s7 t97" style="top:802px;left:0px;" data-x="66.5497" data-y="579.201">#"</div></div><div class="t t114"><div class="l f17 s7 t97" style="top:802px;left:0px;" data-x="61.6334" data-y="611.862">$!"</div></div><div class="t t115"><div class="l f17 s7 t97" style="top:802px;left:0px;" data-x="61.6334" data-y="644.524">$#"</div></div><div class="t t116"><div class="l f17 s7 t97" style="top:802px;left:0px;" data-x="61.6334" data-y="677.185">%!"</div></div><div class="t t117"><div class="l f17 s7 t97" style="top:802px;left:0px;" data-x="61.6334" data-y="709.847">%#"</div></div><div class="t tc3"></div><div class="t t118"><div class="l f17 s7 t97" style="top:802px;left:0px;" data-x="488.109" data-y="692.153">&'()*+,"</div></div><div class="t tc3"></div><div class="t t119"><div class="l f17 s7 t97" style="top:802px;left:0px;" data-x="488.109" data-y="674.666">-./"</div></div><div class="t tc3"></div><div class="t t11a"><div class="l f17 s7 t97" style="top:802px;left:0px;" data-x="488.109" data-y="657.178">01"</div></div><div class="t tc3"></div><div class="t t11b"></div><div class="t t0"><div class="l f1 s4 t0" style="top:360.682px;left:54px;" data-x="54" data-y="431.318">Figure<span class="w1"> </span>10.</div><div class="l f2 s4 t0" style="top:360.682px;left:97.7208px;" data-x="97.7208" data-y="431.318">Speedup<span class="w1"> </span>vs.<span class="w1"> </span>a<span class="w1"> </span>baseline<span class="w1"> </span>JavaScript<span class="w1"> </span>interpreter<span class="w1"> </span>(SpiderMonkey)<span class="w1"> </span>for<span class="w1"> </span>our<span class="w1"> </span>trace-based<span class="w1"> </span>JIT<span class="w1"> </span>compiler,<span class="w2"> </span>Apple’s<span class="w1"> </span>SquirrelFish<span class="w1"> </span>Extreme</div><div class="l f2 s4 t0" style="top:370.645px;left:54px;" data-x="54" data-y="421.355">inline<span class="w2"> </span>threading<span class="w2"> </span>interpreter<span class="w1"> </span>and<span class="w2"> </span>Google’s<span class="w2"> </span>V8<span class="w2"> </span>JS<span class="w1"> </span>compiler.<span class="w2"> </span>Our<span class="w2"> </span>system<span class="w2"> </span>generates<span class="w1"> </span>particularly<span class="w2"> </span>efficient<span class="w2"> </span>code<span class="w1"> </span>for<span class="w2"> </span>programs<span class="w2"> </span>that<span class="w1"> </span>benefit<span class="w2"> </span>most<span class="w2"> </span>from</div><div class="l f2 s4 t0" style="top:380.607px;left:54px;" data-x="54" data-y="411.393">type<span class="w1"> </span>specialization,<span class="w2"> </span>which<span class="w1"> </span>includes<span class="w1"> </span>SunSpider<span class="w1"> </span>Benchmark<span class="w2"> </span>programs<span class="w1"> </span>that<span class="w1"> </span>perform<span class="w1"> </span>bit<span class="w2"> </span>manipulation.<span class="w1"> </span>We<span class="w2"> </span>type-specialize<span class="w1"> </span>the<span class="w1"> </span>code<span class="w1"> </span>in<span class="w2"> </span>question</div><div class="l f2 s4 t0" style="top:390.57px;left:54px;" data-x="54" data-y="401.43">to<span class="w1"> </span>use<span class="w1"> </span>integer<span class="w1"> </span>arithmetic,<span class="w1"> </span>which<span class="w1"> </span>substantially<span class="w1"> </span>improves<span class="w1"> </span>performance.<span class="w1"> </span>For<span class="w1"> </span>one<span class="w1"> </span>of<span class="w1"> </span>the<span class="w1"> </span>benchmark<span class="w1"> </span>programs<span class="w1"> </span>we<span class="w1"> </span>execute<span class="w1"> </span>25<span class="w1"> </span>times<span class="w1"> </span>faster<span class="w1"> </span>than</div><div class="l f2 s4 t0" style="top:400.533px;left:54px;" data-x="54" data-y="391.467">the<span class="w2"> </span>SpiderMonkey<span class="w1"> </span>interpreter,<span class="w2"> </span>and<span class="w1"> </span>almost<span class="w1"> </span>5<span class="w2"> </span>times<span class="w1"> </span>faster<span class="w2"> </span>than<span class="w1"> </span>V8<span class="w1"> </span>and<span class="w2"> </span>SFX.<span class="w1"> </span>For<span class="w2"> </span>a<span class="w1"> </span>large<span class="w1"> </span>number<span class="w2"> </span>of<span class="w1"> </span>benchmarks<span class="w2"> </span>all<span class="w1"> </span>three<span class="w1"> </span>VMs<span class="w2"> </span>produce<span class="w1"> </span>similar</div><div class="l f2 s4 t0" style="top:410.495px;left:54px;" data-x="54" data-y="381.505">results.<span class="w2"> </span>We<span class="w2"> </span>perform<span class="w1"> </span>worst<span class="w1"> </span>on<span class="w2"> </span>benchmark<span class="w1"> </span>programs<span class="w1"> </span>that<span class="w2"> </span>we<span class="w1"> </span>do<span class="w2"> </span>not<span class="w1"> </span>trace<span class="w1"> </span>and<span class="w2"> </span>instead<span class="w1"> </span>fall<span class="w1"> </span>back<span class="w2"> </span>onto<span class="w1"> </span>the<span class="w2"> </span>interpreter.<span class="w1"> </span>This<span class="w2"> </span>includes<span class="w1"> </span>the<span class="w1"> </span>recursive</div><div class="l f2 s4 t0" style="top:420.458px;left:54px;" data-x="54" data-y="371.542">benchmarks</div><div class="l f7 s4 t0" style="top:420.458px;left:99.5667px;" data-x="99.5667" data-y="371.542">access-binary-trees</div><div class="l f2 s4 t0" style="top:420.458px;left:191.247px;" data-x="191.247" data-y="371.542">and</div><div class="l f7 s4 t0" style="top:420.458px;left:206.436px;" data-x="206.436" data-y="371.542">control-flow-recursive</div><div class="l f2 s4 t0" style="top:420.458px;left:309.996px;" data-x="309.996" data-y="371.542">,<span class="w2"> </span>for<span class="w1"> </span>which<span class="w1"> </span>we<span class="w2"> </span>currently<span class="w1"> </span>don’t<span class="w2"> </span>generate<span class="w1"> </span>any<span class="w1"> </span>native<span class="w2"> </span>code.</div><div class="l f2 s4 t0" style="top:450.346px;left:54px;" data-x="54" data-y="341.654">In<span class="w1"> </span>particular,<span class="w2"> </span>the</div><div class="l f7 s4 t0" style="top:450.346px;left:116.139px;" data-x="116.139" data-y="341.654">bitops</div><div class="l f2 s4 t0" style="top:450.346px;left:146.873px;" data-x="146.873" data-y="341.654">benchmarks<span class="w1"> </span>are<span class="w2"> </span>short<span class="w1"> </span>programs<span class="w1"> </span>that<span class="w1"> </span>per-</div><div class="l f2 s4 t0" style="top:460.308px;left:54px;" data-x="54" data-y="331.692">form<span class="w1"> </span>many<span class="w1"> </span>bitwise<span class="w1"> </span>operations,<span class="w1"> </span>so<span class="w2"> </span>TraceMonkey<span class="w1"> </span>can<span class="w1"> </span>cover<span class="w1"> </span>the<span class="w1"> </span>en-</div><div class="l f2 s4 t0" style="top:470.271px;left:54px;" data-x="54" data-y="321.729">tire<span class="w2"> </span>program<span class="w1"> </span>with<span class="w1"> </span>1<span class="w2"> </span>or<span class="w1"> </span>2<span class="w2"> </span>traces<span class="w1"> </span>that<span class="w1"> </span>operate<span class="w2"> </span>on<span class="w1"> </span>integers.<span class="w2"> </span>TraceMon-</div><div class="l f2 s4 t0" style="top:480.234px;left:54px;" data-x="54" data-y="311.766">key<span class="w2"> </span>runs<span class="w1"> </span>all<span class="w1"> </span>the<span class="w1"> </span>other<span class="w2"> </span>programs<span class="w1"> </span>in<span class="w1"> </span>this<span class="w2"> </span>set<span class="w1"> </span>almost<span class="w1"> </span>entirely<span class="w1"> </span>as<span class="w2"> </span>native</div><div class="l f2 s4 t0" style="top:490.196px;left:54px;" data-x="54" data-y="301.804">code.</div><div class="l f7 s4 t0" style="top:500.159px;left:65.9552px;" data-x="65.9552" data-y="291.841">regexp-dna</div><div class="l f2 s4 t0" style="top:500.159px;left:117.726px;" data-x="117.726" data-y="291.841">is<span class="w0"> </span>dominated<span class="w0"> </span>by<span class="w0"> </span>regular<span class="w0"> </span>expression<span class="w0"> </span>matching,</div><div class="l f2 s4 t0" style="top:510.122px;left:54px;" data-x="54" data-y="281.878">which<span class="w2"> </span>is<span class="w1"> </span>implemented<span class="w1"> </span>in<span class="w2"> </span>all<span class="w1"> </span>3<span class="w1"> </span>VMs<span class="w2"> </span>by<span class="w1"> </span>a<span class="w2"> </span>special<span class="w1"> </span>regular<span class="w1"> </span>expression</div><div class="l f2 s4 t0" style="top:520.084px;left:54px;" data-x="54" data-y="271.916">compiler.<span class="w2"> </span>Thus,<span class="w1"> </span>performance<span class="w0"> </span>on<span class="w2"> </span>this<span class="w1"> </span>benchmark<span class="w1"> </span>has<span class="w1"> </span>little<span class="w0"> </span>relation</div><div class="l f2 s4 t0" style="top:530.047px;left:54px;" data-x="54" data-y="261.953">to<span class="w2"> </span>the<span class="w1"> </span>trace<span class="w1"> </span>compilation<span class="w2"> </span>approach<span class="w1"> </span>discussed<span class="w1"> </span>in<span class="w2"> </span>this<span class="w1"> </span>paper.</div><div class="l f2 s4 t0" style="top:540.01px;left:65.9552px;" data-x="65.9552" data-y="251.99">TraceMonkey’</div><div class="l f2 s4 t0" style="top:540.01px;left:118.202px;" data-x="118.202" data-y="251.99">s<span class="w1"> </span>smaller<span class="w1"> </span>speedups<span class="w2"> </span>on<span class="w1"> </span>the<span class="w1"> </span>other<span class="w1"> </span>benchmarks<span class="w1"> </span>can</div><div class="l f2 s4 t0" style="top:549.972px;left:54px;" data-x="54" data-y="242.028">be<span class="w2"> </span>attributed<span class="w1"> </span>to<span class="w1"> </span>a<span class="w2"> </span>few<span class="w1"> </span>specific<span class="w2"> </span>causes:</div><div class="l f3 s3 t0" style="top:575.211px;left:59.2303px;" data-x="59.2303" data-y="216.789">•</div><div class="l f2 s4 t0" style="top:576.11px;left:66.9514px;" data-x="66.9514" data-y="215.89">The<span class="w0"> </span>implementation<span class="w0"> </span>does<span class="w4"> </span>not<span class="w0"> </span>currently<span class="w4"> </span>trace<span class="w0"> </span>recursion,<span class="w4"> </span>so</div><div class="l f2 s4 t0" style="top:586.072px;left:66.9514px;" data-x="66.9514" data-y="205.928">TraceMonkey<span class="w0"> </span>achieves<span class="w0"> </span>a<span class="w0"> </span>small<span class="w0"> </span>speedup<span class="w0"> </span>or<span class="w0"> </span>no<span class="w4"> </span>speedup<span class="w0"> </span>on</div><div class="l f2 s4 t0" style="top:596.035px;left:66.9514px;" data-x="66.9514" data-y="195.965">benchmarks<span class="w0"> </span>that<span class="w4"> </span>use<span class="w4"> </span>recursion<span class="w4"> </span>extensively:</div><div class="l f7 s4 t0" style="top:596.035px;left:238.471px;" data-x="238.471" data-y="195.965">3d-cube</div><div class="l f2 s4 t0" style="top:596.035px;left:271.422px;" data-x="271.422" data-y="195.965">,</div><div class="l f7 s4 t0" style="top:596.035px;left:278.981px;" data-x="278.981" data-y="195.965">3d-</div><div class="l f7 s4 t0" style="top:605.998px;left:66.9514px;" data-x="66.9514" data-y="186.003">raytrace</div><div class="l f2 s4 t0" style="top:605.998px;left:104.61px;" data-x="104.61" data-y="186.003">,</div><div class="l f7 s4 t0" style="top:605.998px;left:109.776px;" data-x="109.776" data-y="186.003">access-binary-trees</div><div class="l f2 s4 t0" style="top:605.998px;left:199.214px;" data-x="199.214" data-y="186.003">,</div><div class="l f7 s4 t0" style="top:605.998px;left:204.38px;" data-x="204.38" data-y="186.003">string-tagcloud</div><div class="l f2 s4 t0" style="top:605.998px;left:274.99px;" data-x="274.99" data-y="186.003">,<span class="w1"> </span>and</div><div class="l f7 s4 t0" style="top:615.96px;left:66.9514px;" data-x="66.9514" data-y="176.04">controlflow-recursive</div><div class="l f2 s4 t0" style="top:615.96px;left:165.805px;" data-x="165.805" data-y="176.04">.</div><div class="l f3 s3 t0" style="top:629.01px;left:59.2303px;" data-x="59.2303" data-y="162.99">•</div><div class="l f2 s4 t0" style="top:629.908px;left:66.9514px;" data-x="66.9514" data-y="162.092">The<span class="w1"> </span>implementation<span class="w0"> </span>does<span class="w1"> </span>not<span class="w0"> </span>currently<span class="w1"> </span>trace</div><div class="l f7 s4 t0" style="top:629.908px;left:235.516px;" data-x="235.516" data-y="162.092">eval</div><div class="l f2 s4 t0" style="top:629.908px;left:257.787px;" data-x="257.787" data-y="162.092">and<span class="w1"> </span>some</div><div class="l f2 s4 t0" style="top:639.87px;left:66.9514px;" data-x="66.9514" data-y="152.13">other<span class="w0"> </span>functions<span class="w0"> </span>implemented<span class="w0"> </span>in<span class="w0"> </span>C.<span class="w1"> </span>Because</div><div class="l f7 s4 t0" style="top:639.87px;left:236.616px;" data-x="236.616" data-y="152.13">date-format-</div><div class="l f7 s4 t0" style="top:649.833px;left:66.9514px;" data-x="66.9514" data-y="142.167">tofte</div><div class="l f2 s4 t0" style="top:649.833px;left:93.9841px;" data-x="93.9841" data-y="142.167">and</div><div class="l f7 s4 t0" style="top:649.833px;left:110.428px;" data-x="110.428" data-y="142.167">date-format-xparb</div><div class="l f2 s4 t0" style="top:649.833px;left:193.948px;" data-x="193.948" data-y="142.167">use<span class="w1"> </span>such<span class="w0"> </span>functions<span class="w1"> </span>in<span class="w0"> </span>their</div><div class="l f2 s4 t0" style="top:659.796px;left:66.9514px;" data-x="66.9514" data-y="132.204">main<span class="w2"> </span>loops,<span class="w1"> </span>we<span class="w1"> </span>do<span class="w2"> </span>not<span class="w1"> </span>trace<span class="w1"> </span>them.</div><div class="l f3 s3 t0" style="top:672.845px;left:59.2303px;" data-x="59.2303" data-y="119.155">•</div><div class="l f2 s4 t0" style="top:673.744px;left:66.9514px;" data-x="66.9514" data-y="118.256">The<span class="w1"> </span>implementation<span class="w0"> </span>does<span class="w1"> </span>not<span class="w0"> </span>currently<span class="w1"> </span>trace<span class="w0"> </span>through<span class="w1"> </span>regular</div><div class="l f2 s4 t0" style="top:683.706px;left:66.9514px;" data-x="66.9514" data-y="108.294">expression</div><div class="l f7 s4 t0" style="top:683.706px;left:108.704px;" data-x="108.704" data-y="108.294">replace</div><div class="l f2 s4 t0" style="top:683.706px;left:145.194px;" data-x="145.194" data-y="108.294">operations.<span class="w1"> </span>The<span class="w0"> </span>replace<span class="w1"> </span>function<span class="w0"> </span>can<span class="w1"> </span>be</div><div class="l f2 s4 t0" style="top:693.669px;left:66.9514px;" data-x="66.9514" data-y="98.3312">passed<span class="w1"> </span>a<span class="w2"> </span>function<span class="w1"> </span>object<span class="w1"> </span>used<span class="w1"> </span>to<span class="w2"> </span>compute<span class="w1"> </span>the<span class="w1"> </span>replacement<span class="w1"> </span>text.</div><div class="l f2 s4 t0" style="top:703.631px;left:66.9514px;" data-x="66.9514" data-y="88.3686">Our<span class="w1"> </span>implementation<span class="w0"> </span>currently<span class="w1"> </span>does<span class="w1"> </span>not<span class="w0"> </span>trace<span class="w1"> </span>functions<span class="w1"> </span>called</div><div class="l f2 s4 t0" style="top:713.594px;left:66.9514px;" data-x="66.9514" data-y="78.406">as<span class="w2"> </span>replace<span class="w1"> </span>functions.<span class="w2"> </span>The<span class="w1"> </span>run<span class="w1"> </span>time<span class="w2"> </span>of</div><div class="l f7 s4 t0" style="top:713.594px;left:200.246px;" data-x="200.246" data-y="78.406">string-unpack-code</div><div class="l f2 s4 t0" style="top:713.594px;left:287.123px;" data-x="287.123" data-y="78.406">is</div><div class="l f2 s4 t0" style="top:723.557px;left:66.9514px;" data-x="66.9514" data-y="68.4433">dominated<span class="w2"> </span>by<span class="w1"> </span>such<span class="w1"> </span>a</div><div class="l f7 s4 t0" style="top:723.557px;left:143.156px;" data-x="143.156" data-y="68.4433">replace</div><div class="l f2 s4 t0" style="top:723.557px;left:178.349px;" data-x="178.349" data-y="68.4433">call.</div><div class="l f3 s3 t0" style="top:449.448px;left:322.244px;" data-x="322.244" data-y="342.552">•</div><div class="l f2 s4 t0" style="top:450.346px;left:329.965px;" data-x="329.965" data-y="341.654">Two<span class="w1"> </span>programs<span class="w1"> </span>trace<span class="w0"> </span>well,<span class="w0"> </span>but<span class="w1"> </span>have<span class="w1"> </span>a<span class="w0"> </span>long<span class="w1"> </span>compilation<span class="w0"> </span>time.</div><div class="l f7 s4 t0" style="top:460.309px;left:329.965px;" data-x="329.965" data-y="331.692">access-nbody</div><div class="l f2 s4 t0" style="top:460.309px;left:388.156px;" data-x="388.156" data-y="331.692">forms<span class="w2"> </span>a<span class="w2"> </span>large<span class="w2"> </span>number<span class="w1"> </span>of<span class="w2"> </span>traces<span class="w2"> </span>(81).</div><div class="l f7 s4 t0" style="top:460.309px;left:515.693px;" data-x="515.693" data-y="331.692">crypto-md5</div><div class="l f2 s4 t0" style="top:470.271px;left:329.965px;" data-x="329.965" data-y="321.729">forms<span class="w1"> </span>one<span class="w1"> </span>very<span class="w2"> </span>long<span class="w1"> </span>trace.<span class="w1"> </span>We<span class="w1"> </span>expect<span class="w1"> </span>to<span class="w1"> </span>improve<span class="w2"> </span>performance</div><div class="l f2 s4 t0" style="top:480.234px;left:329.965px;" data-x="329.965" data-y="311.766">on<span class="w1"> </span>this<span class="w2"> </span>programs<span class="w1"> </span>by<span class="w1"> </span>improving<span class="w1"> </span>the<span class="w2"> </span>compilation<span class="w1"> </span>speed<span class="w1"> </span>of<span class="w1"> </span>nano-</div><div class="l f2 s4 t0" style="top:490.196px;left:329.965px;" data-x="329.965" data-y="301.804">jit.</div><div class="l f3 s3 t0" style="top:503.246px;left:322.244px;" data-x="322.244" data-y="288.754">•</div><div class="l f2 s4 t0" style="top:504.144px;left:329.965px;" data-x="329.965" data-y="287.856">Some<span class="w0"> </span>programs<span class="w1"> </span>trace<span class="w0"> </span>very<span class="w0"> </span>well,<span class="w0"> </span>and<span class="w1"> </span>speed<span class="w0"> </span>up<span class="w0"> </span>compared<span class="w0"> </span>to</div><div class="l f2 s4 t0" style="top:514.107px;left:329.965px;" data-x="329.965" data-y="277.893">the<span class="w1"> </span>interpreter,<span class="w1"> </span>but<span class="w1"> </span>are<span class="w0"> </span>not<span class="w1"> </span>as<span class="w1"> </span>fast<span class="w0"> </span>as<span class="w1"> </span>SFX<span class="w1"> </span>and/or<span class="w1"> </span>V8,<span class="w0"> </span>namely</div><div class="l f7 s4 t0" style="top:524.069px;left:329.965px;" data-x="329.965" data-y="267.931">bitops-bits-in-byte</div><div class="l f2 s4 t0" style="top:524.069px;left:419.404px;" data-x="419.404" data-y="267.931">,</div><div class="l f7 s4 t0" style="top:524.069px;left:428.919px;" data-x="428.919" data-y="267.931">bitops-nsieve-bits</div><div class="l f2 s4 t0" style="top:524.069px;left:513.65px;" data-x="513.65" data-y="267.931">,</div><div class="l f7 s4 t0" style="top:524.069px;left:523.166px;" data-x="523.166" data-y="267.931">access-</div><div class="l f7 s4 t0" style="top:534.032px;left:329.965px;" data-x="329.965" data-y="257.968">fannkuch</div><div class="l f2 s4 t0" style="top:534.032px;left:367.623px;" data-x="367.623" data-y="257.968">,</div><div class="l f7 s4 t0" style="top:534.032px;left:372.736px;" data-x="372.736" data-y="257.968">access-nsieve</div><div class="l f2 s4 t0" style="top:534.032px;left:433.931px;" data-x="433.931" data-y="257.968">,<span class="w1"> </span>and</div><div class="l f7 s4 t0" style="top:534.032px;left:454.863px;" data-x="454.863" data-y="257.968">crypto-aes</div><div class="l f2 s4 t0" style="top:534.032px;left:501.936px;" data-x="501.936" data-y="257.968">.<span class="w1"> </span>The<span class="w1"> </span>reason<span class="w1"> </span>is</div><div class="l f2 s4 t0" style="top:543.995px;left:329.965px;" data-x="329.965" data-y="248.005">not<span class="w0"> </span>clear,<span class="w1"> </span>but<span class="w0"> </span>all<span class="w0"> </span>of<span class="w1"> </span>these<span class="w0"> </span>programs<span class="w0"> </span>have<span class="w1"> </span>nested<span class="w0"> </span>loops<span class="w0"> </span>with</div><div class="l f2 s4 t0" style="top:553.957px;left:329.965px;" data-x="329.965" data-y="238.043">small<span class="w2"> </span>bodies,<span class="w1"> </span>so<span class="w1"> </span>we<span class="w1"> </span>suspect<span class="w2"> </span>that<span class="w1"> </span>the<span class="w1"> </span>implementation<span class="w2"> </span>has<span class="w1"> </span>a<span class="w1"> </span>rela-</div><div class="l f2 s4 t0" style="top:563.92px;left:329.965px;" data-x="329.965" data-y="228.08">tively<span class="w2"> </span>high<span class="w1"> </span>cost<span class="w2"> </span>for<span class="w1"> </span>calling<span class="w2"> </span>nested<span class="w1"> </span>traces.</div><div class="l f7 s4 t0" style="top:563.92px;left:476.548px;" data-x="476.548" data-y="228.08">string-fasta</div><div class="l f2 s4 t0" style="top:563.92px;left:535.208px;" data-x="535.208" data-y="228.08">traces</div><div class="l f2 s4 t0" style="top:573.883px;left:329.965px;" data-x="329.965" data-y="218.117">well,<span class="w2"> </span>but<span class="w1"> </span>its<span class="w2"> </span>run<span class="w1"> </span>time<span class="w2"> </span>is<span class="w2"> </span>dominated<span class="w1"> </span>by<span class="w2"> </span>string<span class="w1"> </span>processing<span class="w2"> </span>builtins,</div><div class="l f2 s4 t0" style="top:583.845px;left:329.965px;" data-x="329.965" data-y="208.155">which<span class="w2"> </span>are<span class="w1"> </span>unaffected<span class="w1"> </span>by<span class="w2"> </span>tracing<span class="w1"> </span>and<span class="w1"> </span>seem<span class="w2"> </span>to<span class="w1"> </span>be<span class="w1"> </span>less<span class="w2"> </span>efficient<span class="w1"> </span>in</div><div class="l f2 s4 t0" style="top:593.808px;left:329.965px;" data-x="329.965" data-y="198.192">SpiderMonkey<span class="w2"> </span>than<span class="w1"> </span>in<span class="w2"> </span>the<span class="w1"> </span>two<span class="w1"> </span>other<span class="w2"> </span>VMs.</div><div class="l f1 s4 t0" style="top:613.968px;left:328.969px;" data-x="328.969" data-y="178.032">Detailed<span class="w2"> </span>performance<span class="w1"> </span>metrics.</div><div class="l f2 s4 t0" style="top:613.968px;left:446.769px;" data-x="446.769" data-y="178.032">In<span class="w2"> </span>Figure<span class="w1"> </span>11<span class="w2"> </span>we<span class="w1"> </span>show<span class="w2"> </span>the<span class="w1"> </span>frac-</div><div class="l f2 s4 t0" style="top:623.93px;left:317.014px;" data-x="317.014" data-y="168.07">tion<span class="w2"> </span>of<span class="w1"> </span>instructions<span class="w1"> </span>interpreted<span class="w2"> </span>and<span class="w1"> </span>the<span class="w1"> </span>fraction<span class="w1"> </span>of<span class="w2"> </span>instructions<span class="w1"> </span>exe-</div><div class="l f2 s4 t0" style="top:633.893px;left:317.014px;" data-x="317.014" data-y="158.107">cuted<span class="w2"> </span>as<span class="w1"> </span>native<span class="w2"> </span>code.<span class="w2"> </span>This<span class="w1"> </span>figure<span class="w2"> </span>shows<span class="w1"> </span>that<span class="w2"> </span>for<span class="w1"> </span>many<span class="w2"> </span>programs,<span class="w2"> </span>we</div><div class="l f2 s4 t0" style="top:643.856px;left:317.014px;" data-x="317.014" data-y="148.144">are<span class="w2"> </span>able<span class="w1"> </span>to<span class="w1"> </span>execute<span class="w2"> </span>almost<span class="w1"> </span>all<span class="w2"> </span>the<span class="w1"> </span>code<span class="w1"> </span>natively</div><div class="l f2 s4 t0" style="top:643.856px;left:483.636px;" data-x="483.636" data-y="148.144">.</div><div class="l f2 s4 t0" style="top:653.818px;left:328.969px;" data-x="328.969" data-y="138.182">Figure<span class="w1"> </span>12<span class="w2"> </span>breaks<span class="w1"> </span>down<span class="w1"> </span>the<span class="w1"> </span>total<span class="w1"> </span>execution<span class="w2"> </span>time<span class="w1"> </span>into<span class="w1"> </span>four<span class="w1"> </span>activ-</div><div class="l f2 s4 t0" style="top:663.781px;left:317.014px;" data-x="317.014" data-y="128.219">ities:<span class="w1"> </span>interpreting<span class="w1"> </span>bytecodes<span class="w1"> </span>while<span class="w1"> </span>not<span class="w0"> </span>recording,<span class="w2"> </span>recording<span class="w0"> </span>traces</div><div class="l f2 s4 t0" style="top:673.743px;left:317.014px;" data-x="317.014" data-y="118.257">(including<span class="w1"> </span>time<span class="w0"> </span>taken<span class="w1"> </span>to<span class="w0"> </span>interpret<span class="w1"> </span>the<span class="w0"> </span>recorded<span class="w1"> </span>trace),<span class="w0"> </span>compiling</div><div class="l f2 s4 t0" style="top:683.706px;left:317.014px;" data-x="317.014" data-y="108.294">traces<span class="w2"> </span>to<span class="w1"> </span>native<span class="w2"> </span>code,<span class="w1"> </span>and<span class="w1"> </span>executing<span class="w2"> </span>native<span class="w2"> </span>code<span class="w1"> </span>traces.</div><div class="l f2 s4 t0" style="top:693.669px;left:328.969px;" data-x="328.969" data-y="98.3313">These<span class="w1"> </span>detailed<span class="w0"> </span>metrics<span class="w1"> </span>allow<span class="w0"> </span>us<span class="w1"> </span>to<span class="w0"> </span>estimate<span class="w1"> </span>parameters<span class="w0"> </span>for<span class="w1"> </span>a</div><div class="l f2 s4 t0" style="top:703.631px;left:317.014px;" data-x="317.014" data-y="88.3686">simple<span class="w1"> </span>model<span class="w1"> </span>of<span class="w0"> </span>tracing<span class="w1"> </span>performance.<span class="w1"> </span>These<span class="w0"> </span>estimates<span class="w1"> </span>should<span class="w1"> </span>be</div><div class="l f2 s4 t0" style="top:713.594px;left:317.014px;" data-x="317.014" data-y="78.406">considered<span class="w1"> </span>very<span class="w0"> </span>rough,<span class="w1"> </span>as<span class="w0"> </span>the<span class="w1"> </span>values<span class="w1"> </span>observed<span class="w0"> </span>on<span class="w1"> </span>the<span class="w0"> </span>individual</div><div class="l f2 s4 t0" style="top:723.557px;left:317.014px;" data-x="317.014" data-y="68.4434">benchmarks<span class="w0"> </span>hav</div><div class="l f2 s4 t0" style="top:723.557px;left:376.766px;" data-x="376.766" data-y="68.4434">e<span class="w0"> </span>large<span class="w1"> </span>standard<span class="w0"> </span>deviations<span class="w1"> </span>(on<span class="w0"> </span>the<span class="w1"> </span>order<span class="w0"> </span>of<span class="w0"> </span>the</div></div></div><div id="page-12" class="p" style="width:612px;height:792px;"><div class="t"><div class="l f2 s4 t0" style="top:78.9738px;left:166.563px;" data-x="166.563" data-y="713.026">Loops<span class="w3"> </span>Trees<span class="w11"> </span>Traces<span class="w3"> </span>Aborts<span class="w11"> </span>Flushes<span class="w3"> </span>Trees/Loop<span class="w11"> </span>Traces/Tree<span class="w3"> </span>Traces/Loop<span class="w11"> </span>Speedup</div></div><div class="t t11c"></div><div class="t t0"><div class="l f2 s4 t0" style="top:89.335px;left:71.4192px;" data-x="71.4192" data-y="702.665">3d-cube<span class="w12"> </span>25<span class="w6"> </span>27<span class="w13"> </span>29<span class="w14"> </span>3<span class="w15"> </span>0<span class="w16"> </span>1.1<span class="wc"> </span>1.1<span class="w17"> </span>1.2<span class="w6"> </span>2.20x</div><div class="l f2 s4 t0" style="top:99.2976px;left:71.4192px;" data-x="71.4192" data-y="692.702">3d-morph<span class="w18"> </span>5<span class="w19"> </span>8<span class="w14"> </span>8<span class="w14"> </span>2<span class="wf"> </span>0<span class="w16"> </span>1.6<span class="wc"> </span>1.0<span class="w17"> </span>1.6<span class="w6"> </span>2.86x</div><div class="l f2 s4 t0" style="top:109.26px;left:71.4192px;" data-x="71.4192" data-y="682.74">3d-raytrace<span class="w1a"> </span>10<span class="w6"> </span>25<span class="w1b"> </span>100<span class="w19"> </span>10<span class="w15"> </span>1<span class="w16"> </span>2.5<span class="wc"> </span>4.0<span class="w16"> </span>10.0<span class="w6"> </span>1.18x</div><div class="l f2 s4 t0" style="top:119.223px;left:71.4192px;" data-x="71.4192" data-y="672.777">access-binary-trees<span class="w1c"> </span>0<span class="w19"> </span>0<span class="w14"> </span>0<span class="w14"> </span>5<span class="wf"> </span>0<span class="w1d"> </span>-<span class="w1d"> </span>-<span class="w1e"> </span>-<span class="w6"> </span>0.93x</div><div class="l f2 s4 t0" style="top:129.185px;left:71.4192px;" data-x="71.4192" data-y="662.815">access-fannkuch<span class="w1f"> </span>10<span class="w6"> </span>34<span class="w13"> </span>57<span class="w19"> </span>24<span class="w15"> </span>0<span class="w16"> </span>3.4<span class="wc"> </span>1.7<span class="w17"> </span>5.7<span class="w6"> </span>2.20x</div><div class="l f2 s4 t0" style="top:139.148px;left:71.4192px;" data-x="71.4192" data-y="652.852">access-nbody<span class="w20"> </span>8<span class="w6"> </span>16<span class="w13"> </span>18<span class="w14"> </span>5<span class="w15"> </span>0<span class="w16"> </span>2.0<span class="wc"> </span>1.1<span class="w17"> </span>2.3<span class="w6"> </span>4.19x</div><div class="l f2 s4 t0" style="top:149.111px;left:71.4192px;" data-x="71.4192" data-y="642.889">access-nsieve<span class="w20"> </span>3<span class="w13"> </span>6<span class="w14"> </span>8<span class="w14"> </span>3<span class="w15"> </span>0<span class="w16"> </span>2.0<span class="wc"> </span>1.3<span class="w17"> </span>2.7<span class="w6"> </span>3.05x</div><div class="l f2 s4 t0" style="top:159.073px;left:71.4192px;" data-x="71.4192" data-y="632.927">bitops-3bit-bits-in-byte<span class="w21"> </span>2<span class="w19"> </span>2<span class="w14"> </span>2<span class="w14"> </span>0<span class="wf"> </span>0<span class="w16"> </span>1.0<span class="wc"> </span>1.0<span class="w17"> </span>1.0<span class="w22"> </span>25.47x</div><div class="l f2 s4 t0" style="top:169.036px;left:71.4192px;" data-x="71.4192" data-y="622.964">bitops-bits-in-byte<span class="w17"> </span>3<span class="w19"> </span>3<span class="w14"> </span>4<span class="w14"> </span>1<span class="w15"> </span>0<span class="w16"> </span>1.0<span class="wc"> </span>1.3<span class="w17"> </span>1.3<span class="w6"> </span>8.67x</div><div class="l f2 s4 t0" style="top:178.999px;left:71.4192px;" data-x="71.4192" data-y="613.001">bitops-bitwise-and<span class="w17"> </span>1<span class="w19"> </span>1<span class="w14"> </span>1<span class="w14"> </span>0<span class="w15"> </span>0<span class="w16"> </span>1.0<span class="w16"> </span>1.0<span class="w17"> </span>1.0<span class="w22"> </span>25.20x</div><div class="l f2 s4 t0" style="top:188.961px;left:71.4192px;" data-x="71.4192" data-y="603.039">bitops-nsieve-bits<span class="w1f"> </span>3<span class="w19"> </span>3<span class="w14"> </span>5<span class="w14"> </span>0<span class="wf"> </span>0<span class="w16"> </span>1.0<span class="wc"> </span>1.7<span class="w17"> </span>1.7<span class="w6"> </span>2.75x</div><div class="l f2 s4 t0" style="top:198.924px;left:71.4192px;" data-x="71.4192" data-y="593.076">controlflow-recursive<span class="w23"> </span>0<span class="w19"> </span>0<span class="w14"> </span>0<span class="w14"> </span>1<span class="wf"> </span>0<span class="w1d"> </span>-<span class="w1d"> </span>-<span class="w1e"> </span>-<span class="w6"> </span>0.98x</div><div class="l f2 s4 t0" style="top:208.887px;left:71.4192px;" data-x="71.4192" data-y="583.113">crypto-aes<span class="we"> </span>50<span class="w6"> </span>72<span class="w13"> </span>78<span class="w19"> </span>19<span class="w15"> </span>0<span class="w16"> </span>1.4<span class="wc"> </span>1.1<span class="w17"> </span>1.6<span class="w6"> </span>1.64x</div><div class="l f2 s4 t0" style="top:218.849px;left:71.4192px;" data-x="71.4192" data-y="573.151">crypto-md5<span class="we"> </span>4<span class="w19"> </span>4<span class="w14"> </span>5<span class="w14"> </span>0<span class="w15"> </span>0<span class="w16"> </span>1.0<span class="w16"> </span>1.3<span class="w17"> </span>1.3<span class="w6"> </span>2.30x</div><div class="l f2 s4 t0" style="top:228.812px;left:71.4192px;" data-x="71.4192" data-y="563.188">crypto-sha1<span class="we"> </span>5<span class="w19"> </span>5<span class="w13"> </span>10<span class="w14"> </span>0<span class="w15"> </span>0<span class="w16"> </span>1.0<span class="wc"> </span>2.0<span class="w17"> </span>2.0<span class="w6"> </span>5.95x</div><div class="l f2 s4 t0" style="top:238.775px;left:71.4192px;" data-x="71.4192" data-y="553.225">date-format-tofte<span class="w8"> </span>3<span class="w19"> </span>3<span class="w21"> </span>4<span class="w14"> </span>7<span class="w15"> </span>0<span class="w16"> </span>1.0<span class="wc"> </span>1.3<span class="w17"> </span>1.3<span class="w6"> </span>1.07x</div><div class="l f2 s4 t0" style="top:248.737px;left:71.4192px;" data-x="71.4192" data-y="543.263">date-format-xparb<span class="w9"> </span>3<span class="w19"> </span>3<span class="w19"> </span>11<span class="w14"> </span>3<span class="w15"> </span>0<span class="w16"> </span>1.0<span class="w16"> </span>3.7<span class="w17"> </span>3.7<span class="w6"> </span>0.98x</div><div class="l f2 s4 t0" style="top:258.7px;left:71.4192px;" data-x="71.4192" data-y="533.3">math-cordic<span class="w24"> </span>2<span class="w19"> </span>4<span class="w14"> </span>5<span class="w14"> </span>1<span class="wf"> </span>0<span class="w16"> </span>2.0<span class="wc"> </span>1.3<span class="w17"> </span>2.5<span class="w6"> </span>4.92x</div><div class="l f2 s4 t0" style="top:268.662px;left:71.4192px;" data-x="71.4192" data-y="523.338">math-partial-sums<span class="w9"> </span>2<span class="w19"> </span>4<span class="w14"> </span>4<span class="w14"> </span>1<span class="wf"> </span>0<span class="w16"> </span>2.0<span class="wc"> </span>1.0<span class="w17"> </span>2.0<span class="w6"> </span>5.90x</div><div class="l f2 s4 t0" style="top:278.625px;left:71.4192px;" data-x="71.4192" data-y="513.375">math-spectral-norm<span class="wa"> </span>15<span class="w1b"> </span>20<span class="w19"> </span>20<span class="w14"> </span>0<span class="w15"> </span>0<span class="w16"> </span>1.3<span class="wc"> </span>1.0<span class="w17"> </span>1.3<span class="w6"> </span>7.12x</div><div class="l f2 s4 t0" style="top:288.588px;left:71.4192px;" data-x="71.4192" data-y="503.412">regexp-dna<span class="w25"> </span>2<span class="w19"> </span>2<span class="w14"> </span>2<span class="w14"> </span>0<span class="wf"> </span>0<span class="w16"> </span>1.0<span class="wc"> </span>1.0<span class="w17"> </span>1.0<span class="w6"> </span>4.21x</div><div class="l f2 s4 t0" style="top:298.55px;left:71.4192px;" data-x="71.4192" data-y="493.45">string-base64<span class="w20"> </span>3<span class="w19"> </span>5<span class="w14"> </span>7<span class="w14"> </span>0<span class="wf"> </span>0<span class="w16"> </span>1.7<span class="wc"> </span>1.4<span class="w17"> </span>2.3<span class="w6"> </span>2.53x</div><div class="l f2 s4 t0" style="top:308.513px;left:71.4192px;" data-x="71.4192" data-y="483.487">string-fasta<span class="w25"> </span>5<span class="w6"> </span>11<span class="w13"> </span>15<span class="w14"> </span>6<span class="w15"> </span>0<span class="w16"> </span>2.2<span class="wc"> </span>1.4<span class="w17"> </span>3.0<span class="w6"> </span>1.49x</div><div class="l f2 s4 t0" style="top:318.476px;left:71.4192px;" data-x="71.4192" data-y="473.524">string-tagcloud<span class="w26"> </span>3<span class="w19"> </span>6<span class="w14"> </span>6<span class="w14"> </span>5<span class="wf"> </span>0<span class="w16"> </span>2.0<span class="wc"> </span>1.0<span class="w17"> </span>2.0<span class="w6"> </span>1.09x</div><div class="l f2 s4 t0" style="top:328.438px;left:71.4192px;" data-x="71.4192" data-y="463.562">string-unpack-code<span class="w1c"> </span>4<span class="w13"> </span>4<span class="w19"> </span>37<span class="w14"> </span>0<span class="w15"> </span>0<span class="w16"> </span>1.0<span class="wc"> </span>9.3<span class="w17"> </span>9.3<span class="w6"> </span>1.20x</div><div class="l f2 s4 t0" style="top:338.401px;left:71.4192px;" data-x="71.4192" data-y="453.599">string-validate-input<span class="w27"> </span>6<span class="w6"> </span>10<span class="w13"> </span>13<span class="w14"> </span>1<span class="w15"> </span>0<span class="w16"> </span>1.7<span class="wc"> </span>1.3<span class="w17"> </span>2.2<span class="w6"> </span>1.86x</div></div><div class="t t11d"></div><div class="t t0"><div class="l f1 s4 t0" style="top:362.84px;left:161.455px;" data-x="161.455" data-y="429.16">Figure<span class="w2"> </span>13.</div><div class="l f2 s4 t0" style="top:362.84px;left:204.628px;" data-x="204.628" data-y="429.16">Detailed<span class="w2"> </span>trace<span class="w1"> </span>recording<span class="w1"> </span>statistics<span class="w2"> </span>for<span class="w1"> </span>the<span class="w1"> </span>SunSpider<span class="w2"> </span>benchmark<span class="w1"> </span>set.</div><div class="l f2 s4 t0" style="top:392.677px;left:54px;" data-x="54" data-y="399.323">mean).<span class="w1"> </span>We<span class="w2"> </span>exclude</div><div class="l f7 s4 t0" style="top:392.677px;left:126.612px;" data-x="126.612" data-y="399.323">regexp-dna</div><div class="l f2 s4 t0" style="top:392.677px;left:176.513px;" data-x="176.513" data-y="399.323">from<span class="w1"> </span>the<span class="w1"> </span>following<span class="w1"> </span>calculations,</div><div class="l f2 s4 t0" style="top:402.639px;left:54px;" data-x="54" data-y="389.361">because<span class="w2"> </span>most<span class="w1"> </span>of<span class="w1"> </span>its<span class="w2"> </span>time<span class="w1"> </span>is<span class="w2"> </span>spent<span class="w1"> </span>in<span class="w1"> </span>the<span class="w2"> </span>regular<span class="w1"> </span>expression<span class="w2"> </span>matcher,</div><div class="l f2 s4 t0" style="top:412.602px;left:54px;" data-x="54" data-y="379.398">which<span class="w0"> </span>has<span class="w0"> </span>much<span class="w0"> </span>different<span class="w1"> </span>performance<span class="w0"> </span>characteristics<span class="w0"> </span>from<span class="w0"> </span>the</div><div class="l f2 s4 t0" style="top:422.565px;left:54px;" data-x="54" data-y="369.435">other<span class="w1"> </span>programs.<span class="w1"> </span>(Note<span class="w0"> </span>that<span class="w1"> </span>this<span class="w1"> </span>only<span class="w1"> </span>makes<span class="w0"> </span>a<span class="w1"> </span>difference<span class="w1"> </span>of<span class="w1"> </span>about</div><div class="l f2 s4 t0" style="top:432.527px;left:54px;" data-x="54" data-y="359.473">10%<span class="w1"> </span>in<span class="w1"> </span>the<span class="w2"> </span>results.)<span class="w1"> </span>Dividing<span class="w1"> </span>the<span class="w1"> </span>total<span class="w1"> </span>execution<span class="w2"> </span>time<span class="w1"> </span>in<span class="w1"> </span>processor</div><div class="l f2 s4 t0" style="top:442.49px;left:54px;" data-x="54" data-y="349.51">clock<span class="w0"> </span>cycles<span class="w1"> </span>by<span class="w0"> </span>the<span class="w0"> </span>number<span class="w0"> </span>of<span class="w0"> </span>bytecodes<span class="w1"> </span>executed<span class="w0"> </span>in<span class="w0"> </span>the<span class="w0"> </span>base</div><div class="l f2 s4 t0" style="top:452.453px;left:54px;" data-x="54" data-y="339.547">interpreter<span class="w1"> </span>shows<span class="w0"> </span>that<span class="w1"> </span>on<span class="w0"> </span>average,<span class="w1"> </span>a<span class="w0"> </span>bytecode<span class="w0"> </span>executes<span class="w1"> </span>in<span class="w0"> </span>about</div><div class="l f2 s4 t0" style="top:462.415px;left:54px;" data-x="54" data-y="329.585">35<span class="w1"> </span>cycles.<span class="w1"> </span>Native<span class="w1"> </span>traces<span class="w1"> </span>take<span class="w0"> </span>about<span class="w1"> </span>9<span class="w1"> </span>cycles<span class="w1"> </span>per<span class="w1"> </span>bytecode,<span class="w1"> </span>a<span class="w0"> </span>3.9x</div><div class="l f2 s4 t0" style="top:472.378px;left:54px;" data-x="54" data-y="319.622">speedup<span class="w2"> </span>over<span class="w1"> </span>the<span class="w2"> </span>interpreter.</div><div class="l f2 s4 t0" style="top:482.341px;left:65.9552px;" data-x="65.9552" data-y="309.659">Using<span class="w1"> </span>similar<span class="w1"> </span>computations,<span class="w1"> </span>we<span class="w1"> </span>find<span class="w1"> </span>that<span class="w1"> </span>trace<span class="w1"> </span>recording<span class="w1"> </span>takes</div><div class="l f2 s4 t0" style="top:492.303px;left:54px;" data-x="54" data-y="299.697">about<span class="w1"> </span>3800<span class="w1"> </span>cycles<span class="w1"> </span>per<span class="w1"> </span>bytecode,<span class="w1"> </span>and<span class="w1"> </span>compilation<span class="w1"> </span>3150<span class="w1"> </span>cycles<span class="w1"> </span>per</div><div class="l f2 s4 t0" style="top:502.266px;left:54px;" data-x="54" data-y="289.734">bytecode.<span class="w1"> </span>Hence,<span class="w1"> </span>during<span class="w1"> </span>recording<span class="w1"> </span>and<span class="w1"> </span>compiling<span class="w1"> </span>the<span class="w1"> </span>VM<span class="w1"> </span>runs<span class="w1"> </span>at</div><div class="l f2 s4 t0" style="top:512.228px;left:54px;" data-x="54" data-y="279.772">1/200<span class="w1"> </span>the<span class="w1"> </span>speed<span class="w1"> </span>of<span class="w1"> </span>the<span class="w1"> </span>interpreter.<span class="w2"> </span>Because<span class="w1"> </span>it<span class="w1"> </span>costs<span class="w1"> </span>6950<span class="w1"> </span>cycles<span class="w1"> </span>to</div><div class="l f2 s4 t0" style="top:522.191px;left:54px;" data-x="54" data-y="269.809">compile<span class="w1"> </span>a<span class="w1"> </span>bytecode,<span class="w1"> </span>and<span class="w1"> </span>we<span class="w1"> </span>save<span class="w2"> </span>26<span class="w1"> </span>cycles<span class="w1"> </span>each<span class="w1"> </span>time<span class="w1"> </span>that<span class="w1"> </span>code<span class="w1"> </span>is</div><div class="l f2 s4 t0" style="top:532.154px;left:54px;" data-x="54" data-y="259.846">run<span class="w2"> </span>natively,<span class="w2"> </span>we<span class="w1"> </span>break<span class="w1"> </span>even<span class="w2"> </span>after<span class="w1"> </span>running<span class="w2"> </span>a<span class="w1"> </span>trace<span class="w2"> </span>270<span class="w1"> </span>times.</div><div class="l f2 s4 t0" style="top:542.116px;left:65.9552px;" data-x="65.9552" data-y="249.884">The<span class="w1"> </span>other<span class="w1"> </span>VMs<span class="w1"> </span>we<span class="w1"> </span>compared<span class="w1"> </span>with<span class="w1"> </span>achieve<span class="w1"> </span>an<span class="w1"> </span>overall<span class="w1"> </span>speedup</div><div class="l f2 s4 t0" style="top:552.079px;left:54px;" data-x="54" data-y="239.921">of<span class="w1"> </span>3.0x<span class="w0"> </span>relative<span class="w1"> </span>to<span class="w0"> </span>our<span class="w1"> </span>baseline<span class="w0"> </span>interpreter</div><div class="l f2 s4 t0" style="top:552.079px;left:210.284px;" data-x="210.284" data-y="239.921">.<span class="w1"> </span>Our<span class="w0"> </span>estimated<span class="w1"> </span>native</div><div class="l f2 s4 t0" style="top:562.042px;left:54px;" data-x="54" data-y="229.958">code<span class="w0"> </span>speedup<span class="w0"> </span>of<span class="w1"> </span>3.9x<span class="w0"> </span>is<span class="w0"> </span>significantly<span class="w0"> </span>better.<span class="w1"> </span>This<span class="w0"> </span>suggests<span class="w0"> </span>that</div><div class="l f2 s4 t0" style="top:572.004px;left:54px;" data-x="54" data-y="219.996">our<span class="w2"> </span>compilation<span class="w1"> </span>techniques<span class="w2"> </span>can<span class="w1"> </span>generate<span class="w1"> </span>more<span class="w2"> </span>efficient<span class="w2"> </span>native<span class="w1"> </span>code</div><div class="l f2 s4 t0" style="top:581.967px;left:54px;" data-x="54" data-y="210.033">than<span class="w2"> </span>any<span class="w1"> </span>other<span class="w1"> </span>current<span class="w2"> </span>JavaScript<span class="w1"> </span>VM.</div><div class="l f2 s4 t0" style="top:591.93px;left:65.9552px;" data-x="65.9552" data-y="200.07">These<span class="w2"> </span>estimates<span class="w2"> </span>also<span class="w1"> </span>indicate<span class="w2"> </span>that<span class="w2"> </span>our<span class="w1"> </span>startup<span class="w2"> </span>performance<span class="w2"> </span>could</div><div class="l f2 s4 t0" style="top:601.892px;left:54px;" data-x="54" data-y="190.108">be<span class="w1"> </span>substantially<span class="w2"> </span>better<span class="w1"> </span>if<span class="w1"> </span>we<span class="w1"> </span>improved<span class="w2"> </span>the<span class="w1"> </span>speed<span class="w1"> </span>of<span class="w2"> </span>trace<span class="w1"> </span>recording</div><div class="l f2 s4 t0" style="top:611.855px;left:54px;" data-x="54" data-y="180.145">and<span class="w1"> </span>compilation.<span class="w1"> </span>The<span class="w2"> </span>estimated<span class="w1"> </span>200x<span class="w1"> </span>slowdown<span class="w1"> </span>for<span class="w1"> </span>recording<span class="w1"> </span>and</div><div class="l f2 s4 t0" style="top:621.818px;left:54px;" data-x="54" data-y="170.182">compilation<span class="w2"> </span>is<span class="w1"> </span>very<span class="w2"> </span>rough,<span class="w2"> </span>and<span class="w1"> </span>may<span class="w2"> </span>be<span class="w1"> </span>influenced<span class="w2"> </span>by<span class="w2"> </span>startup<span class="w1"> </span>factors</div><div class="l f2 s4 t0" style="top:631.78px;left:54px;" data-x="54" data-y="160.22">in<span class="w1"> </span>the<span class="w2"> </span>interpreter<span class="w1"> </span>(e.g.,<span class="w1"> </span>caches<span class="w1"> </span>that<span class="w1"> </span>have<span class="w1"> </span>not<span class="w2"> </span>warmed<span class="w1"> </span>up<span class="w1"> </span>yet<span class="w1"> </span>during</div><div class="l f2 s4 t0" style="top:641.743px;left:54px;" data-x="54" data-y="150.257">recording).<span class="w1"> </span>One<span class="w0"> </span>observation<span class="w1"> </span>supporting<span class="w0"> </span>this<span class="w1"> </span>conjecture<span class="w1"> </span>is<span class="w0"> </span>that<span class="w1"> </span>in</div><div class="l f2 s4 t0" style="top:651.706px;left:54px;" data-x="54" data-y="140.294">the<span class="w2"> </span>tracer,<span class="w1"> </span>interpreted<span class="w2"> </span>bytecodes<span class="w1"> </span>take<span class="w1"> </span>about<span class="w2"> </span>180<span class="w1"> </span>cycles<span class="w2"> </span>to<span class="w1"> </span>run.<span class="w1"> </span>Still,</div><div class="l f2 s4 t0" style="top:661.668px;left:54px;" data-x="54" data-y="130.332">recording<span class="w1"> </span>and<span class="w2"> </span>compilation<span class="w1"> </span>are<span class="w1"> </span>clearly<span class="w1"> </span>both<span class="w1"> </span>expensive,<span class="w2"> </span>and<span class="w1"> </span>a<span class="w1"> </span>better</div><div class="l f2 s4 t0" style="top:671.631px;left:54px;" data-x="54" data-y="120.369">implementation,<span class="w1"> </span>possibly<span class="w0"> </span>including<span class="w0"> </span>redesign<span class="w1"> </span>of<span class="w0"> </span>the<span class="w1"> </span>LIR<span class="w0"> </span>abstract</div><div class="l f2 s4 t0" style="top:681.593px;left:54px;" data-x="54" data-y="110.407">syntax<span class="w2"> </span>or<span class="w1"> </span>encoding,<span class="w1"> </span>would<span class="w2"> </span>improve<span class="w1"> </span>startup<span class="w2"> </span>performance.</div><div class="l f2 s4 t0" style="top:691.556px;left:65.9552px;" data-x="65.9552" data-y="100.444">Our<span class="w1"> </span>performance<span class="w1"> </span>results<span class="w1"> </span>confirm<span class="w1"> </span>that<span class="w1"> </span>type<span class="w1"> </span>specialization<span class="w1"> </span>using</div><div class="l f2 s4 t0" style="top:701.519px;left:54px;" data-x="54" data-y="90.4813">trace<span class="w0"> </span>trees<span class="w0"> </span>substantially<span class="w0"> </span>improves<span class="w1"> </span>performance.<span class="w0"> </span>We<span class="w0"> </span>are<span class="w0"> </span>able<span class="w1"> </span>to</div><div class="l f2 s4 t0" style="top:711.481px;left:54px;" data-x="54" data-y="80.5187">outperform<span class="w1"> </span>the<span class="w1"> </span>fastest<span class="w1"> </span>available<span class="w1"> </span>JavaScript<span class="w1"> </span>compiler<span class="w1"> </span>(V8)<span class="w1"> </span>and<span class="w1"> </span>the</div><div class="l f2 s4 t0" style="top:392.677px;left:317.014px;" data-x="317.014" data-y="399.323">fastest<span class="w1"> </span>available<span class="w1"> </span>JavaScript<span class="w2"> </span>inline<span class="w1"> </span>threaded<span class="w0"> </span>interpreter<span class="w2"> </span>(SFX)<span class="w1"> </span>on<span class="w0"> </span>9</div><div class="l f2 s4 t0" style="top:402.64px;left:317.014px;" data-x="317.014" data-y="389.36">of<span class="w2"> </span>26<span class="w1"> </span>benchmarks.</div><div class="l f1 s2 t0" style="top:440.618px;left:317.014px;" data-x="317.014" data-y="351.382">8.<span class="w3"> </span>Related<span class="w1"> </span>Work</div><div class="l f1 s4 t0" style="top:454.565px;left:317.014px;" data-x="317.014" data-y="337.435">Trace<span class="w2"> </span>optimization<span class="w0"> </span>for<span class="w2"> </span>dynamic<span class="w0"> </span>languages.</div><div class="l f2 s4 t0" style="top:454.565px;left:486.339px;" data-x="486.339" data-y="337.435">The<span class="w1"> </span>closest<span class="w1"> </span>area<span class="w1"> </span>of</div><div class="l f2 s4 t0" style="top:464.528px;left:317.014px;" data-x="317.014" data-y="327.472">related<span class="w1"> </span>work<span class="w0"> </span>is<span class="w1"> </span>on<span class="w1"> </span>applying<span class="w0"> </span>trace<span class="w1"> </span>optimization<span class="w1"> </span>to<span class="w0"> </span>type-specialize</div><div class="l f2 s4 t0" style="top:474.491px;left:317.014px;" data-x="317.014" data-y="317.509">dynamic<span class="w1"> </span>languages.<span class="w0"> </span>Existing<span class="w1"> </span>work<span class="w0"> </span>shares<span class="w1"> </span>the<span class="w0"> </span>idea<span class="w1"> </span>of<span class="w0"> </span>generating</div><div class="l f2 s4 t0" style="top:484.453px;left:317.014px;" data-x="317.014" data-y="307.547">type-specialized<span class="w1"> </span>code<span class="w0"> </span>speculatively<span class="w2"> </span>with<span class="w0"> </span>guards<span class="w1"> </span>along<span class="w1"> </span>interpreter</div><div class="l f2 s4 t0" style="top:494.416px;left:317.014px;" data-x="317.014" data-y="297.584">traces.</div><div class="l f2 s4 t0" style="top:504.379px;left:328.969px;" data-x="328.969" data-y="287.621">To<span class="w1"> </span>our<span class="w0"> </span>knowledge,<span class="w0"> </span>Rigo’s<span class="w1"> </span>Psyco<span class="w0"> </span>(16)<span class="w0"> </span>is<span class="w0"> </span>the<span class="w1"> </span>only<span class="w0"> </span>published</div><div class="l f2 s4 t0" style="top:514.341px;left:317.014px;" data-x="317.014" data-y="277.659">type-specializing<span class="w1"> </span>trace<span class="w2"> </span>compiler<span class="w1"> </span>for<span class="w1"> </span>a<span class="w1"> </span>dynamic<span class="w1"> </span>language<span class="w2"> </span>(Python).</div><div class="l f2 s4 t0" style="top:524.304px;left:317.014px;" data-x="317.014" data-y="267.696">Psyco<span class="w2"> </span>does<span class="w2"> </span>not<span class="w1"> </span>attempt<span class="w2"> </span>to<span class="w1"> </span>identify<span class="w2"> </span>hot<span class="w2"> </span>loops<span class="w1"> </span>or<span class="w2"> </span>inline<span class="w2"> </span>function<span class="w1"> </span>calls.</div><div class="l f2 s4 t0" style="top:534.267px;left:317.014px;" data-x="317.014" data-y="257.733">Instead,<span class="w2"> </span>Psyco<span class="w1"> </span>transforms<span class="w2"> </span>loops<span class="w2"> </span>to<span class="w1"> </span>mutual<span class="w2"> </span>recursion<span class="w1"> </span>before<span class="w2"> </span>running</div><div class="l f2 s4 t0" style="top:544.229px;left:317.014px;" data-x="317.014" data-y="247.771">and<span class="w2"> </span>traces<span class="w1"> </span>all<span class="w1"> </span>operations.</div><div class="l f2 s4 t0" style="top:554.192px;left:328.969px;" data-x="328.969" data-y="237.808">Pall’s<span class="w2"> </span>LuaJIT<span class="w1"> </span>is<span class="w2"> </span>a<span class="w1"> </span>Lua<span class="w1"> </span>VM<span class="w2"> </span>in<span class="w1"> </span>development<span class="w1"> </span>that<span class="w2"> </span>uses<span class="w1"> </span>trace<span class="w1"> </span>com-</div><div class="l f2 s4 t0" style="top:564.154px;left:317.014px;" data-x="317.014" data-y="227.846">pilation<span class="w2"> </span>ideas.<span class="w1"> </span>(1).<span class="w2"> </span>There<span class="w1"> </span>are<span class="w2"> </span>no<span class="w1"> </span>publications<span class="w2"> </span>on<span class="w1"> </span>LuaJIT<span class="w2"> </span>but<span class="w1"> </span>the<span class="w2"> </span>cre-</div><div class="l f2 s4 t0" style="top:574.117px;left:317.014px;" data-x="317.014" data-y="217.883">ator<span class="w2"> </span>has<span class="w1"> </span>told<span class="w1"> </span>us<span class="w1"> </span>that<span class="w2"> </span>LuaJIT<span class="w1"> </span>has<span class="w1"> </span>a<span class="w2"> </span>similar<span class="w1"> </span>design<span class="w1"> </span>to<span class="w2"> </span>our<span class="w1"> </span>system,<span class="w1"> </span>but</div><div class="l f2 s4 t0" style="top:584.08px;left:317.014px;" data-x="317.014" data-y="207.92">will<span class="w1"> </span>use<span class="w1"> </span>a<span class="w1"> </span>less<span class="w0"> </span>aggressiv</div><div class="l f2 s4 t0" style="top:584.08px;left:405.862px;" data-x="405.862" data-y="207.92">e<span class="w1"> </span>type<span class="w1"> </span>speculation<span class="w1"> </span>(e.g.,<span class="w0"> </span>using<span class="w2"> </span>a<span class="w0"> </span>floating-</div><div class="l f2 s4 t0" style="top:594.042px;left:317.014px;" data-x="317.014" data-y="197.958">point<span class="w1"> </span>representation<span class="w1"> </span>for<span class="w1"> </span>all<span class="w1"> </span>number<span class="w1"> </span>values)<span class="w1"> </span>and<span class="w1"> </span>does<span class="w0"> </span>not<span class="w2"> </span>generate</div><div class="l f2 s4 t0" style="top:604.005px;left:317.014px;" data-x="317.014" data-y="187.995">nested<span class="w2"> </span>traces<span class="w1"> </span>for<span class="w1"> </span>nested<span class="w2"> </span>loops.</div><div class="l f1 s4 t0" style="top:613.968px;left:328.969px;" data-x="328.969" data-y="178.032">General<span class="w0"> </span>trace<span class="w1"> </span>optimization.</div><div class="l f2 s4 t0" style="top:613.968px;left:441.427px;" data-x="441.427" data-y="178.032">General<span class="w0"> </span>trace<span class="w1"> </span>optimization<span class="w0"> </span>has</div><div class="l f2 s4 t0" style="top:623.93px;left:317.014px;" data-x="317.014" data-y="168.07">a<span class="w0"> </span>longer<span class="w0"> </span>history<span class="w1"> </span>that<span class="w0"> </span>has<span class="w0"> </span>treated<span class="w0"> </span>mostly<span class="w0"> </span>native<span class="w1"> </span>code<span class="w0"> </span>and<span class="w0"> </span>typed</div><div class="l f2 s4 t0" style="top:633.893px;left:317.014px;" data-x="317.014" data-y="158.107">languages<span class="w2"> </span>like<span class="w1"> </span>Java.<span class="w2"> </span>Thus,<span class="w1"> </span>these<span class="w1"> </span>systems<span class="w2"> </span>have<span class="w1"> </span>focused<span class="w2"> </span>less<span class="w1"> </span>on<span class="w1"> </span>type</div><div class="l f2 s4 t0" style="top:643.856px;left:317.014px;" data-x="317.014" data-y="148.144">specialization<span class="w2"> </span>and<span class="w1"> </span>more<span class="w1"> </span>on<span class="w2"> </span>other<span class="w1"> </span>optimizations.</div><div class="l f2 s4 t0" style="top:653.818px;left:328.969px;" data-x="328.969" data-y="138.182">Dynamo<span class="w1"> </span>(7)<span class="w1"> </span>by<span class="w1"> </span>Bala<span class="w1"> </span>et<span class="w1"> </span>al,<span class="w0"> </span>introduced<span class="w2"> </span>native<span class="w1"> </span>code<span class="w1"> </span>tracing<span class="w1"> </span>as<span class="w0"> </span>a</div><div class="l f2 s4 t0" style="top:663.781px;left:317.014px;" data-x="317.014" data-y="128.219">replacement<span class="w1"> </span>for<span class="w1"> </span>profile-guided<span class="w1"> </span>optimization<span class="w1"> </span>(PGO).<span class="w1"> </span>A<span class="w1"> </span>major<span class="w1"> </span>goal</div><div class="l f2 s4 t0" style="top:673.744px;left:317.014px;" data-x="317.014" data-y="118.256">was<span class="w0"> </span>to<span class="w1"> </span>perform<span class="w0"> </span>PGO<span class="w0"> </span>online<span class="w0"> </span>so<span class="w0"> </span>that<span class="w1"> </span>the<span class="w0"> </span>profile<span class="w0"> </span>was<span class="w0"> </span>specific<span class="w1"> </span>to</div><div class="l f2 s4 t0" style="top:683.706px;left:317.014px;" data-x="317.014" data-y="108.294">the<span class="w1"> </span>current<span class="w2"> </span>execution.<span class="w1"> </span>Dynamo<span class="w1"> </span>used<span class="w2"> </span>loop<span class="w1"> </span>headers<span class="w1"> </span>as<span class="w1"> </span>candidate<span class="w1"> </span>hot</div><div class="l f2 s4 t0" style="top:693.669px;left:317.014px;" data-x="317.014" data-y="98.3312">traces,<span class="w2"> </span>but<span class="w1"> </span>did<span class="w1"> </span>not<span class="w2"> </span>try<span class="w1"> </span>to<span class="w2"> </span>create<span class="w1"> </span>loop<span class="w1"> </span>traces<span class="w2"> </span>specifically.</div><div class="l f2 s4 t0" style="top:703.631px;left:328.969px;" data-x="328.969" data-y="88.3686">Trace<span class="w1"> </span>trees<span class="w1"> </span>were<span class="w0"> </span>originally<span class="w1"> </span>proposed<span class="w1"> </span>by<span class="w1"> </span>Gal<span class="w0"> </span>et<span class="w1"> </span>al.<span class="w1"> </span>(11)<span class="w1"> </span>in<span class="w0"> </span>the</div><div class="l f2 s4 t0" style="top:713.594px;left:317.014px;" data-x="317.014" data-y="78.406">context<span class="w1"> </span>of<span class="w1"> </span>Java,<span class="w1"> </span>a<span class="w0"> </span>statically<span class="w1"> </span>typed<span class="w1"> </span>language.<span class="w1"> </span>Their<span class="w0"> </span>trace<span class="w1"> </span>trees<span class="w1"> </span>ac-</div><div class="l f2 s4 t0" style="top:723.557px;left:317.014px;" data-x="317.014" data-y="68.4433">tually<span class="w1"> </span>inlined<span class="w1"> </span>parts<span class="w1"> </span>of<span class="w1"> </span>outer<span class="w1"> </span>loops<span class="w1"> </span>within<span class="w1"> </span>the<span class="w1"> </span>inner<span class="w1"> </span>loops<span class="w1"> </span>(because</div></div></div><div id="page-13" class="p" style="width:612px;height:792px;"><div class="t"></div><div class="t t11e"></div><div class="t t11f"></div><div class="t t120"></div><div class="t t121"></div><div class="t t122"><div class="l f18 s7 t97" style="top:802px;left:0px;" data-x="115.399" data-y="532.339">!"#</div></div><div class="t t123"><div class="l f18 s7 t97" style="top:802px;left:0px;" data-x="148.039" data-y="532.339">$!"#</div></div><div class="t t124"><div class="l f18 s7 t97" style="top:802px;left:0px;" data-x="182.073" data-y="532.339">%!"#</div></div><div class="t t125"><div class="l f18 s7 t97" style="top:802px;left:0px;" data-x="216.107" data-y="532.339">&!"#</div></div><div class="t t126"><div class="l f18 s7 t97" style="top:802px;left:0px;" data-x="250.141" data-y="532.339">'!"#</div></div><div class="t t127"><div class="l f18 s7 t97" style="top:802px;left:0px;" data-x="282.781" data-y="532.339">(!!"#</div></div><div class="t t128"><div class="l f18 s7 ta3" style="top:800px;left:28.566px;" data-x="88.3613" data-y="544.453">)*+,-./#0$1$23#</div></div><div class="t t129"><div class="l f18 s7 ta3" style="top:800px;left:25.5484px;" data-x="85.0419" data-y="551">)*+45678#0$1923#</div></div><div class="t t12a"><div class="l f18 s7 ta3" style="top:800px;left:23.2164px;" data-x="82.4767" data-y="557.546">)*+6:;<6:,/#0(1$23#</div></div><div class="t t12b"><div class="l f18 s7 ta3" style="top:800px;left:10.5367px;" data-x="68.529" data-y="564.093">:,,/==+.>?:6;+<6//=#0!1923#</div></div><div class="t t12c"><div class="l f18 s7 ta3" style="top:800px;left:15.2731px;" data-x="73.739" data-y="570.639">:,,/==+@:??A-,8#0$1$23#</div></div><div class="t t12d"><div class="l f18 s7 ta3" style="top:800px;left:19.9371px;" data-x="78.8694" data-y="577.185">:,,/==+?.5*;#0%1$23#</div></div><div class="t t12e"><div class="l f18 s7 ta3" style="top:800px;left:19.8492px;" data-x="78.7728" data-y="583.732">:,,/==+?=>/B/#0)1!23#</div></div><div class="t t12f"><div class="l f18 s7 ta3" style="top:800px;left:2.3961px;" data-x="59.5743" data-y="590.278">.><57=+).><+.><=+>?+.;</#0$C1C23#</div></div><div class="t t130"><div class="l f18 s7 ta3" style="top:800px;left:11.9117px;" data-x="70.0145" data-y="596.824">.><57=+.><=+>?+.;</#0'1D23#</div></div><div class="t t131"><div class="l f18 s7 ta3" style="top:800px;left:9.44102px;" data-x="67.3237" data-y="603.371">.><57=+.><E>=/+:?*#0$C1$23#</div></div><div class="t t132"><div class="l f18 s7 ta3" style="top:800px;left:13.0426px;" data-x="71.2855" data-y="609.917">.><57=+?=>/B/+.><=#0$1D23#</div></div><div class="t t133"><div class="l f18 s7 ta3" style="top:800px;left:7.37267px;" data-x="65.0486" data-y="616.463">,5?<65FG5E+6/,-6=>B/#0(1!23#</div></div><div class="t t134"><div class="l f18 s7 ta3" style="top:800px;left:24.6988px;" data-x="84.1074" data-y="623.01">,6;7<5+:/=#0(1&23#</div></div><div class="t t135"><div class="l f18 s7 ta3" style="top:800px;left:22.8453px;" data-x="82.0685" data-y="629.556">,6;7<5+4*C#0$1)23#</div></div><div class="t t136"><div class="l f18 s7 ta3" style="top:800px;left:22.5602px;" data-x="81.7548" data-y="636.102">,6;7<5+=8:(#0C1923#</div></div><div class="t t137"><div class="l f18 s7 ta3" style="top:800px;left:13.3277px;" data-x="71.5991" data-y="642.649">*:</+@564:<+<5H/#0(1(23#</div></div><div class="t t138"><div class="l f18 s7 ta3" style="top:800px;left:12.0191px;" data-x="70.1597" data-y="649.195">*:</+@564:<+27:6.#0(1!23#</div></div><div class="t t139"><div class="l f18 s7 ta3" style="top:800px;left:22.2457px;" data-x="81.4089" data-y="655.741">4:<8+,56*>,#0%1923#</div></div><div class="t t13a"><div class="l f18 s7 ta3" style="top:800px;left:11.9391px;" data-x="70.0716" data-y="662.288">4:<8+7:6I:F+=-4=#0C1923#</div></div><div class="t t13b"><div class="l f18 s7 ta3" style="top:800px;left:9.2047px;" data-x="67.0638" data-y="668.834">4:<8+=7/,<6:F+?564#0D1(23#</div></div><div class="t t13c"><div class="l f18 s7 ta3" style="top:800px;left:23.5152px;" data-x="82.8054" data-y="675.381">6/J/27+*?:#0%1$23#</div></div><div class="t t13d"><div class="l f18 s7 ta3" style="top:800px;left:19.7965px;" data-x="78.7148" data-y="681.927">=<6>?J+.:=/&%#0$1C23#</div></div><div class="t t13e"><div class="l f18 s7 ta3" style="top:800px;left:23.6735px;" data-x="82.9794" data-y="688.473">=<6>?J+@:=<:#0(1C23#</div></div><div class="t t13f"><div class="l f18 s7 ta3" style="top:800px;left:17.4352px;" data-x="76.1173" data-y="695.02">=<6>?J+<:J,F5-*#0(1(23#</div></div><div class="t t140"><div class="l f18 s7 ta3" style="top:800px;left:10.7594px;" data-x="68.7739" data-y="701.566">=<6>?J+-?7:,A+,5*/#0(1$23#</div></div><div class="t t141"><div class="l f18 s7 ta3" style="top:800px;left:8.90391px;" data-x="66.7102" data-y="708.112">=<6>?J+B:F>*:</+>?7-<#0(1923#</div></div><div class="t t121"></div><div class="t t142"><div class="l f18 s7 t97" style="top:802px;left:0px;" data-x="88.6002" data-y="516.526">K?</676/<#</div></div><div class="t t143"></div><div class="t t121"></div><div class="t t144"><div class="l f18 s7 t97" style="top:802px;left:0px;" data-x="122.244" data-y="516.526">L5?><56#</div></div><div class="t t121"></div><div class="t t145"><div class="l f18 s7 t97" style="top:802px;left:0px;" data-x="154.642" data-y="516.526">M/,56*#</div></div><div class="t t146"></div><div class="t t121"></div><div class="t t147"><div class="l f18 s7 t97" style="top:802px;left:0px;" data-x="183.879" data-y="516.526">N547>F/#</div></div><div class="t t121"></div><div class="t t148"><div class="l f18 s7 t97" style="top:802px;left:0px;" data-x="215.955" data-y="516.526">N:FF#O6:,/#</div></div><div class="t t121"></div><div class="t t149"><div class="l f18 s7 t97" style="top:802px;left:0px;" data-x="250.829" data-y="516.526">M-?#O6:,/#</div></div><div class="t t121"></div><div class="t t14a"></div><div class="t t0"><div class="l f1 s4 t0" style="top:307.691px;left:54px;" data-x="54" data-y="484.309">Figure<span class="w2"> </span>12.<span class="w0"> </span>Fraction<span class="w1"> </span>of<span class="w1"> </span>time<span class="w1"> </span>spent<span class="w1"> </span>on<span class="w1"> </span>major<span class="w1"> </span>VM<span class="w2"> </span>activities.</div><div class="l f2 s4 t0" style="top:307.691px;left:279.161px;" data-x="279.161" data-y="484.309">The</div><div class="l f2 s4 t0" style="top:317.654px;left:54px;" data-x="54" data-y="474.346">speedup<span class="w1"> </span>vs.<span class="w1"> </span>interpreter<span class="w0"> </span>is<span class="w2"> </span>shown<span class="w0"> </span>in<span class="w1"> </span>parentheses<span class="w1"> </span>next<span class="w1"> </span>to<span class="w1"> </span>each<span class="w1"> </span>test.</div><div class="l f2 s4 t0" style="top:327.616px;left:54px;" data-x="54" data-y="464.384">Most<span class="w1"> </span>programs<span class="w2"> </span>where<span class="w1"> </span>the<span class="w1"> </span>VM<span class="w1"> </span>spends<span class="w2"> </span>the<span class="w1"> </span>majority<span class="w1"> </span>of<span class="w1"> </span>its<span class="w1"> </span>time<span class="w2"> </span>run-</div><div class="l f2 s4 t0" style="top:337.579px;left:54px;" data-x="54" data-y="454.421">ning<span class="w2"> </span>native<span class="w1"> </span>code<span class="w1"> </span>have<span class="w2"> </span>a<span class="w1"> </span>good<span class="w1"> </span>speedup.<span class="w2"> </span>Recording<span class="w1"> </span>and<span class="w1"> </span>compilation</div><div class="l f2 s4 t0" style="top:347.542px;left:54px;" data-x="54" data-y="444.458">costs<span class="w1"> </span>can<span class="w2"> </span>be<span class="w1"> </span>substantial;<span class="w1"> </span>speeding<span class="w1"> </span>up<span class="w1"> </span>those<span class="w2"> </span>parts<span class="w1"> </span>of<span class="w1"> </span>the<span class="w1"> </span>implemen-</div><div class="l f2 s4 t0" style="top:357.504px;left:54px;" data-x="54" data-y="434.496">tation<span class="w2"> </span>would<span class="w1"> </span>improve<span class="w2"> </span>SunSpider<span class="w1"> </span>performance.</div><div class="l f2 s4 t0" style="top:404.752px;left:54px;" data-x="54" data-y="387.248">inner<span class="w2"> </span>loops<span class="w1"> </span>become<span class="w1"> </span>hot<span class="w1"> </span>first),<span class="w2"> </span>leading<span class="w1"> </span>to<span class="w1"> </span>much<span class="w1"> </span>greater<span class="w2"> </span>tail<span class="w1"> </span>duplica-</div><div class="l f2 s4 t0" style="top:414.715px;left:54px;" data-x="54" data-y="377.285">tion.</div><div class="l f2 s4 t0" style="top:424.677px;left:65.9552px;" data-x="65.9552" data-y="367.323">YETI,<span class="w1"> </span>from<span class="w0"> </span>Zaleski<span class="w1"> </span>et<span class="w0"> </span>al.<span class="w1"> </span>(19)<span class="w0"> </span>applied<span class="w1"> </span>Dynamo-style<span class="w0"> </span>tracing</div><div class="l f2 s4 t0" style="top:434.64px;left:54px;" data-x="54" data-y="357.36">to<span class="w0"> </span>Java<span class="w1"> </span>in<span class="w0"> </span>order<span class="w0"> </span>to<span class="w0"> </span>achieve<span class="w1"> </span>inlining,<span class="w0"> </span>indirect<span class="w0"> </span>jump<span class="w0"> </span>elimination,</div><div class="l f2 s4 t0" style="top:444.603px;left:54px;" data-x="54" data-y="347.397">and<span class="w1"> </span>other<span class="w1"> </span>optimizations.<span class="w2"> </span>Their<span class="w1"> </span>primary<span class="w1"> </span>focus<span class="w1"> </span>was<span class="w1"> </span>on<span class="w1"> </span>designing<span class="w1"> </span>an</div><div class="l f2 s4 t0" style="top:454.565px;left:54px;" data-x="54" data-y="337.435">interpreter<span class="w2"> </span>that<span class="w1"> </span>could<span class="w2"> </span>easily<span class="w1"> </span>be<span class="w1"> </span>gradually<span class="w2"> </span>re-engineered<span class="w1"> </span>as<span class="w2"> </span>a<span class="w1"> </span>tracing</div><div class="l f2 s4 t0" style="top:464.528px;left:54px;" data-x="54" data-y="327.472">VM.</div><div class="l f2 s4 t0" style="top:474.491px;left:65.9552px;" data-x="65.9552" data-y="317.509">Suganuma<span class="w2"> </span>et<span class="w2"> </span>al.<span class="w2"> </span>(18)<span class="w1"> </span>described<span class="w2"> </span>region-based<span class="w2"> </span>compilation<span class="w2"> </span>(RBC),</div><div class="l f2 s4 t0" style="top:484.453px;left:54px;" data-x="54" data-y="307.547">a<span class="w1"> </span>relative<span class="w1"> </span>of<span class="w1"> </span>tracing.<span class="w1"> </span>A<span class="w1"> </span>region<span class="w1"> </span>is<span class="w1"> </span>an<span class="w1"> </span>subprogram<span class="w1"> </span>worth<span class="w1"> </span>optimizing</div><div class="l f2 s4 t0" style="top:494.416px;left:54px;" data-x="54" data-y="297.584">that<span class="w2"> </span>can<span class="w1"> </span>include<span class="w2"> </span>subsets<span class="w1"> </span>of<span class="w1"> </span>any<span class="w2"> </span>number<span class="w1"> </span>of<span class="w2"> </span>methods.<span class="w1"> </span>Thus,<span class="w2"> </span>the<span class="w1"> </span>com-</div><div class="l f2 s4 t0" style="top:504.379px;left:54px;" data-x="54" data-y="287.621">piler<span class="w1"> </span>has<span class="w1"> </span>more<span class="w1"> </span>flexibility<span class="w2"> </span>and<span class="w1"> </span>can<span class="w1"> </span>potentially<span class="w1"> </span>generate<span class="w1"> </span>better<span class="w1"> </span>code,</div><div class="l f2 s4 t0" style="top:514.341px;left:54px;" data-x="54" data-y="277.659">but<span class="w2"> </span>the<span class="w2"> </span>profiling<span class="w2"> </span>and<span class="w1"> </span>compilation<span class="w2"> </span>systems<span class="w2"> </span>are<span class="w1"> </span>correspondingly<span class="w2"> </span>more</div><div class="l f2 s4 t0" style="top:524.304px;left:54px;" data-x="54" data-y="267.696">complex.</div><div class="l f1 s4 t0" style="top:534.266px;left:65.9552px;" data-x="65.9552" data-y="257.734">Type<span class="w1"> </span>specialization<span class="w0"> </span>for<span class="w0"> </span>dynamic<span class="w0"> </span>languages.</div><div class="l f2 s4 t0" style="top:534.266px;left:242.032px;" data-x="242.032" data-y="257.734">Dynamic<span class="w0"> </span>lan-</div><div class="l f2 s4 t0" style="top:544.229px;left:54px;" data-x="54" data-y="247.771">guage<span class="w1"> </span>implementors<span class="w1"> </span>have<span class="w1"> </span>long<span class="w1"> </span>recognized<span class="w1"> </span>the<span class="w1"> </span>importance<span class="w1"> </span>of<span class="w1"> </span>type</div><div class="l f2 s4 t0" style="top:554.192px;left:54px;" data-x="54" data-y="237.808">specialization<span class="w2"> </span>for<span class="w1"> </span>performance.<span class="w2"> </span>Most<span class="w2"> </span>previous<span class="w1"> </span>work<span class="w2"> </span>has<span class="w2"> </span>focused<span class="w1"> </span>on</div><div class="l f2 s4 t0" style="top:564.154px;left:54px;" data-x="54" data-y="227.846">methods<span class="w2"> </span>instead<span class="w1"> </span>of<span class="w1"> </span>traces.</div><div class="l f2 s4 t0" style="top:574.117px;left:65.9552px;" data-x="65.9552" data-y="217.883">Chambers<span class="w1"> </span>et.<span class="w0"> </span>al<span class="w1"> </span>(9)<span class="w1"> </span>pioneered<span class="w0"> </span>the<span class="w1"> </span>idea<span class="w1"> </span>of<span class="w0"> </span>compiling<span class="w1"> </span>multiple</div><div class="l f2 s4 t0" style="top:584.08px;left:54px;" data-x="54" data-y="207.92">versions<span class="w1"> </span>of<span class="w1"> </span>a<span class="w1"> </span>procedure<span class="w1"> </span>specialized<span class="w1"> </span>for<span class="w1"> </span>the<span class="w1"> </span>input<span class="w1"> </span>types<span class="w0"> </span>in<span class="w2"> </span>the<span class="w1"> </span>lan-</div><div class="l f2 s4 t0" style="top:594.042px;left:54px;" data-x="54" data-y="197.958">guage<span class="w1"> </span>Self.<span class="w0"> </span>In<span class="w1"> </span>one<span class="w0"> </span>implementation,<span class="w1"> </span>they<span class="w0"> </span>generated<span class="w1"> </span>a<span class="w1"> </span>specialized</div><div class="l f2 s4 t0" style="top:604.005px;left:54px;" data-x="54" data-y="187.995">method<span class="w2"> </span>online<span class="w1"> </span>each<span class="w2"> </span>time<span class="w2"> </span>a<span class="w1"> </span>method<span class="w2"> </span>was<span class="w2"> </span>called<span class="w1"> </span>with<span class="w2"> </span>new<span class="w2"> </span>input<span class="w1"> </span>types.</div><div class="l f2 s4 t0" style="top:613.968px;left:54px;" data-x="54" data-y="178.032">In<span class="w1"> </span>another,<span class="w1"> </span>they<span class="w0"> </span>used<span class="w1"> </span>an<span class="w1"> </span>offline<span class="w1"> </span>whole-program<span class="w0"> </span>static<span class="w1"> </span>analysis<span class="w1"> </span>to</div><div class="l f2 s4 t0" style="top:623.93px;left:54px;" data-x="54" data-y="168.07">infer<span class="w1"> </span>input<span class="w1"> </span>types<span class="w1"> </span>and<span class="w1"> </span>constant<span class="w1"> </span>receiver<span class="w2"> </span>types<span class="w1"> </span>at<span class="w1"> </span>call<span class="w1"> </span>sites.<span class="w1"> </span>Interest-</div><div class="l f2 s4 t0" style="top:633.893px;left:54px;" data-x="54" data-y="158.107">ingly,<span class="w2"> </span>the<span class="w1"> </span>two<span class="w2"> </span>techniques<span class="w1"> </span>produced<span class="w2"> </span>nearly<span class="w1"> </span>the<span class="w1"> </span>same<span class="w2"> </span>performance.</div><div class="l f2 s4 t0" style="top:643.856px;left:65.9552px;" data-x="65.9552" data-y="148.144">Salib<span class="w2"> </span>(17)<span class="w1"> </span>designed<span class="w2"> </span>a<span class="w1"> </span>type<span class="w2"> </span>inference<span class="w2"> </span>algorithm<span class="w1"> </span>for<span class="w2"> </span>Python<span class="w1"> </span>based</div><div class="l f2 s4 t0" style="top:653.818px;left:54px;" data-x="54" data-y="138.182">on<span class="w2"> </span>the<span class="w1"> </span>Cartesian<span class="w2"> </span>Product<span class="w1"> </span>Algorithm<span class="w1"> </span>and<span class="w2"> </span>used<span class="w1"> </span>the<span class="w2"> </span>results<span class="w1"> </span>to<span class="w2"> </span>special-</div><div class="l f2 s4 t0" style="top:663.781px;left:54px;" data-x="54" data-y="128.219">ize<span class="w2"> </span>on<span class="w1"> </span>types<span class="w1"> </span>and<span class="w2"> </span>translate<span class="w1"> </span>the<span class="w1"> </span>program<span class="w2"> </span>to<span class="w1"> </span>C++.</div><div class="l f2 s4 t0" style="top:673.744px;left:65.9552px;" data-x="65.9552" data-y="118.256">McCloskey<span class="w1"> </span>(14)<span class="w0"> </span>has<span class="w0"> </span>work<span class="w1"> </span>in<span class="w0"> </span>progress<span class="w0"> </span>based<span class="w1"> </span>on<span class="w0"> </span>a<span class="w0"> </span>language-</div><div class="l f2 s4 t0" style="top:683.706px;left:54px;" data-x="54" data-y="108.294">independent<span class="w0"> </span>type<span class="w0"> </span>inference<span class="w0"> </span>that<span class="w1"> </span>is<span class="w0"> </span>used<span class="w0"> </span>to<span class="w0"> </span>generate<span class="w0"> </span>efficient<span class="w0"> </span>C</div><div class="l f2 s4 t0" style="top:693.669px;left:54px;" data-x="54" data-y="98.3312">implementations<span class="w2"> </span>of<span class="w1"> </span>JavaScript<span class="w2"> </span>and<span class="w1"> </span>Python<span class="w1"> </span>programs.</div><div class="l f1 s4 t0" style="top:703.631px;left:65.9552px;" data-x="65.9552" data-y="88.3686">Native<span class="w2"> </span>code<span class="w1"> </span>generation<span class="w1"> </span>by<span class="w1"> </span>interpreters.</div><div class="l f2 s4 t0" style="top:703.631px;left:218.246px;" data-x="218.246" data-y="88.3686">The<span class="w1"> </span>traditional<span class="w2"> </span>inter-</div><div class="l f2 s4 t0" style="top:713.594px;left:54px;" data-x="54" data-y="78.4059">preter<span class="w1"> </span>design<span class="w1"> </span>is<span class="w0"> </span>a<span class="w1"> </span>virtual<span class="w1"> </span>machine<span class="w1"> </span>that<span class="w0"> </span>directly<span class="w1"> </span>executes<span class="w1"> </span>ASTs<span class="w1"> </span>or</div><div class="l f2 s4 t0" style="top:723.557px;left:54px;" data-x="54" data-y="68.4433">machine-code-like<span class="w2"> </span>bytecodes.<span class="w2"> </span>Researchers<span class="w1"> </span>have<span class="w2"> </span>shown<span class="w2"> </span>how<span class="w2"> </span>to<span class="w1"> </span>gen-</div><div class="l f2 s4 t0" style="top:79.9701px;left:317.014px;" data-x="317.014" data-y="712.03">erate<span class="w1"> </span>native<span class="w1"> </span>code<span class="w1"> </span>with<span class="w1"> </span>nearly<span class="w1"> </span>the<span class="w1"> </span>same<span class="w1"> </span>structure<span class="w1"> </span>but<span class="w1"> </span>better<span class="w1"> </span>perfor-</div><div class="l f2 s4 t0" style="top:89.9328px;left:317.014px;" data-x="317.014" data-y="702.067">mance.</div><div class="l f2 s4 t0" style="top:99.8954px;left:328.969px;" data-x="328.969" data-y="692.105">Call<span class="w1"> </span>threading,<span class="w1"> </span>also<span class="w0"> </span>known<span class="w2"> </span>as<span class="w0"> </span>context<span class="w1"> </span>threading<span class="w1"> </span>(8),<span class="w1"> </span>compiles</div><div class="l f2 s4 t0" style="top:109.858px;left:317.014px;" data-x="317.014" data-y="682.142">methods<span class="w1"> </span>by<span class="w0"> </span>generating<span class="w1"> </span>a<span class="w0"> </span>native<span class="w1"> </span>call<span class="w0"> </span>instruction<span class="w1"> </span>to<span class="w0"> </span>an<span class="w1"> </span>interpreter</div><div class="l f2 s4 t0" style="top:119.821px;left:317.014px;" data-x="317.014" data-y="672.179">method<span class="w1"> </span>for<span class="w1"> </span>each<span class="w1"> </span>interpreter<span class="w1"> </span>bytecode.<span class="w0"> </span>A<span class="w2"> </span>call-return<span class="w0"> </span>pair<span class="w1"> </span>has<span class="w1"> </span>been</div><div class="l f2 s4 t0" style="top:129.783px;left:317.014px;" data-x="317.014" data-y="662.217">shown<span class="w2"> </span>to<span class="w1"> </span>be<span class="w2"> </span>a<span class="w1"> </span>potentially<span class="w1"> </span>much<span class="w2"> </span>more<span class="w1"> </span>efficient<span class="w2"> </span>dispatch<span class="w1"> </span>mechanism</div><div class="l f2 s4 t0" style="top:139.746px;left:317.014px;" data-x="317.014" data-y="652.254">than<span class="w2"> </span>the<span class="w1"> </span>indirect<span class="w1"> </span>jumps<span class="w2"> </span>used<span class="w1"> </span>in<span class="w1"> </span>standard<span class="w2"> </span>bytecode<span class="w1"> </span>interpreters.</div><div class="l f2 s4 t0" style="top:149.709px;left:328.969px;" data-x="328.969" data-y="642.291">Inline<span class="w1"> </span>threading<span class="w1"> </span>(15)<span class="w0"> </span>copies<span class="w1"> </span>chunks<span class="w1"> </span>of<span class="w0"> </span>interpreter<span class="w1"> </span>native<span class="w1"> </span>code</div><div class="l f2 s4 t0" style="top:159.671px;left:317.014px;" data-x="317.014" data-y="632.329">which<span class="w1"> </span>implement<span class="w1"> </span>the<span class="w2"> </span>required<span class="w1"> </span>bytecodes<span class="w1"> </span>into<span class="w1"> </span>a<span class="w1"> </span>native<span class="w2"> </span>code<span class="w1"> </span>cache,</div><div class="l f2 s4 t0" style="top:169.634px;left:317.014px;" data-x="317.014" data-y="622.366">thus<span class="w2"> </span>acting<span class="w1"> </span>as<span class="w2"> </span>a<span class="w1"> </span>simple<span class="w2"> </span>per-method<span class="w1"> </span>JIT<span class="w2"> </span>compiler<span class="w1"> </span>that<span class="w2"> </span>eliminates<span class="w1"> </span>the</div><div class="l f2 s4 t0" style="top:179.597px;left:317.014px;" data-x="317.014" data-y="612.403">dispatch<span class="w2"> </span>overhead.</div><div class="l f2 s4 t0" style="top:189.559px;left:328.969px;" data-x="328.969" data-y="602.441">Neither<span class="w2"> </span>call<span class="w2"> </span>threading<span class="w1"> </span>nor<span class="w2"> </span>inline<span class="w1"> </span>threading<span class="w2"> </span>perform<span class="w2"> </span>type<span class="w1"> </span>special-</div><div class="l f2 s4 t0" style="top:199.522px;left:317.014px;" data-x="317.014" data-y="592.478">ization.</div><div class="l f2 s4 t0" style="top:209.485px;left:328.969px;" data-x="328.969" data-y="582.515">Apple’s<span class="w1"> </span>SquirrelFish<span class="w1"> </span>Extreme<span class="w1"> </span>(5)<span class="w0"> </span>is<span class="w1"> </span>a<span class="w1"> </span>JavaScript<span class="w1"> </span>implementa-</div><div class="l f2 s4 t0" style="top:219.447px;left:317.014px;" data-x="317.014" data-y="572.553">tion<span class="w1"> </span>based<span class="w1"> </span>on<span class="w1"> </span>call<span class="w1"> </span>threading<span class="w1"> </span>with<span class="w1"> </span>selective<span class="w1"> </span>inline<span class="w1"> </span>threading.<span class="w1"> </span>Com-</div><div class="l f2 s4 t0" style="top:229.41px;left:317.014px;" data-x="317.014" data-y="562.59">bined<span class="w1"> </span>with<span class="w1"> </span>efficient<span class="w1"> </span>interpreter<span class="w0"> </span>engineering,<span class="w1"> </span>these<span class="w1"> </span>threading<span class="w1"> </span>tech-</div><div class="l f2 s4 t0" style="top:239.372px;left:317.014px;" data-x="317.014" data-y="552.628">niques<span class="w2"> </span>have<span class="w2"> </span>given<span class="w1"> </span>SFX<span class="w2"> </span>excellent<span class="w1"> </span>performance<span class="w2"> </span>on<span class="w1"> </span>the<span class="w2"> </span>standard<span class="w2"> </span>Sun-</div><div class="l f2 s4 t0" style="top:249.335px;left:317.014px;" data-x="317.014" data-y="542.665">Spider<span class="w2"> </span>benchmarks.</div><div class="l f2 s4 t0" style="top:259.298px;left:328.969px;" data-x="328.969" data-y="532.702">Google’s<span class="w1"> </span>V8<span class="w0"> </span>is<span class="w0"> </span>a<span class="w1"> </span>JavaScript<span class="w0"> </span>implementation<span class="w1"> </span>primarily<span class="w0"> </span>based</div><div class="l f2 s4 t0" style="top:269.26px;left:317.014px;" data-x="317.014" data-y="522.74">on<span class="w0"> </span>inline<span class="w0"> </span>threading,<span class="w1"> </span>with<span class="w0"> </span>call<span class="w0"> </span>threading<span class="w0"> </span>only<span class="w0"> </span>for<span class="w0"> </span>very<span class="w1"> </span>complex</div><div class="l f2 s4 t0" style="top:279.223px;left:317.014px;" data-x="317.014" data-y="512.777">operations.</div><div class="l f1 s2 t0" style="top:300.477px;left:317.014px;" data-x="317.014" data-y="491.523">9.<span class="w3"> </span>Conclusions</div><div class="l f2 s4 t0" style="top:314.424px;left:317.014px;" data-x="317.014" data-y="477.576">This<span class="w1"> </span>paper<span class="w2"> </span>described<span class="w1"> </span>how<span class="w1"> </span>to<span class="w1"> </span>run<span class="w1"> </span>dynamic<span class="w1"> </span>languages<span class="w2"> </span>efficiently<span class="w1"> </span>by</div><div class="l f2 s4 t0" style="top:324.387px;left:317.014px;" data-x="317.014" data-y="467.613">recording<span class="w1"> </span>hot<span class="w1"> </span>traces<span class="w0"> </span>and<span class="w1"> </span>generating<span class="w1"> </span>type-specialized<span class="w0"> </span>native<span class="w2"> </span>code.</div><div class="l f2 s4 t0" style="top:334.35px;left:317.014px;" data-x="317.014" data-y="457.65">Our<span class="w1"> </span>technique<span class="w1"> </span>focuses<span class="w2"> </span>on<span class="w1"> </span>aggressively<span class="w1"> </span>inlined<span class="w1"> </span>loops,<span class="w1"> </span>and<span class="w1"> </span>for<span class="w1"> </span>each</div><div class="l f2 s4 t0" style="top:344.312px;left:317.014px;" data-x="317.014" data-y="447.688">loop,<span class="w0"> </span>it<span class="w0"> </span>generates<span class="w0"> </span>a<span class="w1"> </span>tree<span class="w0"> </span>of<span class="w0"> </span>native<span class="w0"> </span>code<span class="w0"> </span>traces<span class="w0"> </span>representing<span class="w1"> </span>the</div><div class="l f2 s4 t0" style="top:354.275px;left:317.014px;" data-x="317.014" data-y="437.725">paths<span class="w1"> </span>and<span class="w1"> </span>value<span class="w1"> </span>types<span class="w0"> </span>through<span class="w1"> </span>the<span class="w1"> </span>loop<span class="w1"> </span>observed<span class="w1"> </span>at<span class="w1"> </span>run<span class="w0"> </span>time.<span class="w1"> </span>We</div><div class="l f2 s4 t0" style="top:364.237px;left:317.014px;" data-x="317.014" data-y="427.763">explained<span class="w1"> </span>how<span class="w1"> </span>to<span class="w1"> </span>identify<span class="w1"> </span>loop<span class="w1"> </span>nesting<span class="w1"> </span>relationships<span class="w1"> </span>and<span class="w0"> </span>generate</div><div class="l f2 s4 t0" style="top:374.2px;left:317.014px;" data-x="317.014" data-y="417.8">nested<span class="w0"> </span>traces<span class="w0"> </span>in<span class="w0"> </span>order<span class="w0"> </span>to<span class="w1"> </span>avoid<span class="w0"> </span>excessive<span class="w0"> </span>code<span class="w0"> </span>duplication<span class="w0"> </span>due</div><div class="l f2 s4 t0" style="top:384.163px;left:317.014px;" data-x="317.014" data-y="407.837">to<span class="w0"> </span>the<span class="w1"> </span>many<span class="w0"> </span>paths<span class="w0"> </span>through<span class="w0"> </span>a<span class="w1"> </span>loop<span class="w0"> </span>nest.<span class="w0"> </span>We<span class="w1"> </span>described<span class="w0"> </span>our<span class="w0"> </span>type</div><div class="l f2 s4 t0" style="top:394.125px;left:317.014px;" data-x="317.014" data-y="397.875">specialization<span class="w0"> </span>algorithm.<span class="w0"> </span>W</div><div class="l f2 s4 t0" style="top:394.125px;left:419.473px;" data-x="419.473" data-y="397.875">e<span class="w0"> </span>also<span class="w0"> </span>described<span class="w1"> </span>our<span class="w0"> </span>trace<span class="w0"> </span>compiler,</div><div class="l f2 s4 t0" style="top:404.088px;left:317.014px;" data-x="317.014" data-y="387.912">which<span class="w0"> </span>translates<span class="w0"> </span>a<span class="w1"> </span>trace<span class="w0"> </span>from<span class="w0"> </span>an<span class="w0"> </span>intermediate<span class="w0"> </span>representation<span class="w0"> </span>to</div><div class="l f2 s4 t0" style="top:414.051px;left:317.014px;" data-x="317.014" data-y="377.949">optimized<span class="w2"> </span>native<span class="w1"> </span>code<span class="w2"> </span>in<span class="w1"> </span>two<span class="w1"> </span>linear<span class="w2"> </span>passes.</div><div class="l f2 s4 t0" style="top:424.013px;left:328.969px;" data-x="328.969" data-y="367.987">Our<span class="w1"> </span>experimental<span class="w1"> </span>results<span class="w1"> </span>show<span class="w0"> </span>that<span class="w1"> </span>in<span class="w1"> </span>practice<span class="w1"> </span>loops<span class="w1"> </span>typically</div><div class="l f2 s4 t0" style="top:433.976px;left:317.014px;" data-x="317.014" data-y="358.024">are<span class="w1"> </span>entered<span class="w1"> </span>with<span class="w1"> </span>only<span class="w1"> </span>a<span class="w1"> </span>few<span class="w1"> </span>different<span class="w1"> </span>combinations<span class="w1"> </span>of<span class="w1"> </span>value<span class="w1"> </span>types</div><div class="l f2 s4 t0" style="top:443.939px;left:317.014px;" data-x="317.014" data-y="348.061">of<span class="w1"> </span>variables.<span class="w1"> </span>Thus,<span class="w1"> </span>a<span class="w1"> </span>small<span class="w1"> </span>number<span class="w1"> </span>of<span class="w1"> </span>traces<span class="w1"> </span>per<span class="w1"> </span>loop<span class="w1"> </span>is<span class="w0"> </span>sufficient</div><div class="l f2 s4 t0" style="top:453.901px;left:317.014px;" data-x="317.014" data-y="338.099">to<span class="w1"> </span>run<span class="w0"> </span>a<span class="w1"> </span>program<span class="w0"> </span>efficiently</div><div class="l f2 s4 t0" style="top:453.901px;left:419.778px;" data-x="419.778" data-y="338.099">.<span class="w1"> </span>Our<span class="w0"> </span>experiments<span class="w1"> </span>also<span class="w0"> </span>show<span class="w1"> </span>that<span class="w1"> </span>on</div><div class="l f2 s4 t0" style="top:463.864px;left:317.014px;" data-x="317.014" data-y="328.136">programs<span class="w2"> </span>amenable<span class="w1"> </span>to<span class="w1"> </span>tracing,<span class="w2"> </span>we<span class="w1"> </span>achieve<span class="w2"> </span>speedups<span class="w1"> </span>of<span class="w1"> </span>2x<span class="w2"> </span>to<span class="w1"> </span>20x.</div><div class="l f1 s2 t0" style="top:485.117px;left:317.014px;" data-x="317.014" data-y="306.883">10.<span class="w3"> </span>Future<span class="w1"> </span>W</div><div class="l f1 s2 t0" style="top:485.117px;left:386.614px;" data-x="386.614" data-y="306.883">ork</div><div class="l f2 s4 t0" style="top:499.065px;left:317.014px;" data-x="317.014" data-y="292.935">Work<span class="w1"> </span>is<span class="w0"> </span>underway<span class="w1"> </span>in<span class="w0"> </span>a<span class="w0"> </span>number<span class="w1"> </span>of<span class="w0"> </span>areas<span class="w1"> </span>to<span class="w0"> </span>further<span class="w0"> </span>improve<span class="w1"> </span>the</div><div class="l f2 s4 t0" style="top:509.028px;left:317.014px;" data-x="317.014" data-y="282.972">performance<span class="w1"> </span>of<span class="w1"> </span>our<span class="w1"> </span>trace-based<span class="w1"> </span>JavaScript<span class="w2"> </span>compiler.<span class="w1"> </span>We<span class="w2"> </span>currently</div><div class="l f2 s4 t0" style="top:518.99px;left:317.014px;" data-x="317.014" data-y="273.01">do<span class="w1"> </span>not<span class="w0"> </span>trace<span class="w1"> </span>across<span class="w0"> </span>recursive<span class="w1"> </span>function<span class="w0"> </span>calls,<span class="w1"> </span>but<span class="w0"> </span>plan<span class="w1"> </span>to<span class="w0"> </span>add<span class="w1"> </span>the</div><div class="l f2 s4 t0" style="top:528.953px;left:317.014px;" data-x="317.014" data-y="263.047">support<span class="w1"> </span>for<span class="w1"> </span>this<span class="w1"> </span>capability<span class="w1"> </span>in<span class="w1"> </span>the<span class="w1"> </span>near<span class="w1"> </span>term.<span class="w1"> </span>We<span class="w2"> </span>are<span class="w1"> </span>also<span class="w1"> </span>exploring</div><div class="l f2 s4 t0" style="top:538.916px;left:317.014px;" data-x="317.014" data-y="253.084">adoption<span class="w1"> </span>of<span class="w1"> </span>the<span class="w1"> </span>existing<span class="w2"> </span>work<span class="w1"> </span>on<span class="w1"> </span>tree<span class="w1"> </span>recompilation<span class="w1"> </span>in<span class="w1"> </span>the<span class="w1"> </span>context</div><div class="l f2 s4 t0" style="top:548.878px;left:317.014px;" data-x="317.014" data-y="243.122">of<span class="w1"> </span>the<span class="w2"> </span>presented<span class="w1"> </span>dynamic<span class="w1"> </span>compiler<span class="w1"> </span>in<span class="w2"> </span>order<span class="w1"> </span>to<span class="w1"> </span>minimize<span class="w1"> </span>JIT<span class="w1"> </span>pause</div><div class="l f2 s4 t0" style="top:558.841px;left:317.014px;" data-x="317.014" data-y="233.159">times<span class="w1"> </span>and<span class="w2"> </span>obtain<span class="w1"> </span>the<span class="w1"> </span>best<span class="w1"> </span>of<span class="w2"> </span>both<span class="w1"> </span>worlds,<span class="w1"> </span>fast<span class="w2"> </span>tree<span class="w1"> </span>stitching<span class="w1"> </span>as<span class="w1"> </span>well</div><div class="l f2 s4 t0" style="top:568.804px;left:317.014px;" data-x="317.014" data-y="223.196">as<span class="w2"> </span>the<span class="w1"> </span>improved<span class="w2"> </span>code<span class="w1"> </span>quality<span class="w1"> </span>due<span class="w2"> </span>to<span class="w1"> </span>tree<span class="w1"> </span>recompilation.</div><div class="l f2 s4 t0" style="top:578.766px;left:328.969px;" data-x="328.969" data-y="213.234">We<span class="w2"> </span>also<span class="w0"> </span>plan<span class="w1"> </span>on<span class="w1"> </span>adding<span class="w1"> </span>support<span class="w0"> </span>for<span class="w2"> </span>tracing<span class="w0"> </span>across<span class="w1"> </span>regular<span class="w1"> </span>ex-</div><div class="l f2 s4 t0" style="top:588.729px;left:317.014px;" data-x="317.014" data-y="203.271">pression<span class="w0"> </span>substitutions<span class="w1"> </span>using<span class="w0"> </span>lambda<span class="w0"> </span>functions,<span class="w1"> </span>function<span class="w0"> </span>applica-</div><div class="l f2 s4 t0" style="top:598.692px;left:317.014px;" data-x="317.014" data-y="193.308">tions<span class="w0"> </span>and<span class="w1"> </span>expression<span class="w0"> </span>evaluation<span class="w1"> </span>using</div><div class="l f7 s4 t0" style="top:598.692px;left:461.227px;" data-x="461.227" data-y="193.308">eval</div><div class="l f2 s4 t0" style="top:598.692px;left:480.056px;" data-x="480.056" data-y="193.308">.<span class="w0"> </span>All<span class="w1"> </span>these<span class="w0"> </span>language</div><div class="l f2 s4 t0" style="top:608.654px;left:317.014px;" data-x="317.014" data-y="183.346">constructs<span class="w1"> </span>are<span class="w0"> </span>currently<span class="w1"> </span>executed<span class="w1"> </span>via<span class="w0"> </span>interpretation,<span class="w1"> </span>which<span class="w0"> </span>limits</div><div class="l f2 s4 t0" style="top:618.617px;left:317.014px;" data-x="317.014" data-y="173.383">our<span class="w2"> </span>performance<span class="w1"> </span>for<span class="w1"> </span>applications<span class="w2"> </span>that<span class="w1"> </span>use<span class="w1"> </span>those<span class="w2"> </span>features.</div><div class="l f1 s2 t0" style="top:639.87px;left:317.014px;" data-x="317.014" data-y="152.13">Acknowledgments</div><div class="l f2 s4 t0" style="top:653.818px;left:317.014px;" data-x="317.014" data-y="138.182">Parts<span class="w1"> </span>of<span class="w1"> </span>this<span class="w0"> </span>effort<span class="w1"> </span>have<span class="w1"> </span>been<span class="w1"> </span>sponsored<span class="w0"> </span>by<span class="w1"> </span>the<span class="w1"> </span>National<span class="w0"> </span>Science</div><div class="l f2 s4 t0" style="top:663.781px;left:317.014px;" data-x="317.014" data-y="128.219">Foundation<span class="w2"> </span>under<span class="w1"> </span>grants<span class="w2"> </span>CNS-0615443<span class="w1"> </span>and<span class="w2"> </span>CNS-0627747,<span class="w1"> </span>as<span class="w2"> </span>well</div><div class="l f2 s4 t0" style="top:673.744px;left:317.014px;" data-x="317.014" data-y="118.257">as<span class="w1"> </span>by<span class="w1"> </span>the<span class="w1"> </span>California<span class="w1"> </span>MICRO<span class="w1"> </span>Program<span class="w0"> </span>and<span class="w2"> </span>industrial<span class="w0"> </span>sponsor<span class="w2"> </span>Sun</div><div class="l f2 s4 t0" style="top:683.706px;left:317.014px;" data-x="317.014" data-y="108.294">Microsystems<span class="w2"> </span>under<span class="w1"> </span>Project<span class="w1"> </span>No.<span class="w2"> </span>07-127.</div><div class="l f2 s4 t0" style="top:693.669px;left:328.969px;" data-x="328.969" data-y="98.3312">The<span class="w1"> </span>U.S.<span class="w2"> </span>Government<span class="w1"> </span>is<span class="w1"> </span>authorized<span class="w2"> </span>to<span class="w1"> </span>reproduce<span class="w1"> </span>and<span class="w1"> </span>distribute</div><div class="l f2 s4 t0" style="top:703.631px;left:317.014px;" data-x="317.014" data-y="88.3686">reprints<span class="w2"> </span>for<span class="w1"> </span>Governmental<span class="w2"> </span>purposes<span class="w1"> </span>notwithstanding<span class="w1"> </span>any<span class="w2"> </span>copyright</div><div class="l f2 s4 t0" style="top:713.594px;left:317.014px;" data-x="317.014" data-y="78.406">annotation<span class="w2"> </span>thereon.<span class="w1"> </span>Any<span class="w2"> </span>opinions,<span class="w2"> </span>findings,<span class="w1"> </span>and<span class="w2"> </span>conclusions<span class="w1"> </span>or<span class="w2"> </span>rec-</div><div class="l f2 s4 t0" style="top:723.557px;left:317.014px;" data-x="317.014" data-y="68.4433">ommendations<span class="w1"> </span>expressed<span class="w1"> </span>here<span class="w1"> </span>are<span class="w0"> </span>those<span class="w1"> </span>of<span class="w1"> </span>the<span class="w1"> </span>author<span class="w1"> </span>and<span class="w0"> </span>should</div></div></div><div id="page-14" class="p" style="width:612px;height:792px;"><div class="t"><div class="l f2 s4 t0" style="top:79.9701px;left:54px;" data-x="54" data-y="712.03">not<span class="w1"> </span>be<span class="w0"> </span>interpreted<span class="w0"> </span>as<span class="w1"> </span>necessarily<span class="w0"> </span>representing<span class="w1"> </span>the<span class="w0"> </span>official<span class="w1"> </span>views,</div><div class="l f2 s4 t0" style="top:89.9328px;left:54px;" data-x="54" data-y="702.067">policies<span class="w1"> </span>or<span class="w1"> </span>endorsements,<span class="w1"> </span>either<span class="w0"> </span>expressed<span class="w1"> </span>or<span class="w1"> </span>implied,<span class="w1"> </span>of<span class="w1"> </span>the<span class="w0"> </span>Na-</div><div class="l f2 s4 t0" style="top:99.8954px;left:54px;" data-x="54" data-y="692.105">tional<span class="w2"> </span>Science<span class="w2"> </span>foundation<span class="w1"> </span>(NSF),<span class="w2"> </span>any<span class="w2"> </span>other<span class="w1"> </span>agency<span class="w2"> </span>of<span class="w2"> </span>the<span class="w2"> </span>U.S.<span class="w1"> </span>Gov-</div><div class="l f2 s4 t0" style="top:109.858px;left:54px;" data-x="54" data-y="682.142">ernment,<span class="w2"> </span>or<span class="w1"> </span>any<span class="w1"> </span>of<span class="w2"> </span>the<span class="w1"> </span>companies<span class="w2"> </span>mentioned<span class="w1"> </span>above.</div><div class="l f1 s2 t0" style="top:130.78px;left:54px;" data-x="54" data-y="661.22">References</div><div class="l f2 s3 t0" style="top:143.731px;left:57.9851px;" data-x="57.9851" data-y="648.269">[1]<span class="w1"> </span>LuaJIT<span class="w3"> </span>roadmap<span class="w10"> </span>2008<span class="w3"> </span>-<span class="w10"> </span>http://lua-users.org/lists/lua-l/2008-</div><div class="l f2 s3 t0" style="top:152.697px;left:70.7651px;" data-x="70.7651" data-y="639.303">02/msg00051.html.</div><div class="l f2 s3 t0" style="top:164.404px;left:57.9851px;" data-x="57.9851" data-y="627.596">[2]<span class="w1"> </span>Mozilla<span class="w0"> </span>—<span class="w0"> </span>Firefox<span class="w0"> </span>web<span class="w0"> </span>browser<span class="w1"> </span>and<span class="w0"> </span>Thunderbird<span class="w0"> </span>email<span class="w0"> </span>client<span class="w0"> </span>-</div><div class="l f2 s3 t0" style="top:173.37px;left:70.7651px;" data-x="70.7651" data-y="618.63">http://www.mozilla.com.</div><div class="l f2 s3 t0" style="top:185.076px;left:57.9851px;" data-x="57.9851" data-y="606.924">[3]<span class="w1"> </span>SPECJVM98<span class="w1"> </span>-<span class="w2"> </span>http://www.spec.org/jvm98/.</div><div class="l f2 s3 t0" style="top:196.782px;left:57.9851px;" data-x="57.9851" data-y="595.218">[4]<span class="w1"> </span>SpiderMonkey<span class="w15"> </span>(JavaScript-C)<span class="w15"> </span>Engine<span class="wf"> </span>-</div><div class="l f2 s3 t0" style="top:205.749px;left:70.7651px;" data-x="70.7651" data-y="586.251">http://www.mozilla.org/js/spidermonkey/.</div><div class="l f2 s3 t0" style="top:217.455px;left:57.9851px;" data-x="57.9851" data-y="574.545">[5]<span class="w1"> </span>Surfin’<span class="w1"> </span>Safari<span class="w0"> </span>-<span class="w2"> </span>Blog<span class="w0"> </span>Archive<span class="w2"> </span>-<span class="w1"> </span>Announcing<span class="w0"> </span>SquirrelFish<span class="w2"> </span>Extreme<span class="w0"> </span>-</div><div class="l f2 s3 t0" style="top:226.421px;left:70.7651px;" data-x="70.7651" data-y="565.579">http://webkit.org/blog/214/introducing-squirrelfish-extreme/.</div><div class="l f2 s3 t0" style="top:238.127px;left:57.9851px;" data-x="57.9851" data-y="553.873">[6]<span class="w1"> </span>A.<span class="w0"> </span>Aho,<span class="w1"> </span>R.<span class="w1"> </span>Sethi,<span class="w1"> </span>J.<span class="w0"> </span>Ullman,<span class="w1"> </span>and<span class="w1"> </span>M.<span class="w0"> </span>Lam.<span class="w4"> </span>Compilers:<span class="w1"> </span>Principles,</div><div class="l f2 s3 t0" style="top:247.094px;left:70.7651px;" data-x="70.7651" data-y="544.906">techniques,<span class="w2"> </span>and<span class="w1"> </span>tools,<span class="w2"> </span>2006.</div><div class="l f2 s3 t0" style="top:258.8px;left:57.9851px;" data-x="57.9851" data-y="533.2">[7]<span class="w1"> </span>V.<span class="w1"> </span>Bala,<span class="w1"> </span>E.<span class="w0"> </span>Duesterwald,<span class="w1"> </span>and<span class="w1"> </span>S.<span class="w1"> </span>Banerjia.<span class="w28"> </span>Dynamo:<span class="w1"> </span>A<span class="w1"> </span>transparent</div><div class="l f2 s3 t0" style="top:267.766px;left:70.7651px;" data-x="70.7651" data-y="524.234">dynamic<span class="w2"> </span>optimization<span class="w1"> </span>system.<span class="w0"> </span>In</div><div class="l fa s3 t0" style="top:267.766px;left:180.023px;" data-x="180.023" data-y="524.234">Proceedings<span class="w2"> </span>of<span class="w1"> </span>the<span class="w1"> </span>ACM<span class="w2"> </span>SIGPLAN</div><div class="l fa s3 t0" style="top:276.732px;left:70.7651px;" data-x="70.7651" data-y="515.268">Conference<span class="w2"> </span>on<span class="w1"> </span>Programming<span class="w1"> </span>Language<span class="w1"> </span>Design<span class="w2"> </span>and<span class="w1"> </span>Implementation</div><div class="l f2 s3 t0" style="top:276.732px;left:291.111px;" data-x="291.111" data-y="515.268">,</div><div class="l f2 s3 t0" style="top:285.699px;left:70.7651px;" data-x="70.7651" data-y="506.301">pages<span class="w2"> </span>1–12.<span class="w1"> </span>ACM<span class="w2"> </span>Press,<span class="w2"> </span>2000.</div><div class="l f2 s3 t0" style="top:297.405px;left:57.9851px;" data-x="57.9851" data-y="494.595">[8]<span class="w1"> </span>M.<span class="w1"> </span>Berndl,<span class="w1"> </span>B.<span class="w2"> </span>Vitale,<span class="w1"> </span>M.<span class="w2"> </span>Zaleski,<span class="w1"> </span>and<span class="w2"> </span>A.<span class="w1"> </span>Brown.<span class="w0"> </span>Context<span class="w2"> </span>Threading:</div><div class="l f2 s3 t0" style="top:306.371px;left:70.7651px;" data-x="70.7651" data-y="485.629">a<span class="w1"> </span>Flexible<span class="w1"> </span>and<span class="w1"> </span>Efficient<span class="w2"> </span>Dispatch<span class="w1"> </span>Technique<span class="w1"> </span>for<span class="w1"> </span>Virtual<span class="w2"> </span>Machine<span class="w1"> </span>In-</div><div class="l f2 s3 t0" style="top:315.338px;left:70.7651px;" data-x="70.7651" data-y="476.662">terpreters.<span class="w0"> </span>In</div><div class="l fa s3 t0" style="top:315.338px;left:116.627px;" data-x="116.627" data-y="476.662">Code<span class="w1"> </span>Generation<span class="w2"> </span>and<span class="w1"> </span>Optimization,<span class="w1"> </span>2005.<span class="w1"> </span>CGO<span class="w1"> </span>2005.</div><div class="l fa s3 t0" style="top:324.304px;left:70.7651px;" data-x="70.7651" data-y="467.696">International<span class="w2"> </span>Symposium<span class="w1"> </span>on</div><div class="l f2 s3 t0" style="top:324.304px;left:161.09px;" data-x="161.09" data-y="467.696">,<span class="w2"> </span>pages<span class="w1"> </span>15–26,<span class="w2"> </span>2005.</div><div class="l f2 s3 t0" style="top:336.01px;left:57.9851px;" data-x="57.9851" data-y="455.99">[9]<span class="w1"> </span>C.<span class="w0"> </span>Chambers<span class="w1"> </span>and<span class="w1"> </span>D.<span class="w0"> </span>Ungar.<span class="w4"> </span>Customization:<span class="w0"> </span>Optimizing<span class="w1"> </span>Compiler</div><div class="l f2 s3 t0" style="top:344.977px;left:70.7651px;" data-x="70.7651" data-y="447.023">Technology<span class="w1"> </span>for<span class="w1"> </span>SELF,<span class="w1"> </span>a<span class="w1"> </span>Dynamically-Typed<span class="w1"> </span>O<span class="w0"> </span>bject-Oriented<span class="w1"> </span>Pro-</div><div class="l f2 s3 t0" style="top:353.943px;left:70.7651px;" data-x="70.7651" data-y="438.057">gramming<span class="w1"> </span>Language.<span class="w28"> </span>In</div><div class="l fa s3 t0" style="top:353.943px;left:157.004px;" data-x="157.004" data-y="438.057">Proceedings<span class="w1"> </span>of<span class="w1"> </span>the<span class="w0"> </span>ACM<span class="w1"> </span>SIGPLAN<span class="w1"> </span>1989</div><div class="l fa s3 t0" style="top:362.909px;left:70.7651px;" data-x="70.7651" data-y="429.091">Conference<span class="w2"> </span>on<span class="w1"> </span>Programming<span class="w1"> </span>Language<span class="w1"> </span>Design<span class="w2"> </span>and<span class="w1"> </span>Implementation</div><div class="l f2 s3 t0" style="top:362.909px;left:291.111px;" data-x="291.111" data-y="429.091">,</div><div class="l f2 s3 t0" style="top:371.876px;left:70.7651px;" data-x="70.7651" data-y="420.124">pages<span class="w2"> </span>146–160.<span class="w1"> </span>ACM<span class="w2"> </span>New<span class="w2"> </span>York,<span class="w2"> </span>NY,<span class="w2"> </span>USA,<span class="w2"> </span>1989.</div><div class="l f2 s3 t0" style="top:79.9703px;left:317.014px;" data-x="317.014" data-y="712.03">[10]<span class="w1"> </span>A.<span class="w1"> </span>Gal.</div><div class="l fa s3 t0" style="top:79.9703px;left:362.103px;" data-x="362.103" data-y="712.03">Efficient<span class="w2"> </span>Bytecode<span class="w1"> </span>Verification<span class="w1"> </span>and<span class="w2"> </span>Compilation<span class="w1"> </span>in<span class="w1"> </span>a<span class="w1"> </span>Virtual</div><div class="l fa s3 t0" style="top:88.9366px;left:333.779px;" data-x="333.779" data-y="703.063">Machine<span class="w1"> </span>Dissertation</div><div class="l f2 s3 t0" style="top:88.9366px;left:403.706px;" data-x="403.706" data-y="703.063">.<span class="w0"> </span>PhD<span class="w1"> </span>thesis,<span class="w1"> </span>University<span class="w1"> </span>Of<span class="w1"> </span>California,<span class="w1"> </span>Irvine,</div><div class="l f2 s3 t0" style="top:97.903px;left:333.779px;" data-x="333.779" data-y="694.097">2006.</div><div class="l f2 s3 t0" style="top:109.858px;left:317.014px;" data-x="317.014" data-y="682.142">[11]<span class="w1"> </span>A.<span class="w1"> </span>Gal,<span class="w1"> </span>C.<span class="w1"> </span>W.<span class="w1"> </span>Probst,<span class="w1"> </span>and<span class="w1"> </span>M.<span class="w1"> </span>Franz.<span class="w4"> </span>HotpathVM:<span class="w1"> </span>An<span class="w1"> </span>effective<span class="w1"> </span>JIT</div><div class="l f2 s3 t0" style="top:118.825px;left:333.779px;" data-x="333.779" data-y="673.175">compiler<span class="w1"> </span>for<span class="w0"> </span>resource-constrained<span class="w0"> </span>devices.<span class="w28"> </span>In</div><div class="l fa s3 t0" style="top:118.825px;left:493.287px;" data-x="493.287" data-y="673.175">Proceedings<span class="w1"> </span>of<span class="w0"> </span>the</div><div class="l fa s3 t0" style="top:127.791px;left:333.779px;" data-x="333.779" data-y="664.209">International<span class="w1"> </span>Conference<span class="w1"> </span>on<span class="w1"> </span>Virtual<span class="w1"> </span>Execution<span class="w1"> </span>Environments</div><div class="l f2 s3 t0" style="top:127.791px;left:532.935px;" data-x="532.935" data-y="664.209">,<span class="w1"> </span>pages</div><div class="l f2 s3 t0" style="top:136.757px;left:333.779px;" data-x="333.779" data-y="655.243">144–153.<span class="w2"> </span>ACM<span class="w2"> </span>Press,<span class="w1"> </span>2006.</div><div class="l f2 s3 t0" style="top:148.713px;left:317.014px;" data-x="317.014" data-y="643.287">[12]<span class="w1"> </span>C.<span class="w1"> </span>Garrett,<span class="w1"> </span>J.<span class="w1"> </span>Dean,<span class="w1"> </span>D.<span class="w1"> </span>Grove,<span class="w1"> </span>and<span class="w1"> </span>C.<span class="w1"> </span>Chambers.<span class="w0"> </span>Measurement<span class="w1"> </span>and</div><div class="l f2 s3 t0" style="top:157.679px;left:333.779px;" data-x="333.779" data-y="634.321">Application<span class="w2"> </span>of<span class="w1"> </span>Dynamic<span class="w2"> </span>Receiver<span class="w2"> </span>Class<span class="w1"> </span>Distributions.<span class="w1"> </span>1994.</div><div class="l f2 s3 t0" style="top:169.634px;left:317.014px;" data-x="317.014" data-y="622.366">[13]<span class="w1"> </span>J.<span class="w1"> </span>Ha,<span class="w1"> </span>M.<span class="w2"> </span>R.<span class="w1"> </span>Haghighat,<span class="w1"> </span>S.<span class="w2"> </span>Cong,<span class="w1"> </span>and<span class="w1"> </span>K.<span class="w1"> </span>S.<span class="w2"> </span>McKinley.<span class="w0"> </span>A<span class="w2"> </span>concurrent</div><div class="l f2 s3 t0" style="top:178.6px;left:333.779px;" data-x="333.779" data-y="613.4">trace-based<span class="w1"> </span>just-in-time<span class="w1"> </span>compiler<span class="w0"> </span>for<span class="w1"> </span>javascript.<span class="w4"> </span>Dept.of<span class="w0"> </span>Computer</div><div class="l f2 s3 t0" style="top:187.567px;left:333.779px;" data-x="333.779" data-y="604.433">Sciences,<span class="w2"> </span>The<span class="w1"> </span>University<span class="w2"> </span>of<span class="w2"> </span>Texas<span class="w2"> </span>at<span class="w1"> </span>Austin,<span class="w2"> </span>TR-09-06,<span class="w1"> </span>2009.</div><div class="l f2 s3 t0" style="top:199.522px;left:317.014px;" data-x="317.014" data-y="592.478">[14]<span class="w1"> </span>B.<span class="w1"> </span>McCloskey.<span class="w2"> </span>Personal<span class="w1"> </span>communication.</div><div class="l f2 s3 t0" style="top:211.477px;left:317.014px;" data-x="317.014" data-y="580.523">[15]<span class="w1"> </span>I.<span class="w1"> </span>Piumarta<span class="w2"> </span>and<span class="w2"> </span>F.<span class="w2"> </span>Riccardi.<span class="w1"> </span>Optimizing<span class="w2"> </span>direct<span class="w1"> </span>threaded<span class="w2"> </span>code<span class="w2"> </span>by<span class="w1"> </span>selec-</div><div class="l f2 s3 t0" style="top:220.444px;left:333.779px;" data-x="333.779" data-y="571.556">tive<span class="w2"> </span>inlining.<span class="w0"> </span>In</div><div class="l fa s3 t0" style="top:220.444px;left:387.542px;" data-x="387.542" data-y="571.556">Proceedings<span class="w2"> </span>of<span class="w1"> </span>the<span class="w1"> </span>ACM<span class="w2"> </span>SIGPLAN<span class="w1"> </span>1998<span class="w1"> </span>conference</div><div class="l fa s3 t0" style="top:229.41px;left:333.779px;" data-x="333.779" data-y="562.59">on<span class="w1"> </span>Programming<span class="w1"> </span>language<span class="w1"> </span>design<span class="w0"> </span>and<span class="w1"> </span>implementation</div><div class="l f2 s3 t0" style="top:229.41px;left:513.675px;" data-x="513.675" data-y="562.59">,<span class="w1"> </span>pages<span class="w1"> </span>291–</div><div class="l f2 s3 t0" style="top:238.376px;left:333.779px;" data-x="333.779" data-y="553.624">300.<span class="w2"> </span>ACM<span class="w2"> </span>New<span class="w1"> </span>York,<span class="w2"> </span>NY</div><div class="l f2 s3 t0" style="top:238.376px;left:416.357px;" data-x="416.357" data-y="553.624">,<span class="w2"> </span>USA,<span class="w1"> </span>1998.</div><div class="l f2 s3 t0" style="top:250.331px;left:317.014px;" data-x="317.014" data-y="541.669">[16]<span class="w1"> </span>A.<span class="w0"> </span>Rigo.<span class="w4"> </span>Representation-Based<span class="w1"> </span>Just-In-time<span class="w0"> </span>Specialization<span class="w1"> </span>and<span class="w1"> </span>the</div><div class="l f2 s3 t0" style="top:259.298px;left:333.779px;" data-x="333.779" data-y="532.702">Psyco<span class="w2"> </span>Prototype<span class="w1"> </span>for<span class="w2"> </span>Python.<span class="w1"> </span>In</div><div class="l fa s3 t0" style="top:259.298px;left:435.166px;" data-x="435.166" data-y="532.702">PEPM</div><div class="l f2 s3 t0" style="top:259.298px;left:456.414px;" data-x="456.414" data-y="532.702">,<span class="w2"> </span>2004.</div><div class="l f2 s3 t0" style="top:271.253px;left:317.014px;" data-x="317.014" data-y="520.747">[17]<span class="w1"> </span>M.<span class="w0"> </span>Salib.<span class="w10"> </span>Starkiller:<span class="w1"> </span>A<span class="w0"> </span>Static<span class="w0"> </span>Type<span class="w1"> </span>Inferencer<span class="w0"> </span>and<span class="w1"> </span>Compiler<span class="w0"> </span>for</div><div class="l f2 s3 t0" style="top:280.219px;left:333.779px;" data-x="333.779" data-y="511.781">Python.<span class="w1"> </span>In</div><div class="l fa s3 t0" style="top:280.219px;left:369.859px;" data-x="369.859" data-y="511.781">Master’s<span class="w2"> </span>Thesis</div><div class="l f2 s3 t0" style="top:280.219px;left:420.238px;" data-x="420.238" data-y="511.781">,<span class="w2"> </span>2004.</div><div class="l f2 s3 t0" style="top:292.175px;left:317.014px;" data-x="317.014" data-y="499.825">[18]<span class="w1"> </span>T.<span class="w1"> </span>Suganuma,<span class="w2"> </span>T.<span class="w1"> </span>Yasue,<span class="w2"> </span>and<span class="w1"> </span>T.<span class="w2"> </span>Nakatani.<span class="w0"> </span>A<span class="w1"> </span>Region-Based<span class="w2"> </span>Compila-</div><div class="l f2 s3 t0" style="top:301.141px;left:333.779px;" data-x="333.779" data-y="490.859">tion<span class="w1"> </span>Technique<span class="w2"> </span>for<span class="w1"> </span>Dynamic<span class="w1"> </span>Compilers.</div><div class="l fa s3 t0" style="top:301.141px;left:468.368px;" data-x="468.368" data-y="490.859">ACM<span class="w2"> </span>Transactions<span class="w1"> </span>on<span class="w1"> </span>Pro-</div><div class="l fa s3 t0" style="top:310.107px;left:333.779px;" data-x="333.779" data-y="481.893">gramming<span class="w2"> </span>Languages<span class="w2"> </span>and<span class="w1"> </span>Systems<span class="w2"> </span>(TOPLAS)</div><div class="l f2 s3 t0" style="top:310.107px;left:479.91px;" data-x="479.91" data-y="481.893">,<span class="w2"> </span>28(1):134–174,<span class="w1"> </span>2006.</div><div class="l f2 s3 t0" style="top:322.062px;left:317.014px;" data-x="317.014" data-y="469.938">[19]<span class="w1"> </span>M.<span class="w0"> </span>Zaleski,<span class="w1"> </span>A.<span class="w0"> </span>D.<span class="w0"> </span>Brown,<span class="w1"> </span>and<span class="w0"> </span>K.<span class="w1"> </span>Stoodley.<span class="w28"> </span>YETI:<span class="w0"> </span>A<span class="w0"> </span>graduallY</div><div class="l f2 s3 t0" style="top:331.029px;left:333.779px;" data-x="333.779" data-y="460.971">Extensible<span class="w0"> </span>Trace<span class="w1"> </span>Interpreter.<span class="w10"> </span>In</div><div class="l fa s3 t0" style="top:331.029px;left:447.299px;" data-x="447.299" data-y="460.971">Proceedings<span class="w1"> </span>of<span class="w0"> </span>the<span class="w0"> </span>International</div><div class="l fa s3 t0" style="top:339.995px;left:333.779px;" data-x="333.779" data-y="452.005">Conference<span class="w1"> </span>on<span class="w1"> </span>Virtual<span class="w1"> </span>Execution<span class="w1"> </span>Environments</div><div class="l f2 s3 t0" style="top:339.995px;left:487.41px;" data-x="487.41" data-y="452.005">,<span class="w1"> </span>pages<span class="w1"> </span>83–93.<span class="w1"> </span>ACM</div><div class="l f2 s3 t0" style="top:348.962px;left:333.779px;" data-x="333.779" data-y="443.038">Press,<span class="w2"> </span>2007.</div></div></div></div></body></html> |