(0.000,0.000) T (0.000,0.000) race-based (0.000,0.000) J (0.000,0.000) ust-in-T (0.000,0.000) ime (0.000,0.000) T (0.000,0.000) ype (0.000,0.000) Specialization (0.000,0.000) f (0.000,0.000) or (0.000,0.000) Dynamic (0.000,0.000) Languages (0.000,0.000) Andreas (0.000,0.000) Gal (0.000,0.000) ∗ (0.000,0.000) + (0.000,0.000) , (0.000,0.000) Brendan (0.000,0.000) Eich (0.000,0.000) ∗ (0.000,0.000) , (0.000,0.000) Mik (0.000,0.000) e (0.000,0.000) Sha (0.000,0.000) v (0.000,0.000) er (0.000,0.000) ∗ (0.000,0.000) , (0.000,0.000) Da (0.000,0.000) vid (0.000,0.000) Anderson (0.000,0.000) ∗ (0.000,0.000) , (0.000,0.000) Da (0.000,0.000) vid (0.000,0.000) Mandelin (0.000,0.000) ∗ (0.000,0.000) , (0.000,0.000) Mohammad (0.000,0.000) R. (0.000,0.000) Haghighat (0.000,0.000) $ (0.000,0.000) , (0.000,0.000) Blak (0.000,0.000) e (0.000,0.000) Kaplan (0.000,0.000) ∗ (0.000,0.000) , (0.000,0.000) Graydon (0.000,0.000) Hoare (0.000,0.000) ∗ (0.000,0.000) , (0.000,0.000) Boris (0.000,0.000) Zbarsk (0.000,0.000) y (0.000,0.000) ∗ (0.000,0.000) , (0.000,0.000) Jason (0.000,0.000) Orendorf (0.000,0.000) f (0.000,0.000) ∗ (0.000,0.000) , (0.000,0.000) Jesse (0.000,0.000) Ruderman (0.000,0.000) ∗ (0.000,0.000) , (0.000,0.000) Edwin (0.000,0.000) Smith (0.000,0.000) # (0.000,0.000) , (0.000,0.000) Rick (0.000,0.000) Reitmaier (0.000,0.000) # (0.000,0.000) , (0.000,0.000) Michael (0.000,0.000) Bebenita (0.000,0.000) + (0.000,0.000) , (0.000,0.000) Mason (0.000,0.000) Chang (0.000,0.000) + (0.000,0.000) # (0.000,0.000) , (0.000,0.000) Michael (0.000,0.000) Franz (0.000,0.000) + (0.000,0.000) Mozilla (0.000,0.000) Corporation (0.000,0.000) ∗ (0.000,0.000) { (0.000,0.000) gal,brendan,shaver,danderson,dmandelin,mrbkap,graydon,bz,jorendorff,jruder (0.000,0.000) man (0.000,0.000) } (0.000,0.000) @mozilla.com (0.000,0.000) Adobe (0.000,0.000) Corporation (0.000,0.000) # (0.000,0.000) { (0.000,0.000) edwsmith,rreitmai (0.000,0.000) } (0.000,0.000) @adobe.com (0.000,0.000) Intel (0.000,0.000) Corporation (0.000,0.000) $ (0.000,0.000) { (0.000,0.000) mohammad.r.haghighat (0.000,0.000) } (0.000,0.000) @intel.com (0.000,0.000) Uni (0.000,0.000) v (0.000,0.000) ersity (0.000,0.000) of (0.000,0.000) California, (0.000,0.000) Irvine (0.000,0.000) + (0.000,0.000) { (0.000,0.000) mbebenit,changm,franz (0.000,0.000) } (0.000,0.000) @uci.edu (0.000,0.000) Abstract (0.000,0.000) Dynamic (0.000,0.000) languages (0.000,0.000) such (0.000,0.000) as (0.000,0.000) Ja (0.000,0.000) v (0.000,0.000) aScript (0.000,0.000) are (0.000,0.000) more (0.000,0.000) dif (0.000,0.000) ficult (0.000,0.000) to (0.000,0.000) com- (0.000,0.000) pile (0.000,0.000) than (0.000,0.000) statically (0.000,0.000) typed (0.000,0.000) ones. (0.000,0.000) Since (0.000,0.000) no (0.000,0.000) concrete (0.000,0.000) type (0.000,0.000) information (0.000,0.000) is (0.000,0.000) a (0.000,0.000) v (0.000,0.000) ailable, (0.000,0.000) traditional (0.000,0.000) compilers (0.000,0.000) need (0.000,0.000) to (0.000,0.000) emit (0.000,0.000) generic (0.000,0.000) code (0.000,0.000) that (0.000,0.000) can (0.000,0.000) handle (0.000,0.000) all (0.000,0.000) possible (0.000,0.000) type (0.000,0.000) combinations (0.000,0.000) at (0.000,0.000) runtime. (0.000,0.000) W (0.000,0.000) e (0.000,0.000) present (0.000,0.000) an (0.000,0.000) al- (0.000,0.000) ternati (0.000,0.000) v (0.000,0.000) e (0.000,0.000) compilat (0.000,0.000) ion (0.000,0.000) technique (0.000,0.000) for (0.000,0.000) dynamically-typed (0.000,0.000) languages (0.000,0.000) that (0.000,0.000) identifies (0.000,0.000) frequently (0.000,0.000) e (0.000,0.000) x (0.000,0.000) ecuted (0.000,0.000) loop (0.000,0.000) traces (0.000,0.000) at (0.000,0.000) run-time (0.000,0.000) and (0.000,0.000) then (0.000,0.000) generates (0.000,0.000) machine (0.000,0.000) code (0.000,0.000) on (0.000,0.000) the (0.000,0.000) fly (0.000,0.000) that (0.000,0.000) is (0.000,0.000) specialized (0.000,0.000) for (0.000,0.000) the (0.000,0.000) ac- (0.000,0.000) tual (0.000,0.000) dynamic (0.000,0.000) types (0.000,0.000) occurring (0.000,0.000) on (0.000,0.000) each (0.000,0.000) path (0.000,0.000) through (0.000,0.000) the (0.000,0.000) loop. (0.000,0.000) Our (0.000,0.000) method (0.000,0.000) pro (0.000,0.000) vides (0.000,0.000) cheap (0.000,0.000) inter (0.000,0.000) -procedural (0.000,0.000) type (0.000,0.000) s (0.000,0.000) pecialization, (0.000,0.000) and (0.000,0.000) an (0.000,0.000) ele (0.000,0.000) g (0.000,0.000) ant (0.000,0.000) and (0.000,0.000) ef (0.000,0.000) ficient (0.000,0.000) w (0.000,0.000) ay (0.000,0.000) of (0.000,0.000) incrementally (0.000,0.000) compiling (0.000,0.000) lazily (0.000,0.000) disco (0.000,0.000) v- (0.000,0.000) ered (0.000,0.000) alternati (0.000,0.000) v (0.000,0.000) e (0.000,0.000) paths (0.000,0.000) through (0.000,0.000) nested (0.000,0.000) loops. (0.000,0.000) W (0.000,0.000) e (0.000,0.000) ha (0.000,0.000) v (0.000,0.000) e (0.000,0.000) implemented (0.000,0.000) a (0.000,0.000) dynamic (0.000,0.000) compiler (0.000,0.000) for (0.000,0.000) Ja (0.000,0.000) v (0.000,0.000) aScript (0.000,0.000) based (0.000,0.000) on (0.000,0.000) our (0.000,0.000) technique (0.000,0.000) and (0.000,0.000) we (0.000,0.000) ha (0.000,0.000) v (0.000,0.000) e (0.000,0.000) measured (0.000,0.000) speedups (0.000,0.000) of (0.000,0.000) 10x (0.000,0.000) and (0.000,0.000) more (0.000,0.000) for (0.000,0.000) certain (0.000,0.000) benchmark (0.000,0.000) programs. (0.000,0.000) Categories (0.000,0.000) and (0.000,0.000) Subject (0.000,0.000) Descriptors (0.000,0.000) D.3.4 (0.000,0.000) [ (0.000,0.000) Pr (0.000,0.000) o (0.000,0.000) gr (0.000,0.000) amming (0.000,0.000) Lan- (0.000,0.000) gua (0.000,0.000) g (0.000,0.000) es (0.000,0.000) ]: (0.000,0.000) Processors (0.000,0.000) — (0.000,0.000) Incr (0.000,0.000) emental (0.000,0.000) compiler (0.000,0.000) s, (0.000,0.000) code (0.000,0.000) g (0.000,0.000) ener (0.000,0.000) ation (0.000,0.000) . (0.000,0.000) General (0.000,0.000) T (0.000,0.000) erms (0.000,0.000) Design, (0.000,0.000) Experimentation, (0.000,0.000) Measurement, (0.000,0.000) Perfor (0.000,0.000) - (0.000,0.000) mance. (0.000,0.000) K (0.000,0.000) eyw (0.000,0.000) ords (0.000,0.000) Ja (0.000,0.000) v (0.000,0.000) aScript, (0.000,0.000) just-in-time (0.000,0.000) compilation, (0.000,0.000) trace (0.000,0.000) trees. (0.000,0.000) 1. (0.000,0.000) Intr (0.000,0.000) oduction (0.000,0.000) Dynamic (0.000,0.000) langua (0.000,0.000) g (0.000,0.000) es (0.000,0.000) such (0.000,0.000) as (0.000,0.000) Ja (0.000,0.000) v (0.000,0.000) aScript, (0.000,0.000) Python, (0.000,0.000) and (0.000,0.000) Ruby (0.000,0.000) , (0.000,0.000) are (0.000,0.000) pop- (0.000,0.000) ular (0.000,0.000) since (0.000,0.000) the (0.000,0.000) y (0.000,0.000) are (0.000,0.000) e (0.000,0.000) xpressi (0.000,0.000) v (0.000,0.000) e, (0.000,0.000) ac (0.000,0.000) cessible (0.000,0.000) to (0.000,0.000) non-e (0.000,0.000) xperts, (0.000,0.000) and (0.000,0.000) mak (0.000,0.000) e (0.000,0.000) deplo (0.000,0.000) yment (0.000,0.000) as (0.000,0.000) easy (0.000,0.000) as (0.000,0.000) distrib (0.000,0.000) uting (0.000,0.000) a (0.000,0.000) source (0.000,0.000) file. (0.000,0.000) The (0.000,0.000) y (0.000,0.000) are (0.000,0.000) used (0.000,0.000) for (0.000,0.000) small (0.000,0.000) scripts (0.000,0.000) as (0.000,0.000) well (0.000,0.000) as (0.000,0.000) for (0.000,0.000) comple (0.000,0.000) x (0.000,0.000) applications. (0.000,0.000) Ja (0.000,0.000) v (0.000,0.000) aScript, (0.000,0.000) for (0.000,0.000) e (0.000,0.000) xample, (0.000,0.000) is (0.000,0.000) the (0.000,0.000) de (0.000,0.000) f (0.000,0.000) acto (0.000,0.000) standard (0.000,0.000) for (0.000,0.000) client-side (0.000,0.000) web (0.000,0.000) programming (0.000,0.000) Permission (0.000,0.000) to (0.000,0.000) mak (0.000,0.000) e (0.000,0.000) digital (0.000,0.000) or (0.000,0.000) hard (0.000,0.000) copies (0.000,0.000) of (0.000,0.000) all (0.000,0.000) or (0.000,0.000) part (0.000,0.000) of (0.000,0.000) this (0.000,0.000) w (0.000,0.000) ork (0.000,0.000) for (0.000,0.000) personal (0.000,0.000) or (0.000,0.000) classroom (0.000,0.000) use (0.000,0.000) is (0.000,0.000) granted (0.000,0.000) without (0.000,0.000) fee (0.000,0.000) pro (0.000,0.000) vided (0.000,0.000) that (0.000,0.000) copies (0.000,0.000) are (0.000,0.000) not (0.000,0.000) made (0.000,0.000) or (0.000,0.000) distrib (0.000,0.000) uted (0.000,0.000) for (0.000,0.000) profit (0.000,0.000) or (0.000,0.000) commercial (0.000,0.000) adv (0.000,0.000) antage (0.000,0.000) and (0.000,0.000) that (0.000,0.000) copies (0.000,0.000) bear (0.000,0.000) this (0.000,0.000) notice (0.000,0.000) and (0.000,0.000) the (0.000,0.000) full (0.000,0.000) citation (0.000,0.000) on (0.000,0.000) the (0.000,0.000) first (0.000,0.000) page. (0.000,0.000) T (0.000,0.000) o (0.000,0.000) cop (0.000,0.000) y (0.000,0.000) otherwise, (0.000,0.000) to (0.000,0.000) republish, (0.000,0.000) to (0.000,0.000) post (0.000,0.000) on (0.000,0.000) serv (0.000,0.000) ers (0.000,0.000) or (0.000,0.000) to (0.000,0.000) redistrib (0.000,0.000) ute (0.000,0.000) to (0.000,0.000) lists, (0.000,0.000) requires (0.000,0.000) prior (0.000,0.000) specific (0.000,0.000) permission (0.000,0.000) and/or (0.000,0.000) a (0.000,0.000) fee. (0.000,0.000) PLDI’09, (0.000,0.000) June (0.000,0.000) 15–20, (0.000,0.000) 2009, (0.000,0.000) Dublin, (0.000,0.000) Ireland. (0.000,0.000) Cop (0.000,0.000) yright (0.000,0.000) c (0.000,0.000) (0.000,0.000) 2009 (0.000,0.000) A (0.000,0.000) CM (0.000,0.000) 978-1-60558-392-1/09/06. (0.000,0.000) . (0.000,0.000) . (0.000,0.000) $5.00 (0.000,0.000) and (0.000,0.000) is (0.000,0.000) used (0.000,0.000) for (0.000,0.000) the (0.000,0.000) application (0.000,0.000) logic (0.000,0.000) of (0.000,0.000) bro (0.000,0.000) wser (0.000,0.000) -based (0.000,0.000) producti (0.000,0.000) vity (0.000,0.000) applications (0.000,0.000) such (0.000,0.000) as (0.000,0.000) Google (0.000,0.000) Mail, (0.000,0.000) Google (0.000,0.000) Docs (0.000,0.000) and (0.000,0.000) Zimbra (0.000,0.000) Col- (0.000,0.000) laboration (0.000,0.000) Suite. (0.000,0.000) In (0.000,0.000) this (0.000,0.000) domain, (0.000,0.000) in (0.000,0.000) order (0.000,0.000) to (0.000,0.000) pro (0.000,0.000) vide (0.000,0.000) a (0.000,0.000) fluid (0.000,0.000) user (0.000,0.000) e (0.000,0.000) xperience (0.000,0.000) and (0.000,0.000) enable (0.000,0.000) a (0.000,0.000) ne (0.000,0.000) w (0.000,0.000) generation (0.000,0.000) of (0.000,0.000) applications, (0.000,0.000) virtual (0.000,0.000) ma- (0.000,0.000) chines (0.000,0.000) must (0.000,0.000) pro (0.000,0.000) vide (0.000,0.000) a (0.000,0.000) lo (0.000,0.000) w (0.000,0.000) startup (0.000,0.000) time (0.000,0.000) and (0.000,0.000) high (0.000,0.000) performance. (0.000,0.000) Compilers (0.000,0.000) for (0.000,0.000) statically (0.000,0.000) typed (0.000,0.000) languages (0.000,0.000) rely (0.000,0.000) on (0.000,0.000) type (0.000,0.000) informa- (0.000,0.000) tion (0.000,0.000) to (0.000,0.000) generate (0.000,0.000) ef (0.000,0.000) ficient (0.000,0.000) machine (0.000,0.000) code. (0.000,0.000) In (0.000,0.000) a (0.000,0.000) dynamically (0.000,0.000) typed (0.000,0.000) pro- (0.000,0.000) gramming (0.000,0.000) language (0.000,0.000) such (0.000,0.000) as (0.000,0.000) Ja (0.000,0.000) v (0.000,0.000) aScript, (0.000,0.000) the (0.000,0.000) types (0.000,0.000) of (0.000,0.000) e (0.000,0.000) xpressions (0.000,0.000) may (0.000,0.000) v (0.000,0.000) ary (0.000,0.000) at (0.000,0.000) runtime. (0.000,0.000) This (0.000,0.000) means (0.000,0.000) that (0.000,0.000) the (0.000,0.000) compiler (0.000,0.000) can (0.000,0.000) no (0.000,0.000) longer (0.000,0.000) easily (0.000,0.000) transform (0.000,0.000) operations (0.000,0.000) into (0.000,0.000) machine (0.000,0.000) instructions (0.000,0.000) that (0.000,0.000) operate (0.000,0.000) on (0.000,0.000) one (0.000,0.000) speci (0.000,0.000) fic (0.000,0.000) type. (0.000,0.000) W (0.000,0.000) ithout (0.000,0.000) e (0.000,0.000) xact (0.000,0.000) type (0.000,0.000) information, (0.000,0.000) the (0.000,0.000) compiler (0.000,0.000) must (0.000,0.000) emit (0.000,0.000) slo (0.000,0.000) wer (0.000,0.000) generalized (0.000,0.000) machine (0.000,0.000) code (0.000,0.000) that (0.000,0.000) can (0.000,0.000) deal (0.000,0.000) with (0.000,0.000) all (0.000,0.000) potential (0.000,0.000) type (0.000,0.000) combinations. (0.000,0.000) While (0.000,0.000) compile-time (0.000,0.000) static (0.000,0.000) type (0.000,0.000) infer (0.000,0.000) - (0.000,0.000) ence (0.000,0.000) might (0.000,0.000) be (0.000,0.000) able (0.000,0.000) to (0.000,0.000) g (0.000,0.000) ather (0.000,0.000) type (0.000,0.000) inf (0.000,0.000) ormation (0.000,0.000) to (0.000,0.000) generate (0.000,0.000) opti- (0.000,0.000) mized (0.000,0.000) machine (0.000,0.000) code, (0.000,0.000) traditional (0.000,0.000) static (0.000,0.000) analysis (0.000,0.000) is (0.000,0.000) v (0.000,0.000) ery (0.000,0.000) e (0.000,0.000) xpensi (0.000,0.000) v (0.000,0.000) e (0.000,0.000) and (0.000,0.000) hence (0.000,0.000) not (0.000,0.000) well (0.000,0.000) s (0.000,0.000) uited (0.000,0.000) for (0.000,0.000) the (0.000,0.000) highly (0.000,0.000) interacti (0.000,0.000) v (0.000,0.000) e (0.000,0.000) en (0.000,0.000) vironment (0.000,0.000) of (0.000,0.000) a (0.000,0.000) web (0.000,0.000) bro (0.000,0.000) wser (0.000,0.000) . (0.000,0.000) W (0.000,0.000) e (0.000,0.000) present (0.000,0.000) a (0.000,0.000) trace-based (0.000,0.000) compilation (0.000,0.000) technique (0.000,0.000) for (0.000,0.000) dynamic (0.000,0.000) languages (0.000,0.000) that (0.000,0.000) reconciles (0.000,0.000) speed (0.000,0.000) of (0.000,0.000) compilation (0.000,0.000) with (0.000,0.000) e (0.000,0.000) xcellent (0.000,0.000) per (0.000,0.000) - (0.000,0.000) formance (0.000,0.000) of (0.000,0.000) the (0.000,0.000) generated (0.000,0.000) machine (0.000,0.000) code. (0.000,0.000) Our (0.000,0.000) system (0.000,0.000) uses (0.000,0.000) a (0.000,0.000) mix (0.000,0.000) ed- (0.000,0.000) mode (0.000,0.000) e (0.000,0.000) x (0.000,0.000) ecution (0.000,0.000) approach: (0.000,0.000) the (0.000,0.000) system (0.000,0.000) starts (0.000,0.000) running (0.000,0.000) Ja (0.000,0.000) v (0.000,0.000) aScript (0.000,0.000) in (0.000,0.000) a (0.000,0.000) f (0.000,0.000) ast-starting (0.000,0.000) bytecode (0.000,0.000) interpreter (0.000,0.000) . (0.000,0.000) As (0.000,0.000) the (0.000,0.000) program (0.000,0.000) runs (0.000,0.000) , (0.000,0.000) the (0.000,0.000) system (0.000,0.000) identifies (0.000,0.000) hot (0.000,0.000) (frequently (0.000,0.000) e (0.000,0.000) x (0.000,0.000) ecuted) (0.000,0.000) bytecode (0.000,0.000) sequences, (0.000,0.000) records (0.000,0.000) them, (0.000,0.000) and (0.000,0.000) compiles (0.000,0.000) them (0.000,0.000) to (0.000,0.000) f (0.000,0.000) ast (0.000,0.000) nati (0.000,0.000) v (0.000,0.000) e (0.000,0.000) code. (0.000,0.000) W (0.000,0.000) e (0.000,0.000) c (0.000,0.000) all (0.000,0.000) such (0.000,0.000) a (0.000,0.000) se- (0.000,0.000) quence (0.000,0.000) of (0.000,0.000) instructions (0.000,0.000) a (0.000,0.000) tr (0.000,0.000) ace (0.000,0.000) . (0.000,0.000) Unlik (0.000,0.000) e (0.000,0.000) method-based (0.000,0.000) dynamic (0.000,0.000) compilers, (0.000,0.000) our (0.000,0.000) dynamic (0.000,0.000) com- (0.000,0.000) piler (0.000,0.000) operates (0.000,0.000) at (0.000,0.000) the (0.000,0.000) granularity (0.000,0.000) of (0.000,0.000) indi (0.000,0.000) vidual (0.000,0.000) loops. (0.000,0.000) This (0.000,0.000) design (0.000,0.000) choice (0.000,0.000) is (0.000,0.000) based (0.000,0.000) on (0.000,0.000) the (0.000,0.000) e (0.000,0.000) xpectation (0.000,0.000) that (0.000,0.000) programs (0.000,0.000) spend (0.000,0.000) most (0.000,0.000) of (0.000,0.000) their (0.000,0.000) time (0.000,0.000) in (0.000,0.000) hot (0.000,0.000) loops. (0.000,0.000) Ev (0.000,0.000) en (0.000,0.000) in (0.000,0.000) dynamically (0.000,0.000) typed (0.000,0.000) languages, (0.000,0.000) we (0.000,0.000) e (0.000,0.000) xpect (0.000,0.000) hot (0.000,0.000) l (0.000,0.000) oops (0.000,0.000) to (0.000,0.000) be (0.000,0.000) mostly (0.000,0.000) type-stable (0.000,0.000) , (0.000,0.000) meaning (0.000,0.000) t (0.000,0.000) hat (0.000,0.000) the (0.000,0.000) types (0.000,0.000) of (0.000,0.000) v (0.000,0.000) alues (0.000,0.000) are (0.000,0.000) in (0.000,0.000) v (0.000,0.000) ariant. (0.000,0.000) (12) (0.000,0.000) F (0.000,0.000) or (0.000,0.000) e (0.000,0.000) xample, (0.000,0.000) we (0.000,0.000) w (0.000,0.000) ould (0.000,0.000) e (0.000,0.000) xpect (0.000,0.000) loop (0.000,0.000) coun- (0.000,0.000) ters (0.000,0.000) that (0.000,0.000) start (0.000,0.000) as (0.000,0.000) inte (0.000,0.000) gers (0.000,0.000) to (0.000,0.000) remain (0.000,0.000) inte (0.000,0.000) gers (0.000,0.000) for (0.000,0.000) all (0.000,0.000) iterations. (0.000,0.000) When (0.000,0.000) both (0.000,0.000) of (0.000,0.000) these (0.000,0.000) e (0.000,0.000) xpectations (0.000,0.000) hold, (0.000,0.000) a (0.000,0.000) trace-based (0.000,0.000) compiler (0.000,0.000) can (0.000,0.000) co (0.000,0.000) v (0.000,0.000) er (0.000,0.000) the (0.000,0.000) program (0.000,0.000) e (0.000,0.000) x (0.000,0.000) ecution (0.000,0.000) with (0.000,0.000) a (0.000,0.000) small (0.000,0.000) number (0.000,0.000) of (0.000,0.000) type-specialized, (0.000,0.000) ef- (0.000,0.000) ficiently (0.000,0.000) compiled (0.000,0.000) traces. (0.000,0.000) Each (0.000,0.000) compiled (0.000,0.000) trace (0.000,0.000) co (0.000,0.000) v (0.000,0.000) ers (0.000,0.000) one (0.000,0.000) path (0.000,0.000) through (0.000,0.000) the (0.000,0.000) program (0.000,0.000) with (0.000,0.000) one (0.000,0.000) mapping (0.000,0.000) of (0.000,0.000) v (0.000,0.000) alues (0.000,0.000) to (0.000,0.000) types. (0.000,0.000) When (0.000,0.000) the (0.000,0.000) VM (0.000,0.000) e (0.000,0.000) x (0.000,0.000) ecutes (0.000,0.000) a (0.000,0.000) compiled (0.000,0.000) trace, (0.000,0.000) it (0.000,0.000) cannot (0.000,0.000) guarantee (0.000,0.000) that (0.000,0.000) the (0.000,0.000) same (0.000,0.000) path (0.000,0.000) will (0.000,0.000) be (0.000,0.000) follo (0.000,0.000) wed (0.000,0.000) or (0.000,0.000) that (0.000,0.000) the (0.000,0.000) same (0.000,0.000) types (0.000,0.000) will (0.000,0.000) occur (0.000,0.000) in (0.000,0.000) subsequent (0.000,0.000) loop (0.000,0.000) iterations. (0.000,0.000) Hence, (0.000,0.000) recording (0.000,0.000) and (0.000,0.000) compiling (0.000,0.000) a (0.000,0.000) trace (0.000,0.000) speculates (0.000,0.000) that (0.000,0.000) the (0.000,0.000) path (0.000,0.000) and (0.000,0.000) typing (0.000,0.000) will (0.000,0.000) be (0.000,0.000) e (0.000,0.000) xac (0.000,0.000) tly (0.000,0.000) as (0.000,0.000) the (0.000,0.000) y (0.000,0.000) were (0.000,0.000) during (0.000,0.000) recording (0.000,0.000) for (0.000,0.000) subsequent (0.000,0.000) iterations (0.000,0.000) of (0.000,0.000) the (0.000,0.000) loop. (0.000,0.000) Ev (0.000,0.000) ery (0.000,0.000) compiled (0.000,0.000) trace (0.000,0.000) contains (0.000,0.000) all (0.000,0.000) the (0.000,0.000) guar (0.000,0.000) ds (0.000,0.000) (checks) (0.000,0.000) required (0.000,0.000) to (0.000,0.000) v (0.000,0.000) alidate (0.000,0.000) the (0.000,0.000) speculation. (0.000,0.000) If (0.000,0.000) one (0.000,0.000) of (0.000,0.000) the (0.000,0.000) guards (0.000,0.000) f (0.000,0.000) ails (0.000,0.000) (if (0.000,0.000) control (0.000,0.000) flo (0.000,0.000) w (0.000,0.000) is (0.000,0.000) dif (0.000,0.000) ferent, (0.000,0.000) or (0.000,0.000) a (0.000,0.000) v (0.000,0.000) alue (0.000,0.000) of (0.000,0.000) a (0.000,0.000) dif (0.000,0.000) ferent (0.000,0.000) type (0.000,0.000) is (0.000,0.000) generated), (0.000,0.000) the (0.000,0.000) trace (0.000,0.000) e (0.000,0.000) xits. (0.000,0.000) If (0.000,0.000) an (0.000,0.000) e (0.000,0.000) xit (0.000,0.000) becomes (0.000,0.000) hot, (0.000,0.000) the (0.000,0.000) V (0.000,0.000) M (0.000,0.000) can (0.000,0.000) record (0.000,0.000) a (0.000,0.000) br (0.000,0.000) anc (0.000,0.000) h (0.000,0.000) tr (0.000,0.000) ace (0.000,0.000) starting (0.000,0.000) at (0.000,0.000) the (0.000,0.000) e (0.000,0.000) xit (0.000,0.000) to (0.000,0.000) co (0.000,0.000) v (0.000,0.000) er (0.000,0.000) the (0.000,0.000) ne (0.000,0.000) w (0.000,0.000) path. (0.000,0.000) In (0.000,0.000) this (0.000,0.000) w (0.000,0.000) ay (0.000,0.000) , (0.000,0.000) the (0.000,0.000) VM (0.000,0.000) records (0.000,0.000) a (0.000,0.000) tr (0.000,0.000) ace (0.000,0.000) tr (0.000,0.000) ee (0.000,0.000) co (0.000,0.000) v (0.000,0.000) ering (0.000,0.000) all (0.000,0.000) the (0.000,0.000) hot (0.000,0.000) paths (0.000,0.000) through (0.000,0.000) the (0.000,0.000) loop. (0.000,0.000) Nested (0.000,0.000) loops (0.000,0.000) can (0.000,0.000) be (0.000,0.000) dif (0.000,0.000) ficult (0.000,0.000) to (0.000,0.000) optimize (0.000,0.000) for (0.000,0.000) tracing (0.000,0.000) VMs. (0.000,0.000) In (0.000,0.000) a (0.000,0.000) na (0.000,0.000) ¨ (0.000,0.000) ıv (0.000,0.000) e (0.000,0.000) implementation, (0.000,0.000) inner (0.000,0.000) loops (0.000,0.000) w (0.000,0.000) ould (0.000,0.000) become (0.000,0.000) hot (0.000,0.000) first, (0.000,0.000) and (0.000,0.000) the (0.000,0.000) VM (0.000,0.000) w (0.000,0.000) ould (0.000,0.000) start (0.000,0.000) tracing (0.000,0.000) there. (0.000,0.000) When (0.000,0.000) the (0.000,0.000) inner (0.000,0.000) loop (0.000,0.000) e (0.000,0.000) xits, (0.000,0.000) the (0.000,0.000) VM (0.000,0.000) w (0.000,0.000) ould (0.000,0.000) detect (0.000,0.000) that (0.000,0.000) a (0.000,0.000) dif (0.000,0.000) ferent (0.000,0.000) branch (0.000,0.000) w (0.000,0.000) as (0.000,0.000) tak (0.000,0.000) en. (0.000,0.000) The (0.000,0.000) VM (0.000,0.000) w (0.000,0.000) ould (0.000,0.000) try (0.000,0.000) to (0.000,0.000) record (0.000,0.000) a (0.000,0.000) branch (0.000,0.000) trace, (0.000,0.000) and (0.000,0.000) find (0.000,0.000) that (0.000,0.000) the (0.000,0.000) trace (0.000,0.000) reaches (0.000,0.000) not (0.000,0.000) the (0.000,0.000) inner (0.000,0.000) loop (0.000,0.000) header (0.000,0.000) , (0.000,0.000) b (0.000,0.000) ut (0.000,0.000) the (0.000,0.000) outer (0.000,0.000) loop (0.000,0.000) header (0.000,0.000) . (0.000,0.000) At (0.000,0.000) this (0.000,0.000) point, (0.000,0.000) the (0.000,0.000) VM (0.000,0.000) could (0.000,0.000) continue (0.000,0.000) tracing (0.000,0.000) until (0.000,0.000) it (0.000,0.000) reaches (0.000,0.000) the (0.000,0.000) inner (0.000,0.000) loop (0.000,0.000) header (0.000,0.000) ag (0.000,0.000) ain, (0.000,0.000) thus (0.000,0.000) tracing (0.000,0.000) the (0.000,0.000) outer (0.000,0.000) loop (0.000,0.000) inside (0.000,0.000) a (0.000,0.000) trace (0.000,0.000) tree (0.000,0.000) for (0.000,0.000) the (0.000,0.000) inner (0.000,0.000) loop. (0.000,0.000) But (0.000,0.000) this (0.000,0.000) requires (0.000,0.000) tracing (0.000,0.000) a (0.000,0.000) cop (0.000,0.000) y (0.000,0.000) of (0.000,0.000) the (0.000,0.000) outer (0.000,0.000) loop (0.000,0.000) for (0.000,0.000) e (0.000,0.000) v (0.000,0.000) ery (0.000,0.000) side (0.000,0.000) e (0.000,0.000) xit (0.000,0.000) and (0.000,0.000) type (0.000,0.000) combination (0.000,0.000) in (0.000,0.000) the (0.000,0.000) inner (0.000,0.000) loop. (0.000,0.000) In (0.000,0.000) essence, (0.000,0.000) t (0.000,0.000) his (0.000,0.000) is (0.000,0.000) a (0.000,0.000) form (0.000,0.000) of (0.000,0.000) unintended (0.000,0.000) tail (0.000,0.000) duplication, (0.000,0.000) which (0.000,0.000) can (0.000,0.000) easily (0.000,0.000) o (0.000,0.000) v (0.000,0.000) erflo (0.000,0.000) w (0.000,0.000) the (0.000,0.000) code (0.000,0.000) cache. (0.000,0.000) Alternati (0.000,0.000) v (0.000,0.000) ely (0.000,0.000) , (0.000,0.000) the (0.000,0.000) VM (0.000,0.000) could (0.000,0.000) simply (0.000,0.000) stop (0.000,0.000) tracing, (0.000,0.000) and (0.000,0.000) gi (0.000,0.000) v (0.000,0.000) e (0.000,0.000) up (0.000,0.000) on (0.000,0.000) e (0.000,0.000) v (0.000,0.000) er (0.000,0.000) tracing (0.000,0.000) outer (0.000,0.000) loops. (0.000,0.000) W (0.000,0.000) e (0.000,0.000) solv (0.000,0.000) e (0.000,0.000) the (0.000,0.000) nested (0.000,0.000) loop (0.000,0.000) problem (0.000,0.000) by (0.000,0.000) recording (0.000,0.000) nested (0.000,0.000) tr (0.000,0.000) ace (0.000,0.000) tr (0.000,0.000) ees (0.000,0.000) . (0.000,0.000) Our (0.000,0.000) system (0.000,0.000) traces (0.000,0.000) the (0.000,0.000) inner (0.000,0.000) loop (0.000,0.000) e (0.000,0.000) xactly (0.000,0.000) as (0.000,0.000) the (0.000,0.000) na (0.000,0.000) ¨ (0.000,0.000) ıv (0.000,0.000) e (0.000,0.000) v (0.000,0.000) ersion. (0.000,0.000) The (0.000,0.000) system (0.000,0.000) stops (0.000,0.000) e (0.000,0.000) xtending (0.000,0.000) the (0.000,0.000) inner (0.000,0.000) tree (0.000,0.000) when (0.000,0.000) it (0.000,0.000) reaches (0.000,0.000) an (0.000,0.000) outer (0.000,0.000) loop, (0.000,0.000) b (0.000,0.000) ut (0.000,0.000) then (0.000,0.000) it (0.000,0.000) starts (0.000,0.000) a (0.000,0.000) ne (0.000,0.000) w (0.000,0.000) trace (0.000,0.000) at (0.000,0.000) the (0.000,0.000) outer (0.000,0.000) loop (0.000,0.000) header (0.000,0.000) . (0.000,0.000) When (0.000,0.000) the (0.000,0.000) outer (0.000,0.000) loop (0.000,0.000) reaches (0.000,0.000) the (0.000,0.000) inner (0.000,0.000) loop (0.000,0.000) header (0.000,0.000) , (0.000,0.000) the (0.000,0.000) system (0.000,0.000) tries (0.000,0.000) to (0.000,0.000) call (0.000,0.000) the (0.000,0.000) trac (0.000,0.000) e (0.000,0.000) tree (0.000,0.000) for (0.000,0.000) the (0.000,0.000) inner (0.000,0.000) loop. (0.000,0.000) If (0.000,0.000) the (0.000,0.000) call (0.000,0.000) succeeds, (0.000,0.000) the (0.000,0.000) VM (0.000,0.000) records (0.000,0.000) the (0.000,0.000) cal (0.000,0.000) l (0.000,0.000) to (0.000,0.000) the (0.000,0.000) inner (0.000,0.000) tree (0.000,0.000) as (0.000,0.000) part (0.000,0.000) of (0.000,0.000) the (0.000,0.000) outer (0.000,0.000) trace (0.000,0.000) and (0.000,0.000) finishes (0.000,0.000) the (0.000,0.000) outer (0.000,0.000) trace (0.000,0.000) as (0.000,0.000) normal. (0.000,0.000) In (0.000,0.000) this (0.000,0.000) w (0.000,0.000) ay (0.000,0.000) , (0.000,0.000) our (0.000,0.000) system (0.000,0.000) can (0.000,0.000) trace (0.000,0.000) an (0.000,0.000) y (0.000,0.000) number (0.000,0.000) of (0.000,0.000) loops (0.000,0.000) nested (0.000,0.000) to (0.000,0.000) an (0.000,0.000) y (0.000,0.000) depth (0.000,0.000) without (0.000,0.000) causing (0.000,0.000) e (0.000,0.000) xcessi (0.000,0.000) v (0.000,0.000) e (0.000,0.000) tail (0.000,0.000) duplication. (0.000,0.000) These (0.000,0.000) techniques (0.000,0.000) allo (0.000,0.000) w (0.000,0.000) a (0.000,0.000) VM (0.000,0.000) to (0.000,0.000) dynamically (0.000,0.000) translate (0.000,0.000) a (0.000,0.000) pro- (0.000,0.000) gram (0.000,0.000) to (0.000,0.000) nested, (0.000,0.000) type-specialized (0.000,0.000) trace (0.000,0.000) trees. (0.000,0.000) Because (0.000,0.000) traces (0.000,0.000) can (0.000,0.000) cross (0.000,0.000) function (0.000,0.000) call (0.000,0.000) boundaries, (0.000,0.000) our (0.000,0.000) techniques (0.000,0.000) also (0.000,0.000) achie (0.000,0.000) v (0.000,0.000) e (0.000,0.000) the (0.000,0.000) ef- (0.000,0.000) fects (0.000,0.000) of (0.000,0.000) inlining. (0.000,0.000) Because (0.000,0.000) traces (0.000,0.000) ha (0.000,0.000) v (0.000,0.000) e (0.000,0.000) no (0.000,0.000) internal (0.000,0.000) control-flo (0.000,0.000) w (0.000,0.000) joins, (0.000,0.000) the (0.000,0.000) y (0.000,0.000) can (0.000,0.000) be (0.000,0.000) optimized (0.000,0.000) in (0.000,0.000) linear (0.000,0.000) time (0.000,0.000) by (0.000,0.000) a (0.000,0.000) simple (0.000,0.000) compiler (0.000,0.000) (10). (0.000,0.000) Thus, (0.000,0.000) our (0.000,0.000) tracing (0.000,0.000) VM (0.000,0.000) ef (0.000,0.000) ficiently (0.000,0.000) performs (0.000,0.000) the (0.000,0.000) same (0.000,0.000) kind (0.000,0.000) of (0.000,0.000) op- (0.000,0.000) timizations (0.000,0.000) that (0.000,0.000) w (0.000,0.000) ould (0.000,0.000) require (0.000,0.000) interprocedural (0.000,0.000) analysis (0.000,0.000) in (0.000,0.000) a (0.000,0.000) static (0.000,0.000) optimization (0.000,0.000) setting. (0.000,0.000) This (0.000,0.000) mak (0.000,0.000) es (0.000,0.000) tracing (0.000,0.000) an (0.000,0.000) attracti (0.000,0.000) v (0.000,0.000) e (0.000,0.000) and (0.000,0.000) ef (0.000,0.000) fecti (0.000,0.000) v (0.000,0.000) e (0.000,0.000) tool (0.000,0.000) to (0.000,0.000) type (0.000,0.000) specialize (0.000,0.000) e (0.000,0.000) v (0.000,0.000) en (0.000,0.000) comple (0.000,0.000) x (0.000,0.000) function (0.000,0.000) call-rich (0.000,0.000) code. (0.000,0.000) W (0.000,0.000) e (0.000,0.000) implemented (0.000,0.000) these (0.000,0.000) techniques (0.000,0.000) for (0.000,0.000) an (0.000,0.000) e (0.000,0.000) xisting (0.000,0.000) Ja (0.000,0.000) v (0.000,0.000) aScript (0.000,0.000) in- (0.000,0.000) terpreter (0.000,0.000) , (0.000,0.000) SpiderMonk (0.000,0.000) e (0.000,0.000) y (0.000,0.000) . (0.000,0.000) W (0.000,0.000) e (0.000,0.000) call (0.000,0.000) the (0.000,0.000) resulting (0.000,0.000) tracing (0.000,0.000) VM (0.000,0.000) T (0.000,0.000) r (0.000,0.000) ace- (0.000,0.000) Monk (0.000,0.000) e (0.000,0.000) y (0.000,0.000) . (0.000,0.000) T (0.000,0.000) raceMonk (0.000,0.000) e (0.000,0.000) y (0.000,0.000) supports (0.000,0.000) all (0.000,0.000) the (0.000,0.000) Ja (0.000,0.000) v (0.000,0.000) aScript (0.000,0.000) features (0.000,0.000) of (0.000,0.000) Spi- (0.000,0.000) derMonk (0.000,0.000) e (0.000,0.000) y (0.000,0.000) , (0.000,0.000) with (0.000,0.000) a (0.000,0.000) 2x-20x (0.000,0.000) speedup (0.000,0.000) for (0.000,0.000) traceable (0.000,0.000) programs. (0.000,0.000) This (0.000,0.000) paper (0.000,0.000) mak (0.000,0.000) es (0.000,0.000) the (0.000,0.000) follo (0.000,0.000) wing (0.000,0.000) contrib (0.000,0.000) utions: (0.000,0.000) • (0.000,0.000) W (0.000,0.000) e (0.000,0.000) e (0.000,0.000) xplain (0.000,0.000) an (0.000,0.000) algorithm (0.000,0.000) for (0.000,0.000) dynam (0.000,0.000) ically (0.000,0.000) forming (0.000,0.000) trace (0.000,0.000) trees (0.000,0.000) to (0.000,0.000) co (0.000,0.000) v (0.000,0.000) er (0.000,0.000) a (0.000,0.000) program, (0.000,0.000) representing (0.000,0.000) nested (0.000,0.000) loops (0.000,0.000) as (0.000,0.000) nested (0.000,0.000) trace (0.000,0.000) trees. (0.000,0.000) • (0.000,0.000) W (0.000,0.000) e (0.000,0.000) e (0.000,0.000) xplain (0.000,0.000) ho (0.000,0.000) w (0.000,0.000) to (0.000,0.000) speculati (0.000,0.000) v (0.000,0.000) ely (0.000,0.000) generate (0.000,0.000) ef (0.000,0.000) ficient (0.000,0.000) type-specialized (0.000,0.000) code (0.000,0.000) for (0.000,0.000) traces (0.000,0.000) from (0.000,0.000) dynamic (0.000,0.000) language (0.000,0.000) programs. (0.000,0.000) • (0.000,0.000) W (0.000,0.000) e (0.000,0.000) v (0.000,0.000) alidate (0.000,0.000) our (0.000,0.000) tracing (0.000,0.000) techniques (0.000,0.000) in (0.000,0.000) an (0.000,0.000) implementation (0.000,0.000) based (0.000,0.000) on (0.000,0.000) the (0.000,0.000) SpiderMonk (0.000,0.000) e (0.000,0.000) y (0.000,0.000) Ja (0.000,0.000) v (0.000,0.000) aScript (0.000,0.000) int (0.000,0.000) erpreter (0.000,0.000) , (0.000,0.000) achie (0.000,0.000) ving (0.000,0.000) 2x-20x (0.000,0.000) speedups (0.000,0.000) on (0.000,0.000) man (0.000,0.000) y (0.000,0.000) programs. (0.000,0.000) The (0.000,0.000) remainder (0.000,0.000) of (0.000,0.000) this (0.000,0.000) paper (0.000,0.000) is (0.000,0.000) or (0.000,0.000) g (0.000,0.000) anized (0.000,0.000) as (0.000,0.000) follo (0.000,0.000) ws. (0.000,0.000) Section (0.000,0.000) 3 (0.000,0.000) is (0.000,0.000) a (0.000,0.000) general (0.000,0.000) o (0.000,0.000) v (0.000,0.000) ervie (0.000,0.000) w (0.000,0.000) of (0.000,0.000) trace (0.000,0.000) t (0.000,0.000) ree (0.000,0.000) based (0.000,0.000) compilation (0.000,0.000) we (0.000,0.000) use (0.000,0.000) to (0.000,0.000) cap- (0.000,0.000) ture (0.000,0.000) and (0.000,0.000) compile (0.000,0.000) frequently (0.000,0.000) e (0.000,0.000) x (0.000,0.000) ecuted (0.000,0.000) code (0.000,0.000) re (0.000,0.000) gions. (0.000,0.000) In (0.000,0.000) Section (0.000,0.000) 4 (0.000,0.000) we (0.000,0.000) describe (0.000,0.000) our (0.000,0.000) approach (0.000,0.000) of (0.000,0.000) co (0.000,0.000) v (0.000,0.000) ering (0.000,0.000) nested (0.000,0.000) loops (0.000,0.000) using (0.000,0.000) a (0.000,0.000) num- (0.000,0.000) ber (0.000,0.000) of (0.000,0.000) indi (0.000,0.000) vidual (0.000,0.000) trace (0.000,0.000) trees. (0.000,0.000) In (0.000,0.000) Section (0.000,0.000) 5 (0.000,0.000) we (0.000,0.000) describe (0.000,0.000) our (0.000,0.000) trace- (0.000,0.000) compilation (0.000,0.000) ba (0.000,0.000) sed (0.000,0.000) speculati (0.000,0.000) v (0.000,0.000) e (0.000,0.000) type (0.000,0.000) specialization (0.000,0.000) approach (0.000,0.000) we (0.000,0.000) use (0.000,0.000) to (0.000,0.000) generate (0.000,0.000) ef (0.000,0.000) ficient (0.000,0.000) machine (0.000,0.000) code (0.000,0.000) from (0.000,0.000) recorded (0.000,0.000) bytecode (0.000,0.000) traces. (0.000,0.000) Our (0.000,0.000) implementation (0.000,0.000) of (0.000,0.000) a (0.000,0.000) dynamic (0.000,0.000) type-specializing (0.000,0.000) compiler (0.000,0.000) for (0.000,0.000) Ja (0.000,0.000) v (0.000,0.000) aScript (0.000,0.000) is (0.000,0.000) described (0.000,0.000) in (0.000,0.000) Section (0.000,0.000) 6. (0.000,0.000) Related (0.000,0.000) w (0.000,0.000) ork (0.000,0.000) is (0.000,0.000) discussed (0.000,0.000) in (0.000,0.000) Section (0.000,0.000) 8. (0.000,0.000) In (0.000,0.000) Section (0.000,0.000) 7 (0.000,0.000) we (0.000,0.000) e (0.000,0.000) v (0.000,0.000) aluate (0.000,0.000) our (0.000,0.000) dynamic (0.000,0.000) compiler (0.000,0.000) based (0.000,0.000) on (0.000,0.000) 1 (0.000,0.000) for (0.000,0.000) (var (0.000,0.000) i (0.000,0.000) = (0.000,0.000) 2; (0.000,0.000) i (0.000,0.000) < (0.000,0.000) 100; (0.000,0.000) ++i) (0.000,0.000) { (0.000,0.000) 2 (0.000,0.000) if (0.000,0.000) (!primes[i]) (0.000,0.000) 3 (0.000,0.000) continue; (0.000,0.000) 4 (0.000,0.000) for (0.000,0.000) (var (0.000,0.000) k (0.000,0.000) = (0.000,0.000) i (0.000,0.000) + (0.000,0.000) i; (0.000,0.000) i (0.000,0.000) < (0.000,0.000) 100; (0.000,0.000) k (0.000,0.000) += (0.000,0.000) i) (0.000,0.000) 5 (0.000,0.000) primes[k] (0.000,0.000) = (0.000,0.000) false; (0.000,0.000) 6 (0.000,0.000) } (0.164,239.103) Figur (0.164,239.103) e (0.164,239.103) 1. (0.164,239.103) Sample (0.164,239.103) pr (0.164,239.103) ogram: (0.164,239.103) sie (0.164,239.103) v (0.164,239.103) e (0.164,239.103) of (0.164,239.103) Eratosthenes. (0.164,239.103) primes (0.164,239.103) is (0.164,239.103) initialized (0.164,239.103) to (0.164,239.103) an (0.164,239.103) array (0.164,239.103) of (0.164,239.103) 100 (0.164,239.103) false (0.164,239.103) v (0.164,239.103) alues (0.164,239.103) on (0.164,239.103) entry (0.164,239.103) to (0.164,239.103) this (0.164,239.103) code (0.164,239.103) snippet. (0.164,239.103) Figur (0.164,239.103) e (0.164,239.103) 2. (0.164,239.103) State (0.164,239.103) machine (0.164,239.103) describing (0.164,239.103) the (0.164,239.103) major (0.164,239.103) acti (0.164,239.103) vities (0.164,239.103) of (0.164,239.103) T (0.164,239.103) race- (0.164,239.103) Monk (0.164,239.103) e (0.164,239.103) y (0.164,239.103) and (0.164,239.103) the (0.164,239.103) conditions (0.164,239.103) that (0.164,239.103) cause (0.164,239.103) transitions (0.164,239.103) to (0.164,239.103) a (0.164,239.103) ne (0.164,239.103) w (0.164,239.103) acti (0.164,239.103) v- (0.164,239.103) ity (0.164,239.103) . (0.164,239.103) In (0.164,239.103) the (0.164,239.103) dark (0.164,239.103) box, (0.164,239.103) TM (0.164,239.103) e (0.164,239.103) x (0.164,239.103) ecutes (0.164,239.103) JS (0.164,239.103) as (0.164,239.103) compiled (0.164,239.103) traces. (0.164,239.103) In (0.164,239.103) the (0.164,239.103) light (0.164,239.103) gray (0.164,239.103) box (0.164,239.103) es, (0.164,239.103) TM (0.164,239.103) e (0.164,239.103) x (0.164,239.103) ecutes (0.164,239.103) JS (0.164,239.103) in (0.164,239.103) the (0.164,239.103) standard (0.164,239.103) interpreter (0.164,239.103) . (0.164,239.103) White (0.164,239.103) box (0.164,239.103) es (0.164,239.103) are (0.164,239.103) o (0.164,239.103) v (0.164,239.103) erhead. (0.164,239.103) Thus, (0.164,239.103) to (0.164,239.103) maximize (0.164,239.103) performance, (0.164,239.103) we (0.164,239.103) need (0.164,239.103) to (0.164,239.103) maximize (0.164,239.103) time (0.164,239.103) spent (0.164,239.103) in (0.164,239.103) the (0.164,239.103) dark (0.164,239.103) est (0.164,239.103) box (0.164,239.103) and (0.164,239.103) minimize (0.164,239.103) time (0.164,239.103) spent (0.164,239.103) in (0.164,239.103) the (0.164,239.103) white (0.164,239.103) box (0.164,239.103) es. (0.164,239.103) The (0.164,239.103) best (0.164,239.103) case (0.164,239.103) is (0.164,239.103) a (0.164,239.103) loop (0.164,239.103) where (0.164,239.103) the (0.164,239.103) types (0.164,239.103) at (0.164,239.103) the (0.164,239.103) loop (0.164,239.103) edge (0.164,239.103) are (0.164,239.103) the (0.164,239.103) same (0.164,239.103) as (0.164,239.103) the (0.164,239.103) types (0.164,239.103) on (0.164,239.103) entry–then (0.164,239.103) TM (0.164,239.103) can (0.164,239.103) stay (0.164,239.103) in (0.164,239.103) nati (0.164,239.103) v (0.164,239.103) e (0.164,239.103) code (0.164,239.103) until (0.164,239.103) the (0.164,239.103) loop (0.164,239.103) is (0.164,239.103) done. (0.164,239.103) a (0.164,239.103) set (0.164,239.103) of (0.164,239.103) industry (0.164,239.103) benchmarks. (0.164,239.103) The (0.164,239.103) paper (0.164,239.103) ends (0.164,239.103) with (0.164,239.103) conclusions (0.164,239.103) in (0.164,239.103) Section (0.164,239.103) 9 (0.164,239.103) and (0.164,239.103) an (0.164,239.103) outlook (0.164,239.103) on (0.164,239.103) future (0.164,239.103) w (0.164,239.103) ork (0.164,239.103) is (0.164,239.103) presented (0.164,239.103) in (0.164,239.103) Section (0.164,239.103) 10. (0.164,239.103) 2. (0.164,239.103) Ov (0.164,239.103) er (0.164,239.103) view: (0.164,239.103) Example (0.164,239.103) T (0.164,239.103) racing (0.164,239.103) Run (0.164,239.103) This (0.164,239.103) section (0.164,239.103) pro (0.164,239.103) vides (0.164,239.103) an (0.164,239.103) o (0.164,239.103) v (0.164,239.103) ervie (0.164,239.103) w (0.164,239.103) of (0.164,239.103) our (0.164,239.103) system (0.164,239.103) by (0.164,239.103) describing (0.164,239.103) ho (0.164,239.103) w (0.164,239.103) T (0.164,239.103) raceMonk (0.164,239.103) e (0.164,239.103) y (0.164,239.103) e (0.164,239.103) x (0.164,239.103) ecutes (0.164,239.103) an (0.164,239.103) e (0.164,239.103) xample (0.164,239.103) program. (0.164,239.103) The (0.164,239.103) e (0.164,239.103) xample (0.164,239.103) program, (0.164,239.103) sho (0.164,239.103) wn (0.164,239.103) in (0.164,239.103) Figure (0.164,239.103) 1, (0.164,239.103) computes (0.164,239.103) the (0.164,239.103) first (0.164,239.103) 100 (0.164,239.103) prime (0.164,239.103) numbers (0.164,239.103) with (0.164,239.103) nested (0.164,239.103) loops. (0.164,239.103) The (0.164,239.103) narra (0.164,239.103) ti (0.164,239.103) v (0.164,239.103) e (0.164,239.103) should (0.164,239.103) be (0.164,239.103) read (0.164,239.103) along (0.164,239.103) with (0.164,239.103) Figure (0.164,239.103) 2, (0.164,239.103) which (0.164,239.103) describes (0.164,239.103) the (0.164,239.103) acti (0.164,239.103) vities (0.164,239.103) T (0.164,239.103) raceMonk (0.164,239.103) e (0.164,239.103) y (0.164,239.103) performs (0.164,239.103) and (0.164,239.103) when (0.164,239.103) it (0.164,239.103) transitions (0.164,239.103) between (0.164,239.103) the (0.164,239.103) loops. (0.164,239.103) T (0.164,239.103) raceMonk (0.164,239.103) e (0.164,239.103) y (0.164,239.103) al (0.164,239.103) w (0.164,239.103) ays (0.164,239.103) be (0.164,239.103) gins (0.164,239.103) e (0.164,239.103) x (0.164,239.103) ecuting (0.164,239.103) a (0.164,239.103) program (0.164,239.103) in (0.164,239.103) the (0.164,239.103) byte- (0.164,239.103) code (0.164,239.103) interpreter (0.164,239.103) . (0.164,239.103) Ev (0.164,239.103) ery (0.164,239.103) loop (0.164,239.103) back (0.164,239.103) edge (0.164,239.103) is (0.164,239.103) a (0.164,239.103) potential (0.164,239.103) tra (0.164,239.103) ce (0.164,239.103) point. (0.164,239.103) When (0.164,239.103) the (0.164,239.103) interpreter (0.164,239.103) crosses (0.164,239.103) a (0.164,239.103) loop (0.164,239.103) edge, (0.164,239.103) T (0.164,239.103) raceMonk (0.164,239.103) e (0.164,239.103) y (0.164,239.103) in (0.164,239.103) v (0.164,239.103) ok (0.164,239.103) es (0.164,239.103) the (0.164,239.103) tr (0.164,239.103) ace (0.164,239.103) monitor (0.164,239.103) , (0.164,239.103) which (0.164,239.103) may (0.164,239.103) decide (0.164,239.103) to (0.164,239.103) record (0.164,239.103) or (0.164,239.103) e (0.164,239.103) x (0.164,239.103) ecute (0.164,239.103) a (0.164,239.103) nat (0.164,239.103) i (0.164,239.103) v (0.164,239.103) e (0.164,239.103) trace. (0.164,239.103) At (0.164,239.103) the (0.164,239.103) start (0.164,239.103) of (0.164,239.103) e (0.164,239.103) x (0.164,239.103) ecution, (0.164,239.103) there (0.164,239.103) are (0.164,239.103) no (0.164,239.103) compiled (0.164,239.103) traces (0.164,239.103) yet, (0.164,239.103) so (0.164,239.103) the (0.164,239.103) trace (0.164,239.103) monitor (0.164,239.103) counts (0.164,239.103) the (0.164,239.103) number (0.164,239.103) of (0.164,239.103) times (0.164,239.103) each (0.164,239.103) loop (0.164,239.103) back (0.164,239.103) edge (0.164,239.103) is (0.164,239.103) e (0.164,239.103) x (0.164,239.103) ecuted (0.164,239.103) until (0.164,239.103) a (0.164,239.103) loop (0.164,239.103) becomes (0.164,239.103) hot (0.164,239.103) , (0.164,239.103) currently (0.164,239.103) after (0.164,239.103) 2 (0.164,239.103) crossings. (0.164,239.103) Note (0.164,239.103) that (0.164,239.103) the (0.164,239.103) w (0.164,239.103) ay (0.164,239.103) our (0.164,239.103) loops (0.164,239.103) are (0.164,239.103) compiled, (0.164,239.103) the (0.164,239.103) loop (0.164,239.103) edge (0.164,239.103) is (0.164,239.103) crossed (0.164,239.103) before (0.164,239.103) entering (0.164,239.103) the (0.164,239.103) loop, (0.164,239.103) so (0.164,239.103) the (0.164,239.103) second (0.164,239.103) crossing (0.164,239.103) occurs (0.164,239.103) immediat (0.164,239.103) ely (0.164,239.103) after (0.164,239.103) the (0.164,239.103) first (0.164,239.103) iteration. (0.164,239.103) Here (0.164,239.103) is (0.164,239.103) the (0.164,239.103) sequence (0.164,239.103) of (0.164,239.103) e (0.164,239.103) v (0.164,239.103) ents (0.164,239.103) brok (0.164,239.103) en (0.164,239.103) do (0.164,239.103) wn (0.164,239.103) by (0.164,239.103) outer (0.164,239.103) loop (0.164,239.103) iteration: (0.000,0.000) v0 (0.000,0.000) := (0.000,0.000) ld (0.000,0.000) state[748] (0.000,0.000) // (0.000,0.000) load (0.000,0.000) primes (0.000,0.000) from (0.000,0.000) the (0.000,0.000) trace (0.000,0.000) activation (0.000,0.000) record (0.000,0.000) st (0.000,0.000) sp[0], (0.000,0.000) v0 (0.000,0.000) // (0.000,0.000) store (0.000,0.000) primes (0.000,0.000) to (0.000,0.000) interpreter (0.000,0.000) stack (0.000,0.000) v1 (0.000,0.000) := (0.000,0.000) ld (0.000,0.000) state[764] (0.000,0.000) // (0.000,0.000) load (0.000,0.000) k (0.000,0.000) from (0.000,0.000) the (0.000,0.000) trace (0.000,0.000) activation (0.000,0.000) record (0.000,0.000) v2 (0.000,0.000) := (0.000,0.000) i2f(v1) (0.000,0.000) // (0.000,0.000) convert (0.000,0.000) k (0.000,0.000) from (0.000,0.000) int (0.000,0.000) to (0.000,0.000) double (0.000,0.000) st (0.000,0.000) sp[8], (0.000,0.000) v1 (0.000,0.000) // (0.000,0.000) store (0.000,0.000) k (0.000,0.000) to (0.000,0.000) interpreter (0.000,0.000) stack (0.000,0.000) st (0.000,0.000) sp[16], (0.000,0.000) 0 (0.000,0.000) // (0.000,0.000) store (0.000,0.000) false (0.000,0.000) to (0.000,0.000) interpreter (0.000,0.000) stack (0.000,0.000) v3 (0.000,0.000) := (0.000,0.000) ld (0.000,0.000) v0[4] (0.000,0.000) // (0.000,0.000) load (0.000,0.000) class (0.000,0.000) word (0.000,0.000) for (0.000,0.000) primes (0.000,0.000) v4 (0.000,0.000) := (0.000,0.000) and (0.000,0.000) v3, (0.000,0.000) -4 (0.000,0.000) // (0.000,0.000) mask (0.000,0.000) out (0.000,0.000) object (0.000,0.000) class (0.000,0.000) tag (0.000,0.000) for (0.000,0.000) primes (0.000,0.000) v5 (0.000,0.000) := (0.000,0.000) eq (0.000,0.000) v4, (0.000,0.000) Array (0.000,0.000) // (0.000,0.000) test (0.000,0.000) whether (0.000,0.000) primes (0.000,0.000) is (0.000,0.000) an (0.000,0.000) array (0.000,0.000) xf (0.000,0.000) v5 (0.000,0.000) // (0.000,0.000) side (0.000,0.000) exit (0.000,0.000) if (0.000,0.000) v5 (0.000,0.000) is (0.000,0.000) false (0.000,0.000) v6 (0.000,0.000) := (0.000,0.000) js_Array_set(v0, (0.000,0.000) v2, (0.000,0.000) false) (0.000,0.000) // (0.000,0.000) call (0.000,0.000) function (0.000,0.000) to (0.000,0.000) set (0.000,0.000) array (0.000,0.000) element (0.000,0.000) v7 (0.000,0.000) := (0.000,0.000) eq (0.000,0.000) v6, (0.000,0.000) 0 (0.000,0.000) // (0.000,0.000) test (0.000,0.000) return (0.000,0.000) value (0.000,0.000) from (0.000,0.000) call (0.000,0.000) xt (0.000,0.000) v7 (0.000,0.000) // (0.000,0.000) side (0.000,0.000) exit (0.000,0.000) if (0.000,0.000) js_Array_set (0.000,0.000) returns (0.000,0.000) false. (0.164,502.117) Figur (0.164,502.117) e (0.164,502.117) 3. (0.164,502.117) LIR (0.164,502.117) snippet (0.164,502.117) f (0.164,502.117) or (0.164,502.117) sample (0.164,502.117) pr (0.164,502.117) ogram. (0.164,502.117) This (0.164,502.117) is (0.164,502.117) the (0.164,502.117) LIR (0.164,502.117) recorded (0.164,502.117) for (0.164,502.117) line (0.164,502.117) 5 (0.164,502.117) of (0.164,502.117) the (0.164,502.117) sample (0.164,502.117) program (0.164,502.117) in (0.164,502.117) Figure (0.164,502.117) 1. (0.164,502.117) The (0.164,502.117) LIR (0.164,502.117) encodes (0.164,502.117) the (0.164,502.117) semantics (0.164,502.117) in (0.164,502.117) SSA (0.164,502.117) form (0.164,502.117) using (0.164,502.117) temporary (0.164,502.117) v (0.164,502.117) ariables. (0.164,502.117) The (0.164,502.117) LIR (0.164,502.117) also (0.164,502.117) encodes (0.164,502.117) all (0.164,502.117) the (0.164,502.117) stores (0.164,502.117) that (0.164,502.117) the (0.164,502.117) interpreter (0.164,502.117) w (0.164,502.117) ould (0.164,502.117) do (0.164,502.117) to (0.164,502.117) its (0.164,502.117) data (0.164,502.117) stack. (0.164,502.117) Sometimes (0.164,502.117) these (0.164,502.117) stores (0.164,502.117) can (0.164,502.117) be (0.164,502.117) optimized (0.164,502.117) a (0.164,502.117) w (0.164,502.117) ay (0.164,502.117) as (0.164,502.117) the (0.164,502.117) stack (0.164,502.117) locations (0.164,502.117) are (0.164,502.117) li (0.164,502.117) v (0.164,502.117) e (0.164,502.117) only (0.164,502.117) on (0.164,502.117) e (0.164,502.117) xits (0.164,502.117) to (0.164,502.117) the (0.164,502.117) interpreter (0.164,502.117) . (0.164,502.117) Finally (0.164,502.117) , (0.164,502.117) the (0.164,502.117) LIR (0.164,502.117) records (0.164,502.117) guards (0.164,502.117) and (0.164,502.117) side (0.164,502.117) e (0.164,502.117) xits (0.164,502.117) to (0.164,502.117) v (0.164,502.117) erify (0.164,502.117) the (0.164,502.117) assumptions (0.164,502.117) made (0.164,502.117) in (0.164,502.117) this (0.164,502.117) recording: (0.164,502.117) that (0.164,502.117) primes (0.164,502.117) is (0.164,502.117) an (0.164,502.117) array (0.164,502.117) and (0.164,502.117) that (0.164,502.117) the (0.164,502.117) call (0.164,502.117) to (0.164,502.117) set (0.164,502.117) its (0.164,502.117) element (0.164,502.117) succeeds. (0.164,502.117) mov (0.164,502.117) edx, (0.164,502.117) ebx(748) (0.164,502.117) // (0.164,502.117) load (0.164,502.117) primes (0.164,502.117) from (0.164,502.117) the (0.164,502.117) trace (0.164,502.117) activation (0.164,502.117) record (0.164,502.117) mov (0.164,502.117) edi(0), (0.164,502.117) edx (0.164,502.117) // (0.164,502.117) (*) (0.164,502.117) store (0.164,502.117) primes (0.164,502.117) to (0.164,502.117) interpreter (0.164,502.117) stack (0.164,502.117) mov (0.164,502.117) esi, (0.164,502.117) ebx(764) (0.164,502.117) // (0.164,502.117) load (0.164,502.117) k (0.164,502.117) from (0.164,502.117) the (0.164,502.117) trace (0.164,502.117) activation (0.164,502.117) record (0.164,502.117) mov (0.164,502.117) edi(8), (0.164,502.117) esi (0.164,502.117) // (0.164,502.117) (*) (0.164,502.117) store (0.164,502.117) k (0.164,502.117) to (0.164,502.117) interpreter (0.164,502.117) stack (0.164,502.117) mov (0.164,502.117) edi(16), (0.164,502.117) 0 (0.164,502.117) // (0.164,502.117) (*) (0.164,502.117) store (0.164,502.117) false (0.164,502.117) to (0.164,502.117) interpreter (0.164,502.117) stack (0.164,502.117) mov (0.164,502.117) eax, (0.164,502.117) edx(4) (0.164,502.117) // (0.164,502.117) (*) (0.164,502.117) load (0.164,502.117) object (0.164,502.117) class (0.164,502.117) word (0.164,502.117) for (0.164,502.117) primes (0.164,502.117) and (0.164,502.117) eax, (0.164,502.117) -4 (0.164,502.117) // (0.164,502.117) (*) (0.164,502.117) mask (0.164,502.117) out (0.164,502.117) object (0.164,502.117) class (0.164,502.117) tag (0.164,502.117) for (0.164,502.117) primes (0.164,502.117) cmp (0.164,502.117) eax, (0.164,502.117) Array (0.164,502.117) // (0.164,502.117) (*) (0.164,502.117) test (0.164,502.117) whether (0.164,502.117) primes (0.164,502.117) is (0.164,502.117) an (0.164,502.117) array (0.164,502.117) jne (0.164,502.117) side_exit_1 (0.164,502.117) // (0.164,502.117) (*) (0.164,502.117) side (0.164,502.117) exit (0.164,502.117) if (0.164,502.117) primes (0.164,502.117) is (0.164,502.117) not (0.164,502.117) an (0.164,502.117) array (0.164,502.117) sub (0.164,502.117) esp, (0.164,502.117) 8 (0.164,502.117) // (0.164,502.117) bump (0.164,502.117) stack (0.164,502.117) for (0.164,502.117) call (0.164,502.117) alignment (0.164,502.117) convention (0.164,502.117) push (0.164,502.117) false (0.164,502.117) // (0.164,502.117) push (0.164,502.117) last (0.164,502.117) argument (0.164,502.117) for (0.164,502.117) call (0.164,502.117) push (0.164,502.117) esi (0.164,502.117) // (0.164,502.117) push (0.164,502.117) first (0.164,502.117) argument (0.164,502.117) for (0.164,502.117) call (0.164,502.117) call (0.164,502.117) js_Array_set (0.164,502.117) // (0.164,502.117) call (0.164,502.117) function (0.164,502.117) to (0.164,502.117) set (0.164,502.117) array (0.164,502.117) element (0.164,502.117) add (0.164,502.117) esp, (0.164,502.117) 8 (0.164,502.117) // (0.164,502.117) clean (0.164,502.117) up (0.164,502.117) extra (0.164,502.117) stack (0.164,502.117) space (0.164,502.117) mov (0.164,502.117) ecx, (0.164,502.117) ebx (0.164,502.117) // (0.164,502.117) (*) (0.164,502.117) created (0.164,502.117) by (0.164,502.117) register (0.164,502.117) allocator (0.164,502.117) test (0.164,502.117) eax, (0.164,502.117) eax (0.164,502.117) // (0.164,502.117) (*) (0.164,502.117) test (0.164,502.117) return (0.164,502.117) value (0.164,502.117) of (0.164,502.117) js_Array_set (0.164,502.117) je (0.164,502.117) side_exit_2 (0.164,502.117) // (0.164,502.117) (*) (0.164,502.117) side (0.164,502.117) exit (0.164,502.117) if (0.164,502.117) call (0.164,502.117) failed (0.164,502.117) ... (0.164,502.117) side_exit_1: (0.164,502.117) mov (0.164,502.117) ecx, (0.164,502.117) ebp(-4) (0.164,502.117) // (0.164,502.117) restore (0.164,502.117) ecx (0.164,502.117) mov (0.164,502.117) esp, (0.164,502.117) ebp (0.164,502.117) // (0.164,502.117) restore (0.164,502.117) esp (0.164,502.117) jmp (0.164,502.117) epilog (0.164,502.117) // (0.164,502.117) jump (0.164,502.117) to (0.164,502.117) ret (0.164,502.117) statement (0.164,502.117) Figur (0.164,502.117) e (0.164,502.117) 4. (0.164,502.117) x86 (0.164,502.117) snippet (0.164,502.117) f (0.164,502.117) or (0.164,502.117) sample (0.164,502.117) pr (0.164,502.117) ogram. (0.164,502.117) This (0.164,502.117) is (0.164,502.117) the (0.164,502.117) x86 (0.164,502.117) code (0.164,502.117) compiled (0.164,502.117) from (0.164,502.117) the (0.164,502.117) LIR (0.164,502.117) snippet (0.164,502.117) in (0.164,502.117) Figure (0.164,502.117) 3. (0.164,502.117) Most (0.164,502.117) LIR (0.164,502.117) instructions (0.164,502.117) compile (0.164,502.117) to (0.164,502.117) a (0.164,502.117) single (0.164,502.117) x86 (0.164,502.117) instruction. (0.164,502.117) Instructions (0.164,502.117) mark (0.164,502.117) ed (0.164,502.117) with (0.164,502.117) (*) (0.164,502.117) w (0.164,502.117) ould (0.164,502.117) be (0.164,502.117) omitted (0.164,502.117) by (0.164,502.117) an (0.164,502.117) idealized (0.164,502.117) compiler (0.164,502.117) that (0.164,502.117) kne (0.164,502.117) w (0.164,502.117) that (0.164,502.117) none (0.164,502.117) of (0.164,502.117) the (0.164,502.117) side (0.164,502.117) e (0.164,502.117) xits (0.164,502.117) w (0.164,502.117) ould (0.164,502.117) e (0.164,502.117) v (0.164,502.117) er (0.164,502.117) be (0.164,502.117) tak (0.164,502.117) en. (0.164,502.117) The (0.164,502.117) 17 (0.164,502.117) instructions (0.164,502.117) generated (0.164,502.117) by (0.164,502.117) the (0.164,502.117) compiler (0.164,502.117) compare (0.164,502.117) f (0.164,502.117) a (0.164,502.117) v (0.164,502.117) orably (0.164,502.117) with (0.164,502.117) the (0.164,502.117) 100+ (0.164,502.117) instructions (0.164,502.117) that (0.164,502.117) the (0.164,502.117) interpreter (0.164,502.117) w (0.164,502.117) ould (0.164,502.117) e (0.164,502.117) x (0.164,502.117) ecute (0.164,502.117) for (0.164,502.117) the (0.164,502.117) same (0.164,502.117) code (0.164,502.117) snippet, (0.164,502.117) including (0.164,502.117) 4 (0.164,502.117) indirect (0.164,502.117) jumps. (0.164,502.117) i=2. (0.164,502.117) This (0.164,502.117) is (0.164,502.117) the (0.164,502.117) first (0.164,502.117) iteration (0.164,502.117) of (0.164,502.117) the (0.164,502.117) outer (0.164,502.117) loop. (0.164,502.117) The (0.164,502.117) loop (0.164,502.117) on (0.164,502.117) lines (0.164,502.117) 4-5 (0.164,502.117) becomes (0.164,502.117) hot (0.164,502.117) on (0.164,502.117) its (0.164,502.117) second (0.164,502.117) iteration, (0.164,502.117) so (0.164,502.117) T (0.164,502.117) raceMonk (0.164,502.117) e (0.164,502.117) y (0.164,502.117) en- (0.164,502.117) ters (0.164,502.117) recording (0.164,502.117) mode (0.164,502.117) on (0.164,502.117) line (0.164,502.117) 4. (0.164,502.117) In (0.164,502.117) recording (0.164,502.117) m (0.164,502.117) ode, (0.164,502.117) T (0.164,502.117) raceMonk (0.164,502.117) e (0.164,502.117) y (0.164,502.117) records (0.164,502.117) the (0.164,502.117) code (0.164,502.117) along (0.164,502.117) the (0.164,502.117) trace (0.164,502.117) in (0.164,502.117) a (0.164,502.117) lo (0.164,502.117) w-le (0.164,502.117) v (0.164,502.117) el (0.164,502.117) compiler (0.164,502.117) intermedi- (0.164,502.117) ate (0.164,502.117) representation (0.164,502.117) we (0.164,502.117) call (0.164,502.117) LIR (0.164,502.117) . (0.164,502.117) The (0.164,502.117) LIR (0.164,502.117) trace (0.164,502.117) encodes (0.164,502.117) all (0.164,502.117) the (0.164,502.117) oper (0.164,502.117) - (0.164,502.117) ations (0.164,502.117) performed (0.164,502.117) and (0.164,502.117) the (0.164,502.117) types (0.164,502.117) of (0.164,502.117) all (0.164,502.117) operands. (0.164,502.117) The (0.164,502.117) LIR (0.164,502.117) trace (0.164,502.117) also (0.164,502.117) encodes (0.164,502.117) guar (0.164,502.117) ds (0.164,502.117) , (0.164,502.117) which (0.164,502.117) are (0.164,502.117) checks (0.164,502.117) that (0.164,502.117) v (0.164,502.117) erify (0.164,502.117) that (0.164,502.117) the (0.164,502.117) control (0.164,502.117) flo (0.164,502.117) w (0.164,502.117) and (0.164,502.117) types (0.164,502.117) are (0.164,502.117) identical (0.164,502.117) to (0.164,502.117) those (0.164,502.117) observ (0.164,502.117) ed (0.164,502.117) during (0.164,502.117) trace (0.164,502.117) recording. (0.164,502.117) Thus, (0.164,502.117) on (0.164,502.117) later (0.164,502.117) e (0.164,502.117) x (0.164,502.117) ecutions, (0.164,502.117) if (0.164,502.117) and (0.164,502.117) only (0.164,502.117) if (0.164,502.117) all (0.164,502.117) guards (0.164,502.117) are (0.164,502.117) passed, (0.164,502.117) the (0.164,502.117) trace (0.164,502.117) has (0.164,502.117) the (0.164,502.117) required (0.164,502.117) program (0.164,502.117) semantics. (0.164,502.117) T (0.164,502.117) raceMonk (0.164,502.117) e (0.164,502.117) y (0.164,502.117) stops (0.164,502.117) recording (0.164,502.117) when (0.164,502.117) e (0.164,502.117) x (0.164,502.117) ecution (0.164,502.117) returns (0.164,502.117) to (0.164,502.117) the (0.164,502.117) loop (0.164,502.117) header (0.164,502.117) or (0.164,502.117) e (0.164,502.117) xits (0.164,502.117) the (0.164,502.117) loop. (0.164,502.117) In (0.164,502.117) this (0.164,502.117) case, (0.164,502.117) e (0.164,502.117) x (0.164,502.117) ecution (0.164,502.117) returns (0.164,502.117) to (0.164,502.117) the (0.164,502.117) loop (0.164,502.117) header (0.164,502.117) on (0.164,502.117) line (0.164,502.117) 4. (0.164,502.117) After (0.164,502.117) recording (0.164,502.117) is (0.164,502.117) finished, (0.164,502.117) T (0.164,502.117) raceMonk (0.164,502.117) e (0.164,502.117) y (0.164,502.117) compiles (0.164,502.117) the (0.164,502.117) trace (0.164,502.117) to (0.164,502.117) nati (0.164,502.117) v (0.164,502.117) e (0.164,502.117) code (0.164,502.117) using (0.164,502.117) the (0.164,502.117) recorded (0.164,502.117) type (0.164,502.117) information (0.164,502.117) for (0.164,502.117) optimization. (0.164,502.117) The (0.164,502.117) result (0.164,502.117) is (0.164,502.117) a (0.164,502.117) nati (0.164,502.117) v (0.164,502.117) e (0.164,502.117) code (0.164,502.117) fragment (0.164,502.117) that (0.164,502.117) can (0.164,502.117) be (0.164,502.117) entered (0.164,502.117) if (0.164,502.117) the (0.164,502.117) interpreter (0.164,502.117) PC (0.164,502.117) and (0.164,502.117) the (0.164,502.117) types (0.164,502.117) of (0.164,502.117) v (0.164,502.117) alues (0.164,502.117) match (0.164,502.117) those (0.164,502.117) observ (0.164,502.117) ed (0.164,502.117) when (0.164,502.117) trace (0.164,502.117) recording (0.164,502.117) w (0.164,502.117) as (0.164,502.117) started. (0.164,502.117) The (0.164,502.117) first (0.164,502.117) trace (0.164,502.117) in (0.164,502.117) our (0.164,502.117) e (0.164,502.117) xample, (0.164,502.117) T (0.164,502.117) 45 (0.164,502.117) , (0.164,502.117) co (0.164,502.117) v (0.164,502.117) ers (0.164,502.117) lines (0.164,502.117) 4 (0.164,502.117) and (0.164,502.117) 5. (0.164,502.117) This (0.164,502.117) trace (0.164,502.117) can (0.164,502.117) be (0.164,502.117) entered (0.164,502.117) if (0.164,502.117) the (0.164,502.117) PC (0.164,502.117) is (0.164,502.117) at (0.164,502.117) line (0.164,502.117) 4, (0.164,502.117) i (0.164,502.117) and (0.164,502.117) k (0.164,502.117) are (0.164,502.117) inte (0.164,502.117) gers, (0.164,502.117) and (0.164,502.117) primes (0.164,502.117) is (0.164,502.117) an (0.164,502.117) object. (0.164,502.117) After (0.164,502.117) compiling (0.164,502.117) T (0.164,502.117) 45 (0.164,502.117) , (0.164,502.117) T (0.164,502.117) raceMonk (0.164,502.117) e (0.164,502.117) y (0.164,502.117) returns (0.164,502.117) to (0.164,502.117) the (0.164,502.117) interpreter (0.164,502.117) and (0.164,502.117) loops (0.164,502.117) back (0.164,502.117) to (0.164,502.117) line (0.164,502.117) 1. (0.164,502.117) i=3. (0.164,502.117) No (0.164,502.117) w (0.164,502.117) the (0.164,502.117) loop (0.164,502.117) header (0.164,502.117) at (0.164,502.117) line (0.164,502.117) 1 (0.164,502.117) has (0.164,502.117) become (0.164,502.117) hot, (0.164,502.117) so (0.164,502.117) T (0.164,502.117) race- (0.164,502.117) Monk (0.164,502.117) e (0.164,502.117) y (0.164,502.117) starts (0.164,502.117) recording. (0.164,502.117) When (0.164,502.117) recording (0.164,502.117) reaches (0.164,502.117) line (0.164,502.117) 4, (0.164,502.117) T (0.164,502.117) race- (0.164,502.117) Monk (0.164,502.117) e (0.164,502.117) y (0.164,502.117) observ (0.164,502.117) es (0.164,502.117) that (0.164,502.117) it (0.164,502.117) has (0.164,502.117) reached (0.164,502.117) an (0.164,502.117) inner (0.164,502.117) loop (0.164,502.117) header (0.164,502.117) that (0.164,502.117) al- (0.164,502.117) ready (0.164,502.117) has (0.164,502.117) a (0.164,502.117) compiled (0.164,502.117) trace, (0.164,502.117) so (0.164,502.117) T (0.164,502.117) raceMonk (0.164,502.117) e (0.164,502.117) y (0.164,502.117) attempts (0.164,502.117) to (0.164,502.117) nest (0.164,502.117) the (0.164,502.117) inner (0.164,502.117) loop (0.164,502.117) inside (0.164,502.117) the (0.164,502.117) current (0.164,502.117) trace. (0.164,502.117) The (0.164,502.117) first (0.164,502.117) step (0.164,502.117) is (0.164,502.117) to (0.164,502.117) ca (0.164,502.117) ll (0.164,502.117) the (0.164,502.117) inner (0.164,502.117) trace (0.164,502.117) as (0.164,502.117) a (0.164,502.117) subroutine. (0.164,502.117) This (0.164,502.117) e (0.164,502.117) x (0.164,502.117) ecutes (0.164,502.117) the (0.164,502.117) loop (0.164,502.117) on (0.164,502.117) line (0.164,502.117) 4 (0.164,502.117) to (0.164,502.117) completion (0.164,502.117) and (0.164,502.117) then (0.164,502.117) returns (0.164,502.117) to (0.164,502.117) the (0.164,502.117) recorder (0.164,502.117) . (0.164,502.117) T (0.164,502.117) raceMonk (0.164,502.117) e (0.164,502.117) y (0.164,502.117) v (0.164,502.117) erifies (0.164,502.117) that (0.164,502.117) the (0.164,502.117) call (0.164,502.117) w (0.164,502.117) as (0.164,502.117) successful (0.164,502.117) and (0.164,502.117) then (0.164,502.117) records (0.164,502.117) the (0.164,502.117) call (0.164,502.117) to (0.164,502.117) the (0.164,502.117) inner (0.164,502.117) trace (0.164,502.117) as (0.164,502.117) part (0.164,502.117) of (0.164,502.117) the (0.164,502.117) current (0.164,502.117) trace. (0.164,502.117) Recor (0.164,502.117) ding (0.164,502.117) continues (0.164,502.117) until (0.164,502.117) e (0.164,502.117) x (0.164,502.117) ecution (0.164,502.117) reaches (0.164,502.117) line (0.164,502.117) 1, (0.164,502.117) and (0.164,502.117) at (0.164,502.117) which (0.164,502.117) point (0.164,502.117) T (0.164,502.117) raceMonk (0.164,502.117) e (0.164,502.117) y (0.164,502.117) finishes (0.164,502.117) and (0.164,502.117) compiles (0.164,502.117) a (0.164,502.117) trace (0.164,502.117) for (0.164,502.117) the (0.164,502.117) outer (0.164,502.117) loop, (0.164,502.117) T (0.164,502.117) 16 (0.164,502.117) . (0.000,0.000) i=4. (0.000,0.000) On (0.000,0.000) this (0.000,0.000) iteration, (0.000,0.000) T (0.000,0.000) raceMonk (0.000,0.000) e (0.000,0.000) y (0.000,0.000) calls (0.000,0.000) T (0.000,0.000) 16 (0.000,0.000) . (0.000,0.000) Because (0.000,0.000) i=4 (0.000,0.000) , (0.000,0.000) the (0.000,0.000) if (0.000,0.000) statement (0.000,0.000) on (0.000,0.000) line (0.000,0.000) 2 (0.000,0.000) is (0.000,0.000) tak (0.000,0.000) en. (0.000,0.000) This (0.000,0.000) branch (0.000,0.000) w (0.000,0.000) as (0.000,0.000) not (0.000,0.000) tak (0.000,0.000) en (0.000,0.000) in (0.000,0.000) the (0.000,0.000) original (0.000,0.000) trace, (0.000,0.000) so (0.000,0.000) this (0.000,0.000) causes (0.000,0.000) T (0.000,0.000) 16 (0.000,0.000) to (0.000,0.000) f (0.000,0.000) ail (0.000,0.000) a (0.000,0.000) guard (0.000,0.000) and (0.000,0.000) tak (0.000,0.000) e (0.000,0.000) a (0.000,0.000) side (0.000,0.000) e (0.000,0.000) xit. (0.000,0.000) The (0.000,0.000) e (0.000,0.000) xit (0.000,0.000) is (0.000,0.000) not (0.000,0.000) yet (0.000,0.000) hot, (0.000,0.000) so (0.000,0.000) T (0.000,0.000) raceMonk (0.000,0.000) e (0.000,0.000) y (0.000,0.000) returns (0.000,0.000) to (0.000,0.000) the (0.000,0.000) interpreter (0.000,0.000) , (0.000,0.000) which (0.000,0.000) e (0.000,0.000) x (0.000,0.000) ecutes (0.000,0.000) the (0.000,0.000) continue (0.000,0.000) statement. (0.000,0.000) i=5. (0.000,0.000) T (0.000,0.000) raceMonk (0.000,0.000) e (0.000,0.000) y (0.000,0.000) calls (0.000,0.000) T (0.000,0.000) 16 (0.000,0.000) , (0.000,0.000) which (0.000,0.000) in (0.000,0.000) turn (0.000,0.000) calls (0.000,0.000) the (0.000,0.000) nested (0.000,0.000) trace (0.000,0.000) T (0.000,0.000) 45 (0.000,0.000) . (0.000,0.000) T (0.000,0.000) 16 (0.000,0.000) loops (0.000,0.000) back (0.000,0.000) to (0.000,0.000) its (0.000,0.000) o (0.000,0.000) wn (0.000,0.000) header (0.000,0.000) , (0.000,0.000) starting (0.000,0.000) the (0.000,0.000) ne (0.000,0.000) xt (0.000,0.000) iteration (0.000,0.000) without (0.000,0.000) e (0.000,0.000) v (0.000,0.000) er (0.000,0.000) returning (0.000,0.000) to (0.000,0.000) the (0.000,0.000) monitor (0.000,0.000) . (0.000,0.000) i=6. (0.000,0.000) On (0.000,0.000) this (0.000,0.000) iteration, (0.000,0.000) the (0.000,0.000) side (0.000,0.000) e (0.000,0.000) xit (0.000,0.000) on (0.000,0.000) line (0.000,0.000) 2 (0.000,0.000) is (0.000,0.000) tak (0.000,0.000) en (0.000,0.000) ag (0.000,0.000) ain. (0.000,0.000) This (0.000,0.000) time, (0.000,0.000) the (0.000,0.000) side (0.000,0.000) e (0.000,0.000) xit (0.000,0.000) becomes (0.000,0.000) hot, (0.000,0.000) so (0.000,0.000) a (0.000,0.000) trace (0.000,0.000) T (0.000,0.000) 23 (0.000,0.000) , (0.000,0.000) 1 (0.000,0.000) is (0.000,0.000) recorded (0.000,0.000) that (0.000,0.000) co (0.000,0.000) v (0.000,0.000) ers (0.000,0.000) line (0.000,0.000) 3 (0.000,0.000) and (0.000,0.000) returns (0.000,0.000) to (0.000,0.000) the (0.000,0.000) loop (0.000,0.000) header (0.000,0.000) . (0.000,0.000) Thus, (0.000,0.000) the (0.000,0.000) end (0.000,0.000) of (0.000,0.000) T (0.000,0.000) 23 (0.000,0.000) , (0.000,0.000) 1 (0.000,0.000) jumps (0.000,0.000) directly (0.000,0.000) to (0.000,0.000) the (0.000,0.000) start (0.000,0.000) of (0.000,0.000) T (0.000,0.000) 16 (0.000,0.000) . (0.000,0.000) The (0.000,0.000) side (0.000,0.000) e (0.000,0.000) xit (0.000,0.000) is (0.000,0.000) patched (0.000,0.000) so (0.000,0.000) that (0.000,0.000) on (0.000,0.000) future (0.000,0.000) iterations, (0.000,0.000) it (0.000,0.000) jumps (0.000,0.000) directly (0.000,0.000) to (0.000,0.000) T (0.000,0.000) 23 (0.000,0.000) , (0.000,0.000) 1 (0.000,0.000) . (0.000,0.000) At (0.000,0.000) this (0.000,0.000) point, (0.000,0.000) T (0.000,0.000) raceMonk (0.000,0.000) e (0.000,0.000) y (0.000,0.000) has (0.000,0.000) compiled (0.000,0.000) enough (0.000,0.000) traces (0.000,0.000) to (0.000,0.000) co (0.000,0.000) v (0.000,0.000) er (0.000,0.000) the (0.000,0.000) entire (0.000,0.000) nested (0.000,0.000) loop (0.000,0.000) st (0.000,0.000) ructure, (0.000,0.000) so (0.000,0.000) the (0.000,0.000) rest (0.000,0.000) of (0.000,0.000) the (0.000,0.000) program (0.000,0.000) runs (0.000,0.000) entirely (0.000,0.000) as (0.000,0.000) nati (0.000,0.000) v (0.000,0.000) e (0.000,0.000) code. (0.000,0.000) 3. (0.000,0.000) T (0.000,0.000) race (0.000,0.000) T (0.000,0.000) r (0.000,0.000) ees (0.000,0.000) In (0.000,0.000) this (0.000,0.000) section, (0.000,0.000) we (0.000,0.000) describe (0.000,0.000) traces, (0.000,0.000) trace (0.000,0.000) trees, (0.000,0.000) and (0.000,0.000) ho (0.000,0.000) w (0.000,0.000) the (0.000,0.000) y (0.000,0.000) are (0.000,0.000) formed (0.000,0.000) at (0.000,0.000) run (0.000,0.000) time. (0.000,0.000) Although (0.000,0.000) our (0.000,0.000) techniques (0.000,0.000) apply (0.000,0.000) to (0.000,0.000) an (0.000,0.000) y (0.000,0.000) dynamic (0.000,0.000) language (0.000,0.000) interpreter (0.000,0.000) , (0.000,0.000) we (0.000,0.000) will (0.000,0.000) describe (0.000,0.000) them (0.000,0.000) assuming (0.000,0.000) a (0.000,0.000) bytecode (0.000,0.000) interpreter (0.000,0.000) to (0.000,0.000) k (0.000,0.000) eep (0.000,0.000) the (0.000,0.000) e (0.000,0.000) xposition (0.000,0.000) simple. (0.000,0.000) 3.1 (0.000,0.000) T (0.000,0.000) races (0.000,0.000) A (0.000,0.000) tr (0.000,0.000) ace (0.000,0.000) is (0.000,0.000) sim (0.000,0.000) ply (0.000,0.000) a (0.000,0.000) program (0.000,0.000) path, (0.000,0.000) which (0.000,0.000) may (0.000,0.000) cross (0.000,0.000) function (0.000,0.000) call (0.000,0.000) boundaries. (0.000,0.000) T (0.000,0.000) raceMonk (0.000,0.000) e (0.000,0.000) y (0.000,0.000) focuses (0.000,0.000) on (0.000,0.000) loop (0.000,0.000) tr (0.000,0.000) aces (0.000,0.000) , (0.000,0.000) that (0.000,0.000) originate (0.000,0.000) at (0.000,0.000) a (0.000,0.000) loop (0.000,0.000) edge (0.000,0.000) and (0.000,0.000) represent (0.000,0.000) a (0.000,0.000) single (0.000,0.000) iteration (0.000,0.000) through (0.000,0.000) the (0.000,0.000) associated (0.000,0.000) loop. (0.000,0.000) Similar (0.000,0.000) to (0.000,0.000) an (0.000,0.000) e (0.000,0.000) xtended (0.000,0.000) basic (0.000,0.000) block, (0.000,0.000) a (0.000,0.000) trace (0.000,0.000) is (0.000,0.000) only (0.000,0.000) entered (0.000,0.000) at (0.000,0.000) the (0.000,0.000) top, (0.000,0.000) b (0.000,0.000) ut (0.000,0.000) may (0.000,0.000) ha (0.000,0.000) v (0.000,0.000) e (0.000,0.000) man (0.000,0.000) y (0.000,0.000) e (0.000,0.000) xits. (0.000,0.000) In (0.000,0.000) contrast (0.000,0.000) to (0.000,0.000) an (0.000,0.000) e (0.000,0.000) xtended (0.000,0.000) basic (0.000,0.000) block, (0.000,0.000) a (0.000,0.000) trace (0.000,0.000) can (0.000,0.000) contain (0.000,0.000) join (0.000,0.000) nodes. (0.000,0.000) Since (0.000,0.000) a (0.000,0.000) trace (0.000,0.000) al (0.000,0.000) w (0.000,0.000) ays (0.000,0.000) only (0.000,0.000) follo (0.000,0.000) ws (0.000,0.000) one (0.000,0.000) single (0.000,0.000) path (0.000,0.000) through (0.000,0.000) the (0.000,0.000) original (0.000,0.000) program, (0.000,0.000) ho (0.000,0.000) we (0.000,0.000) v (0.000,0.000) er (0.000,0.000) , (0.000,0.000) join (0.000,0.000) nodes (0.000,0.000) are (0.000,0.000) not (0.000,0.000) recognizable (0.000,0.000) as (0.000,0.000) such (0.000,0.000) in (0.000,0.000) a (0.000,0.000) trace (0.000,0.000) and (0.000,0.000) ha (0.000,0.000) v (0.000,0.000) e (0.000,0.000) a (0.000,0.000) single (0.000,0.000) predecessor (0.000,0.000) node (0.000,0.000) lik (0.000,0.000) e (0.000,0.000) re (0.000,0.000) gular (0.000,0.000) nodes. (0.000,0.000) A (0.000,0.000) typed (0.000,0.000) tr (0.000,0.000) ace (0.000,0.000) is (0.000,0.000) a (0.000,0.000) trace (0.000,0.000) annotated (0.000,0.000) with (0.000,0.000) a (0.000,0.000) type (0.000,0.000) for (0.000,0.000) e (0.000,0.000) v (0.000,0.000) ery (0.000,0.000) v (0.000,0.000) ariable (0.000,0.000) (including (0.000,0.000) temporaries) (0.000,0.000) on (0.000,0.000) the (0.000,0.000) trace. (0.000,0.000) A (0.000,0.000) typed (0.000,0.000) trace (0.000,0.000) also (0.000,0.000) has (0.000,0.000) an (0.000,0.000) entry (0.000,0.000) type (0.000,0.000) map (0.000,0.000) gi (0.000,0.000) ving (0.000,0.000) the (0.000,0.000) required (0.000,0.000) types (0.000,0.000) for (0.000,0.000) v (0.000,0.000) ariables (0.000,0.000) used (0.000,0.000) on (0.000,0.000) the (0.000,0.000) trace (0.000,0.000) before (0.000,0.000) the (0.000,0.000) y (0.000,0.000) are (0.000,0.000) defined. (0.000,0.000) F (0.000,0.000) or (0.000,0.000) e (0.000,0.000) xample, (0.000,0.000) a (0.000,0.000) trace (0.000,0.000) could (0.000,0.000) ha (0.000,0.000) v (0.000,0.000) e (0.000,0.000) a (0.000,0.000) type (0.000,0.000) map (0.000,0.000) (x: (0.000,0.000) int, (0.000,0.000) b: (0.000,0.000) boolean) (0.000,0.000) , (0.000,0.000) meaning (0.000,0.000) that (0.000,0.000) the (0.000,0.000) trace (0.000,0.000) may (0.000,0.000) be (0.000,0.000) entered (0.000,0.000) only (0.000,0.000) if (0.000,0.000) the (0.000,0.000) v (0.000,0.000) alue (0.000,0.000) of (0.000,0.000) the (0.000,0.000) v (0.000,0.000) ariable (0.000,0.000) x (0.000,0.000) is (0.000,0.000) of (0.000,0.000) type (0.000,0.000) int (0.000,0.000) and (0.000,0.000) the (0.000,0.000) v (0.000,0.000) alue (0.000,0.000) of (0.000,0.000) b (0.000,0.000) is (0.000,0.000) of (0.000,0.000) type (0.000,0.000) boolean (0.000,0.000) . (0.000,0.000) The (0.000,0.000) entry (0.000,0.000) type (0.000,0.000) map (0.000,0.000) is (0.000,0.000) much (0.000,0.000) lik (0.000,0.000) e (0.000,0.000) the (0.000,0.000) signature (0.000,0.000) of (0.000,0.000) a (0.000,0.000) function. (0.000,0.000) In (0.000,0.000) this (0.000,0.000) paper (0.000,0.000) , (0.000,0.000) we (0.000,0.000) only (0.000,0.000) discuss (0.000,0.000) typed (0.000,0.000) loop (0.000,0.000) traces, (0.000,0.000) and (0.000,0.000) we (0.000,0.000) will (0.000,0.000) refer (0.000,0.000) to (0.000,0.000) them (0.000,0.000) simply (0.000,0.000) as (0.000,0.000) “traces”. (0.000,0.000) The (0.000,0.000) k (0.000,0.000) e (0.000,0.000) y (0.000,0.000) property (0.000,0.000) of (0.000,0.000) typed (0.000,0.000) loop (0.000,0.000) traces (0.000,0.000) is (0.000,0.000) that (0.000,0.000) the (0.000,0.000) y (0.000,0.000) can (0.000,0.000) be (0.000,0.000) compiled (0.000,0.000) to (0.000,0.000) ef (0.000,0.000) ficient (0.000,0.000) machine (0.000,0.000) code (0.000,0.000) using (0.000,0.000) the (0.000,0.000) same (0.000,0.000) techniques (0.000,0.000) used (0.000,0.000) for (0.000,0.000) typed (0.000,0.000) languages. (0.000,0.000) In (0.000,0.000) T (0.000,0.000) raceMonk (0.000,0.000) e (0.000,0.000) y (0.000,0.000) , (0.000,0.000) traces (0.000,0.000) are (0.000,0.000) recorded (0.000,0.000) in (0.000,0.000) trace-fla (0.000,0.000) v (0.000,0.000) ored (0.000,0.000) SSA (0.000,0.000) LIR (0.000,0.000) (lo (0.000,0.000) w-le (0.000,0.000) v (0.000,0.000) el (0.000,0.000) intermediate (0.000,0.000) representation). (0.000,0.000) In (0.000,0.000) trace-fla (0.000,0.000) v (0.000,0.000) ored (0.000,0.000) SSA (0.000,0.000) (or (0.000,0.000) TSSA), (0.000,0.000) phi (0.000,0.000) nodes (0.000,0.000) appear (0.000,0.000) only (0.000,0.000) at (0.000,0.000) the (0.000,0.000) entry (0.000,0.000) point, (0.000,0.000) which (0.000,0.000) is (0.000,0.000) reached (0.000,0.000) both (0.000,0.000) on (0.000,0.000) entry (0.000,0.000) and (0.000,0.000) via (0.000,0.000) loop (0.000,0.000) edges. (0.000,0.000) The (0.000,0.000) im (0.000,0.000) portant (0.000,0.000) LIR (0.000,0.000) primiti (0.000,0.000) v (0.000,0.000) es (0.000,0.000) are (0.000,0.000) constant (0.000,0.000) v (0.000,0.000) alues, (0.000,0.000) memory (0.000,0.000) loads (0.000,0.000) and (0.000,0.000) stores (0.000,0.000) (by (0.000,0.000) address (0.000,0.000) and (0.000,0.000) of (0.000,0.000) fset), (0.000,0.000) inte (0.000,0.000) ger (0.000,0.000) operators, (0.000,0.000) floating-point (0.000,0.000) operators, (0.000,0.000) function (0.000,0.000) calls, (0.000,0.000) and (0.000,0.000) conditional (0.000,0.000) e (0.000,0.000) xits. (0.000,0.000) T (0.000,0.000) ype (0.000,0.000) con (0.000,0.000) v (0.000,0.000) ersions, (0.000,0.000) such (0.000,0.000) as (0.000,0.000) inte (0.000,0.000) ger (0.000,0.000) to (0.000,0.000) double, (0.000,0.000) are (0.000,0.000) represented (0.000,0.000) by (0.000,0.000) function (0.000,0.000) calls. (0.000,0.000) This (0.000,0.000) mak (0.000,0.000) es (0.000,0.000) the (0.000,0.000) LIR (0.000,0.000) used (0.000,0.000) by (0.000,0.000) T (0.000,0.000) raceMonk (0.000,0.000) e (0.000,0.000) y (0.000,0.000) independent (0.000,0.000) of (0.000,0.000) the (0.000,0.000) concrete (0.000,0.000) type (0.000,0.000) system (0.000,0.000) and (0.000,0.000) type (0.000,0.000) con (0.000,0.000) v (0.000,0.000) ersion (0.000,0.000) rules (0.000,0.000) of (0.000,0.000) the (0.000,0.000) source (0.000,0.000) language. (0.000,0.000) The (0.000,0.000) LIR (0.000,0.000) operations (0.000,0.000) are (0.000,0.000) generic (0.000,0.000) enough (0.000,0.000) that (0.000,0.000) the (0.000,0.000) back (0.000,0.000) end (0.000,0.000) compiler (0.000,0.000) is (0.000,0.000) language (0.000,0.000) independent. (0.000,0.000) Figure (0.000,0.000) 3 (0.000,0.000) sho (0.000,0.000) ws (0.000,0.000) an (0.000,0.000) e (0.000,0.000) xample (0.000,0.000) LIR (0.000,0.000) trace. (0.000,0.000) Bytecode (0.000,0.000) interpreters (0.000,0.000) typically (0.000,0.000) represent (0.000,0.000) v (0.000,0.000) alues (0.000,0.000) in (0.000,0.000) a (0.000,0.000) v (0.000,0.000) arious (0.000,0.000) comple (0.000,0.000) x (0.000,0.000) data (0.000,0.000) structures (0.000,0.000) (e.g., (0.000,0.000) hash (0.000,0.000) tables) (0.000,0.000) in (0.000,0.000) a (0.000,0.000) box (0.000,0.000) ed (0.000,0.000) format (0.000,0.000) (i.e., (0.000,0.000) with (0.000,0.000) attached (0.000,0.000) type (0.000,0.000) tag (0.000,0.000) bits). (0.000,0.000) Since (0.000,0.000) a (0.000,0.000) trace (0.000,0.000) i (0.000,0.000) s (0.000,0.000) intended (0.000,0.000) to (0.000,0.000) represent (0.000,0.000) ef (0.000,0.000) ficient (0.000,0.000) code (0.000,0.000) that (0.000,0.000) eliminates (0.000,0.000) all (0.000,0.000) that (0.000,0.000) comple (0.000,0.000) xity (0.000,0.000) , (0.000,0.000) our (0.000,0.000) traces (0.000,0.000) oper (0.000,0.000) - (0.000,0.000) ate (0.000,0.000) on (0.000,0.000) unbox (0.000,0.000) ed (0.000,0.000) v (0.000,0.000) alues (0.000,0.000) in (0.000,0.000) simpl (0.000,0.000) e (0.000,0.000) v (0.000,0.000) ariables (0.000,0.000) and (0.000,0.000) arrays (0.000,0.000) as (0.000,0.000) much (0.000,0.000) as (0.000,0.000) possible. (0.000,0.000) A (0.000,0.000) trace (0.000,0.000) records (0.000,0.000) a (0.000,0.000) ll (0.000,0.000) its (0.000,0.000) intermediate (0.000,0.000) v (0.000,0.000) alues (0.000,0.000) in (0.000,0.000) a (0.000,0.000) small (0.000,0.000) acti (0.000,0.000) v (0.000,0.000) ation (0.000,0.000) record (0.000,0.000) area. (0.000,0.000) T (0.000,0.000) o (0.000,0.000) mak (0.000,0.000) e (0.000,0.000) v (0.000,0.000) ariable (0.000,0.000) accesses (0.000,0.000) f (0.000,0.000) ast (0.000,0.000) on (0.000,0.000) trace, (0.000,0.000) the (0.000,0.000) trace (0.000,0.000) also (0.000,0.000) imports (0.000,0.000) local (0.000,0.000) and (0.000,0.000) global (0.000,0.000) v (0.000,0.000) ariables (0.000,0.000) by (0.000,0.000) unboxing (0.000,0.000) them (0.000,0.000) and (0.000,0.000) cop (0.000,0.000) ying (0.000,0.000) them (0.000,0.000) to (0.000,0.000) its (0.000,0.000) acti (0.000,0.000) v (0.000,0.000) ation (0.000,0.000) record. (0.000,0.000) Thus, (0.000,0.000) the (0.000,0.000) trace (0.000,0.000) can (0.000,0.000) read (0.000,0.000) and (0.000,0.000) write (0.000,0.000) these (0.000,0.000) v (0.000,0.000) ariables (0.000,0.000) wit (0.000,0.000) h (0.000,0.000) simple (0.000,0.000) loads (0.000,0.000) and (0.000,0.000) stores (0.000,0.000) from (0.000,0.000) a (0.000,0.000) nati (0.000,0.000) v (0.000,0.000) e (0.000,0.000) acti (0.000,0.000) v (0.000,0.000) ation (0.000,0.000) recording, (0.000,0.000) independently (0.000,0.000) of (0.000,0.000) the (0.000,0.000) boxing (0.000,0.000) mechanism (0.000,0.000) used (0.000,0.000) by (0.000,0.000) the (0.000,0.000) interpreter (0.000,0.000) . (0.000,0.000) When (0.000,0.000) the (0.000,0.000) trace (0.000,0.000) e (0.000,0.000) xits, (0.000,0.000) the (0.000,0.000) VM (0.000,0.000) box (0.000,0.000) es (0.000,0.000) the (0.000,0.000) v (0.000,0.000) alues (0.000,0.000) from (0.000,0.000) this (0.000,0.000) nati (0.000,0.000) v (0.000,0.000) e (0.000,0.000) storage (0.000,0.000) location (0.000,0.000) and (0.000,0.000) copies (0.000,0.000) them (0.000,0.000) back (0.000,0.000) to (0.000,0.000) the (0.000,0.000) interpreter (0.000,0.000) structures. (0.000,0.000) F (0.000,0.000) or (0.000,0.000) e (0.000,0.000) v (0.000,0.000) ery (0.000,0.000) control-flo (0.000,0.000) w (0.000,0.000) branch (0.000,0.000) in (0.000,0.000) the (0.000,0.000) source (0.000,0.000) program, (0.000,0.000) the (0.000,0.000) recorder (0.000,0.000) generates (0.000,0.000) conditional (0.000,0.000) e (0.000,0.000) xit (0.000,0.000) LIR (0.000,0.000) inst (0.000,0.000) ructions. (0.000,0.000) These (0.000,0.000) instruc- (0.000,0.000) tions (0.000,0.000) e (0.000,0.000) xit (0.000,0.000) from (0.000,0.000) the (0.000,0.000) trace (0.000,0.000) if (0.000,0.000) required (0.000,0.000) control (0.000,0.000) flo (0.000,0.000) w (0.000,0.000) is (0.000,0.000) dif (0.000,0.000) ferent (0.000,0.000) from (0.000,0.000) what (0.000,0.000) it (0.000,0.000) w (0.000,0.000) as (0.000,0.000) at (0.000,0.000) trac (0.000,0.000) e (0.000,0.000) recording, (0.000,0.000) ensuring (0.000,0.000) that (0.000,0.000) the (0.000,0.000) trace (0.000,0.000) instructions (0.000,0.000) are (0.000,0.000) run (0.000,0.000) only (0.000,0.000) if (0.000,0.000) the (0.000,0.000) y (0.000,0.000) are (0.000,0.000) supposed (0.000,0.000) to. (0.000,0.000) W (0.000,0.000) e (0.000,0.000) call (0.000,0.000) these (0.000,0.000) instructions (0.000,0.000) guar (0.000,0.000) d (0.000,0.000) instructions. (0.000,0.000) Most (0.000,0.000) of (0.000,0.000) our (0.000,0.000) traces (0.000,0.000) represent (0.000,0.000) loops (0.000,0.000) and (0.000,0.000) end (0.000,0.000) with (0.000,0.000) the (0.000,0.000) special (0.000,0.000) loop (0.000,0.000) LIR (0.000,0.000) instruction. (0.000,0.000) This (0.000,0.000) is (0.000,0.000) just (0.000,0.000) an (0.000,0.000) unconditional (0.000,0.000) branch (0.000,0.000) to (0.000,0.000) the (0.000,0.000) top (0.000,0.000) of (0.000,0.000) the (0.000,0.000) trace. (0.000,0.000) Such (0.000,0.000) traces (0.000,0.000) return (0.000,0.000) only (0.000,0.000) via (0.000,0.000) guards. (0.000,0.000) No (0.000,0.000) w (0.000,0.000) , (0.000,0.000) we (0.000,0.000) describe (0.000,0.000) the (0.000,0.000) k (0.000,0.000) e (0.000,0.000) y (0.000,0.000) optimizations (0.000,0.000) that (0.000,0.000) are (0.000,0.000) performed (0.000,0.000) as (0.000,0.000) part (0.000,0.000) of (0.000,0.000) recording (0.000,0.000) LIR. (0.000,0.000) All (0.000,0.000) of (0.000,0.000) thes (0.000,0.000) e (0.000,0.000) optimizations (0.000,0.000) reduce (0.000,0.000) comple (0.000,0.000) x (0.000,0.000) dynamic (0.000,0.000) language (0.000,0.000) constructs (0.000,0.000) to (0.000,0.000) simple (0.000,0.000) typed (0.000,0.000) constructs (0.000,0.000) by (0.000,0.000) spe- (0.000,0.000) cializing (0.000,0.000) for (0.000,0.000) the (0.000,0.000) current (0.000,0.000) trace. (0.000,0.000) Each (0.000,0.000) optimization (0.000,0.000) requires (0.000,0.000) guard (0.000,0.000) in- (0.000,0.000) structions (0.000,0.000) to (0.000,0.000) v (0.000,0.000) erify (0.000,0.000) their (0.000,0.000) assumptions (0.000,0.000) about (0.000,0.000) the (0.000,0.000) state (0.000,0.000) a (0.000,0.000) nd (0.000,0.000) e (0.000,0.000) xit (0.000,0.000) the (0.000,0.000) trace (0.000,0.000) if (0.000,0.000) necessary (0.000,0.000) . (0.000,0.000) T (0.000,0.000) ype (0.000,0.000) specialization. (0.000,0.000) All (0.000,0.000) LIR (0.000,0.000) primiti (0.000,0.000) v (0.000,0.000) e (0.000,0.000) s (0.000,0.000) apply (0.000,0.000) to (0.000,0.000) operands (0.000,0.000) of (0.000,0.000) specific (0.000,0.000) type (0.000,0.000) s. (0.000,0.000) Thus, (0.000,0.000) LIR (0.000,0.000) traces (0.000,0.000) are (0.000,0.000) necessarily (0.000,0.000) type-specialized, (0.000,0.000) and (0.000,0.000) a (0.000,0.000) compiler (0.000,0.000) can (0.000,0.000) easily (0.000,0.000) produc (0.000,0.000) e (0.000,0.000) a (0.000,0.000) translation (0.000,0.000) that (0.000,0.000) requires (0.000,0.000) no (0.000,0.000) type (0.000,0.000) dispatches. (0.000,0.000) A (0.000,0.000) typical (0.000,0.000) byt (0.000,0.000) ecode (0.000,0.000) interpreter (0.000,0.000) carri (0.000,0.000) es (0.000,0.000) tag (0.000,0.000) bits (0.000,0.000) along (0.000,0.000) with (0.000,0.000) each (0.000,0.000) v (0.000,0.000) alue, (0.000,0.000) and (0.000,0.000) to (0.000,0.000) perform (0.000,0.000) an (0.000,0.000) y (0.000,0.000) operation, (0.000,0.000) must (0.000,0.000) check (0.000,0.000) the (0.000,0.000) tag (0.000,0.000) bits, (0.000,0.000) dynamically (0.000,0.000) dispatch, (0.000,0.000) mask (0.000,0.000) out (0.000,0.000) the (0.000,0.000) tag (0.000,0.000) bits (0.000,0.000) to (0.000,0.000) reco (0.000,0.000) v (0.000,0.000) er (0.000,0.000) the (0.000,0.000) untagged (0.000,0.000) v (0.000,0.000) alue, (0.000,0.000) perform (0.000,0.000) the (0.000,0.000) operation, (0.000,0.000) and (0.000,0.000) then (0.000,0.000) reappl (0.000,0.000) y (0.000,0.000) tags. (0.000,0.000) LIR (0.000,0.000) omits (0.000,0.000) e (0.000,0.000) v (0.000,0.000) erything (0.000,0.000) e (0.000,0.000) xcept (0.000,0.000) the (0.000,0.000) operation (0.000,0.000) itself. (0.000,0.000) A (0.000,0.000) potential (0.000,0.000) problem (0.000,0.000) is (0.000,0.000) that (0.000,0.000) some (0.000,0.000) operations (0.000,0.000) can (0.000,0.000) produce (0.000,0.000) v (0.000,0.000) alues (0.000,0.000) of (0.000,0.000) unpredictable (0.000,0.000) types. (0.000,0.000) F (0.000,0.000) or (0.000,0.000) e (0.000,0.000) xample, (0.000,0.000) reading (0.000,0.000) a (0.000,0.000) property (0.000,0.000) from (0.000,0.000) an (0.000,0.000) object (0.000,0.000) could (0.000,0.000) yield (0.000,0.000) a (0.000,0.000) v (0.000,0.000) alue (0.000,0.000) of (0.000,0.000) an (0.000,0.000) y (0.000,0.000) type, (0.000,0.000) not (0.000,0.000) ne (0.000,0.000) cessarily (0.000,0.000) the (0.000,0.000) type (0.000,0.000) observ (0.000,0.000) ed (0.000,0.000) during (0.000,0.000) rec (0.000,0.000) ording. (0.000,0.000) The (0.000,0.000) recorder (0.000,0.000) emits (0.000,0.000) guard (0.000,0.000) instructions (0.000,0.000) that (0.000,0.000) conditionally (0.000,0.000) e (0.000,0.000) xit (0.000,0.000) if (0.000,0.000) the (0.000,0.000) operation (0.000,0.000) yields (0.000,0.000) a (0.000,0.000) v (0.000,0.000) alue (0.000,0.000) of (0.000,0.000) a (0.000,0.000) dif (0.000,0.000) ferent (0.000,0.000) type (0.000,0.000) from (0.000,0.000) that (0.000,0.000) seen (0.000,0.000) during (0.000,0.000) recording. (0.000,0.000) These (0.000,0.000) guard (0.000,0.000) instructions (0.000,0.000) guarantee (0.000,0.000) that (0.000,0.000) as (0.000,0.000) long (0.000,0.000) as (0.000,0.000) e (0.000,0.000) x (0.000,0.000) ecution (0.000,0.000) is (0.000,0.000) on (0.000,0.000) trace, (0.000,0.000) the (0.000,0.000) types (0.000,0.000) of (0.000,0.000) v (0.000,0.000) alues (0.000,0.000) match (0.000,0.000) those (0.000,0.000) of (0.000,0.000) the (0.000,0.000) typed (0.000,0.000) trace. (0.000,0.000) When (0.000,0.000) the (0.000,0.000) VM (0.000,0.000) observ (0.000,0.000) es (0.000,0.000) a (0.000,0.000) side (0.000,0.000) e (0.000,0.000) xit (0.000,0.000) along (0.000,0.000) such (0.000,0.000) a (0.000,0.000) type (0.000,0.000) guard, (0.000,0.000) a (0.000,0.000) ne (0.000,0.000) w (0.000,0.000) typed (0.000,0.000) trace (0.000,0.000) is (0.000,0.000) recorded (0.000,0.000) originating (0.000,0.000) at (0.000,0.000) the (0.000,0.000) side (0.000,0.000) e (0.000,0.000) xit (0.000,0.000) location, (0.000,0.000) capturing (0.000,0.000) the (0.000,0.000) ne (0.000,0.000) w (0.000,0.000) type (0.000,0.000) of (0.000,0.000) the (0.000,0.000) operation (0.000,0.000) in (0.000,0.000) question. (0.000,0.000) Repr (0.000,0.000) esentation (0.000,0.000) specialization: (0.000,0.000) objects. (0.000,0.000) In (0.000,0.000) Ja (0.000,0.000) v (0.000,0.000) aS (0.000,0.000) cript, (0.000,0.000) name (0.000,0.000) lookup (0.000,0.000) semantics (0.000,0.000) are (0.000,0.000) comple (0.000,0.000) x (0.000,0.000) and (0.000,0.000) potentially (0.000,0.000) e (0.000,0.000) xpensi (0.000,0.000) v (0.000,0.000) e (0.000,0.000) because (0.000,0.000) the (0.000,0.000) y (0.000,0.000) include (0.000,0.000) features (0.000,0.000) lik (0.000,0.000) e (0.000,0.000) object (0.000,0.000) inheritance (0.000,0.000) and (0.000,0.000) eval (0.000,0.000) . (0.000,0.000) T (0.000,0.000) o (0.000,0.000) e (0.000,0.000) v (0.000,0.000) aluate (0.000,0.000) an (0.000,0.000) object (0.000,0.000) property (0.000,0.000) read (0.000,0.000) e (0.000,0.000) xpression (0.000,0.000) li (0.000,0.000) k (0.000,0.000) e (0.000,0.000) o.x (0.000,0.000) , (0.000,0.000) the (0.000,0.000) interpreter (0.000,0.000) must (0.000,0.000) search (0.000,0.000) the (0.000,0.000) property (0.000,0.000) map (0.000,0.000) of (0.000,0.000) o (0.000,0.000) and (0.000,0.000) all (0.000,0.000) of (0.000,0.000) its (0.000,0.000) prototypes (0.000,0.000) and (0.000,0.000) parents. (0.000,0.000) Property (0.000,0.000) maps (0.000,0.000) can (0.000,0.000) be (0.000,0.000) implemented (0.000,0.000) with (0.000,0.000) dif (0.000,0.000) ferent (0.000,0.000) data (0.000,0.000) structures (0.000,0.000) (e.g., (0.000,0.000) per (0.000,0.000) -object (0.000,0.000) hash (0.000,0.000) tables (0.000,0.000) or (0.000,0.000) shared (0.000,0.000) hash (0.000,0.000) tables), (0.000,0.000) so (0.000,0.000) the (0.000,0.000) search (0.000,0.000) process (0.000,0.000) also (0.000,0.000) must (0.000,0.000) dispatch (0.000,0.000) on (0.000,0.000) t (0.000,0.000) he (0.000,0.000) representation (0.000,0.000) of (0.000,0.000) each (0.000,0.000) object (0.000,0.000) found (0.000,0.000) during (0.000,0.000) search. (0.000,0.000) T (0.000,0.000) raceMonk (0.000,0.000) e (0.000,0.000) y (0.000,0.000) can (0.000,0.000) simply (0.000,0.000) observ (0.000,0.000) e (0.000,0.000) the (0.000,0.000) result (0.000,0.000) of (0.000,0.000) the (0.000,0.000) search (0.000,0.000) process (0.000,0.000) and (0.000,0.000) record (0.000,0.000) the (0.000,0.000) simplest (0.000,0.000) possible (0.000,0.000) LIR (0.000,0.000) to (0.000,0.000) access (0.000,0.000) the (0.000,0.000) property (0.000,0.000) v (0.000,0.000) alue. (0.000,0.000) F (0.000,0.000) or (0.000,0.000) e (0.000,0.000) xample, (0.000,0.000) the (0.000,0.000) search (0.000,0.000) might (0.000,0.000) finds (0.000,0.000) the (0.000,0.000) v (0.000,0.000) alue (0.000,0.000) of (0.000,0.000) o.x (0.000,0.000) in (0.000,0.000) the (0.000,0.000) prototype (0.000,0.000) of (0.000,0.000) o (0.000,0.000) , (0.000,0.000) which (0.000,0.000) uses (0.000,0.000) a (0.000,0.000) shared (0.000,0.000) hash-table (0.000,0.000) represen- (0.000,0.000) tation (0.000,0.000) that (0.000,0.000) places (0.000,0.000) x (0.000,0.000) in (0.000,0.000) sl (0.000,0.000) ot (0.000,0.000) 2 (0.000,0.000) of (0.000,0.000) a (0.000,0.000) property (0.000,0.000) v (0.000,0.000) ector (0.000,0.000) . (0.000,0.000) Then (0.000,0.000) the (0.000,0.000) recorded (0.000,0.000) can (0.000,0.000) generate (0.000,0.000) LIR (0.000,0.000) that (0.000,0.000) reads (0.000,0.000) o.x (0.000,0.000) with (0.000,0.000) just (0.000,0.000) tw (0.000,0.000) o (0.000,0.000) or (0.000,0.000) three (0.000,0.000) loads: (0.000,0.000) one (0.000,0.000) to (0.000,0.000) get (0.000,0.000) the (0.000,0.000) prototype, (0.000,0.000) possibly (0.000,0.000) one (0.000,0.000) to (0.000,0.000) get (0.000,0.000) the (0.000,0.000) property (0.000,0.000) v (0.000,0.000) alue (0.000,0.000) v (0.000,0.000) ector (0.000,0.000) , (0.000,0.000) and (0.000,0.000) one (0.000,0.000) more (0.000,0.000) to (0.000,0.000) get (0.000,0.000) slot (0.000,0.000) 2 (0.000,0.000) from (0.000,0.000) the (0.000,0.000) v (0.000,0.000) ector (0.000,0.000) . (0.000,0.000) This (0.000,0.000) is (0.000,0.000) a (0.000,0.000) v (0.000,0.000) ast (0.000,0.000) simplification (0.000,0.000) and (0.000,0.000) speedup (0.000,0.000) compared (0.000,0.000) to (0.000,0.000) the (0.000,0.000) original (0.000,0.000) interpreter (0.000,0.000) code. (0.000,0.000) Inheritance (0.000,0.000) relationships (0.000,0.000) and (0.000,0.000) object (0.000,0.000) representations (0.000,0.000) can (0.000,0.000) change (0.000,0.000) during (0.000,0.000) e (0.000,0.000) x (0.000,0.000) ecu- (0.000,0.000) tion, (0.000,0.000) so (0.000,0.000) the (0.000,0.000) simplified (0.000,0.000) code (0.000,0.000) require (0.000,0.000) s (0.000,0.000) guard (0.000,0.000) instructions (0.000,0.000) that (0.000,0.000) ensure (0.000,0.000) the (0.000,0.000) object (0.000,0.000) representation (0.000,0.000) is (0.000,0.000) the (0.000,0.000) same. (0.000,0.000) In (0.000,0.000) T (0.000,0.000) raceMonk (0.000,0.000) e (0.000,0.000) y (0.000,0.000) , (0.000,0.000) objects’ (0.000,0.000) rep- (0.000,0.000) resentations (0.000,0.000) are (0.000,0.000) assigned (0.000,0.000) an (0.000,0.000) inte (0.000,0.000) ger (0.000,0.000) k (0.000,0.000) e (0.000,0.000) y (0.000,0.000) called (0.000,0.000) the (0.000,0.000) object (0.000,0.000) shape (0.000,0.000) . (0.000,0.000) Thus, (0.000,0.000) the (0.000,0.000) guard (0.000,0.000) is (0.000,0.000) a (0.000,0.000) simple (0.000,0.000) equality (0.000,0.000) check (0.000,0.000) on (0.000,0.000) the (0.000,0.000) object (0.000,0.000) shape. (0.000,0.000) Repr (0.000,0.000) esentation (0.000,0.000) specialization: (0.000,0.000) numbers. (0.000,0.000) Ja (0.000,0.000) v (0.000,0.000) aScript (0.000,0.000) has (0.000,0.000) no (0.000,0.000) inte (0.000,0.000) ger (0.000,0.000) type, (0.000,0.000) only (0.000,0.000) a (0.000,0.000) Number (0.000,0.000) type (0.000,0.000) that (0.000,0.000) is (0.000,0.000) the (0.000,0.000) set (0.000,0.000) of (0.000,0.000) 64-bit (0.000,0.000) IEEE- (0.000,0.000) 754 (0.000,0.000) floating-pointer (0.000,0.000) numbers (0.000,0.000) (“doubles”). (0.000,0.000) But (0.000,0.000) man (0.000,0.000) y (0.000,0.000) Ja (0.000,0.000) v (0.000,0.000) aScript (0.000,0.000) operators, (0.000,0.000) in (0.000,0.000) particular (0.000,0.000) array (0.000,0.000) accesses (0.000,0.000) and (0.000,0.000) bitwise (0.000,0.000) operators, (0.000,0.000) really (0.000,0.000) operate (0.000,0.000) on (0.000,0.000) inte (0.000,0.000) gers, (0.000,0.000) so (0.000,0.000) the (0.000,0.000) y (0.000,0.000) first (0.000,0.000) con (0.000,0.000) v (0.000,0.000) ert (0.000,0.000) the (0.000,0.000) number (0.000,0.000) to (0.000,0.000) an (0.000,0.000) inte (0.000,0.000) ger (0.000,0.000) , (0.000,0.000) and (0.000,0.000) then (0.000,0.000) con (0.000,0.000) v (0.000,0.000) ert (0.000,0.000) an (0.000,0.000) y (0.000,0.000) inte (0.000,0.000) ger (0.000,0.000) result (0.000,0.000) back (0.000,0.000) to (0.000,0.000) a (0.000,0.000) double. (0.000,0.000) 1 (0.000,0.000) Clearly (0.000,0.000) , (0.000,0.000) a (0.000,0.000) Ja (0.000,0.000) v (0.000,0.000) aScript (0.000,0.000) VM (0.000,0.000) that (0.000,0.000) w (0.000,0.000) ants (0.000,0.000) to (0.000,0.000) be (0.000,0.000) f (0.000,0.000) ast (0.000,0.000) must (0.000,0.000) find (0.000,0.000) a (0.000,0.000) w (0.000,0.000) ay (0.000,0.000) to (0.000,0.000) operate (0.000,0.000) on (0.000,0.000) inte (0.000,0.000) gers (0.000,0.000) directly (0.000,0.000) and (0.000,0.000) a (0.000,0.000) v (0.000,0.000) oid (0.000,0.000) these (0.000,0.000) con (0.000,0.000) v (0.000,0.000) ersions. (0.000,0.000) In (0.000,0.000) T (0.000,0.000) raceMonk (0.000,0.000) e (0.000,0.000) y (0.000,0.000) , (0.000,0.000) we (0.000,0.000) support (0.000,0.000) tw (0.000,0.000) o (0.000,0.000) representations (0.000,0.000) for (0.000,0.000) numbers: (0.000,0.000) inte (0.000,0.000) gers (0.000,0.000) and (0.000,0.000) doubles. (0.000,0.000) The (0.000,0.000) interpreter (0.000,0.000) uses (0.000,0.000) inte (0.000,0.000) ger (0.000,0.000) representations (0.000,0.000) as (0.000,0.000) much (0.000,0.000) as (0.000,0.000) it (0.000,0.000) can, (0.000,0.000) switching (0.000,0.000) for (0.000,0.000) results (0.000,0.000) that (0.000,0.000) can (0.000,0.000) only (0.000,0.000) be (0.000,0.000) represented (0.000,0.000) as (0.000,0.000) doubles. (0.000,0.000) When (0.000,0.000) a (0.000,0.000) trace (0.000,0.000) is (0.000,0.000) started, (0.000,0.000) some (0.000,0.000) v (0.000,0.000) alues (0.000,0.000) may (0.000,0.000) be (0.000,0.000) imported (0.000,0.000) and (0.000,0.000) represented (0.000,0.000) as (0.000,0.000) inte (0.000,0.000) gers. (0.000,0.000) Some (0.000,0.000) operations (0.000,0.000) on (0.000,0.000) inte (0.000,0.000) gers (0.000,0.000) require (0.000,0.000) guards. (0.000,0.000) F (0.000,0.000) or (0.000,0.000) e (0.000,0.000) xample, (0.000,0.000) adding (0.000,0.000) tw (0.000,0.000) o (0.000,0.000) inte (0.000,0.000) gers (0.000,0.000) can (0.000,0.000) produce (0.000,0.000) a (0.000,0.000) v (0.000,0.000) alue (0.000,0.000) too (0.000,0.000) lar (0.000,0.000) ge (0.000,0.000) for (0.000,0.000) the (0.000,0.000) inte (0.000,0.000) ger (0.000,0.000) representation. (0.000,0.000) Function (0.000,0.000) inlining (0.000,0.000) . (0.000,0.000) LIR (0.000,0.000) traces (0.000,0.000) can (0.000,0.000) cross (0.000,0.000) function (0.000,0.000) boundaries (0.000,0.000) in (0.000,0.000) either (0.000,0.000) direction, (0.000,0.000) achie (0.000,0.000) ving (0.000,0.000) function (0.000,0.000) inlining. (0.000,0.000) Mo (0.000,0.000) v (0.000,0.000) e (0.000,0.000) instructions (0.000,0.000) need (0.000,0.000) to (0.000,0.000) be (0.000,0.000) recorded (0.000,0.000) for (0.000,0.000) function (0.000,0.000) entry (0.000,0.000) and (0.000,0.000) e (0.000,0.000) xit (0.000,0.000) to (0.000,0.000) cop (0.000,0.000) y (0.000,0.000) ar (0.000,0.000) guments (0.000,0.000) in (0.000,0.000) and (0.000,0.000) return (0.000,0.000) v (0.000,0.000) alues (0.000,0.000) out (0.000,0.000) . (0.000,0.000) These (0.000,0.000) mo (0.000,0.000) v (0.000,0.000) e (0.000,0.000) statements (0.000,0.000) are (0.000,0.000) then (0.000,0.000) optimized (0.000,0.000) a (0.000,0.000) w (0.000,0.000) ay (0.000,0.000) by (0.000,0.000) the (0.000,0.000) compiler (0.000,0.000) using (0.000,0.000) cop (0.000,0.000) y (0.000,0.000) propag (0.000,0.000) ation. (0.000,0.000) In (0.000,0.000) order (0.000,0.000) to (0.000,0.000) be (0.000,0.000) able (0.000,0.000) to (0.000,0.000) return (0.000,0.000) to (0.000,0.000) the (0.000,0.000) interpreter (0.000,0.000) , (0.000,0.000) the (0.000,0.000) trace (0.000,0.000) must (0.000,0.000) also (0.000,0.000) generate (0.000,0.000) LIR (0.000,0.000) to (0.000,0.000) record (0.000,0.000) that (0.000,0.000) a (0.000,0.000) call (0.000,0.000) frame (0.000,0.000) has (0.000,0.000) been (0.000,0.000) entered (0.000,0.000) and (0.000,0.000) e (0.000,0.000) xited. (0.000,0.000) The (0.000,0.000) frame (0.000,0.000) entry (0.000,0.000) and (0.000,0.000) e (0.000,0.000) xit (0.000,0.000) LIR (0.000,0.000) sa (0.000,0.000) v (0.000,0.000) es (0.000,0.000) just (0.000,0.000) enough (0.000,0.000) information (0.000,0.000) to (0.000,0.000) allo (0.000,0.000) w (0.000,0.000) the (0.000,0.000) intepreter (0.000,0.000) call (0.000,0.000) stack (0.000,0.000) to (0.000,0.000) be (0.000,0.000) restored (0.000,0.000) later (0.000,0.000) and (0.000,0.000) is (0.000,0.000) much (0.000,0.000) simpler (0.000,0.000) than (0.000,0.000) the (0.000,0.000) interpreter’ (0.000,0.000) s (0.000,0.000) standard (0.000,0.000) call (0.000,0.000) code. (0.000,0.000) If (0.000,0.000) the (0.000,0.000) function (0.000,0.000) being (0.000,0.000) entered (0.000,0.000) is (0.000,0.000) not (0.000,0.000) constant (0.000,0.000) (which (0.000,0.000) in (0.000,0.000) Ja (0.000,0.000) v (0.000,0.000) aScript (0.000,0.000) includes (0.000,0.000) an (0.000,0.000) y (0.000,0.000) call (0.000,0.000) by (0.000,0.000) function (0.000,0.000) name), (0.000,0.000) the (0.000,0.000) recorder (0.000,0.000) must (0.000,0.000) also (0.000,0.000) emit (0.000,0.000) LIR (0.000,0.000) to (0.000,0.000) guard (0.000,0.000) that (0.000,0.000) the (0.000,0.000) function (0.000,0.000) is (0.000,0.000) the (0.000,0.000) same. (0.000,0.000) Guards (0.000,0.000) and (0.000,0.000) side (0.000,0.000) exits. (0.000,0.000) Each (0.000,0.000) optimization (0.000,0.000) described (0.000,0.000) abo (0.000,0.000) v (0.000,0.000) e (0.000,0.000) requires (0.000,0.000) one (0.000,0.000) or (0.000,0.000) more (0.000,0.000) guards (0.000,0.000) to (0.000,0.000) v (0.000,0.000) erify (0.000,0.000) the (0.000,0.000) assumptions (0.000,0.000) made (0.000,0.000) in (0.000,0.000) doing (0.000,0.000) the (0.000,0.000) optimization. (0.000,0.000) A (0.000,0.000) guard (0.000,0.000) is (0.000,0.000) just (0.000,0.000) a (0.000,0.000) group (0.000,0.000) of (0.000,0.000) LIR (0.000,0.000) instructions (0.000,0.000) that (0.000,0.000) performs (0.000,0.000) a (0.000,0.000) test (0.000,0.000) and (0.000,0.000) conditional (0.000,0.000) e (0.000,0.000) xit. (0.000,0.000) The (0.000,0.000) e (0.000,0.000) xit (0.000,0.000) branches (0.000,0.000) to (0.000,0.000) a (0.000,0.000) side (0.000,0.000) e (0.000,0.000) xit (0.000,0.000) , (0.000,0.000) a (0.000,0.000) small (0.000,0.000) of (0.000,0.000) f-trace (0.000,0.000) piece (0.000,0.000) of (0.000,0.000) LIR (0.000,0.000) that (0.000,0.000) returns (0.000,0.000) a (0.000,0.000) pointer (0.000,0.000) to (0.000,0.000) a (0.000,0.000) structure (0.000,0.000) that (0.000,0.000) describes (0.000,0.000) the (0.000,0.000) reason (0.000,0.000) for (0.000,0.000) the (0.000,0.000) e (0.000,0.000) xit (0.000,0.000) along (0.000,0.000) with (0.000,0.000) the (0.000,0.000) interpreter (0.000,0.000) PC (0.000,0.000) at (0.000,0.000) the (0.000,0.000) e (0.000,0.000) xit (0.000,0.000) point (0.000,0.000) and (0.000,0.000) an (0.000,0.000) y (0.000,0.000) other (0.000,0.000) dat (0.000,0.000) a (0.000,0.000) needed (0.000,0.000) to (0.000,0.000) restore (0.000,0.000) the (0.000,0.000) interpreter’ (0.000,0.000) s (0.000,0.000) state (0.000,0.000) structures. (0.000,0.000) Aborts. (0.000,0.000) Some (0.000,0.000) constructs (0.000,0.000) are (0.000,0.000) dif (0.000,0.000) ficult (0.000,0.000) to (0.000,0.000) record (0.000,0.000) in (0.000,0.000) LIR (0.000,0.000) traces. (0.000,0.000) F (0.000,0.000) or (0.000,0.000) e (0.000,0.000) xample, (0.000,0.000) eval (0.000,0.000) or (0.000,0.000) calls (0.000,0.000) to (0.000,0.000) e (0.000,0.000) xternal (0.000,0.000) functions (0.000,0.000) can (0.000,0.000) change (0.000,0.000) the (0.000,0.000) program (0.000,0.000) state (0.000,0.000) in (0.000,0.000) unpredictable (0.000,0.000) w (0.000,0.000) ays, (0.000,0.000) making (0.000,0.000) it (0.000,0.000) dif (0.000,0.000) fic (0.000,0.000) ult (0.000,0.000) for (0.000,0.000) the (0.000,0.000) tracer (0.000,0.000) to (0.000,0.000) kno (0.000,0.000) w (0.000,0.000) the (0.000,0.000) current (0.000,0.000) type (0.000,0.000) map (0.000,0.000) in (0.000,0.000) order (0.000,0.000) to (0.000,0.000) continue (0.000,0.000) tracing. (0.000,0.000) A (0.000,0.000) tracing (0.000,0.000) implementation (0.000,0.000) can (0.000,0.000) also (0.000,0.000) ha (0.000,0.000) v (0.000,0.000) e (0.000,0.000) an (0.000,0.000) y (0.000,0.000) number (0.000,0.000) of (0.000,0.000) other (0.000,0.000) limi- (0.000,0.000) tations, (0.000,0.000) e.g.,a (0.000,0.000) small-memory (0.000,0.000) de (0.000,0.000) vice (0.000,0.000) may (0.000,0.000) limit (0.000,0.000) the (0.000,0.000) length (0.000,0.000) of (0.000,0.000) traces. (0.000,0.000) When (0.000,0.000) an (0.000,0.000) y (0.000,0.000) situation (0.000,0.000) occurs (0.000,0.000) that (0.000,0.000) pre (0.000,0.000) v (0.000,0.000) ents (0.000,0.000) the (0.000,0.000) implementation (0.000,0.000) from (0.000,0.000) continuing (0.000,0.000) trace (0.000,0.000) recording, (0.000,0.000) the (0.000,0.000) implementation (0.000,0.000) aborts (0.000,0.000) trace (0.000,0.000) record- (0.000,0.000) ing (0.000,0.000) and (0.000,0.000) returns (0.000,0.000) to (0.000,0.000) the (0.000,0.000) trace (0.000,0.000) monitor (0.000,0.000) . (0.000,0.000) 3.2 (0.000,0.000) T (0.000,0.000) race (0.000,0.000) T (0.000,0.000) r (0.000,0.000) ees (0.000,0.000) Especially (0.000,0.000) simple (0.000,0.000) loops, (0.000,0.000) namely (0.000,0.000) those (0.000,0.000) where (0.000,0.000) control (0.000,0.000) flo (0.000,0.000) w (0.000,0.000) , (0.000,0.000) v (0.000,0.000) alue (0.000,0.000) types, (0.000,0.000) v (0.000,0.000) alue (0.000,0.000) representations, (0.000,0.000) and (0.000,0.000) inlined (0.000,0.000) functions (0.000,0.000) are (0.000,0.000) all (0.000,0.000) in (0.000,0.000) v (0.000,0.000) ariant, (0.000,0.000) can (0.000,0.000) be (0.000,0.000) represented (0.000,0.000) by (0.000,0.000) a (0.000,0.000) single (0.000,0.000) trace. (0.000,0.000) But (0.000,0.000) most (0.000,0.000) loops (0.000,0.000) ha (0.000,0.000) v (0.000,0.000) e (0.000,0.000) at (0.000,0.000) least (0.000,0.000) some (0.000,0.000) v (0.000,0.000) ariation, (0.000,0.000) and (0.000,0.000) so (0.000,0.000) the (0.000,0.000) program (0.000,0.000) will (0.000,0.000) tak (0.000,0.000) e (0.000,0.000) side (0.000,0.000) e (0.000,0.000) xits (0.000,0.000) from (0.000,0.000) the (0.000,0.000) main (0.000,0.000) trace. (0.000,0.000) When (0.000,0.000) a (0.000,0.000) side (0.000,0.000) e (0.000,0.000) xit (0.000,0.000) becomes (0.000,0.000) hot, (0.000,0.000) T (0.000,0.000) raceMonk (0.000,0.000) e (0.000,0.000) y (0.000,0.000) starts (0.000,0.000) a (0.000,0.000) ne (0.000,0.000) w (0.000,0.000) br (0.000,0.000) anc (0.000,0.000) h (0.000,0.000) tr (0.000,0.000) ace (0.000,0.000) from (0.000,0.000) that (0.000,0.000) point (0.000,0.000) and (0.000,0.000) patches (0.000,0.000) the (0.000,0.000) side (0.000,0.000) e (0.000,0.000) xit (0.000,0.000) to (0.000,0.000) jump (0.000,0.000) directly (0.000,0.000) to (0.000,0.000) that (0.000,0.000) trace. (0.000,0.000) In (0.000,0.000) this (0.000,0.000) w (0.000,0.000) ay (0.000,0.000) , (0.000,0.000) a (0.000,0.000) single (0.000,0.000) trace (0.000,0.000) e (0.000,0.000) xpands (0.000,0.000) on (0.000,0.000) demand (0.000,0.000) to (0.000,0.000) a (0.000,0.000) single-entry (0.000,0.000) , (0.000,0.000) multiple-e (0.000,0.000) xit (0.000,0.000) tr (0.000,0.000) ace (0.000,0.000) tr (0.000,0.000) ee (0.000,0.000) . (0.000,0.000) This (0.000,0.000) section (0.000,0.000) e (0.000,0.000) xplains (0.000,0.000) ho (0.000,0.000) w (0.000,0.000) trace (0.000,0.000) trees (0.000,0.000) are (0.000,0.000) formed (0.000,0.000) during (0.000,0.000) e (0.000,0.000) x (0.000,0.000) ecu- (0.000,0.000) tion. (0.000,0.000) The (0.000,0.000) goal (0.000,0.000) is (0.000,0.000) to (0.000,0.000) form (0.000,0.000) trace (0.000,0.000) trees (0.000,0.000) during (0.000,0.000) e (0.000,0.000) x (0.000,0.000) ecution (0.000,0.000) that (0.000,0.000) co (0.000,0.000) v (0.000,0.000) er (0.000,0.000) all (0.000,0.000) the (0.000,0.000) hot (0.000,0.000) paths (0.000,0.000) of (0.000,0.000) the (0.000,0.000) program. (0.164,119.552) 1 (0.164,119.552) Arrays (0.164,119.552) are (0.164,119.552) actually (0.164,119.552) w (0.164,119.552) orse (0.164,119.552) than (0.164,119.552) this: (0.164,119.552) if (0.164,119.552) the (0.164,119.552) inde (0.164,119.552) x (0.164,119.552) v (0.164,119.552) alue (0.164,119.552) is (0.164,119.552) a (0.164,119.552) number (0.164,119.552) , (0.164,119.552) it (0.164,119.552) must (0.164,119.552) be (0.164,119.552) con (0.164,119.552) v (0.164,119.552) erted (0.164,119.552) from (0.164,119.552) a (0.164,119.552) double (0.164,119.552) to (0.164,119.552) a (0.164,119.552) string (0.164,119.552) for (0.164,119.552) the (0.164,119.552) property (0.164,119.552) access (0.164,119.552) operator (0.164,119.552) , (0.164,119.552) and (0.164,119.552) then (0.164,119.552) to (0.164,119.552) an (0.164,119.552) inte (0.164,119.552) ger (0.164,119.552) internally (0.164,119.552) to (0.164,119.552) the (0.164,119.552) array (0.164,119.552) implementation. (0.164,119.552) Starting (0.164,119.552) a (0.164,119.552) tr (0.164,119.552) ee. (0.164,119.552) T (0.164,119.552) ree (0.164,119.552) trees (0.164,119.552) al (0.164,119.552) w (0.164,119.552) ays (0.164,119.552) start (0.164,119.552) at (0.164,119.552) loop (0.164,119.552) headers, (0.164,119.552) because (0.164,119.552) the (0.164,119.552) y (0.164,119.552) are (0.164,119.552) a (0.164,119.552) natural (0.164,119.552) place (0.164,119.552) to (0.164,119.552) look (0.164,119.552) for (0.164,119.552) hot (0.164,119.552) paths. (0.164,119.552) In (0.164,119.552) T (0.164,119.552) raceMonk (0.164,119.552) e (0.164,119.552) y (0.164,119.552) , (0.164,119.552) loop (0.164,119.552) headers (0.164,119.552) are (0.164,119.552) easy (0.164,119.552) to (0.164,119.552) detect–the (0.164,119.552) bytecode (0.164,119.552) compiler (0.164,119.552) ensur (0.164,119.552) es (0.164,119.552) that (0.164,119.552) a (0.164,119.552) bytecode (0.164,119.552) is (0.164,119.552) a (0.164,119.552) loop (0.164,119.552) header (0.164,119.552) if (0.164,119.552) f (0.164,119.552) it (0.164,119.552) is (0.164,119.552) the (0.164,119.552) tar (0.164,119.552) get (0.164,119.552) of (0.164,119.552) a (0.164,119.552) backw (0.164,119.552) ard (0.164,119.552) branch. (0.164,119.552) T (0.164,119.552) raceMonk (0.164,119.552) e (0.164,119.552) y (0.164,119.552) starts (0.164,119.552) a (0.164,119.552) tree (0.164,119.552) when (0.164,119.552) a (0.164,119.552) gi (0.164,119.552) v (0.164,119.552) en (0.164,119.552) loop (0.164,119.552) header (0.164,119.552) has (0.164,119.552) bee (0.164,119.552) n (0.164,119.552) e (0.164,119.552) x (0.164,119.552) e- (0.164,119.552) cuted (0.164,119.552) a (0.164,119.552) certain (0.164,119.552) number (0.164,119.552) of (0.164,119.552) times (0.164,119.552) (2 (0.164,119.552) in (0.164,119.552) the (0.164,119.552) current (0.164,119.552) implementation). (0.164,119.552) Starting (0.164,119.552) a (0.164,119.552) tree (0.164,119.552) just (0.164,119.552) means (0.164,119.552) starting (0.164,119.552) recordi (0.164,119.552) ng (0.164,119.552) a (0.164,119.552) trace (0.164,119.552) for (0.164,119.552) the (0.164,119.552) current (0.164,119.552) point (0.164,119.552) and (0.164,119.552) type (0.164,119.552) map (0.164,119.552) and (0.164,119.552) marking (0.164,119.552) the (0.164,119.552) trace (0.164,119.552) as (0.164,119.552) the (0.164,119.552) root (0.164,119.552) of (0.164,119.552) a (0.164,119.552) tree. (0.164,119.552) Each (0.164,119.552) tree (0.164,119.552) is (0.164,119.552) associated (0.164,119.552) with (0.164,119.552) a (0.164,119.552) loop (0.164,119.552) header (0.164,119.552) and (0.164,119.552) type (0.164,119.552) map, (0.164,119.552) so (0.164,119.552) there (0.164,119.552) may (0.164,119.552) be (0.164,119.552) se (0.164,119.552) v (0.164,119.552) eral (0.164,119.552) trees (0.164,119.552) for (0.164,119.552) a (0.164,119.552) gi (0.164,119.552) v (0.164,119.552) en (0.164,119.552) loop (0.164,119.552) header (0.164,119.552) . (0.164,119.552) Closing (0.164,119.552) the (0.164,119.552) loop. (0.164,119.552) T (0.164,119.552) race (0.164,119.552) recording (0.164,119.552) can (0.164,119.552) end (0.164,119.552) in (0.164,119.552) se (0.164,119.552) v (0.164,119.552) eral (0.164,119.552) w (0.164,119.552) ays. (0.164,119.552) Ideally (0.164,119.552) , (0.164,119.552) the (0.164,119.552) trace (0.164,119.552) reaches (0.164,119.552) the (0.164,119.552) loop (0.164,119.552) header (0.164,119.552) where (0.164,119.552) it (0.164,119.552) started (0.164,119.552) with (0.164,119.552) the (0.164,119.552) same (0.164,119.552) type (0.164,119.552) map (0.164,119.552) as (0.164,119.552) on (0.164,119.552) entry (0.164,119.552) . (0.164,119.552) This (0.164,119.552) is (0.164,119.552) called (0.164,119.552) a (0.164,119.552) type-stable (0.164,119.552) loop (0.164,119.552) iteration. (0.164,119.552) In (0.164,119.552) this (0.164,119.552) case, (0.164,119.552) the (0.164,119.552) end (0.164,119.552) of (0.164,119.552) the (0.164,119.552) trace (0.164,119.552) can (0.164,119.552) jump (0.164,119.552) right (0.164,119.552) to (0.164,119.552) the (0.164,119.552) be (0.164,119.552) ginning, (0.164,119.552) as (0.164,119.552) all (0.164,119.552) the (0.164,119.552) v (0.164,119.552) alue (0.164,119.552) representations (0.164,119.552) are (0.164,119.552) e (0.164,119.552) xactly (0.164,119.552) as (0.164,119.552) needed (0.164,119.552) to (0.164,119.552) enter (0.164,119.552) the (0.164,119.552) trace. (0.164,119.552) The (0.164,119.552) jump (0.164,119.552) can (0.164,119.552) e (0.164,119.552) v (0.164,119.552) en (0.164,119.552) skip (0.164,119.552) the (0.164,119.552) usual (0.164,119.552) code (0.164,119.552) that (0.164,119.552) w (0.164,119.552) ould (0.164,119.552) cop (0.164,119.552) y (0.164,119.552) out (0.164,119.552) the (0.164,119.552) state (0.164,119.552) at (0.164,119.552) the (0.164,119.552) end (0.164,119.552) of (0.164,119.552) the (0.164,119.552) trace (0.164,119.552) and (0.164,119.552) cop (0.164,119.552) y (0.164,119.552) it (0.164,119.552) back (0.164,119.552) in (0.164,119.552) to (0.164,119.552) the (0.164,119.552) trace (0.164,119.552) acti (0.164,119.552) v (0.164,119.552) ation (0.164,119.552) record (0.164,119.552) to (0.164,119.552) enter (0.164,119.552) a (0.164,119.552) trace. (0.164,119.552) In (0.164,119.552) certain (0.164,119.552) cases (0.164,119.552) the (0.164,119.552) trace (0.164,119.552) might (0.164,119.552) reach (0.164,119.552) the (0.164,119.552) loop (0.164,119.552) header (0.164,119.552) with (0.164,119.552) a (0.164,119.552) dif (0.164,119.552) ferent (0.164,119.552) type (0.164,119.552) map. (0.164,119.552) This (0.164,119.552) scenario (0.164,119.552) is (0.164,119.552) sometime (0.164,119.552) observ (0.164,119.552) ed (0.164,119.552) for (0.164,119.552) the (0.164,119.552) first (0.164,119.552) iteration (0.164,119.552) of (0.164,119.552) a (0.164,119.552) loop. (0.164,119.552) Some (0.164,119.552) v (0.164,119.552) ariables (0.164,119.552) inside (0.164,119.552) the (0.164,119.552) loop (0.164,119.552) might (0.164,119.552) initially (0.164,119.552) be (0.164,119.552) undefined (0.164,119.552) , (0.164,119.552) before (0.164,119.552) the (0.164,119.552) y (0.164,119.552) are (0.164,119.552) set (0.164,119.552) to (0.164,119.552) a (0.164,119.552) concrete (0.164,119.552) type (0.164,119.552) during (0.164,119.552) the (0.164,119.552) first (0.164,119.552) loop (0.164,119.552) iteration. (0.164,119.552) When (0.164,119.552) recording (0.164,119.552) such (0.164,119.552) an (0.164,119.552) iteration, (0.164,119.552) t (0.164,119.552) he (0.164,119.552) recorder (0.164,119.552) cannot (0.164,119.552) link (0.164,119.552) the (0.164,119.552) trace (0.164,119.552) back (0.164,119.552) to (0.164,119.552) its (0.164,119.552) o (0.164,119.552) wn (0.164,119.552) loop (0.164,119.552) header (0.164,119.552) since (0.164,119.552) it (0.164,119.552) is (0.164,119.552) type-unstable (0.164,119.552) . (0.164,119.552) Instead, (0.164,119.552) the (0.164,119.552) iteration (0.164,119.552) is (0.164,119.552) terminated (0.164,119.552) with (0.164,119.552) a (0.164,119.552) side (0.164,119.552) e (0.164,119.552) xit (0.164,119.552) that (0.164,119.552) will (0.164,119.552) al (0.164,119.552) w (0.164,119.552) ays (0.164,119.552) f (0.164,119.552) ail (0.164,119.552) and (0.164,119.552) return (0.164,119.552) to (0.164,119.552) the (0.164,119.552) interpreter (0.164,119.552) . (0.164,119.552) At (0.164,119.552) the (0.164,119.552) same (0.164,119.552) time (0.164,119.552) a (0.164,119.552) ne (0.164,119.552) w (0.164,119.552) trace (0.164,119.552) is (0.164,119.552) recorded (0.164,119.552) with (0.164,119.552) the (0.164,119.552) ne (0.164,119.552) w (0.164,119.552) type (0.164,119.552) map. (0.164,119.552) Ev (0.164,119.552) ery (0.164,119.552) time (0.164,119.552) an (0.164,119.552) additional (0.164,119.552) type- (0.164,119.552) unstable (0.164,119.552) trace (0.164,119.552) is (0.164,119.552) adde (0.164,119.552) d (0.164,119.552) to (0.164,119.552) a (0.164,119.552) re (0.164,119.552) gion, (0.164,119.552) its (0.164,119.552) e (0.164,119.552) xit (0.164,119.552) type (0.164,119.552) map (0.164,119.552) is (0.164,119.552) compared (0.164,119.552) to (0.164,119.552) the (0.164,119.552) entry (0.164,119.552) m (0.164,119.552) ap (0.164,119.552) of (0.164,119.552) all (0.164,119.552) e (0.164,119.552) xisting (0.164,119.552) traces (0.164,119.552) in (0.164,119.552) case (0.164,119.552) the (0.164,119.552) y (0.164,119.552) complement (0.164,119.552) each (0.164,119.552) other (0.164,119.552) . (0.164,119.552) W (0.164,119.552) ith (0.164,119.552) this (0.164,119.552) approach (0.164,119.552) we (0.164,119.552) are (0.164,119.552) able (0.164,119.552) to (0.164,119.552) co (0.164,119.552) v (0.164,119.552) er (0.164,119.552) type-unstable (0.164,119.552) loop (0.164,119.552) iterations (0.164,119.552) as (0.164,119.552) long (0.164,119.552) the (0.164,119.552) y (0.164,119.552) e (0.164,119.552) v (0.164,119.552) entually (0.164,119.552) form (0.164,119.552) a (0.164,119.552) stable (0.164,119.552) equilibrium. (0.164,119.552) Finally (0.164,119.552) , (0.164,119.552) the (0.164,119.552) trace (0.164,119.552) might (0.164,119.552) e (0.164,119.552) xit (0.164,119.552) the (0.164,119.552) loop (0.164,119.552) before (0.164,119.552) reaching (0.164,119.552) the (0.164,119.552) loop (0.164,119.552) header (0.164,119.552) , (0.164,119.552) for (0.164,119.552) e (0.164,119.552) xample (0.164,119.552) because (0.164,119.552) e (0.164,119.552) x (0.164,119.552) ecution (0.164,119.552) reaches (0.164,119.552) a (0.164,119.552) break (0.164,119.552) or (0.164,119.552) return (0.164,119.552) statement. (0.164,119.552) In (0.164,119.552) this (0.164,119.552) case, (0.164,119.552) the (0.164,119.552) VM (0.164,119.552) simply (0.164,119.552) ends (0.164,119.552) the (0.164,119.552) trace (0.164,119.552) with (0.164,119.552) an (0.164,119.552) e (0.164,119.552) xit (0.164,119.552) to (0.164,119.552) the (0.164,119.552) trace (0.164,119.552) monitor (0.164,119.552) . (0.164,119.552) As (0.164,119.552) mentioned (0.164,119.552) pre (0.164,119.552) viously (0.164,119.552) , (0.164,119.552) we (0.164,119.552) may (0.164,119.552) speculati (0.164,119.552) v (0.164,119.552) ely (0.164,119.552) chose (0.164,119.552) to (0.164,119.552) rep- (0.164,119.552) resent (0.164,119.552) certain (0.164,119.552) Number (0.164,119.552) -typed (0.164,119.552) v (0.164,119.552) alues (0.164,119.552) as (0.164,119.552) inte (0.164,119.552) gers (0.164,119.552) on (0.164,119.552) trace. (0.164,119.552) W (0.164,119.552) e (0.164,119.552) do (0.164,119.552) so (0.164,119.552) when (0.164,119.552) we (0.164,119.552) observ (0.164,119.552) e (0.164,119.552) that (0.164,119.552) Number (0.164,119.552) -typed (0.164,119.552) v (0.164,119.552) ariables (0.164,119.552) c (0.164,119.552) ontain (0.164,119.552) an (0.164,119.552) inte (0.164,119.552) ger (0.164,119.552) v (0.164,119.552) alue (0.164,119.552) at (0.164,119.552) trace (0.164,119.552) entry (0.164,119.552) . (0.164,119.552) If (0.164,119.552) during (0.164,119.552) trace (0.164,119.552) recording (0.164,119.552) the (0.164,119.552) v (0.164,119.552) ariable (0.164,119.552) is (0.164,119.552) une (0.164,119.552) x- (0.164,119.552) pectedly (0.164,119.552) assigned (0.164,119.552) a (0.164,119.552) non-inte (0.164,119.552) ger (0.164,119.552) v (0.164,119.552) alue, (0.164,119.552) we (0.164,119.552) ha (0.164,119.552) v (0.164,119.552) e (0.164,119.552) to (0.164,119.552) widen (0.164,119.552) the (0.164,119.552) type (0.164,119.552) of (0.164,119.552) the (0.164,119.552) v (0.164,119.552) ariable (0.164,119.552) to (0.164,119.552) a (0.164,119.552) double. (0.164,119.552) As (0.164,119.552) a (0.164,119.552) result, (0.164,119.552) the (0.164,119.552) recorded (0.164,119.552) trace (0.164,119.552) becomes (0.164,119.552) inherently (0.164,119.552) type-unstable (0.164,119.552) since (0.164,119.552) it (0.164,119.552) starts (0.164,119.552) with (0.164,119.552) an (0.164,119.552) i (0.164,119.552) nte (0.164,119.552) ger (0.164,119.552) v (0.164,119.552) alue (0.164,119.552) b (0.164,119.552) ut (0.164,119.552) ends (0.164,119.552) with (0.164,119.552) a (0.164,119.552) double (0.164,119.552) v (0.164,119.552) alue. (0.164,119.552) This (0.164,119.552) represents (0.164,119.552) a (0.164,119.552) mis-speculat (0.164,119.552) ion, (0.164,119.552) since (0.164,119.552) at (0.164,119.552) trace (0.164,119.552) entry (0.164,119.552) we (0.164,119.552) specialized (0.164,119.552) the (0.164,119.552) Number (0.164,119.552) -typed (0.164,119.552) v (0.164,119.552) alue (0.164,119.552) to (0.164,119.552) an (0.164,119.552) inte (0.164,119.552) ger (0.164,119.552) , (0.164,119.552) assuming (0.164,119.552) that (0.164,119.552) at (0.164,119.552) the (0.164,119.552) loop (0.164,119.552) edge (0.164,119.552) we (0.164,119.552) w (0.164,119.552) ould (0.164,119.552) ag (0.164,119.552) ain (0.164,119.552) find (0.164,119.552) an (0.164,119.552) inte (0.164,119.552) ger (0.164,119.552) v (0.164,119.552) alue (0.164,119.552) in (0.164,119.552) the (0.164,119.552) v (0.164,119.552) ariable, (0.164,119.552) allo (0.164,119.552) wing (0.164,119.552) us (0.164,119.552) to (0.164,119.552) close (0.164,119.552) the (0.164,119.552) loop. (0.164,119.552) T (0.164,119.552) o (0.164,119.552) a (0.164,119.552) v (0.164,119.552) oid (0.164,119.552) future (0.164,119.552) spec- (0.164,119.552) ulati (0.164,119.552) v (0.164,119.552) e (0.164,119.552) f (0.164,119.552) ai (0.164,119.552) lures (0.164,119.552) in (0.164,119.552) v (0.164,119.552) olving (0.164,119.552) this (0.164,119.552) v (0.164,119.552) ariable, (0.164,119.552) and (0.164,119.552) to (0.164,119.552) obtain (0.164,119.552) a (0.164,119.552) type-stable (0.164,119.552) trace (0.164,119.552) we (0.164,119.552) note (0.164,119.552) the (0.164,119.552) f (0.164,119.552) act (0.164,119.552) that (0.164,119.552) the (0.164,119.552) v (0.164,119.552) ariable (0.164,119.552) in (0.164,119.552) question (0.164,119.552) as (0.164,119.552) been (0.164,119.552) observ (0.164,119.552) ed (0.164,119.552) to (0.164,119.552) sometimes (0.164,119.552) hold (0.164,119.552) non-inte (0.164,119.552) ger (0.164,119.552) v (0.164,119.552) alues (0.164,119.552) in (0.164,119.552) an (0.164,119.552) advisory (0.164,119.552) data (0.164,119.552) structure (0.164,119.552) which (0.164,119.552) we (0.164,119.552) call (0.164,119.552) the (0.164,119.552) “oracle”. (0.164,119.552) When (0.164,119.552) compiling (0.164,119.552) loops, (0.164,119.552) we (0.164,119.552) consult (0.164,119.552) the (0.164,119.552) oracle (0.164,119.552) before (0.164,119.552) specializ- (0.164,119.552) ing (0.164,119.552) v (0.164,119.552) alues (0.164,119.552) to (0.164,119.552) inte (0.164,119.552) gers. (0.164,119.552) Speculation (0.164,119.552) to (0.164,119.552) w (0.164,119.552) ards (0.164,119.552) inte (0.164,119.552) gers (0.164,119.552) is (0.164,119.552) performed (0.164,119.552) only (0.164,119.552) if (0.164,119.552) no (0.164,119.552) adv (0.164,119.552) erse (0.164,119.552) information (0.164,119.552) is (0.164,119.552) kno (0.164,119.552) wn (0.164,119.552) to (0.164,119.552) the (0.164,119.552) oracle (0.164,119.552) about (0.164,119.552) that (0.164,119.552) particular (0.164,119.552) v (0.164,119.552) ariable. (0.164,119.552) Whene (0.164,119.552) v (0.164,119.552) er (0.164,119.552) we (0.164,119.552) accidentally (0.164,119.552) compile (0.164,119.552) a (0.164,119.552) loop (0.164,119.552) that (0.164,119.552) is (0.164,119.552) type-unstable (0.164,119.552) due (0.164,119.552) to (0.164,119.552) mis-speculation (0.164,119.552) of (0.164,119.552) a (0.164,119.552) Number (0.164,119.552) -typed (0.164,119.552) v (0.164,119.552) ari- (0.164,119.552) able, (0.164,119.552) we (0.164,119.552) immediately (0.164,119.552) trigger (0.164,119.552) the (0.164,119.552) recording (0.164,119.552) of (0.164,119.552) a (0.164,119.552) ne (0.164,119.552) w (0.164,119.552) trace, (0.164,119.552) which (0.164,119.552) based (0.164,119.552) on (0.164,119.552) the (0.164,119.552) no (0.164,119.552) w (0.164,119.552) updated (0.164,119.552) oracle (0.164,119.552) information (0.164,119.552) will (0.164,119.552) start (0.164,119.552) with (0.164,119.552) a (0.164,119.552) dou- (0.164,119.552) ble (0.164,119.552) v (0.164,119.552) alue (0.164,119.552) and (0.164,119.552) thus (0.164,119.552) become (0.164,119.552) type (0.164,119.552) stable. (0.164,119.552) Extending (0.164,119.552) a (0.164,119.552) tr (0.164,119.552) ee. (0.164,119.552) Side (0.164,119.552) e (0.164,119.552) xits (0.164,119.552) lead (0.164,119.552) to (0.164,119.552) di (0.164,119.552) f (0.164,119.552) ferent (0.164,119.552) paths (0.164,119.552) through (0.164,119.552) the (0.164,119.552) loop, (0.164,119.552) or (0.164,119.552) paths (0.164,119.552) with (0.164,119.552) dif (0.164,119.552) ferent (0.164,119.552) types (0.164,119.552) or (0.164,119.552) representations (0.164,119.552) . (0.164,119.552) Thus, (0.164,119.552) to (0.164,119.552) completely (0.164,119.552) co (0.164,119.552) v (0.164,119.552) er (0.164,119.552) the (0.164,119.552) loop, (0.164,119.552) the (0.164,119.552) VM (0.164,119.552) must (0.164,119.552) record (0.164,119.552) traces (0.164,119.552) starting (0.164,119.552) at (0.164,119.552) all (0.164,119.552) side (0.164,119.552) e (0.164,119.552) xits. (0.164,119.552) These (0.164,119.552) traces (0.164,119.552) are (0.164,119.552) recorded (0.164,119.552) much (0.164,119.552) lik (0.164,119.552) e (0.164,119.552) root (0.164,119.552) traces: (0.164,119.552) there (0.164,119.552) is (0.164,119.552) a (0.164,119.552) counter (0.164,119.552) for (0.164,119.552) each (0.164,119.552) side (0.164,119.552) e (0.164,119.552) xit, (0.164,119.552) and (0.164,119.552) when (0.164,119.552) the (0.164,119.552) counter (0.164,119.552) reaches (0.164,119.552) a (0.164,119.552) hotness (0.164,119.552) threshold, (0.164,119.552) recording (0.164,119.552) starts. (0.164,119.552) Recording (0.164,119.552) stops (0.164,119.552) e (0.164,119.552) xactly (0.164,119.552) as (0.164,119.552) for (0.164,119.552) the (0.164,119.552) root (0.164,119.552) trace, (0.164,119.552) using (0.164,119.552) the (0.164,119.552) loop (0.164,119.552) header (0.164,119.552) of (0.164,119.552) the (0.164,119.552) root (0.164,119.552) trace (0.164,119.552) as (0.164,119.552) the (0.164,119.552) tar (0.164,119.552) get (0.164,119.552) to (0.164,119.552) reach. (0.000,0.000) Our (0.000,0.000) implementation (0.000,0.000) does (0.000,0.000) not (0.000,0.000) e (0.000,0.000) xtend (0.000,0.000) at (0.000,0.000) all (0.000,0.000) side (0.000,0.000) e (0.000,0.000) xits. (0.000,0.000) It (0.000,0.000) e (0.000,0.000) xtends (0.000,0.000) only (0.000,0.000) if (0.000,0.000) the (0.000,0.000) side (0.000,0.000) e (0.000,0.000) xit (0.000,0.000) is (0.000,0.000) for (0.000,0.000) a (0.000,0.000) control-flo (0.000,0.000) w (0.000,0.000) branch, (0.000,0.000) and (0.000,0.000) only (0.000,0.000) if (0.000,0.000) the (0.000,0.000) side (0.000,0.000) e (0.000,0.000) xit (0.000,0.000) does (0.000,0.000) not (0.000,0.000) lea (0.000,0.000) v (0.000,0.000) e (0.000,0.000) the (0.000,0.000) loop. (0.000,0.000) In (0.000,0.000) particular (0.000,0.000) we (0.000,0.000) do (0.000,0.000) not (0.000,0.000) w (0.000,0.000) ant (0.000,0.000) to (0.000,0.000) e (0.000,0.000) xtend (0.000,0.000) a (0.000,0.000) trace (0.000,0.000) tree (0.000,0.000) along (0.000,0.000) a (0.000,0.000) path (0.000,0.000) that (0.000,0.000) leads (0.000,0.000) to (0.000,0.000) an (0.000,0.000) outer (0.000,0.000) loop, (0.000,0.000) because (0.000,0.000) we (0.000,0.000) w (0.000,0.000) ant (0.000,0.000) to (0.000,0.000) co (0.000,0.000) v (0.000,0.000) er (0.000,0.000) such (0.000,0.000) paths (0.000,0.000) in (0.000,0.000) an (0.000,0.000) outer (0.000,0.000) tree (0.000,0.000) through (0.000,0.000) tree (0.000,0.000) nesting (0.000,0.000) . (0.000,0.000) 3.3 (0.000,0.000) Blacklisting (0.000,0.000) Sometimes, (0.000,0.000) a (0.000,0.000) program (0.000,0.000) follo (0.000,0.000) ws (0.000,0.000) a (0.000,0.000) path (0.000,0.000) that (0.000,0.000) cannot (0.000,0.000) be (0.000,0.000) compiled (0.000,0.000) into (0.000,0.000) a (0.000,0.000) trace, (0.000,0.000) usually (0.000,0.000) because (0.000,0.000) of (0.000,0.000) limitations (0.000,0.000) in (0.000,0.000) the (0.000,0.000) implementation. (0.000,0.000) T (0.000,0.000) raceMonk (0.000,0.000) e (0.000,0.000) y (0.000,0.000) does (0.000,0.000) not (0.000,0.000) currently (0.000,0.000) support (0.000,0.000) recording (0.000,0.000) thro (0.000,0.000) wing (0.000,0.000) and (0.000,0.000) catching (0.000,0.000) of (0.000,0.000) arbitrary (0.000,0.000) e (0.000,0.000) xceptions. (0.000,0.000) This (0.000,0.000) design (0.000,0.000) trade (0.000,0.000) of (0.000,0.000) f (0.000,0.000) w (0.000,0.000) as (0.000,0.000) chosen, (0.000,0.000) because (0.000,0.000) e (0.000,0.000) xceptions (0.000,0.000) are (0.000,0.000) usually (0.000,0.000) rare (0.000,0.000) in (0.000,0.000) Ja (0.000,0.000) v (0.000,0.000) aScript. (0.000,0.000) Ho (0.000,0.000) we (0.000,0.000) v (0.000,0.000) er (0.000,0.000) , (0.000,0.000) if (0.000,0.000) a (0.000,0.000) program (0.000,0.000) opts (0.000,0.000) to (0.000,0.000) use (0.000,0.000) e (0.000,0.000) xceptions (0.000,0.000) intensi (0.000,0.000) v (0.000,0.000) ely (0.000,0.000) , (0.000,0.000) we (0.000,0.000) w (0.000,0.000) ould (0.000,0.000) suddenly (0.000,0.000) incur (0.000,0.000) a (0.000,0.000) punishing (0.000,0.000) runt (0.000,0.000) ime (0.000,0.000) o (0.000,0.000) v (0.000,0.000) erhead (0.000,0.000) if (0.000,0.000) we (0.000,0.000) repeatedly (0.000,0.000) try (0.000,0.000) to (0.000,0.000) record (0.000,0.000) a (0.000,0.000) trace (0.000,0.000) for (0.000,0.000) this (0.000,0.000) path (0.000,0.000) and (0.000,0.000) repeatedly (0.000,0.000) f (0.000,0.000) ail (0.000,0.000) to (0.000,0.000) do (0.000,0.000) so, (0.000,0.000) since (0.000,0.000) we (0.000,0.000) abort (0.000,0.000) tracing (0.000,0.000) e (0.000,0.000) v (0.000,0.000) ery (0.000,0.000) time (0.000,0.000) we (0.000,0.000) observ (0.000,0.000) e (0.000,0.000) an (0.000,0.000) e (0.000,0.000) xception (0.000,0.000) being (0.000,0.000) thro (0.000,0.000) wn. (0.000,0.000) As (0.000,0.000) a (0.000,0.000) result, (0.000,0.000) if (0.000,0.000) a (0.000,0.000) hot (0.000,0.000) loop (0.000,0.000) contains (0.000,0.000) traces (0.000,0.000) that (0.000,0.000) al (0.000,0.000) w (0.000,0.000) ays (0.000,0.000) f (0.000,0.000) ail, (0.000,0.000) the (0.000,0.000) VM (0.000,0.000) could (0.000,0.000) potentially (0.000,0.000) run (0.000,0.000) much (0.000,0.000) more (0.000,0.000) slo (0.000,0.000) wly (0.000,0.000) than (0.000,0.000) the (0.000,0.000) base (0.000,0.000) interpreter: (0.000,0.000) the (0.000,0.000) VM (0.000,0.000) repeatedly (0.000,0.000) spends (0.000,0.000) t (0.000,0.000) ime (0.000,0.000) trying (0.000,0.000) to (0.000,0.000) record (0.000,0.000) traces, (0.000,0.000) b (0.000,0.000) ut (0.000,0.000) is (0.000,0.000) ne (0.000,0.000) v (0.000,0.000) er (0.000,0.000) able (0.000,0.000) to (0.000,0.000) run (0.000,0.000) an (0.000,0.000) y (0.000,0.000) . (0.000,0.000) T (0.000,0.000) o (0.000,0.000) a (0.000,0.000) v (0.000,0.000) oid (0.000,0.000) this (0.000,0.000) problem, (0.000,0.000) whene (0.000,0.000) v (0.000,0.000) er (0.000,0.000) the (0.000,0.000) VM (0.000,0.000) is (0.000,0.000) about (0.000,0.000) to (0.000,0.000) start (0.000,0.000) tracing, (0.000,0.000) it (0.000,0.000) must (0.000,0.000) try (0.000,0.000) to (0.000,0.000) predict (0.000,0.000) whether (0.000,0.000) it (0.000,0.000) will (0.000,0.000) finish (0.000,0.000) the (0.000,0.000) trace. (0.000,0.000) Our (0.000,0.000) prediction (0.000,0.000) algorithm (0.000,0.000) is (0.000,0.000) based (0.000,0.000) on (0.000,0.000) blac (0.000,0.000) klisting (0.000,0.000) traces (0.000,0.000) that (0.000,0.000) ha (0.000,0.000) v (0.000,0.000) e (0.000,0.000) been (0.000,0.000) tried (0.000,0.000) and (0.000,0.000) f (0.000,0.000) ailed. (0.000,0.000) When (0.000,0.000) the (0.000,0.000) VM (0.000,0.000) f (0.000,0.000) ails (0.000,0.000) to (0.000,0.000) finish (0.000,0.000) a (0.000,0.000) trace (0.000,0.000) start- (0.000,0.000) ing (0.000,0.000) at (0.000,0.000) a (0.000,0.000) gi (0.000,0.000) v (0.000,0.000) en (0.000,0.000) point, (0.000,0.000) the (0.000,0.000) VM (0.000,0.000) records (0.000,0.000) that (0.000,0.000) a (0.000,0.000) f (0.000,0.000) ailure (0.000,0.000) has (0.000,0.000) occurred. (0.000,0.000) The (0.000,0.000) VM (0.000,0.000) also (0.000,0.000) sets (0.000,0.000) a (0.000,0.000) counter (0.000,0.000) so (0.000,0.000) that (0.000,0.000) it (0.000,0.000) will (0.000,0.000) not (0.000,0.000) try (0.000,0.000) to (0.000,0.000) record (0.000,0.000) a (0.000,0.000) trace (0.000,0.000) starting (0.000,0.000) at (0.000,0.000) that (0.000,0.000) point (0.000,0.000) until (0.000,0.000) it (0.000,0.000) is (0.000,0.000) passed (0.000,0.000) a (0.000,0.000) fe (0.000,0.000) w (0.000,0.000) more (0.000,0.000) times (0.000,0.000) (32 (0.000,0.000) in (0.000,0.000) our (0.000,0.000) imple- (0.000,0.000) mentation). (0.000,0.000) This (0.000,0.000) bac (0.000,0.000) k (0.000,0.000) of (0.000,0.000) f (0.000,0.000) counter (0.000,0.000) gi (0.000,0.000) v (0.000,0.000) es (0.000,0.000) t (0.000,0.000) emporary (0.000,0.000) conditions (0.000,0.000) that (0.000,0.000) pre (0.000,0.000) v (0.000,0.000) ent (0.000,0.000) tracing (0.000,0.000) a (0.000,0.000) chance (0.000,0.000) to (0.000,0.000) end. (0.000,0.000) F (0.000,0.000) or (0.000,0.000) e (0.000,0.000) xample, (0.000,0.000) a (0.000,0.000) loop (0.000,0.000) may (0.000,0.000) beha (0.000,0.000) v (0.000,0.000) e (0.000,0.000) dif (0.000,0.000) ferently (0.000,0.000) during (0.000,0.000) startup (0.000,0.000) than (0.000,0.000) during (0.000,0.000) its (0.000,0.000) steady-state (0.000,0.000) e (0.000,0.000) x (0.000,0.000) ecution. (0.000,0.000) Af- (0.000,0.000) ter (0.000,0.000) a (0.000,0.000) gi (0.000,0.000) v (0.000,0.000) en (0.000,0.000) number (0.000,0.000) of (0.000,0.000) f (0.000,0.000) ailures (0.000,0.000) (2 (0.000,0.000) in (0.000,0.000) our (0.000,0.000) implementation), (0.000,0.000) the (0.000,0.000) VM (0.000,0.000) marks (0.000,0.000) the (0.000,0.000) fragment (0.000,0.000) as (0.000,0.000) blacklisted, (0.000,0.000) which (0.000,0.000) means (0.000,0.000) the (0.000,0.000) VM (0.000,0.000) will (0.000,0.000) ne (0.000,0.000) v (0.000,0.000) er (0.000,0.000) ag (0.000,0.000) ain (0.000,0.000) start (0.000,0.000) recording (0.000,0.000) at (0.000,0.000) that (0.000,0.000) point. (0.000,0.000) After (0.000,0.000) implem (0.000,0.000) enting (0.000,0.000) this (0.000,0.000) basic (0.000,0.000) strate (0.000,0.000) gy (0.000,0.000) , (0.000,0.000) we (0.000,0.000) observ (0.000,0.000) ed (0.000,0.000) that (0.000,0.000) for (0.000,0.000) small (0.000,0.000) loops (0.000,0.000) that (0.000,0.000) get (0.000,0.000) blacklisted, (0.000,0.000) the (0.000,0.000) system (0.000,0.000) can (0.000,0.000) spend (0.000,0.000) a (0.000,0.000) noticeable (0.000,0.000) amount (0.000,0.000) of (0.000,0.000) time (0.000,0.000) just (0.000,0.000) finding (0.000,0.000) the (0.000,0.000) loop (0.000,0.000) fragment (0.000,0.000) and (0.000,0.000) determining (0.000,0.000) that (0.000,0.000) it (0.000,0.000) has (0.000,0.000) been (0.000,0.000) blacklisted. (0.000,0.000) W (0.000,0.000) e (0.000,0.000) no (0.000,0.000) w (0.000,0.000) a (0.000,0.000) v (0.000,0.000) oid (0.000,0.000) that (0.000,0.000) problem (0.000,0.000) by (0.000,0.000) patching (0.000,0.000) the (0.000,0.000) bytecode. (0.000,0.000) W (0.000,0.000) e (0.000,0.000) define (0.000,0.000) an (0.000,0.000) e (0.000,0.000) xtra (0.000,0.000) no-op (0.000,0.000) bytecode (0.000,0.000) that (0.000,0.000) indicates (0.000,0.000) a (0.000,0.000) loop (0.000,0.000) header (0.000,0.000) . (0.000,0.000) The (0.000,0.000) VM (0.000,0.000) calls (0.000,0.000) into (0.000,0.000) the (0.000,0.000) trace (0.000,0.000) monitor (0.000,0.000) e (0.000,0.000) v (0.000,0.000) ery (0.000,0.000) time (0.000,0.000) the (0.000,0.000) inter (0.000,0.000) - (0.000,0.000) preter (0.000,0.000) e (0.000,0.000) x (0.000,0.000) ecutes (0.000,0.000) a (0.000,0.000) loop (0.000,0.000) header (0.000,0.000) no-op. (0.000,0.000) T (0.000,0.000) o (0.000,0.000) blacklist (0.000,0.000) a (0.000,0.000) fragm (0.000,0.000) ent, (0.000,0.000) we (0.000,0.000) simply (0.000,0.000) replace (0.000,0.000) the (0.000,0.000) loop (0.000,0.000) header (0.000,0.000) no-op (0.000,0.000) with (0.000,0.000) a (0.000,0.000) re (0.000,0.000) gular (0.000,0.000) no-op. (0.000,0.000) Thus, (0.000,0.000) the (0.000,0.000) interpreter (0.000,0.000) will (0.000,0.000) ne (0.000,0.000) v (0.000,0.000) er (0.000,0.000) ag (0.000,0.000) ain (0.000,0.000) e (0.000,0.000) v (0.000,0.000) en (0.000,0.000) call (0.000,0.000) into (0.000,0.000) the (0.000,0.000) trace (0.000,0.000) monitor (0.000,0.000) . (0.000,0.000) There (0.000,0.000) is (0.000,0.000) a (0.000,0.000) related (0.000,0.000) problem (0.000,0.000) we (0.000,0.000) ha (0.000,0.000) v (0.000,0.000) e (0.000,0.000) not (0.000,0.000) yet (0.000,0.000) solv (0.000,0.000) ed, (0.000,0.000) which (0.000,0.000) occurs (0.000,0.000) when (0.000,0.000) a (0.000,0.000) loop (0.000,0.000) meets (0.000,0.000) all (0.000,0.000) of (0.000,0.000) these (0.000,0.000) conditions: (0.000,0.000) • (0.000,0.000) The (0.000,0.000) VM (0.000,0.000) can (0.000,0.000) form (0.000,0.000) at (0.000,0.000) least (0.000,0.000) one (0.000,0.000) root (0.000,0.000) trace (0.000,0.000) for (0.000,0.000) the (0.000,0.000) loop. (0.000,0.000) • (0.000,0.000) There (0.000,0.000) is (0.000,0.000) at (0.000,0.000) least (0.000,0.000) one (0.000,0.000) hot (0.000,0.000) side (0.000,0.000) e (0.000,0.000) xit (0.000,0.000) for (0.000,0.000) which (0.000,0.000) the (0.000,0.000) VM (0.000,0.000) cannot (0.000,0.000) complete (0.000,0.000) a (0.000,0.000) trace. (0.000,0.000) • (0.000,0.000) The (0.000,0.000) loop (0.000,0.000) body (0.000,0.000) is (0.000,0.000) short. (0.000,0.000) In (0.000,0.000) this (0.000,0.000) case, (0.000,0.000) the (0.000,0.000) VM (0.000,0.000) will (0.000,0.000) repeatedly (0.000,0.000) pass (0.000,0.000) the (0.000,0.000) loop (0.000,0.000) header (0.000,0.000) , (0.000,0.000) search (0.000,0.000) for (0.000,0.000) a (0.000,0.000) trace, (0.000,0.000) find (0.000,0.000) it, (0.000,0.000) e (0.000,0.000) x (0.000,0.000) ecute (0.000,0.000) it, (0.000,0.000) and (0.000,0.000) f (0.000,0.000) all (0.000,0.000) back (0.000,0.000) to (0.000,0.000) the (0.000,0.000) interpreter (0.000,0.000) . (0.000,0.000) W (0.000,0.000) ith (0.000,0.000) a (0.000,0.000) short (0.000,0.000) loop (0.000,0.000) body (0.000,0.000) , (0.000,0.000) the (0.000,0.000) o (0.000,0.000) v (0.000,0.000) erhead (0.000,0.000) of (0.000,0.000) finding (0.000,0.000) and (0.000,0.000) calling (0.000,0.000) the (0.000,0.000) trace (0.000,0.000) is (0.000,0.000) high, (0.000,0.000) and (0.000,0.000) causes (0.000,0.000) performance (0.000,0.000) to (0.000,0.000) be (0.000,0.000) e (0.000,0.000) v (0.000,0.000) en (0.000,0.000) slo (0.000,0.000) wer (0.000,0.000) than (0.000,0.000) the (0.000,0.000) basic (0.000,0.000) interpreter (0.000,0.000) . (0.000,0.000) So (0.000,0.000) f (0.000,0.000) ar (0.000,0.000) , (0.000,0.000) in (0.000,0.000) this (0.000,0.000) situation (0.000,0.000) we (0.000,0.000) ha (0.000,0.000) v (0.000,0.000) e (0.000,0.000) impro (0.000,0.000) v (0.000,0.000) ed (0.000,0.000) the (0.000,0.000) implementation (0.000,0.000) so (0.000,0.000) that (0.000,0.000) the (0.000,0.000) VM (0.000,0.000) can (0.000,0.000) complete (0.000,0.000) the (0.000,0.000) branch (0.000,0.000) trace. (0.000,0.000) But (0.000,0.000) it (0.000,0.000) is (0.000,0.000) hard (0.000,0.000) to (0.000,0.000) guarantee (0.000,0.000) that (0.000,0.000) this (0.000,0.000) situation (0.000,0.000) will (0.000,0.000) ne (0.000,0.000) v (0.000,0.000) e (0.000,0.000) r (0.000,0.000) happen. (0.000,0.000) As (0.000,0.000) future (0.000,0.000) w (0.000,0.000) ork, (0.000,0.000) this (0.000,0.000) situation (0.000,0.000) could (0.000,0.000) be (0.000,0.000) a (0.000,0.000) v (0.000,0.000) oided (0.000,0.000) by (0.000,0.000) detecting (0.000,0.000) and (0.000,0.000) blacklisting (0.000,0.000) loops (0.000,0.000) for (0.000,0.000) which (0.000,0.000) the (0.000,0.000) a (0.000,0.000) v (0.000,0.000) erage (0.000,0.000) trace (0.000,0.000) call (0.000,0.000) e (0.000,0.000) x (0.000,0.000) ecutes (0.000,0.000) fe (0.000,0.000) w (0.000,0.000) bytecodes (0.000,0.000) before (0.000,0.000) returning (0.000,0.000) to (0.000,0.000) the (0.000,0.000) interpreter (0.000,0.000) . (0.000,0.000) 4. (0.000,0.000) Nested (0.000,0.000) T (0.000,0.000) race (0.000,0.000) T (0.000,0.000) r (0.000,0.000) ee (0.000,0.000) F (0.000,0.000) ormation (0.000,0.000) Figure (0.000,0.000) 7 (0.000,0.000) sho (0.000,0.000) ws (0.000,0.000) basic (0.000,0.000) trace (0.000,0.000) tree (0.000,0.000) compilation (0.000,0.000) (11) (0.000,0.000) applied (0.000,0.000) to (0.000,0.000) a (0.000,0.000) nested (0.000,0.000) loop (0.000,0.000) where (0.000,0.000) the (0.000,0.000) inner (0.000,0.000) loop (0.000,0.000) contains (0.000,0.000) tw (0.000,0.000) o (0.000,0.000) paths. (0.000,0.000) Usually (0.000,0.000) , (0.000,0.000) the (0.000,0.000) inner (0.000,0.000) loop (0.000,0.000) (with (0.000,0.000) header (0.000,0.000) at (0.000,0.000) i (0.000,0.000) 2 (0.000,0.000) ) (0.000,0.000) becomes (0.000,0.000) hot (0.000,0.000) first, (0.000,0.000) and (0.000,0.000) a (0.000,0.000) trace (0.000,0.000) tree (0.000,0.000) is (0.000,0.000) rooted (0.000,0.000) at (0.000,0.000) that (0.000,0.000) point. (0.000,0.000) F (0.000,0.000) or (0.000,0.000) e (0.000,0.000) xample, (0.000,0.000) the (0.000,0.000) first (0.000,0.000) recorded (0.000,0.000) trace (0.000,0.000) may (0.000,0.000) be (0.000,0.000) a (0.000,0.000) c (0.000,0.000) ycle (0.164,239.103) Figur (0.164,239.103) e (0.164,239.103) 5. (0.164,239.103) A (0.164,239.103) tree (0.164,239.103) with (0.164,239.103) tw (0.164,239.103) o (0.164,239.103) trac (0.164,239.103) es, (0.164,239.103) a (0.164,239.103) trunk (0.164,239.103) trace (0.164,239.103) and (0.164,239.103) one (0.164,239.103) branch (0.164,239.103) trace. (0.164,239.103) The (0.164,239.103) trunk (0.164,239.103) trace (0.164,239.103) contains (0.164,239.103) a (0.164,239.103) guard (0.164,239.103) to (0.164,239.103) which (0.164,239.103) a (0.164,239.103) branch (0.164,239.103) trace (0.164,239.103) w (0.164,239.103) as (0.164,239.103) attached. (0.164,239.103) The (0.164,239.103) branch (0.164,239.103) trace (0.164,239.103) contain (0.164,239.103) a (0.164,239.103) guard (0.164,239.103) that (0.164,239.103) may (0.164,239.103) f (0.164,239.103) ail (0.164,239.103) and (0.164,239.103) trigger (0.164,239.103) a (0.164,239.103) side (0.164,239.103) e (0.164,239.103) xit. (0.164,239.103) Both (0.164,239.103) the (0.164,239.103) trunk (0.164,239.103) and (0.164,239.103) the (0.164,239.103) branch (0.164,239.103) trace (0.164,239.103) loop (0.164,239.103) back (0.164,239.103) to (0.164,239.103) the (0.164,239.103) tree (0.164,239.103) anchor (0.164,239.103) , (0.164,239.103) which (0.164,239.103) is (0.164,239.103) the (0.164,239.103) be (0.164,239.103) ginning (0.164,239.103) of (0.164,239.103) the (0.164,239.103) trace (0.164,239.103) tree. (0.164,239.103) Figur (0.164,239.103) e (0.164,239.103) 6. (0.164,239.103) W (0.164,239.103) e (0.164,239.103) handle (0.164,239.103) type-unstable (0.164,239.103) loops (0.164,239.103) by (0.164,239.103) allo (0.164,239.103) wing (0.164,239.103) traces (0.164,239.103) to (0.164,239.103) compile (0.164,239.103) that (0.164,239.103) cannot (0.164,239.103) loop (0.164,239.103) back (0.164,239.103) to (0.164,239.103) themselv (0.164,239.103) es (0.164,239.103) due (0.164,239.103) to (0.164,239.103) a (0.164,239.103) type (0.164,239.103) mis- (0.164,239.103) match. (0.164,239.103) As (0.164,239.103) such (0.164,239.103) traces (0.164,239.103) accumulate, (0.164,239.103) we (0.164,239.103) attempt (0.164,239.103) to (0.164,239.103) connect (0.164,239.103) their (0.164,239.103) loop (0.164,239.103) edges (0.164,239.103) to (0.164,239.103) form (0.164,239.103) groups (0.164,239.103) of (0.164,239.103) trace (0.164,239.103) trees (0.164,239.103) that (0.164,239.103) can (0.164,239.103) e (0.164,239.103) x (0.164,239.103) ecute (0.164,239.103) without (0.164,239.103) ha (0.164,239.103) ving (0.164,239.103) to (0.164,239.103) side-e (0.164,239.103) xit (0.164,239.103) to (0.164,239.103) the (0.164,239.103) interpreter (0.164,239.103) to (0.164,239.103) co (0.164,239.103) v (0.164,239.103) er (0.164,239.103) odd (0.164,239.103) type (0.164,239.103) case (0.164,239.103) s. (0.164,239.103) This (0.164,239.103) is (0.164,239.103) par (0.164,239.103) - (0.164,239.103) ticularly (0.164,239.103) important (0.164,239.103) for (0.164,239.103) nested (0.164,239.103) trace (0.164,239.103) trees (0.164,239.103) where (0.164,239.103) an (0.164,239.103) outer (0.164,239.103) tree (0.164,239.103) tries (0.164,239.103) to (0.164,239.103) call (0.164,239.103) an (0.164,239.103) inner (0.164,239.103) tree (0.164,239.103) (or (0.164,239.103) in (0.164,239.103) this (0.164,239.103) case (0.164,239.103) a (0.164,239.103) forest (0.164,239.103) of (0.164,239.103) inner (0.164,239.103) trees), (0.164,239.103) since (0.164,239.103) inner (0.164,239.103) loops (0.164,239.103) frequently (0.164,239.103) ha (0.164,239.103) v (0.164,239.103) e (0.164,239.103) initially (0.164,239.103) undefined (0.164,239.103) v (0.164,239.103) alues (0.164,239.103) which (0.164,239.103) change (0.164,239.103) type (0.164,239.103) to (0.164,239.103) a (0.164,239.103) concrete (0.164,239.103) v (0.164,239.103) alue (0.164,239.103) after (0.164,239.103) the (0.164,239.103) first (0.164,239.103) iteration. (0.164,239.103) through (0.164,239.103) the (0.164,239.103) inner (0.164,239.103) l (0.164,239.103) oop, (0.164,239.103) { (0.164,239.103) i (0.164,239.103) 2 (0.164,239.103) , (0.164,239.103) i (0.164,239.103) 3 (0.164,239.103) , (0.164,239.103) i (0.164,239.103) 5 (0.164,239.103) , (0.164,239.103) α (0.164,239.103) } (0.164,239.103) . (0.164,239.103) The (0.164,239.103) α (0.164,239.103) symbol (0.164,239.103) is (0.164,239.103) used (0.164,239.103) to (0.164,239.103) indicate (0.164,239.103) that (0.164,239.103) the (0.164,239.103) trace (0.164,239.103) loops (0.164,239.103) back (0.164,239.103) the (0.164,239.103) tree (0.164,239.103) anchor (0.164,239.103) . (0.164,239.103) When (0.164,239.103) e (0.164,239.103) x (0.164,239.103) ecution (0.164,239.103) lea (0.164,239.103) v (0.164,239.103) es (0.164,239.103) the (0.164,239.103) inner (0.164,239.103) loop, (0.164,239.103) the (0.164,239.103) basic (0.164,239.103) design (0.164,239.103) has (0.164,239.103) tw (0.164,239.103) o (0.164,239.103) choices. (0.164,239.103) First, (0.164,239.103) the (0.164,239.103) system (0.164,239.103) can (0.164,239.103) stop (0.164,239.103) tracing (0.164,239.103) and (0.164,239.103) gi (0.164,239.103) v (0.164,239.103) e (0.164,239.103) up (0.164,239.103) on (0.164,239.103) compiling (0.164,239.103) the (0.164,239.103) outer (0.164,239.103) loop, (0.164,239.103) clearly (0.164,239.103) an (0.164,239.103) undesirable (0.164,239.103) solution. (0.164,239.103) The (0.164,239.103) other (0.164,239.103) choice (0.164,239.103) is (0.164,239.103) to (0.164,239.103) continue (0.164,239.103) tracing, (0.164,239.103) compiling (0.164,239.103) traces (0.164,239.103) for (0.164,239.103) the (0.164,239.103) outer (0.164,239.103) loop (0.164,239.103) inside (0.164,239.103) the (0.164,239.103) inner (0.164,239.103) loop’ (0.164,239.103) s (0.164,239.103) trace (0.164,239.103) tree. (0.164,239.103) F (0.164,239.103) or (0.164,239.103) e (0.164,239.103) xample, (0.164,239.103) the (0.164,239.103) program (0.164,239.103) might (0.164,239.103) e (0.164,239.103) xit (0.164,239.103) at (0.164,239.103) i (0.164,239.103) 5 (0.164,239.103) and (0.164,239.103) record (0.164,239.103) a (0.164,239.103) branch (0.164,239.103) trace (0.164,239.103) that (0.164,239.103) incorporates (0.164,239.103) the (0.164,239.103) outer (0.164,239.103) loop: (0.164,239.103) { (0.164,239.103) i (0.164,239.103) 5 (0.164,239.103) , (0.164,239.103) i (0.164,239.103) 7 (0.164,239.103) , (0.164,239.103) i (0.164,239.103) 1 (0.164,239.103) , (0.164,239.103) i (0.164,239.103) 6 (0.164,239.103) , (0.164,239.103) i (0.164,239.103) 7 (0.164,239.103) , (0.164,239.103) i (0.164,239.103) 1 (0.164,239.103) , (0.164,239.103) α (0.164,239.103) } (0.164,239.103) . (0.164,239.103) Later (0.164,239.103) , (0.164,239.103) the (0.164,239.103) program (0.164,239.103) might (0.164,239.103) tak (0.164,239.103) e (0.164,239.103) the (0.164,239.103) other (0.164,239.103) branch (0.164,239.103) at (0.164,239.103) i (0.164,239.103) 2 (0.164,239.103) and (0.164,239.103) then (0.164,239.103) e (0.164,239.103) xit, (0.164,239.103) recording (0.164,239.103) another (0.164,239.103) branch (0.164,239.103) trace (0.164,239.103) incorporating (0.164,239.103) the (0.164,239.103) outer (0.164,239.103) loop: (0.164,239.103) { (0.164,239.103) i (0.164,239.103) 2 (0.164,239.103) , (0.164,239.103) i (0.164,239.103) 4 (0.164,239.103) , (0.164,239.103) i (0.164,239.103) 5 (0.164,239.103) , (0.164,239.103) i (0.164,239.103) 7 (0.164,239.103) , (0.164,239.103) i (0.164,239.103) 1 (0.164,239.103) , (0.164,239.103) i (0.164,239.103) 6 (0.164,239.103) , (0.164,239.103) i (0.164,239.103) 7 (0.164,239.103) , (0.164,239.103) i (0.164,239.103) 1 (0.164,239.103) , (0.164,239.103) α (0.164,239.103) } (0.164,239.103) . (0.164,239.103) Thus, (0.164,239.103) the (0.164,239.103) outer (0.164,239.103) loop (0.164,239.103) is (0.164,239.103) recorded (0.164,239.103) and (0.164,239.103) compiled (0.164,239.103) twice, (0.164,239.103) and (0.164,239.103) both (0.164,239.103) copies (0.164,239.103) must (0.164,239.103) be (0.164,239.103) retained (0.164,239.103) in (0.164,239.103) the (0.164,239.103) trace (0.164,239.103) cache. (0.164,239.103) Figur (0.164,239.103) e (0.164,239.103) 7. (0.164,239.103) Control (0.164,239.103) flo (0.164,239.103) w (0.164,239.103) graph (0.164,239.103) of (0.164,239.103) a (0.164,239.103) nested (0.164,239.103) loop (0.164,239.103) with (0.164,239.103) an (0.164,239.103) if (0.164,239.103) statement (0.164,239.103) inside (0.164,239.103) the (0.164,239.103) inner (0.164,239.103) most (0.164,239.103) loop (0.164,239.103) (a). (0.164,239.103) An (0.164,239.103) inner (0.164,239.103) tre (0.164,239.103) e (0.164,239.103) captures (0.164,239.103) the (0.164,239.103) inner (0.164,239.103) loop, (0.164,239.103) and (0.164,239.103) is (0.164,239.103) nested (0.164,239.103) inside (0.164,239.103) an (0.164,239.103) outer (0.164,239.103) tree (0.164,239.103) which (0.164,239.103) “calls” (0.164,239.103) the (0.164,239.103) inner (0.164,239.103) tree. (0.164,239.103) The (0.164,239.103) inner (0.164,239.103) tree (0.164,239.103) returns (0.164,239.103) to (0.164,239.103) the (0.164,239.103) outer (0.164,239.103) tree (0.164,239.103) once (0.164,239.103) it (0.164,239.103) e (0.164,239.103) xits (0.164,239.103) along (0.164,239.103) its (0.164,239.103) loop (0.164,239.103) condition (0.164,239.103) guard (0.164,239.103) (b). (0.164,239.103) In (0.164,239.103) general, (0.164,239.103) if (0.164,239.103) loops (0.164,239.103) are (0.164,239.103) nes (0.164,239.103) ted (0.164,239.103) to (0.164,239.103) depth (0.164,239.103) k (0.164,239.103) , (0.164,239.103) and (0.164,239.103) each (0.164,239.103) loop (0.164,239.103) has (0.164,239.103) n (0.164,239.103) paths (0.164,239.103) (on (0.164,239.103) geometric (0.164,239.103) a (0.164,239.103) v (0.164,239.103) erage), (0.164,239.103) this (0.164,239.103) na (0.164,239.103) ¨ (0.164,239.103) ıv (0.164,239.103) e (0.164,239.103) strate (0.164,239.103) gy (0.164,239.103) yields (0.164,239.103) O (0.164,239.103) ( (0.164,239.103) n (0.164,239.103) k (0.164,239.103) ) (0.164,239.103) traces, (0.164,239.103) which (0.164,239.103) can (0.164,239.103) easily (0.164,239.103) fill (0.164,239.103) the (0.164,239.103) trace (0.164,239.103) cache. (0.164,239.103) In (0.164,239.103) order (0.164,239.103) to (0.164,239.103) e (0.164,239.103) x (0.164,239.103) e (0.164,239.103) cute (0.164,239.103) programs (0.164,239.103) with (0.164,239.103) nested (0.164,239.103) loops (0.164,239.103) ef (0.164,239.103) ficientl (0.164,239.103) y (0.164,239.103) , (0.164,239.103) a (0.164,239.103) tracing (0.164,239.103) system (0.164,239.103) needs (0.164,239.103) a (0.164,239.103) technique (0.164,239.103) for (0.164,239.103) co (0.164,239.103) v (0.164,239.103) ering (0.164,239.103) the (0.164,239.103) nested (0.164,239.103) loops (0.164,239.103) with (0.164,239.103) nati (0.164,239.103) v (0.164,239.103) e (0.164,239.103) code (0.164,239.103) without (0.164,239.103) e (0.164,239.103) xponential (0.164,239.103) trace (0.164,239.103) duplication. (0.164,239.103) 4.1 (0.164,239.103) Nesting (0.164,239.103) Algorithm (0.164,239.103) The (0.164,239.103) k (0.164,239.103) e (0.164,239.103) y (0.164,239.103) insight (0.164,239.103) is (0.164,239.103) that (0.164,239.103) if (0.164,239.103) each (0.164,239.103) loop (0.164,239.103) is (0.164,239.103) represented (0.164,239.103) by (0.164,239.103) its (0.164,239.103) o (0.164,239.103) wn (0.164,239.103) trace (0.164,239.103) tree, (0.164,239.103) the (0.164,239.103) code (0.164,239.103) for (0.164,239.103) each (0.164,239.103) loop (0.164,239.103) can (0.164,239.103) be (0.164,239.103) contained (0.164,239.103) only (0.164,239.103) in (0.164,239.103) its (0.164,239.103) o (0.164,239.103) wn (0.164,239.103) tree, (0.164,239.103) and (0.164,239.103) outer (0.164,239.103) loop (0.164,239.103) paths (0.164,239.103) will (0.164,239.103) not (0.164,239.103) be (0.164,239.103) duplicated. (0.164,239.103) Another (0.164,239.103) k (0.164,239.103) e (0.164,239.103) y (0.164,239.103) f (0.164,239.103) act (0.164,239.103) is (0.164,239.103) that (0.164,239.103) we (0.164,239.103) are (0.164,239.103) not (0.164,239.103) tracing (0.164,239.103) arbitrary (0.164,239.103) bytec (0.164,239.103) odes (0.164,239.103) that (0.164,239.103) might (0.164,239.103) ha (0.164,239.103) v (0.164,239.103) e (0.164,239.103) irreduceable (0.164,239.103) control (0.164,239.103) flo (0.164,239.103) w (0.164,239.103) graphs, (0.164,239.103) b (0.164,239.103) ut (0.164,239.103) rather (0.164,239.103) byt (0.164,239.103) ecodes (0.164,239.103) produced (0.164,239.103) by (0.164,239.103) a (0.164,239.103) compiler (0.164,239.103) for (0.164,239.103) a (0.164,239.103) language (0.164,239.103) with (0.164,239.103) structured (0.164,239.103) control (0.164,239.103) flo (0.164,239.103) w (0.164,239.103) . (0.164,239.103) Thus, (0.164,239.103) gi (0.164,239.103) v (0.164,239.103) en (0.164,239.103) tw (0.164,239.103) o (0.164,239.103) loop (0.164,239.103) edges, (0.164,239.103) the (0.164,239.103) system (0.164,239.103) can (0.164,239.103) easily (0.164,239.103) determine (0.164,239.103) whether (0.164,239.103) the (0.164,239.103) y (0.164,239.103) are (0.164,239.103) nested (0.164,239.103) and (0.164,239.103) which (0.164,239.103) is (0.164,239.103) the (0.164,239.103) inner (0.164,239.103) loop. (0.164,239.103) Using (0.164,239.103) this (0.164,239.103) kno (0.164,239.103) wledge, (0.164,239.103) the (0.164,239.103) system (0.164,239.103) can (0.164,239.103) compile (0.164,239.103) inner (0.164,239.103) and (0.164,239.103) outer (0.164,239.103) loops (0.164,239.103) separately (0.164,239.103) , (0.164,239.103) and (0.164,239.103) mak (0.164,239.103) e (0.164,239.103) the (0.164,239.103) outer (0.164,239.103) loop’ (0.164,239.103) s (0.164,239.103) traces (0.164,239.103) call (0.164,239.103) the (0.164,239.103) inner (0.164,239.103) loop’ (0.164,239.103) s (0.164,239.103) trace (0.164,239.103) tree. (0.164,239.103) The (0.164,239.103) algorithm (0.164,239.103) for (0.164,239.103) b (0.164,239.103) uilding (0.164,239.103) nested (0.164,239.103) trace (0.164,239.103) trees (0.164,239.103) is (0.164,239.103) as (0.164,239.103) follo (0.164,239.103) ws. (0.164,239.103) W (0.164,239.103) e (0.164,239.103) start (0.164,239.103) tracing (0.164,239.103) at (0.164,239.103) loop (0.164,239.103) headers (0.164,239.103) e (0.164,239.103) xactly (0.164,239.103) as (0.164,239.103) in (0.164,239.103) the (0.164,239.103) basic (0.164,239.103) tracing (0.164,239.103) system. (0.164,239.103) When (0.164,239.103) we (0.164,239.103) e (0.164,239.103) xit (0.164,239.103) a (0.164,239.103) loop (0.164,239.103) (detected (0.164,239.103) by (0.164,239.103) comparing (0.164,239.103) the (0.164,239.103) interpreter (0.164,239.103) PC (0.164,239.103) with (0.164,239.103) the (0.164,239.103) range (0.164,239.103) gi (0.164,239.103) v (0.164,239.103) en (0.164,239.103) by (0.164,239.103) the (0.164,239.103) loop (0.164,239.103) edge), (0.164,239.103) we (0.164,239.103) stop (0.164,239.103) the (0.164,239.103) trace. (0.164,239.103) The (0.164,239.103) k (0.164,239.103) e (0.164,239.103) y (0.164,239.103) step (0.164,239.103) of (0.164,239.103) the (0.164,239.103) algorithm (0.164,239.103) occurs (0.164,239.103) when (0.164,239.103) we (0.164,239.103) are (0.164,239.103) recording (0.164,239.103) a (0.164,239.103) trace (0.164,239.103) for (0.164,239.103) loop (0.164,239.103) L (0.164,239.103) R (0.164,239.103) ( (0.164,239.103) R (0.164,239.103) for (0.164,239.103) loop (0.164,239.103) being (0.164,239.103) recorded) (0.164,239.103) and (0.164,239.103) we (0.164,239.103) reach (0.164,239.103) the (0.164,239.103) header (0.164,239.103) of (0.164,239.103) a (0.164,239.103) dif (0.164,239.103) ferent (0.164,239.103) loop (0.164,239.103) L (0.164,239.103) O (0.164,239.103) ( (0.164,239.103) O (0.164,239.103) for (0.164,239.103) other (0.164,239.103) loop). (0.164,239.103) Note (0.164,239.103) that (0.164,239.103) L (0.164,239.103) O (0.164,239.103) must (0.164,239.103) be (0.164,239.103) an (0.164,239.103) inner (0.164,239.103) loop (0.164,239.103) of (0.164,239.103) L (0.164,239.103) R (0.164,239.103) because (0.164,239.103) we (0.164,239.103) stop (0.164,239.103) the (0.164,239.103) trace (0.164,239.103) when (0.164,239.103) we (0.164,239.103) e (0.164,239.103) xit (0.164,239.103) a (0.164,239.103) loop. (0.164,239.103) • (0.164,239.103) If (0.164,239.103) L (0.164,239.103) O (0.164,239.103) has (0.164,239.103) a (0.164,239.103) type- (0.164,239.103) matching (0.164,239.103) compiled (0.164,239.103) trace (0.164,239.103) tree, (0.164,239.103) we (0.164,239.103) call (0.164,239.103) L (0.164,239.103) O (0.164,239.103) as (0.164,239.103) a (0.164,239.103) nested (0.164,239.103) trace (0.164,239.103) tree. (0.164,239.103) If (0.164,239.103) the (0.164,239.103) call (0.164,239.103) succeeds, (0.164,239.103) then (0.164,239.103) we (0.164,239.103) record (0.164,239.103) the (0.164,239.103) call (0.164,239.103) in (0.164,239.103) the (0.164,239.103) trace (0.164,239.103) for (0.164,239.103) L (0.164,239.103) R (0.164,239.103) . (0.164,239.103) On (0.164,239.103) future (0.164,239.103) e (0.164,239.103) x (0.164,239.103) ecutions, (0.164,239.103) the (0.164,239.103) trace (0.164,239.103) for (0.164,239.103) L (0.164,239.103) R (0.164,239.103) will (0.164,239.103) call (0.164,239.103) the (0.164,239.103) inner (0.164,239.103) trace (0.164,239.103) directly (0.164,239.103) . (0.164,239.103) • (0.164,239.103) If (0.164,239.103) L (0.164,239.103) O (0.164,239.103) does (0.164,239.103) not (0.164,239.103) ha (0.164,239.103) v (0.164,239.103) e (0.164,239.103) a (0.164,239.103) type-matching (0.164,239.103) compiled (0.164,239.103) trace (0.164,239.103) tree (0.164,239.103) yet, (0.164,239.103) we (0.164,239.103) ha (0.164,239.103) v (0.164,239.103) e (0.164,239.103) to (0.164,239.103) obtain (0.164,239.103) it (0.164,239.103) before (0.164,239.103) we (0.164,239.103) are (0.164,239.103) able (0.164,239.103) to (0.164,239.103) proceed. (0.164,239.103) In (0.164,239.103) order (0.164,239.103) to (0.164,239.103) do (0.164,239.103) this, (0.164,239.103) we (0.164,239.103) simply (0.164,239.103) abort (0.164,239.103) recording (0.164,239.103) the (0.164,239.103) first (0.164,239.103) trace. (0.164,239.103) The (0.164,239.103) trace (0.164,239.103) monitor (0.164,239.103) will (0.164,239.103) see (0.164,239.103) the (0.164,239.103) inner (0.164,239.103) loop (0.164,239.103) header (0.164,239.103) , (0.164,239.103) and (0.164,239.103) wi (0.164,239.103) ll (0.164,239.103) immediately (0.164,239.103) start (0.164,239.103) recording (0.164,239.103) the (0.164,239.103) inner (0.164,239.103) loop. (0.164,239.103) 2 (0.164,239.103) If (0.164,239.103) all (0.164,239.103) the (0.164,239.103) loops (0.164,239.103) in (0.164,239.103) a (0.164,239.103) nest (0.164,239.103) are (0.164,239.103) type-stable, (0.164,239.103) then (0.164,239.103) loop (0.164,239.103) nesting (0.164,239.103) creates (0.164,239.103) no (0.164,239.103) duplication. (0.164,239.103) Otherwise, (0.164,239.103) if (0.164,239.103) loops (0.164,239.103) are (0.164,239.103) nested (0.164,239.103) to (0.164,239.103) a (0.164,239.103) depth (0.164,239.103) k (0.164,239.103) , (0.164,239.103) and (0.164,239.103) each (0.164,119.552) 2 (0.164,119.552) Instead (0.164,119.552) of (0.164,119.552) aborting (0.164,119.552) the (0.164,119.552) outer (0.164,119.552) recording, (0.164,119.552) we (0.164,119.552) could (0.164,119.552) principally (0.164,119.552) merely (0.164,119.552) sus- (0.164,119.552) pend (0.164,119.552) the (0.164,119.552) recording, (0.164,119.552) b (0.164,119.552) ut (0.164,119.552) that (0.164,119.552) w (0.164,119.552) ould (0.164,119.552) require (0.164,119.552) the (0.164,119.552) implementation (0.164,119.552) to (0.164,119.552) be (0.164,119.552) able (0.164,119.552) to (0.164,119.552) record (0.164,119.552) se (0.164,119.552) v (0.164,119.552) eral (0.164,119.552) traces (0.164,119.552) simultaneously (0.164,119.552) , (0.164,119.552) complicating (0.164,119.552) the (0.164,119.552) implementation, (0.164,119.552) while (0.164,119.552) sa (0.164,119.552) ving (0.164,119.552) only (0.164,119.552) a (0.164,119.552) fe (0.164,119.552) w (0.164,119.552) iterations (0.164,119.552) in (0.164,119.552) the (0.164,119.552) interpreter (0.164,119.552) . (0.164,239.103) Figur (0.164,239.103) e (0.164,239.103) 8. (0.164,239.103) Control (0.164,239.103) flo (0.164,239.103) w (0.164,239.103) graph (0.164,239.103) of (0.164,239.103) a (0.164,239.103) loop (0.164,239.103) with (0.164,239.103) tw (0.164,239.103) o (0.164,239.103) nested (0.164,239.103) loops (0.164,239.103) (left) (0.164,239.103) and (0.164,239.103) its (0.164,239.103) nested (0.164,239.103) trace (0.164,239.103) tree (0.164,239.103) configuration (0.164,239.103) (right). (0.164,239.103) The (0.164,239.103) outer (0.164,239.103) tree (0.164,239.103) calls (0.164,239.103) the (0.164,239.103) tw (0.164,239.103) o (0.164,239.103) inner (0.164,239.103) nested (0.164,239.103) trace (0.164,239.103) trees (0.164,239.103) and (0.164,239.103) places (0.164,239.103) guards (0.164,239.103) at (0.164,239.103) their (0.164,239.103) side (0.164,239.103) e (0.164,239.103) xit (0.164,239.103) locations. (0.164,239.103) loop (0.164,239.103) is (0.164,239.103) entered (0.164,239.103) with (0.164,239.103) m (0.164,239.103) dif (0.164,239.103) ferent (0.164,239.103) t (0.164,239.103) ype (0.164,239.103) maps (0.164,239.103) (on (0.164,239.103) geometric (0.164,239.103) a (0.164,239.103) v (0.164,239.103) erage), (0.164,239.103) then (0.164,239.103) we (0.164,239.103) compile (0.164,239.103) O (0.164,239.103) ( (0.164,239.103) m (0.164,239.103) k (0.164,239.103) ) (0.164,239.103) copies (0.164,239.103) of (0.164,239.103) the (0.164,239.103) innermost (0.164,239.103) loop. (0.164,239.103) As (0.164,239.103) long (0.164,239.103) as (0.164,239.103) m (0.164,239.103) is (0.164,239.103) close (0.164,239.103) to (0.164,239.103) 1, (0.164,239.103) the (0.164,239.103) resulting (0.164,239.103) trace (0.164,239.103) trees (0.164,239.103) will (0.164,239.103) be (0.164,239.103) tractable. (0.164,239.103) An (0.164,239.103) important (0.164,239.103) detail (0.164,239.103) is (0.164,239.103) that (0.164,239.103) the (0.164,239.103) call (0.164,239.103) to (0.164,239.103) the (0.164,239.103) inner (0.164,239.103) trace (0.164,239.103) tree (0.164,239.103) must (0.164,239.103) act (0.164,239.103) lik (0.164,239.103) e (0.164,239.103) a (0.164,239.103) function (0.164,239.103) call (0.164,239.103) site: (0.164,239.103) it (0.164,239.103) must (0.164,239.103) return (0.164,239.103) to (0.164,239.103) the (0.164,239.103) same (0.164,239.103) point (0.164,239.103) e (0.164,239.103) v (0.164,239.103) ery (0.164,239.103) time. (0.164,239.103) The (0.164,239.103) goal (0.164,239.103) of (0.164,239.103) nesting (0.164,239.103) is (0.164,239.103) to (0.164,239.103) mak (0.164,239.103) e (0.164,239.103) inner (0.164,239.103) and (0.164,239.103) outer (0.164,239.103) loops (0.164,239.103) independent; (0.164,239.103) thus (0.164,239.103) when (0.164,239.103) the (0.164,239.103) inner (0.164,239.103) tree (0.164,239.103) is (0.164,239.103) called, (0.164,239.103) it (0.164,239.103) must (0.164,239.103) e (0.164,239.103) xit (0.164,239.103) to (0.164,239.103) the (0.164,239.103) same (0.164,239.103) point (0.164,239.103) in (0.164,239.103) the (0.164,239.103) outer (0.164,239.103) tree (0.164,239.103) e (0.164,239.103) v (0.164,239.103) ery (0.164,239.103) time (0.164,239.103) with (0.164,239.103) the (0.164,239.103) same (0.164,239.103) type (0.164,239.103) map. (0.164,239.103) Because (0.164,239.103) we (0.164,239.103) cannot (0.164,239.103) actually (0.164,239.103) guarantee (0.164,239.103) this (0.164,239.103) property (0.164,239.103) , (0.164,239.103) we (0.164,239.103) must (0.164,239.103) guard (0.164,239.103) on (0.164,239.103) it (0.164,239.103) after (0.164,239.103) the (0.164,239.103) call, (0.164,239.103) and (0.164,239.103) side (0.164,239.103) e (0.164,239.103) xit (0.164,239.103) if (0.164,239.103) the (0.164,239.103) property (0.164,239.103) does (0.164,239.103) not (0.164,239.103) hold. (0.164,239.103) A (0.164,239.103) common (0.164,239.103) reason (0.164,239.103) for (0.164,239.103) the (0.164,239.103) inner (0.164,239.103) tree (0.164,239.103) not (0.164,239.103) to (0.164,239.103) return (0.164,239.103) to (0.164,239.103) the (0.164,239.103) same (0.164,239.103) point (0.164,239.103) w (0.164,239.103) ould (0.164,239.103) be (0.164,239.103) if (0.164,239.103) the (0.164,239.103) inner (0.164,239.103) tree (0.164,239.103) took (0.164,239.103) a (0.164,239.103) ne (0.164,239.103) w (0.164,239.103) side (0.164,239.103) e (0.164,239.103) xit (0.164,239.103) for (0.164,239.103) which (0.164,239.103) it (0.164,239.103) had (0.164,239.103) ne (0.164,239.103) v (0.164,239.103) er (0.164,239.103) compiled (0.164,239.103) a (0.164,239.103) trace. (0.164,239.103) At (0.164,239.103) this (0.164,239.103) point, (0.164,239.103) the (0.164,239.103) interpreter (0.164,239.103) PC (0.164,239.103) is (0.164,239.103) in (0.164,239.103) the (0.164,239.103) inner (0.164,239.103) tree, (0.164,239.103) so (0.164,239.103) we (0.164,239.103) cannot (0.164,239.103) continue (0.164,239.103) recording (0.164,239.103) or (0.164,239.103) e (0.164,239.103) x (0.164,239.103) ecuting (0.164,239.103) the (0.164,239.103) outer (0.164,239.103) tree. (0.164,239.103) If (0.164,239.103) this (0.164,239.103) happens (0.164,239.103) during (0.164,239.103) recording, (0.164,239.103) we (0.164,239.103) abort (0.164,239.103) the (0.164,239.103) outer (0.164,239.103) trace, (0.164,239.103) to (0.164,239.103) gi (0.164,239.103) v (0.164,239.103) e (0.164,239.103) the (0.164,239.103) inner (0.164,239.103) tree (0.164,239.103) a (0.164,239.103) chance (0.164,239.103) to (0.164,239.103) finish (0.164,239.103) gro (0.164,239.103) wing. (0.164,239.103) A (0.164,239.103) fut (0.164,239.103) ure (0.164,239.103) e (0.164,239.103) x (0.164,239.103) ecution (0.164,239.103) of (0.164,239.103) the (0.164,239.103) outer (0.164,239.103) tree (0.164,239.103) w (0.164,239.103) ould (0.164,239.103) then (0.164,239.103) be (0.164,239.103) able (0.164,239.103) to (0.164,239.103) properly (0.164,239.103) finish (0.164,239.103) and (0.164,239.103) rec (0.164,239.103) ord (0.164,239.103) a (0.164,239.103) call (0.164,239.103) to (0.164,239.103) the (0.164,239.103) inner (0.164,239.103) tree. (0.164,239.103) If (0.164,239.103) an (0.164,239.103) inner (0.164,239.103) tree (0.164,239.103) side (0.164,239.103) e (0.164,239.103) xit (0.164,239.103) happens (0.164,239.103) during (0.164,239.103) e (0.164,239.103) x (0.164,239.103) ecution (0.164,239.103) of (0.164,239.103) a (0.164,239.103) compiled (0.164,239.103) trace (0.164,239.103) for (0.164,239.103) the (0.164,239.103) outer (0.164,239.103) tree, (0.164,239.103) we (0.164,239.103) simply (0.164,239.103) e (0.164,239.103) xit (0.164,239.103) the (0.164,239.103) outer (0.164,239.103) trace (0.164,239.103) and (0.164,239.103) start (0.164,239.103) recording (0.164,239.103) a (0.164,239.103) ne (0.164,239.103) w (0.164,239.103) branch (0.164,239.103) in (0.164,239.103) the (0.164,239.103) inner (0.164,239.103) tree. (0.164,239.103) 4.2 (0.164,239.103) Blacklisting (0.164,239.103) with (0.164,239.103) Nesting (0.164,239.103) The (0.164,239.103) blacklisting (0.164,239.103) algorithm (0.164,239.103) needs (0.164,239.103) modification (0.164,239.103) to (0.164,239.103) w (0.164,239.103) ork (0.164,239.103) well (0.164,239.103) with (0.164,239.103) nesting. (0.164,239.103) The (0.164,239.103) problem (0.164,239.103) is (0.164,239.103) that (0.164,239.103) outer (0.164,239.103) loop (0.164,239.103) traces (0.164,239.103) often (0.164,239.103) abort (0.164,239.103) during (0.164,239.103) startup (0.164,239.103) (because (0.164,239.103) the (0.164,239.103) inner (0.164,239.103) tree (0.164,239.103) is (0.164,239.103) not (0.164,239.103) a (0.164,239.103) v (0.164,239.103) ailable (0.164,239.103) or (0.164,239.103) tak (0.164,239.103) es (0.164,239.103) a (0.164,239.103) side (0.164,239.103) e (0.164,239.103) xit), (0.164,239.103) which (0.164,239.103) w (0.164,239.103) ould (0.164,239.103) lead (0.164,239.103) to (0.164,239.103) t (0.164,239.103) heir (0.164,239.103) being (0.164,239.103) quickly (0.164,239.103) blacklisted (0.164,239.103) by (0.164,239.103) the (0.164,239.103) basic (0.164,239.103) algorithm. (0.164,239.103) The (0.164,239.103) k (0.164,239.103) e (0.164,239.103) y (0.164,239.103) observ (0.164,239.103) ation (0.164,239.103) is (0.164,239.103) that (0.164,239.103) when (0.164,239.103) an (0.164,239.103) outer (0.164,239.103) tr (0.164,239.103) ace (0.164,239.103) aborts (0.164,239.103) because (0.164,239.103) the (0.164,239.103) inner (0.164,239.103) tree (0.164,239.103) is (0.164,239.103) not (0.164,239.103) ready (0.164,239.103) , (0.164,239.103) this (0.164,239.103) is (0.164,239.103) probably (0.164,239.103) a (0.164,239.103) temporary (0.164,239.103) condition. (0.164,239.103) Thus, (0.164,239.103) we (0.164,239.103) should (0.164,239.103) not (0.164,239.103) count (0.164,239.103) such (0.164,239.103) aborts (0.164,239.103) to (0.164,239.103) w (0.164,239.103) ard (0.164,239.103) blacklisting (0.164,239.103) as (0.164,239.103) long (0.164,239.103) as (0.164,239.103) we (0.164,239.103) are (0.164,239.103) able (0.164,239.103) to (0.164,239.103) b (0.164,239.103) uild (0.164,239.103) up (0.164,239.103) more (0.164,239.103) traces (0.164,239.103) for (0.164,239.103) the (0.164,239.103) inner (0.164,239.103) tree. (0.164,239.103) In (0.164,239.103) our (0.164,239.103) implementation, (0.164,239.103) when (0.164,239.103) an (0.164,239.103) outer (0.164,239.103) tree (0.164,239.103) aborts (0.164,239.103) on (0.164,239.103) the (0.164,239.103) inner (0.164,239.103) tree, (0.164,239.103) we (0.164,239.103) increment (0.164,239.103) the (0.164,239.103) outer (0.164,239.103) tree’ (0.164,239.103) s (0.164,239.103) blacklist (0.164,239.103) counter (0.164,239.103) as (0.164,239.103) usual (0.164,239.103) and (0.164,239.103) back (0.164,239.103) of (0.164,239.103) f (0.164,239.103) on (0.164,239.103) compiling (0.164,239.103) it. (0.164,239.103) When (0.164,239.103) the (0.164,239.103) inner (0.164,239.103) tree (0.164,239.103) finis (0.164,239.103) hes (0.164,239.103) a (0.164,239.103) trace, (0.164,239.103) we (0.164,239.103) decrement (0.164,239.103) the (0.164,239.103) blacklist (0.164,239.103) count (0.164,239.103) er (0.164,239.103) on (0.164,239.103) the (0.164,239.103) outer (0.164,239.103) loop, (0.164,239.103) “for (0.164,239.103) gi (0.164,239.103) ving” (0.164,239.103) the (0.164,239.103) outer (0.164,239.103) loop (0.164,239.103) for (0.164,239.103) aborting (0.164,239.103) pre (0.164,239.103) viously (0.164,239.103) . (0.164,239.103) W (0.164,239.103) e (0.164,239.103) also (0.164,239.103) undo (0.164,239.103) the (0.164,239.103) back (0.164,239.103) of (0.164,239.103) f (0.164,239.103) so (0.164,239.103) that (0.164,239.103) the (0.164,239.103) outer (0.164,239.103) tree (0.164,239.103) can (0.164,239.103) start (0.164,239.103) immediately (0.164,239.103) trying (0.164,239.103) to (0.164,239.103) compile (0.164,239.103) the (0.164,239.103) ne (0.164,239.103) xt (0.164,239.103) time (0.164,239.103) we (0.164,239.103) reach (0.164,239.103) it. (0.164,239.103) 5. (0.164,239.103) T (0.164,239.103) race (0.164,239.103) T (0.164,239.103) r (0.164,239.103) ee (0.164,239.103) Optimization (0.164,239.103) This (0.164,239.103) section (0.164,239.103) e (0.164,239.103) xplains (0.164,239.103) ho (0.164,239.103) w (0.164,239.103) a (0.164,239.103) recorded (0.164,239.103) trace (0.164,239.103) is (0.164,239.103) translated (0.164,239.103) to (0.164,239.103) an (0.164,239.103) optimized (0.164,239.103) machine (0.164,239.103) code (0.164,239.103) trace. (0.164,239.103) The (0.164,239.103) trace (0.164,239.103) compilation (0.164,239.103) subsystem, (0.164,239.103) N (0.164,239.103) A (0.164,239.103) N (0.164,239.103) O (0.164,239.103) J (0.164,239.103) I (0.164,239.103) T (0.164,239.103) , (0.164,239.103) is (0.164,239.103) separate (0.164,239.103) from (0.164,239.103) the (0.164,239.103) VM (0.164,239.103) and (0.164,239.103) can (0.164,239.103) be (0.164,239.103) used (0.164,239.103) for (0.164,239.103) other (0.164,239.103) applications. (0.000,0.000) 5.1 (0.000,0.000) Optimizations (0.000,0.000) Because (0.000,0.000) traces (0.000,0.000) are (0.000,0.000) in (0.000,0.000) SSA (0.000,0.000) form (0.000,0.000) and (0.000,0.000) ha (0.000,0.000) v (0.000,0.000) e (0.000,0.000) no (0.000,0.000) join (0.000,0.000) points (0.000,0.000) or (0.000,0.000) φ (0.000,0.000) - (0.000,0.000) nodes, (0.000,0.000) certa (0.000,0.000) in (0.000,0.000) optimizations (0.000,0.000) a (0.000,0.000) re (0.000,0.000) easy (0.000,0.000) to (0.000,0.000) implement. (0.000,0.000) In (0.000,0.000) order (0.000,0.000) to (0.000,0.000) get (0.000,0.000) good (0.000,0.000) startup (0.000,0.000) performance, (0.000,0.000) the (0.000,0.000) optimizations (0.000,0.000) must (0.000,0.000) run (0.000,0.000) quickly (0.000,0.000) , (0.000,0.000) so (0.000,0.000) we (0.000,0.000) chose (0.000,0.000) a (0.000,0.000) small (0.000,0.000) set (0.000,0.000) of (0.000,0.000) optimizations. (0.000,0.000) W (0.000,0.000) e (0.000,0.000) implemented (0.000,0.000) the (0.000,0.000) optimizations (0.000,0.000) as (0.000,0.000) pipelined (0.000,0.000) filters (0.000,0.000) so (0.000,0.000) that (0.000,0.000) the (0.000,0.000) y (0.000,0.000) can (0.000,0.000) be (0.000,0.000) turned (0.000,0.000) on (0.000,0.000) and (0.000,0.000) of (0.000,0.000) f (0.000,0.000) independently (0.000,0.000) , (0.000,0.000) and (0.000,0.000) yet (0.000,0.000) all (0.000,0.000) run (0.000,0.000) in (0.000,0.000) just (0.000,0.000) tw (0.000,0.000) o (0.000,0.000) l (0.000,0.000) oop (0.000,0.000) passes (0.000,0.000) o (0.000,0.000) v (0.000,0.000) er (0.000,0.000) the (0.000,0.000) trace: (0.000,0.000) one (0.000,0.000) forw (0.000,0.000) ard (0.000,0.000) and (0.000,0.000) one (0.000,0.000) backw (0.000,0.000) ard. (0.000,0.000) Ev (0.000,0.000) ery (0.000,0.000) time (0.000,0.000) the (0.000,0.000) trace (0.000,0.000) recorder (0.000,0.000) emits (0.000,0.000) a (0.000,0.000) LIR (0.000,0.000) instruction, (0.000,0.000) the (0.000,0.000) in- (0.000,0.000) struction (0.000,0.000) is (0.000,0.000) immediately (0.000,0.000) passed (0.000,0.000) to (0.000,0.000) the (0.000,0.000) first (0.000,0.000) filter (0.000,0.000) in (0.000,0.000) the (0.000,0.000) forw (0.000,0.000) ard (0.000,0.000) pipeline. (0.000,0.000) Thus, (0.000,0.000) forw (0.000,0.000) ard (0.000,0.000) filte (0.000,0.000) r (0.000,0.000) optimizations (0.000,0.000) are (0.000,0.000) performed (0.000,0.000) as (0.000,0.000) the (0.000,0.000) trace (0.000,0.000) is (0.000,0.000) recorded. (0.000,0.000) Each (0.000,0.000) filter (0.000,0.000) may (0.000,0.000) pass (0.000,0.000) each (0.000,0.000) instruction (0.000,0.000) to (0.000,0.000) the (0.000,0.000) ne (0.000,0.000) xt (0.000,0.000) filter (0.000,0.000) unchanged, (0.000,0.000) write (0.000,0.000) a (0.000,0.000) dif (0.000,0.000) ferent (0.000,0.000) instruction (0.000,0.000) to (0.000,0.000) the (0.000,0.000) ne (0.000,0.000) xt (0.000,0.000) filter (0.000,0.000) , (0.000,0.000) or (0.000,0.000) write (0.000,0.000) no (0.000,0.000) instruction (0.000,0.000) at (0.000,0.000) all. (0.000,0.000) F (0.000,0.000) or (0.000,0.000) e (0.000,0.000) xample, (0.000,0.000) the (0.000,0.000) constant (0.000,0.000) folding (0.000,0.000) filter (0.000,0.000) can (0.000,0.000) replace (0.000,0.000) a (0.000,0.000) multiply (0.000,0.000) instruction (0.000,0.000) lik (0.000,0.000) e (0.000,0.000) v (0.000,0.000) 13 (0.000,0.000) := (0.000,0.000) mu (0.000,0.000) l (0.000,0.000) 3 (0.000,0.000) , (0.000,0.000) 1000 (0.000,0.000) with (0.000,0.000) a (0.000,0.000) constant (0.000,0.000) instruction (0.000,0.000) v (0.000,0.000) 13 (0.000,0.000) = (0.000,0.000) 3000 (0.000,0.000) . (0.000,0.000) W (0.000,0.000) e (0.000,0.000) currently (0.000,0.000) apply (0.000,0.000) four (0.000,0.000) forw (0.000,0.000) ard (0.000,0.000) filters: (0.000,0.000) • (0.000,0.000) On (0.000,0.000) ISAs (0.000,0.000) without (0.000,0.000) floating-point (0.000,0.000) instructions, (0.000,0.000) a (0.000,0.000) soft-float (0.000,0.000) filter (0.000,0.000) con (0.000,0.000) v (0.000,0.000) erts (0.000,0.000) floating-point (0.000,0.000) LIR (0.000,0.000) instructions (0.000,0.000) to (0.000,0.000) sequences (0.000,0.000) of (0.000,0.000) inte (0.000,0.000) ger (0.000,0.000) instructions. (0.000,0.000) • (0.000,0.000) CSE (0.000,0.000) (constant (0.000,0.000) sube (0.000,0.000) xpression (0.000,0.000) elimination), (0.000,0.000) • (0.000,0.000) e (0.000,0.000) xpression (0.000,0.000) simplification, (0.000,0.000) including (0.000,0.000) constant (0.000,0.000) folding (0.000,0.000) and (0.000,0.000) a (0.000,0.000) fe (0.000,0.000) w (0.000,0.000) algebraic (0.000,0.000) identities (0.000,0.000) (e.g., (0.000,0.000) a (0.000,0.000) − (0.000,0.000) a (0.000,0.000) = (0.000,0.000) 0 (0.000,0.000) ), (0.000,0.000) and (0.000,0.000) • (0.000,0.000) source (0.000,0.000) language (0.000,0.000) semantic-specific (0.000,0.000) e (0.000,0.000) xpression (0.000,0.000) simplification, (0.000,0.000) primarily (0.000,0.000) algebraic (0.000,0.000) identit (0.000,0.000) ies (0.000,0.000) that (0.000,0.000) allo (0.000,0.000) w (0.000,0.000) D (0.000,0.000) O (0.000,0.000) U (0.000,0.000) B (0.000,0.000) L (0.000,0.000) E (0.000,0.000) to (0.000,0.000) be (0.000,0.000) replaced (0.000,0.000) with (0.000,0.000) I (0.000,0.000) N (0.000,0.000) T (0.000,0.000) . (0.000,0.000) F (0.000,0.000) or (0.000,0.000) e (0.000,0.000) xample, (0.000,0.000) LIR (0.000,0.000) that (0.000,0.000) con (0.000,0.000) v (0.000,0.000) erts (0.000,0.000) an (0.000,0.000) I (0.000,0.000) N (0.000,0.000) T (0.000,0.000) to (0.000,0.000) a (0.000,0.000) D (0.000,0.000) O (0.000,0.000) U (0.000,0.000) B (0.000,0.000) L (0.000,0.000) E (0.000,0.000) and (0.000,0.000) then (0.000,0.000) back (0.000,0.000) ag (0.000,0.000) ain (0.000,0.000) w (0.000,0.000) ould (0.000,0.000) be (0.000,0.000) remo (0.000,0.000) v (0.000,0.000) ed (0.000,0.000) by (0.000,0.000) this (0.000,0.000) filter (0.000,0.000) . (0.000,0.000) When (0.000,0.000) trace (0.000,0.000) recording (0.000,0.000) is (0.000,0.000) completed, (0.000,0.000) nanojit (0.000,0.000) runs (0.000,0.000) the (0.000,0.000) backw (0.000,0.000) ard (0.000,0.000) optimization (0.000,0.000) filters. (0.000,0.000) These (0.000,0.000) are (0.000,0.000) used (0.000,0.000) for (0.000,0.000) optimizations (0.000,0.000) that (0.000,0.000) require (0.000,0.000) backw (0.000,0.000) ard (0.000,0.000) program (0.000,0.000) analysis. (0.000,0.000) When (0.000,0.000) running (0.000,0.000) the (0.000,0.000) backw (0.000,0.000) ard (0.000,0.000) filters, (0.000,0.000) nanojit (0.000,0.000) reads (0.000,0.000) one (0.000,0.000) LIR (0.000,0.000) instruction (0.000,0.000) at (0.000,0.000) a (0.000,0.000) time, (0.000,0.000) and (0.000,0.000) t (0.000,0.000) he (0.000,0.000) reads (0.000,0.000) are (0.000,0.000) passed (0.000,0.000) through (0.000,0.000) the (0.000,0.000) pipeline. (0.000,0.000) W (0.000,0.000) e (0.000,0.000) currently (0.000,0.000) apply (0.000,0.000) three (0.000,0.000) backw (0.000,0.000) ard (0.000,0.000) filters: (0.000,0.000) • (0.000,0.000) Dead (0.000,0.000) data-stack (0.000,0.000) store (0.000,0.000) elimination. (0.000,0.000) The (0.000,0.000) LIR (0.000,0.000) trace (0.000,0.000) encodes (0.000,0.000) man (0.000,0.000) y (0.000,0.000) stores (0.000,0.000) to (0.000,0.000) locations (0.000,0.000) in (0.000,0.000) the (0.000,0.000) interpreter (0.000,0.000) stack. (0.000,0.000) But (0.000,0.000) these (0.000,0.000) v (0.000,0.000) alues (0.000,0.000) are (0.000,0.000) ne (0.000,0.000) v (0.000,0.000) er (0.000,0.000) read (0.000,0.000) back (0.000,0.000) before (0.000,0.000) e (0.000,0.000) xiting (0.000,0.000) the (0.000,0.000) trace (0.000,0.000) (by (0.000,0.000) the (0.000,0.000) interpret (0.000,0.000) er (0.000,0.000) or (0.000,0.000) another (0.000,0.000) trace). (0.000,0.000) Thus, (0.000,0.000) stores (0.000,0.000) to (0.000,0.000) the (0.000,0.000) s (0.000,0.000) tack (0.000,0.000) that (0.000,0.000) are (0.000,0.000) o (0.000,0.000) v (0.000,0.000) erwritten (0.000,0.000) before (0.000,0.000) the (0.000,0.000) ne (0.000,0.000) xt (0.000,0.000) e (0.000,0.000) xit (0.000,0.000) are (0.000,0.000) dead. (0.000,0.000) Store (0.000,0.000) s (0.000,0.000) to (0.000,0.000) locations (0.000,0.000) that (0.000,0.000) are (0.000,0.000) of (0.000,0.000) f (0.000,0.000) the (0.000,0.000) top (0.000,0.000) of (0.000,0.000) the (0.000,0.000) interpreter (0.000,0.000) stack (0.000,0.000) at (0.000,0.000) future (0.000,0.000) e (0.000,0.000) xits (0.000,0.000) are (0.000,0.000) also (0.000,0.000) dead. (0.000,0.000) • (0.000,0.000) Dead (0.000,0.000) call-stack (0.000,0.000) store (0.000,0.000) elimination. (0.000,0.000) This (0.000,0.000) is (0.000,0.000) the (0.000,0.000) same (0.000,0.000) optimization (0.000,0.000) as (0.000,0.000) abo (0.000,0.000) v (0.000,0.000) e, (0.000,0.000) e (0.000,0.000) xcept (0.000,0.000) applied (0.000,0.000) to (0.000,0.000) the (0.000,0.000) interpreter’ (0.000,0.000) s (0.000,0.000) call (0.000,0.000) stack (0.000,0.000) used (0.000,0.000) for (0.000,0.000) function (0.000,0.000) call (0.000,0.000) inlining. (0.000,0.000) • (0.000,0.000) Dead (0.000,0.000) code (0.000,0.000) elimination. (0.000,0.000) This (0.000,0.000) eliminates (0.000,0.000) an (0.000,0.000) y (0.000,0.000) operation (0.000,0.000) that (0.000,0.000) stores (0.000,0.000) to (0.000,0.000) a (0.000,0.000) v (0.000,0.000) alue (0.000,0.000) that (0.000,0.000) is (0.000,0.000) ne (0.000,0.000) v (0.000,0.000) er (0.000,0.000) used. (0.000,0.000) After (0.000,0.000) a (0.000,0.000) LIR (0.000,0.000) instruction (0.000,0.000) is (0.000,0.000) successfully (0.000,0.000) read (0.000,0.000) (“pulled”) (0.000,0.000) from (0.000,0.000) the (0.000,0.000) backw (0.000,0.000) ard (0.000,0.000) filter (0.000,0.000) pipeli (0.000,0.000) ne, (0.000,0.000) nanojit’ (0.000,0.000) s (0.000,0.000) code (0.000,0.000) generator (0.000,0.000) emits (0.000,0.000) nati (0.000,0.000) v (0.000,0.000) e (0.000,0.000) machine (0.000,0.000) instruction(s) (0.000,0.000) for (0.000,0.000) it. (0.000,0.000) 5.2 (0.000,0.000) Register (0.000,0.000) Allocation (0.000,0.000) W (0.000,0.000) e (0.000,0.000) use (0.000,0.000) a (0.000,0.000) simple (0.000,0.000) greedy (0.000,0.000) re (0.000,0.000) gister (0.000,0.000) allocator (0.000,0.000) that (0.000,0.000) mak (0.000,0.000) es (0.000,0.000) a (0.000,0.000) single (0.000,0.000) backw (0.000,0.000) ard (0.000,0.000) pass (0.000,0.000) o (0.000,0.000) v (0.000,0.000) er (0.000,0.000) the (0.000,0.000) trace (0.000,0.000) (it (0.000,0.000) is (0.000,0.000) inte (0.000,0.000) grated (0.000,0.000) with (0.000,0.000) the (0.000,0.000) c (0.000,0.000) ode (0.000,0.000) gen- (0.000,0.000) erator). (0.000,0.000) By (0.000,0.000) the (0.000,0.000) time (0.000,0.000) the (0.000,0.000) allocator (0.000,0.000) has (0.000,0.000) reached (0.000,0.000) an (0.000,0.000) instruction (0.000,0.000) lik (0.000,0.000) e (0.000,0.000) v (0.000,0.000) 3 (0.000,0.000) = (0.000,0.000) add (0.000,0.000) v (0.000,0.000) 1 (0.000,0.000) , (0.000,0.000) v (0.000,0.000) 2 (0.000,0.000) , (0.000,0.000) it (0.000,0.000) has (0.000,0.000) already (0.000,0.000) assigned (0.000,0.000) a (0.000,0.000) re (0.000,0.000) gister (0.000,0.000) to (0.000,0.000) v (0.000,0.000) 3 (0.000,0.000) . (0.000,0.000) If (0.000,0.000) v (0.000,0.000) 1 (0.000,0.000) and (0.000,0.000) v (0.000,0.000) 2 (0.000,0.000) ha (0.000,0.000) v (0.000,0.000) e (0.000,0.000) not (0.000,0.000) yet (0.000,0.000) been (0.000,0.000) assigned (0.000,0.000) re (0.000,0.000) gister (0.000,0.000) s, (0.000,0.000) the (0.000,0.000) all (0.000,0.000) ocator (0.000,0.000) assigns (0.000,0.000) a (0.000,0.000) free (0.000,0.000) re (0.000,0.000) gister (0.000,0.000) to (0.000,0.000) each. (0.000,0.000) If (0.000,0.000) there (0.000,0.000) are (0.000,0.000) no (0.000,0.000) free (0.000,0.000) re (0.000,0.000) gisters, (0.000,0.000) a (0.000,0.000) v (0.000,0.000) alue (0.000,0.000) is (0.000,0.000) selected (0.000,0.000) for (0.000,0.000) spilling. (0.000,0.000) W (0.000,0.000) e (0.000,0.000) use (0.000,0.000) a (0.000,0.000) class (0.000,0.000) heuristic (0.000,0.000) that (0.000,0.000) sel (0.000,0.000) ects (0.000,0.000) the (0.000,0.000) “oldest” (0.000,0.000) re (0.000,0.000) gister (0.000,0.000) - (0.000,0.000) carried (0.000,0.000) v (0.000,0.000) alue (0.000,0.000) (6). (0.000,0.000) The (0.000,0.000) heuristic (0.000,0.000) considers (0.000,0.000) the (0.000,0.000) set (0.000,0.000) R (0.000,0.000) of (0.000,0.000) v (0.000,0.000) alues (0.000,0.000) v (0.000,0.000) in (0.000,0.000) re (0.000,0.000) gisters (0.000,0.000) imme- (0.000,0.000) diately (0.000,0.000) after (0.000,0.000) the (0.000,0.000) current (0.000,0.000) instruction (0.000,0.000) for (0.000,0.000) spilling. (0.000,0.000) Let (0.000,0.000) v (0.000,0.000) m (0.000,0.000) be (0.000,0.000) the (0.000,0.000) last (0.000,0.000) instruction (0.000,0.000) before (0.000,0.000) the (0.000,0.000) current (0.000,0.000) where (0.000,0.000) each (0.000,0.000) v (0.000,0.000) is (0.000,0.000) referred (0.000,0.000) to. (0.000,0.000) Then (0.000,0.000) the (0.000,0.000) T (0.000,0.000) ag (9.963,0.199) JS (9.963,0.199) T (9.963,0.199) ype (9.963,0.199) Description (0.199,237.984) xx1 (9.963,0.199) number (9.963,0.199) 31-bit (9.963,0.199) inte (9.963,0.199) ger (9.963,0.199) representation (9.963,0.199) 000 (9.963,0.199) object (9.963,0.199) pointer (9.963,0.199) to (9.963,0.199) JSObject (9.963,0.199) handle (9.963,0.199) 010 (9.963,0.199) number (9.963,0.199) pointer (9.963,0.199) to (9.963,0.199) double (9.963,0.199) handle (9.963,0.199) 100 (9.963,0.199) string (9.963,0.199) pointer (9.963,0.199) to (9.963,0.199) JSString (9.963,0.199) handle (9.963,0.199) 110 (9.963,0.199) boolean (9.963,0.199) enumeration (9.963,0.199) for (9.963,0.199) null, (9.963,0.199) undefined, (9.963,0.199) true, (9.963,0.199) f (9.963,0.199) alse (9.963,0.199) null, (9.963,0.199) or (9.963,0.199) undefined (0.164,239.103) Figur (0.164,239.103) e (0.164,239.103) 9. (0.164,239.103) T (0.164,239.103) agged (0.164,239.103) v (0.164,239.103) alues (0.164,239.103) in (0.164,239.103) the (0.164,239.103) SpiderMonk (0.164,239.103) ey (0.164,239.103) JS (0.164,239.103) inter (0.164,239.103) pr (0.164,239.103) eter (0.164,239.103) . (0.164,239.103) T (0.164,239.103) esting (0.164,239.103) tags, (0.164,239.103) unboxing (0.164,239.103) (e (0.164,239.103) xtracting (0.164,239.103) the (0.164,239.103) untagged (0.164,239.103) v (0.164,239.103) alue) (0.164,239.103) and (0.164,239.103) boxing (0.164,239.103) (creating (0.164,239.103) tagged (0.164,239.103) v (0.164,239.103) alues) (0.164,239.103) are (0.164,239.103) significant (0.164,239.103) costs. (0.164,239.103) A (0.164,239.103) v (0.164,239.103) oiding (0.164,239.103) these (0.164,239.103) costs (0.164,239.103) is (0.164,239.103) a (0.164,239.103) k (0.164,239.103) e (0.164,239.103) y (0.164,239.103) benefit (0.164,239.103) of (0.164,239.103) tracing. (0.164,239.103) heuristic (0.164,239.103) selects (0.164,239.103) v (0.164,239.103) with (0.164,239.103) minimum (0.164,239.103) v (0.164,239.103) m (0.164,239.103) . (0.164,239.103) The (0.164,239.103) moti (0.164,239.103) v (0.164,239.103) ation (0.164,239.103) is (0.164,239.103) that (0.164,239.103) this (0.164,239.103) frees (0.164,239.103) up (0.164,239.103) a (0.164,239.103) re (0.164,239.103) gister (0.164,239.103) for (0.164,239.103) as (0.164,239.103) long (0.164,239.103) as (0.164,239.103) possible (0.164,239.103) gi (0.164,239.103) v (0.164,239.103) en (0.164,239.103) a (0.164,239.103) single (0.164,239.103) spill. (0.164,239.103) If (0.164,239.103) we (0.164,239.103) need (0.164,239.103) to (0.164,239.103) spill (0.164,239.103) a (0.164,239.103) v (0.164,239.103) alue (0.164,239.103) v (0.164,239.103) s (0.164,239.103) at (0.164,239.103) this (0.164,239.103) point, (0.164,239.103) we (0.164,239.103) ge (0.164,239.103) nerate (0.164,239.103) the (0.164,239.103) restore (0.164,239.103) code (0.164,239.103) just (0.164,239.103) after (0.164,239.103) the (0.164,239.103) code (0.164,239.103) for (0.164,239.103) the (0.164,239.103) current (0.164,239.103) instruction. (0.164,239.103) The (0.164,239.103) corresponding (0.164,239.103) spill (0.164,239.103) code (0.164,239.103) is (0.164,239.103) generated (0.164,239.103) just (0.164,239.103) after (0.164,239.103) the (0.164,239.103) last (0.164,239.103) point (0.164,239.103) where (0.164,239.103) v (0.164,239.103) s (0.164,239.103) w (0.164,239.103) as (0.164,239.103) used. (0.164,239.103) The (0.164,239.103) re (0.164,239.103) gister (0.164,239.103) that (0.164,239.103) w (0.164,239.103) as (0.164,239.103) assigned (0.164,239.103) to (0.164,239.103) v (0.164,239.103) s (0.164,239.103) is (0.164,239.103) mark (0.164,239.103) ed (0.164,239.103) free (0.164,239.103) for (0.164,239.103) the (0.164,239.103) preceding (0.164,239.103) code, (0.164,239.103) because (0.164,239.103) that (0.164,239.103) re (0.164,239.103) gister (0.164,239.103) can (0.164,239.103) no (0.164,239.103) w (0.164,239.103) be (0.164,239.103) used (0.164,239.103) freely (0.164,239.103) without (0.164,239.103) af (0.164,239.103) fecting (0.164,239.103) the (0.164,239.103) follo (0.164,239.103) wing (0.164,239.103) code (0.164,239.103) 6. (0.164,239.103) Implementation (0.164,239.103) T (0.164,239.103) o (0.164,239.103) demonstrate (0.164,239.103) the (0.164,239.103) ef (0.164,239.103) fecti (0.164,239.103) v (0.164,239.103) eness (0.164,239.103) of (0.164,239.103) our (0.164,239.103) approach, (0.164,239.103) we (0.164,239.103) ha (0.164,239.103) v (0.164,239.103) e (0.164,239.103) im- (0.164,239.103) plemented (0.164,239.103) a (0.164,239.103) trace-based (0.164,239.103) dynamic (0.164,239.103) compiler (0.164,239.103) for (0.164,239.103) the (0.164,239.103) SpiderMonk (0.164,239.103) e (0.164,239.103) y (0.164,239.103) Ja (0.164,239.103) v (0.164,239.103) aScript (0.164,239.103) V (0.164,239.103) irtual (0.164,239.103) Machine (0.164,239.103) (4). (0.164,239.103) SpiderM (0.164,239.103) onk (0.164,239.103) e (0.164,239.103) y (0.164,239.103) is (0.164,239.103) the (0.164,239.103) Ja (0.164,239.103) v (0.164,239.103) aScript (0.164,239.103) VM (0.164,239.103) embedded (0.164,239.103) in (0.164,239.103) Mozilla’ (0.164,239.103) s (0.164,239.103) Firefox (0.164,239.103) open-source (0.164,239.103) web (0.164,239.103) bro (0.164,239.103) wser (0.164,239.103) (2), (0.164,239.103) which (0.164,239.103) is (0.164,239.103) used (0.164,239.103) by (0.164,239.103) more (0.164,239.103) than (0.164,239.103) 200 (0.164,239.103) million (0.164,239.103) users (0.164,239.103) w (0.164,239.103) orld-wide. (0.164,239.103) The (0.164,239.103) core (0.164,239.103) of (0.164,239.103) SpiderMonk (0.164,239.103) e (0.164,239.103) y (0.164,239.103) is (0.164,239.103) a (0.164,239.103) bytecode (0.164,239.103) interpreter (0.164,239.103) implemented (0.164,239.103) in (0.164,239.103) C++. (0.164,239.103) In (0.164,239.103) SpiderMonk (0.164,239.103) e (0.164,239.103) y (0.164,239.103) , (0.164,239.103) all (0.164,239.103) Ja (0.164,239.103) v (0.164,239.103) aScript (0.164,239.103) v (0.164,239.103) alues (0.164,239.103) are (0.164,239.103) represented (0.164,239.103) by (0.164,239.103) the (0.164,239.103) type (0.164,239.103) jsval (0.164,239.103) . (0.164,239.103) A (0.164,239.103) jsval (0.164,239.103) is (0.164,239.103) machine (0.164,239.103) w (0.164,239.103) ord (0.164,239.103) in (0.164,239.103) which (0.164,239.103) up (0.164,239.103) to (0.164,239.103) the (0.164,239.103) 3 (0.164,239.103) of (0.164,239.103) the (0.164,239.103) least (0.164,239.103) significant (0.164,239.103) bits (0.164,239.103) are (0.164,239.103) a (0.164,239.103) type (0.164,239.103) tag, (0.164,239.103) and (0.164,239.103) the (0.164,239.103) remaining (0.164,239.103) bits (0.164,239.103) are (0.164,239.103) data. (0.164,239.103) See (0.164,239.103) Figure (0.164,239.103) 6 (0.164,239.103) for (0.164,239.103) details. (0.164,239.103) All (0.164,239.103) pointers (0.164,239.103) contai (0.164,239.103) ned (0.164,239.103) in (0.164,239.103) jsvals (0.164,239.103) point (0.164,239.103) to (0.164,239.103) GC-controlled (0.164,239.103) blocks (0.164,239.103) aligned (0.164,239.103) on (0.164,239.103) 8-byte (0.164,239.103) boundaries. (0.164,239.103) Ja (0.164,239.103) v (0.164,239.103) aScript (0.164,239.103) object (0.164,239.103) v (0.164,239.103) alues (0.164,239.103) are (0.164,239.103) mappings (0.164,239.103) of (0.164,239.103) string-v (0.164,239.103) alued (0.164,239.103) property (0.164,239.103) names (0.164,239.103) to (0.164,239.103) arbitrary (0.164,239.103) v (0.164,239.103) alues. (0.164,239.103) The (0.164,239.103) y (0.164,239.103) are (0.164,239.103) represented (0.164,239.103) in (0.164,239.103) one (0.164,239.103) of (0.164,239.103) tw (0.164,239.103) o (0.164,239.103) w (0.164,239.103) ays (0.164,239.103) in (0.164,239.103) SpiderMonk (0.164,239.103) e (0.164,239.103) y (0.164,239.103) . (0.164,239.103) Most (0.164,239.103) objects (0.164,239.103) are (0.164,239.103) represented (0.164,239.103) by (0.164,239.103) a (0.164,239.103) shared (0.164,239.103) struc- (0.164,239.103) tural (0.164,239.103) desc (0.164,239.103) ription, (0.164,239.103) called (0.164,239.103) the (0.164,239.103) object (0.164,239.103) shape (0.164,239.103) , (0.164,239.103) that (0.164,239.103) maps (0.164,239.103) property (0.164,239.103) names (0.164,239.103) to (0.164,239.103) array (0.164,239.103) inde (0.164,239.103) x (0.164,239.103) es (0.164,239.103) using (0.164,239.103) a (0.164,239.103) hash (0.164,239.103) table. (0.164,239.103) The (0.164,239.103) object (0.164,239.103) store (0.164,239.103) s (0.164,239.103) a (0.164,239.103) pointer (0.164,239.103) to (0.164,239.103) the (0.164,239.103) shape (0.164,239.103) and (0.164,239.103) the (0.164,239.103) array (0.164,239.103) of (0.164,239.103) its (0.164,239.103) o (0.164,239.103) wn (0.164,239.103) property (0.164,239.103) v (0.164,239.103) alues. (0.164,239.103) Objects (0.164,239.103) with (0.164,239.103) lar (0.164,239.103) ge, (0.164,239.103) unique (0.164,239.103) sets (0.164,239.103) of (0.164,239.103) property (0.164,239.103) names (0.164,239.103) store (0.164,239.103) their (0.164,239.103) properties (0.164,239.103) directly (0.164,239.103) in (0.164,239.103) a (0.164,239.103) hash (0.164,239.103) table. (0.164,239.103) The (0.164,239.103) g (0.164,239.103) arbage (0.164,239.103) collector (0.164,239.103) is (0.164,239.103) an (0.164,239.103) e (0.164,239.103) xact, (0.164,239.103) non-gene (0.164,239.103) rational, (0.164,239.103) stop-the- (0.164,239.103) w (0.164,239.103) orld (0.164,239.103) mark-and-sweep (0.164,239.103) collector (0.164,239.103) . (0.164,239.103) In (0.164,239.103) the (0.164,239.103) rest (0.164,239.103) of (0.164,239.103) this (0.164,239.103) section (0.164,239.103) we (0.164,239.103) discuss (0.164,239.103) k (0.164,239.103) e (0.164,239.103) y (0.164,239.103) areas (0.164,239.103) of (0.164,239.103) the (0.164,239.103) T (0.164,239.103) raceMon- (0.164,239.103) k (0.164,239.103) e (0.164,239.103) y (0.164,239.103) implementation. (0.164,239.103) 6.1 (0.164,239.103) Calling (0.164,239.103) Compiled (0.164,239.103) T (0.164,239.103) races (0.164,239.103) Compiled (0.164,239.103) traces (0.164,239.103) are (0.164,239.103) stored (0.164,239.103) in (0.164,239.103) a (0.164,239.103) tr (0.164,239.103) ace (0.164,239.103) cac (0.164,239.103) he (0.164,239.103) , (0.164,239.103) inde (0.164,239.103) x (0.164,239.103) ed (0.164,239.103) by (0.164,239.103) intepreter (0.164,239.103) PC (0.164,239.103) and (0.164,239.103) type (0.164,239.103) map. (0.164,239.103) T (0.164,239.103) races (0.164,239.103) are (0.164,239.103) compiled (0.164,239.103) so (0.164,239.103) that (0.164,239.103) the (0.164,239.103) y (0.164,239.103) may (0.164,239.103) be (0.164,239.103) called (0.164,239.103) as (0.164,239.103) functions (0.164,239.103) using (0.164,239.103) standard (0.164,239.103) nati (0.164,239.103) v (0.164,239.103) e (0.164,239.103) calling (0.164,239.103) con (0.164,239.103) v (0.164,239.103) entions (0.164,239.103) (e.g., (0.164,239.103) FASTCALL (0.164,239.103) on (0.164,239.103) x86). (0.164,239.103) The (0.164,239.103) interpreter (0.164,239.103) must (0.164,239.103) hit (0.164,239.103) a (0.164,239.103) loop (0.164,239.103) edge (0.164,239.103) and (0.164,239.103) enter (0.164,239.103) the (0.164,239.103) m (0.164,239.103) onitor (0.164,239.103) in (0.164,239.103) order (0.164,239.103) to (0.164,239.103) call (0.164,239.103) a (0.164,239.103) nati (0.164,239.103) v (0.164,239.103) e (0.164,239.103) trace (0.164,239.103) for (0.164,239.103) the (0.164,239.103) first (0.164,239.103) time. (0.164,239.103) The (0.164,239.103) monitor (0.164,239.103) computes (0.164,239.103) the (0.164,239.103) current (0.164,239.103) type (0.164,239.103) map, (0.164,239.103) checks (0.164,239.103) the (0.164,239.103) trace (0.164,239.103) cache (0.164,239.103) for (0.164,239.103) a (0.164,239.103) trace (0.164,239.103) for (0.164,239.103) the (0.164,239.103) current (0.164,239.103) PC (0.164,239.103) and (0.164,239.103) type (0.164,239.103) map, (0.164,239.103) and (0.164,239.103) if (0.164,239.103) it (0.164,239.103) finds (0.164,239.103) one, (0.164,239.103) e (0.164,239.103) x (0.164,239.103) ecutes (0.164,239.103) the (0.164,239.103) trace. (0.164,239.103) T (0.164,239.103) o (0.164,239.103) e (0.164,239.103) x (0.164,239.103) ecute (0.164,239.103) a (0.164,239.103) trace, (0.164,239.103) the (0.164,239.103) monitor (0.164,239.103) must (0.164,239.103) b (0.164,239.103) uild (0.164,239.103) a (0.164,239.103) trace (0.164,239.103) acti (0.164,239.103) v (0.164,239.103) ation (0.164,239.103) record (0.164,239.103) containi (0.164,239.103) ng (0.164,239.103) imported (0.164,239.103) local (0.164,239.103) and (0.164,239.103) global (0.164,239.103) v (0.164,239.103) ariables, (0.164,239.103) temporary (0.164,239.103) stack (0.164,239.103) s (0.164,239.103) pace, (0.164,239.103) and (0.164,239.103) space (0.164,239.103) for (0.164,239.103) ar (0.164,239.103) guments (0.164,239.103) to (0.164,239.103) nati (0.164,239.103) v (0.164,239.103) e (0.164,239.103) calls. (0.164,239.103) The (0.164,239.103) local (0.164,239.103) and (0.164,239.103) global (0.164,239.103) v (0.164,239.103) alue (0.164,239.103) s (0.164,239.103) are (0.164,239.103) then (0.164,239.103) copied (0.164,239.103) from (0.164,239.103) the (0.164,239.103) interpreter (0.164,239.103) state (0.164,239.103) to (0.164,239.103) the (0.164,239.103) trace (0.164,239.103) acti (0.164,239.103) v (0.164,239.103) ation (0.164,239.103) record. (0.164,239.103) Then, (0.164,239.103) the (0.164,239.103) trace (0.164,239.103) is (0.164,239.103) called (0.164,239.103) lik (0.164,239.103) e (0.164,239.103) a (0.164,239.103) normal (0.164,239.103) C (0.164,239.103) function (0.164,239.103) pointer (0.164,239.103) . (0.000,0.000) When (0.000,0.000) a (0.000,0.000) trace (0.000,0.000) call (0.000,0.000) returns, (0.000,0.000) the (0.000,0.000) monitor (0.000,0.000) restores (0.000,0.000) the (0.000,0.000) interpreter (0.000,0.000) state. (0.000,0.000) First, (0.000,0.000) the (0.000,0.000) monitor (0.000,0.000) checks (0.000,0.000) the (0.000,0.000) reason (0.000,0.000) for (0.000,0.000) the (0.000,0.000) trace (0.000,0.000) e (0.000,0.000) xit (0.000,0.000) and (0.000,0.000) applies (0.000,0.000) blacklisting (0.000,0.000) if (0.000,0.000) needed. (0.000,0.000) Then, (0.000,0.000) it (0.000,0.000) pops (0.000,0.000) or (0.000,0.000) synthesizes (0.000,0.000) inter (0.000,0.000) - (0.000,0.000) preter (0.000,0.000) Ja (0.000,0.000) v (0.000,0.000) aScript (0.000,0.000) call (0.000,0.000) stack (0.000,0.000) frames (0.000,0.000) as (0.000,0.000) needed. (0.000,0.000) Finally (0.000,0.000) , (0.000,0.000) it (0.000,0.000) copies (0.000,0.000) the (0.000,0.000) imported (0.000,0.000) v (0.000,0.000) ariables (0.000,0.000) back (0.000,0.000) from (0.000,0.000) the (0.000,0.000) trace (0.000,0.000) acti (0.000,0.000) v (0.000,0.000) ation (0.000,0.000) record (0.000,0.000) to (0.000,0.000) the (0.000,0.000) in- (0.000,0.000) terpreter (0.000,0.000) state. (0.000,0.000) At (0.000,0.000) least (0.000,0.000) in (0.000,0.000) the (0.000,0.000) current (0.000,0.000) implementation, (0.000,0.000) these (0.000,0.000) steps (0.000,0.000) ha (0.000,0.000) v (0.000,0.000) e (0.000,0.000) a (0.000,0.000) non- (0.000,0.000) ne (0.000,0.000) gligible (0.000,0.000) runtime (0.000,0.000) cost, (0.000,0.000) so (0.000,0.000) minimizing (0.000,0.000) the (0.000,0.000) numbe (0.000,0.000) r (0.000,0.000) of (0.000,0.000) interpreter (0.000,0.000) - (0.000,0.000) to-trace (0.000,0.000) and (0.000,0.000) trac (0.000,0.000) e-to-interpreter (0.000,0.000) transitions (0.000,0.000) is (0.000,0.000) essential (0.000,0.000) for (0.000,0.000) perfor (0.000,0.000) - (0.000,0.000) mance. (0.000,0.000) (see (0.000,0.000) also (0.000,0.000) Section (0.000,0.000) 3.3). (0.000,0.000) Our (0.000,0.000) e (0.000,0.000) xperiments (0.000,0.000) (see (0.000,0.000) Figure (0.000,0.000) 12) (0.000,0.000) sho (0.000,0.000) w (0.000,0.000) that (0.000,0.000) for (0.000,0.000) programs (0.000,0.000) we (0.000,0.000) can (0.000,0.000) trace (0.000,0.000) well (0.000,0.000) such (0.000,0.000) transiti (0.000,0.000) ons (0.000,0.000) hap- (0.000,0.000) pen (0.000,0.000) infrequently (0.000,0.000) and (0.000,0.000) hence (0.000,0.000) do (0.000,0.000) not (0.000,0.000) contrib (0.000,0.000) ute (0.000,0.000) significantly (0.000,0.000) to (0.000,0.000) total (0.000,0.000) runtime. (0.000,0.000) In (0.000,0.000) a (0.000,0.000) fe (0.000,0.000) w (0.000,0.000) programs, (0.000,0.000) where (0.000,0.000) the (0.000,0.000) s (0.000,0.000) ystem (0.000,0.000) is (0.000,0.000) pre (0.000,0.000) v (0.000,0.000) ented (0.000,0.000) from (0.000,0.000) recording (0.000,0.000) branch (0.000,0.000) traces (0.000,0.000) for (0.000,0.000) hot (0.000,0.000) s (0.000,0.000) ide (0.000,0.000) e (0.000,0.000) xits (0.000,0.000) by (0.000,0.000) aborts, (0.000,0.000) this (0.000,0.000) cost (0.000,0.000) can (0.000,0.000) rise (0.000,0.000) to (0.000,0.000) up (0.000,0.000) to (0.000,0.000) 10% (0.000,0.000) of (0.000,0.000) total (0.000,0.000) e (0.000,0.000) x (0.000,0.000) ecution (0.000,0.000) time. (0.000,0.000) 6.2 (0.000,0.000) T (0.000,0.000) race (0.000,0.000) Stitching (0.000,0.000) T (0.000,0.000) ransitions (0.000,0.000) from (0.000,0.000) a (0.000,0.000) trace (0.000,0.000) to (0.000,0.000) a (0.000,0.000) branch (0.000,0.000) trace (0.000,0.000) at (0.000,0.000) a (0.000,0.000) side (0.000,0.000) e (0.000,0.000) xit (0.000,0.000) a (0.000,0.000) v (0.000,0.000) oid (0.000,0.000) the (0.000,0.000) costs (0.000,0.000) of (0.000,0.000) calling (0.000,0.000) traces (0.000,0.000) from (0.000,0.000) the (0.000,0.000) monitor (0.000,0.000) , (0.000,0.000) in (0.000,0.000) a (0.000,0.000) feature (0.000,0.000) called (0.000,0.000) tr (0.000,0.000) ace (0.000,0.000) stitc (0.000,0.000) hing (0.000,0.000) . (0.000,0.000) At (0.000,0.000) a (0.000,0.000) side (0.000,0.000) e (0.000,0.000) xit, (0.000,0.000) the (0.000,0.000) e (0.000,0.000) xiting (0.000,0.000) trace (0.000,0.000) only (0.000,0.000) needs (0.000,0.000) to (0.000,0.000) write (0.000,0.000) li (0.000,0.000) v (0.000,0.000) e (0.000,0.000) re (0.000,0.000) gister (0.000,0.000) -carried (0.000,0.000) v (0.000,0.000) alues (0.000,0.000) back (0.000,0.000) to (0.000,0.000) its (0.000,0.000) trace (0.000,0.000) acti (0.000,0.000) v (0.000,0.000) ation (0.000,0.000) record. (0.000,0.000) In (0.000,0.000) our (0.000,0.000) im- (0.000,0.000) plementation, (0.000,0.000) identical (0.000,0.000) type (0.000,0.000) maps (0.000,0.000) yield (0.000,0.000) identical (0.000,0.000) acti (0.000,0.000) v (0.000,0.000) ation (0.000,0.000) record (0.000,0.000) layouts, (0.000,0.000) so (0.000,0.000) the (0.000,0.000) trace (0.000,0.000) acti (0.000,0.000) v (0.000,0.000) ati (0.000,0.000) on (0.000,0.000) record (0.000,0.000) can (0.000,0.000) be (0.000,0.000) reused (0.000,0.000) immediately (0.000,0.000) by (0.000,0.000) the (0.000,0.000) branch (0.000,0.000) trace. (0.000,0.000) In (0.000,0.000) programs (0.000,0.000) with (0.000,0.000) branch (0.000,0.000) y (0.000,0.000) trace (0.000,0.000) trees (0.000,0.000) with (0.000,0.000) small (0.000,0.000) traces, (0.000,0.000) trace (0.000,0.000) stitching (0.000,0.000) has (0.000,0.000) a (0.000,0.000) noticeable (0.000,0.000) cost. (0.000,0.000) Although (0.000,0.000) writing (0.000,0.000) to (0.000,0.000) memory (0.000,0.000) and (0.000,0.000) then (0.000,0.000) soon (0.000,0.000) reading (0.000,0.000) back (0.000,0.000) w (0.000,0.000) ould (0.000,0.000) be (0.000,0.000) e (0.000,0.000) xpected (0.000,0.000) to (0.000,0.000) ha (0.000,0.000) v (0.000,0.000) e (0.000,0.000) a (0.000,0.000) high (0.000,0.000) L1 (0.000,0.000) cache (0.000,0.000) hit (0.000,0.000) rate, (0.000,0.000) for (0.000,0.000) small (0.000,0.000) traces (0.000,0.000) the (0.000,0.000) increased (0.000,0.000) instruction (0.000,0.000) count (0.000,0.000) has (0.000,0.000) a (0.000,0.000) noticeable (0.000,0.000) cost. (0.000,0.000) Also, (0.000,0.000) if (0.000,0.000) the (0.000,0.000) writes (0.000,0.000) and (0.000,0.000) reads (0.000,0.000) are (0.000,0.000) v (0.000,0.000) ery (0.000,0.000) close (0.000,0.000) in (0.000,0.000) the (0.000,0.000) dynam (0.000,0.000) ic (0.000,0.000) instruction (0.000,0.000) stream, (0.000,0.000) we (0.000,0.000) ha (0.000,0.000) v (0.000,0.000) e (0.000,0.000) found (0.000,0.000) that (0.000,0.000) current (0.000,0.000) x86 (0.000,0.000) processors (0.000,0.000) often (0.000,0.000) incur (0.000,0.000) penalties (0.000,0.000) of (0.000,0.000) 6 (0.000,0.000) c (0.000,0.000) ycles (0.000,0.000) or (0.000,0.000) more (0.000,0.000) (e.g., (0.000,0.000) if (0.000,0.000) the (0.000,0.000) instructions (0.000,0.000) use (0.000,0.000) dif (0.000,0.000) ferent (0.000,0.000) base (0.000,0.000) re (0.000,0.000) gisters (0.000,0.000) with (0.000,0.000) equal (0.000,0.000) v (0.000,0.000) alues, (0.000,0.000) the (0.000,0.000) processor (0.000,0.000) may (0.000,0.000) not (0.000,0.000) be (0.000,0.000) able (0.000,0.000) to (0.000,0.000) detect (0.000,0.000) that (0.000,0.000) the (0.000,0.000) addresses (0.000,0.000) are (0.000,0.000) the (0.000,0.000) same (0.000,0.000) right (0.000,0.000) a (0.000,0.000) w (0.000,0.000) ay). (0.000,0.000) The (0.000,0.000) alternate (0.000,0.000) solution (0.000,0.000) is (0.000,0.000) to (0.000,0.000) recompile (0.000,0.000) an (0.000,0.000) entire (0.000,0.000) trace (0.000,0.000) tre (0.000,0.000) e, (0.000,0.000) thus (0.000,0.000) achie (0.000,0.000) ving (0.000,0.000) inter (0.000,0.000) -trace (0.000,0.000) re (0.000,0.000) gister (0.000,0.000) allocation (0.000,0.000) (10). (0.000,0.000) The (0.000,0.000) disadv (0.000,0.000) antage (0.000,0.000) is (0.000,0.000) that (0.000,0.000) tree (0.000,0.000) recompilation (0.000,0.000) tak (0.000,0.000) es (0.000,0.000) time (0.000,0.000) quadratic (0.000,0.000) in (0.000,0.000) the (0.000,0.000) number (0.000,0.000) of (0.000,0.000) traces. (0.000,0.000) W (0.000,0.000) e (0.000,0.000) belie (0.000,0.000) v (0.000,0.000) e (0.000,0.000) that (0.000,0.000) the (0.000,0.000) cost (0.000,0.000) of (0.000,0.000) recompiling (0.000,0.000) a (0.000,0.000) trace (0.000,0.000) tree (0.000,0.000) e (0.000,0.000) v (0.000,0.000) ery (0.000,0.000) time (0.000,0.000) a (0.000,0.000) branch (0.000,0.000) is (0.000,0.000) added (0.000,0.000) w (0.000,0.000) ould (0.000,0.000) be (0.000,0.000) prohibiti (0.000,0.000) v (0.000,0.000) e. (0.000,0.000) That (0.000,0.000) problem (0.000,0.000) might (0.000,0.000) be (0.000,0.000) mitig (0.000,0.000) ated (0.000,0.000) by (0.000,0.000) recompiling (0.000,0.000) only (0.000,0.000) at (0.000,0.000) certain (0.000,0.000) points, (0.000,0.000) or (0.000,0.000) onl (0.000,0.000) y (0.000,0.000) for (0.000,0.000) v (0.000,0.000) ery (0.000,0.000) hot, (0.000,0.000) stable (0.000,0.000) trees. (0.000,0.000) In (0.000,0.000) the (0.000,0.000) future, (0.000,0.000) multicore (0.000,0.000) hardw (0.000,0.000) are (0.000,0.000) is (0.000,0.000) e (0.000,0.000) xpected (0.000,0.000) to (0.000,0.000) be (0.000,0.000) common, (0.000,0.000) making (0.000,0.000) background (0.000,0.000) tree (0.000,0.000) recompilation (0.000,0.000) attracti (0.000,0.000) v (0.000,0.000) e. (0.000,0.000) In (0.000,0.000) a (0.000,0.000) closely (0.000,0.000) re- (0.000,0.000) lated (0.000,0.000) project (0.000,0.000) (13) (0.000,0.000) background (0.000,0.000) recompilation (0.000,0.000) yielded (0.000,0.000) speedups (0.000,0.000) of (0.000,0.000) up (0.000,0.000) to (0.000,0.000) 1.25x (0.000,0.000) on (0.000,0.000) benchmarks (0.000,0.000) with (0.000,0.000) man (0.000,0.000) y (0.000,0.000) branch (0.000,0.000) traces. (0.000,0.000) W (0.000,0.000) e (0.000,0.000) plan (0.000,0.000) to (0.000,0.000) apply (0.000,0.000) this (0.000,0.000) technique (0.000,0.000) to (0.000,0.000) T (0.000,0.000) raceMonk (0.000,0.000) e (0.000,0.000) y (0.000,0.000) as (0.000,0.000) future (0.000,0.000) w (0.000,0.000) ork. (0.000,0.000) 6.3 (0.000,0.000) T (0.000,0.000) race (0.000,0.000) Recording (0.000,0.000) The (0.000,0.000) job (0.000,0.000) of (0.000,0.000) the (0.000,0.000) trace (0.000,0.000) recorder (0.000,0.000) is (0.000,0.000) to (0.000,0.000) emit (0.000,0.000) LIR (0.000,0.000) with (0.000,0.000) identical (0.000,0.000) semantics (0.000,0.000) to (0.000,0.000) the (0.000,0.000) currently (0.000,0.000) running (0.000,0.000) interpreter (0.000,0.000) bytecode (0.000,0.000) trace. (0.000,0.000) A (0.000,0.000) good (0.000,0.000) imple- (0.000,0.000) mentation (0.000,0.000) should (0.000,0.000) ha (0.000,0.000) v (0.000,0.000) e (0.000,0.000) lo (0.000,0.000) w (0.000,0.000) impact (0.000,0.000) on (0.000,0.000) non-tracing (0.000,0.000) interpreter (0.000,0.000) per (0.000,0.000) - (0.000,0.000) formance (0.000,0.000) and (0.000,0.000) a (0.000,0.000) con (0.000,0.000) v (0.000,0.000) enient (0.000,0.000) w (0.000,0.000) ay (0.000,0.000) for (0.000,0.000) implementers (0.000,0.000) to (0.000,0.000) maintain (0.000,0.000) se- (0.000,0.000) mantic (0.000,0.000) equi (0.000,0.000) v (0.000,0.000) alence. (0.000,0.000) In (0.000,0.000) our (0.000,0.000) implementation, (0.000,0.000) the (0.000,0.000) only (0.000,0.000) direct (0.000,0.000) modification (0.000,0.000) to (0.000,0.000) the (0.000,0.000) inter (0.000,0.000) - (0.000,0.000) preter (0.000,0.000) is (0.000,0.000) a (0.000,0.000) call (0.000,0.000) to (0.000,0.000) the (0.000,0.000) trace (0.000,0.000) m (0.000,0.000) onitor (0.000,0.000) at (0.000,0.000) loop (0.000,0.000) edges. (0.000,0.000) In (0.000,0.000) our (0.000,0.000) benchmark (0.000,0.000) results (0.000,0.000) (see (0.000,0.000) Figure (0.000,0.000) 12) (0.000,0.000) the (0.000,0.000) total (0.000,0.000) time (0.000,0.000) spent (0.000,0.000) in (0.000,0.000) the (0.000,0.000) monitor (0.000,0.000) (for (0.000,0.000) all (0.000,0.000) acti (0.000,0.000) vities) (0.000,0.000) is (0.000,0.000) usually (0.000,0.000) less (0.000,0.000) than (0.000,0.000) 5%, (0.000,0.000) so (0.000,0.000) we (0.000,0.000) consider (0.000,0.000) the (0.000,0.000) interpreter (0.000,0.000) impact (0.000,0.000) re (0.000,0.000) quirement (0.000,0.000) met. (0.000,0.000) Increm (0.000,0.000) enting (0.000,0.000) the (0.000,0.000) loop (0.000,0.000) hit (0.000,0.000) counter (0.000,0.000) is (0.000,0.000) e (0.000,0.000) x- (0.000,0.000) pensi (0.000,0.000) v (0.000,0.000) e (0.000,0.000) because (0.000,0.000) it (0.000,0.000) requires (0.000,0.000) us (0.000,0.000) to (0.000,0.000) look (0.000,0.000) up (0.000,0.000) the (0.000,0.000) loop (0.000,0.000) in (0.000,0.000) the (0.000,0.000) trace (0.000,0.000) cache, (0.000,0.000) b (0.000,0.000) ut (0.000,0.000) we (0.000,0.000) ha (0.000,0.000) v (0.000,0.000) e (0.000,0.000) tuned (0.000,0.000) our (0.000,0.000) loops (0.000,0.000) to (0.000,0.000) become (0.000,0.000) hot (0.000,0.000) and (0.000,0.000) trace (0.000,0.000) v (0.000,0.000) ery (0.000,0.000) quickly (0.000,0.000) (on (0.000,0.000) the (0.000,0.000) second (0.000,0.000) iteration). (0.000,0.000) The (0.000,0.000) hit (0.000,0.000) counter (0.000,0.000) implementation (0.000,0.000) could (0.000,0.000) be (0.000,0.000) impro (0.000,0.000) v (0.000,0.000) ed, (0.000,0.000) which (0.000,0.000) might (0.000,0.000) gi (0.000,0.000) v (0.000,0.000) e (0.000,0.000) us (0.000,0.000) a (0.000,0.000) small (0.000,0.000) increase (0.000,0.000) in (0.000,0.000) o (0.000,0.000) v (0.000,0.000) erall (0.000,0.000) perfor (0.000,0.000) - (0.000,0.000) mance, (0.000,0.000) as (0.000,0.000) well (0.000,0.000) as (0.000,0.000) more (0.000,0.000) fle (0.000,0.000) xibility (0.000,0.000) with (0.000,0.000) tuning (0.000,0.000) hotness (0.000,0.000) thresholds. (0.000,0.000) Once (0.000,0.000) a (0.000,0.000) loop (0.000,0.000) is (0.000,0.000) blacklisted (0.000,0.000) we (0.000,0.000) ne (0.000,0.000) v (0.000,0.000) er (0.000,0.000) call (0.000,0.000) into (0.000,0.000) the (0.000,0.000) trace (0.000,0.000) monitor (0.000,0.000) for (0.000,0.000) that (0.000,0.000) loop (0.000,0.000) (see (0.000,0.000) Section (0.000,0.000) 3.3). (0.000,0.000) Recording (0.000,0.000) is (0.000,0.000) acti (0.000,0.000) v (0.000,0.000) ated (0.000,0.000) by (0.000,0.000) a (0.000,0.000) pointer (0.000,0.000) sw (0.000,0.000) ap (0.000,0.000) that (0.000,0.000) sets (0.000,0.000) the (0.000,0.000) inter (0.000,0.000) - (0.000,0.000) preter’ (0.000,0.000) s (0.000,0.000) dispatch (0.000,0.000) ta (0.000,0.000) ble (0.000,0.000) to (0.000,0.000) call (0.000,0.000) a (0.000,0.000) single (0.000,0.000) “interrupt” (0.000,0.000) routine (0.000,0.000) for (0.000,0.000) e (0.000,0.000) v- (0.000,0.000) ery (0.000,0.000) bytecode. (0.000,0.000) The (0.000,0.000) interrupt (0.000,0.000) routine (0.000,0.000) first (0.000,0.000) calls (0.000,0.000) a (0.000,0.000) bytecode-specific (0.000,0.000) recording (0.000,0.000) routine. (0.000,0.000) Then, (0.000,0.000) it (0.000,0.000) turns (0.000,0.000) of (0.000,0.000) f (0.000,0.000) recording (0.000,0.000) if (0.000,0.000) necessary (0.000,0.000) (e.g., (0.000,0.000) the (0.000,0.000) trace (0.000,0.000) ended). (0.000,0.000) Finally (0.000,0.000) , (0.000,0.000) it (0.000,0.000) jumps (0.000,0.000) to (0.000,0.000) the (0.000,0.000) standard (0.000,0.000) interpreter (0.000,0.000) byte- (0.000,0.000) code (0.000,0.000) implementation. (0.000,0.000) Some (0.000,0.000) bytecodes (0.000,0.000) ha (0.000,0.000) v (0.000,0.000) e (0.000,0.000) ef (0.000,0.000) fects (0.000,0.000) on (0.000,0.000) the (0.000,0.000) type (0.000,0.000) map (0.000,0.000) that (0.000,0.000) cannot (0.000,0.000) be (0.000,0.000) predicted (0.000,0.000) before (0.000,0.000) e (0.000,0.000) x (0.000,0.000) ecuting (0.000,0.000) the (0.000,0.000) bytecode (0.000,0.000) (e.g., (0.000,0.000) call- (0.000,0.000) ing (0.000,0.000) String.charCodeAt (0.000,0.000) , (0.000,0.000) which (0.000,0.000) returns (0.000,0.000) an (0.000,0.000) inte (0.000,0.000) ger (0.000,0.000) or (0.000,0.000) NaN (0.000,0.000) if (0.000,0.000) the (0.000,0.000) inde (0.000,0.000) x (0.000,0.000) ar (0.000,0.000) gument (0.000,0.000) is (0.000,0.000) out (0.000,0.000) of (0.000,0.000) range). (0.000,0.000) F (0.000,0.000) or (0.000,0.000) these, (0.000,0.000) we (0.000,0.000) arrange (0.000,0.000) for (0.000,0.000) the (0.000,0.000) inter (0.000,0.000) - (0.000,0.000) preter (0.000,0.000) to (0.000,0.000) call (0.000,0.000) into (0.000,0.000) the (0.000,0.000) recorder (0.000,0.000) ag (0.000,0.000) ain (0.000,0.000) after (0.000,0.000) e (0.000,0.000) x (0.000,0.000) ecuting (0.000,0.000) the (0.000,0.000) bytecode. (0.000,0.000) Since (0.000,0.000) such (0.000,0.000) hooks (0.000,0.000) are (0.000,0.000) relati (0.000,0.000) v (0.000,0.000) ely (0.000,0.000) rare, (0.000,0.000) we (0.000,0.000) embed (0.000,0.000) them (0.000,0.000) directly (0.000,0.000) into (0.000,0.000) the (0.000,0.000) interpreter (0.000,0.000) , (0.000,0.000) with (0.000,0.000) an (0.000,0.000) additional (0.000,0.000) runtime (0.000,0.000) check (0.000,0.000) to (0.000,0.000) see (0.000,0.000) whether (0.000,0.000) a (0.000,0.000) recorder (0.000,0.000) is (0.000,0.000) currently (0.000,0.000) acti (0.000,0.000) v (0.000,0.000) e. (0.000,0.000) While (0.000,0.000) separating (0.000,0.000) the (0.000,0.000) interpreter (0.000,0.000) from (0.000,0.000) the (0.000,0.000) recorder (0.000,0.000) reduces (0.000,0.000) indi- (0.000,0.000) vidual (0.000,0.000) code (0.000,0.000) comple (0.000,0.000) xity (0.000,0.000) , (0.000,0.000) it (0.000,0.000) also (0.000,0.000) requires (0.000,0.000) careful (0.000,0.000) implementation (0.000,0.000) and (0.000,0.000) e (0.000,0.000) xtensi (0.000,0.000) v (0.000,0.000) e (0.000,0.000) testing (0.000,0.000) to (0.000,0.000) achie (0.000,0.000) v (0.000,0.000) e (0.000,0.000) semantic (0.000,0.000) equi (0.000,0.000) v (0.000,0.000) alence. (0.000,0.000) In (0.000,0.000) some (0.000,0.000) cases (0.000,0.000) achie (0.000,0.000) ving (0.000,0.000) this (0.000,0.000) equi (0.000,0.000) v (0.000,0.000) alence (0.000,0.000) is (0.000,0.000) dif (0.000,0.000) ficult (0.000,0.000) since (0.000,0.000) Spi- (0.000,0.000) derMonk (0.000,0.000) e (0.000,0.000) y (0.000,0.000) follo (0.000,0.000) ws (0.000,0.000) a (0.000,0.000) fat-bytecode (0.000,0.000) design, (0.000,0.000) which (0.000,0.000) w (0.000,0.000) as (0.000,0.000) found (0.000,0.000) to (0.000,0.000) be (0.000,0.000) beneficial (0.000,0.000) to (0.000,0.000) pure (0.000,0.000) interpreter (0.000,0.000) performance. (0.000,0.000) In (0.000,0.000) f (0.000,0.000) at-bytecode (0.000,0.000) designs, (0.000,0.000) indi (0.000,0.000) vidual (0.000,0.000) bytecodes (0.000,0.000) can (0.000,0.000) implement (0.000,0.000) comple (0.000,0.000) x (0.000,0.000) processing (0.000,0.000) (e.g., (0.000,0.000) the (0.000,0.000) getprop (0.000,0.000) bytecode, (0.000,0.000) which (0.000,0.000) imple- (0.000,0.000) ments (0.000,0.000) full (0.000,0.000) Ja (0.000,0.000) v (0.000,0.000) aScript (0.000,0.000) property (0.000,0.000) v (0.000,0.000) alue (0.000,0.000) access, (0.000,0.000) including (0.000,0.000) s (0.000,0.000) pecial (0.000,0.000) cases (0.000,0.000) for (0.000,0.000) cached (0.000,0.000) and (0.000,0.000) dense (0.000,0.000) array (0.000,0.000) access). (0.000,0.000) F (0.000,0.000) at (0.000,0.000) bytecodes (0.000,0.000) ha (0.000,0.000) v (0.000,0.000) e (0.000,0.000) tw (0.000,0.000) o (0.000,0.000) adv (0.000,0.000) antages: (0.000,0.000) fe (0.000,0.000) wer (0.000,0.000) bytecodes (0.000,0.000) means (0.000,0.000) lo (0.000,0.000) wer (0.000,0.000) dispatch (0.000,0.000) cost, (0.000,0.000) and (0.000,0.000) bigger (0.000,0.000) bytecode (0.000,0.000) impleme (0.000,0.000) ntations (0.000,0.000) gi (0.000,0.000) v (0.000,0.000) e (0.000,0.000) the (0.000,0.000) compiler (0.000,0.000) more (0.000,0.000) opportunities (0.000,0.000) to (0.000,0.000) optimize (0.000,0.000) the (0.000,0.000) interpreter (0.000,0.000) . (0.000,0.000) F (0.000,0.000) at (0.000,0.000) bytecodes (0.000,0.000) are (0.000,0.000) a (0.000,0.000) problem (0.000,0.000) for (0.000,0.000) T (0.000,0.000) raceMonk (0.000,0.000) e (0.000,0.000) y (0.000,0.000) because (0.000,0.000) the (0.000,0.000) y (0.000,0.000) require (0.000,0.000) the (0.000,0.000) recorder (0.000,0.000) to (0.000,0.000) reimplement (0.000,0.000) the (0.000,0.000) same (0.000,0.000) special (0.000,0.000) c (0.000,0.000) ase (0.000,0.000) logic (0.000,0.000) in (0.000,0.000) the (0.000,0.000) same (0.000,0.000) w (0.000,0.000) ay (0.000,0.000) . (0.000,0.000) Also, (0.000,0.000) the (0.000,0.000) adv (0.000,0.000) antages (0.000,0.000) are (0.000,0.000) reduced (0.000,0.000) because (0.000,0.000) (a) (0.000,0.000) dispatch (0.000,0.000) costs (0.000,0.000) are (0.000,0.000) eliminated (0.000,0.000) entirely (0.000,0.000) in (0.000,0.000) compiled (0.000,0.000) traces, (0.000,0.000) (b) (0.000,0.000) the (0.000,0.000) traces (0.000,0.000) contain (0.000,0.000) only (0.000,0.000) one (0.000,0.000) special (0.000,0.000) case, (0.000,0.000) not (0.000,0.000) the (0.000,0.000) interpreter’ (0.000,0.000) s (0.000,0.000) lar (0.000,0.000) ge (0.000,0.000) chunk (0.000,0.000) of (0.000,0.000) code, (0.000,0.000) and (0.000,0.000) (c) (0.000,0.000) T (0.000,0.000) raceMonk (0.000,0.000) e (0.000,0.000) y (0.000,0.000) spends (0.000,0.000) less (0.000,0.000) time (0.000,0.000) running (0.000,0.000) the (0.000,0.000) base (0.000,0.000) interpreter (0.000,0.000) . (0.000,0.000) One (0.000,0.000) w (0.000,0.000) ay (0.000,0.000) we (0.000,0.000) ha (0.000,0.000) v (0.000,0.000) e (0.000,0.000) mitig (0.000,0.000) ated (0.000,0.000) these (0.000,0.000) problems (0.000,0.000) is (0.000,0.000) by (0.000,0.000) implementing (0.000,0.000) certain (0.000,0.000) comple (0.000,0.000) x (0.000,0.000) bytecodes (0.000,0.000) in (0.000,0.000) the (0.000,0.000) recorder (0.000,0.000) as (0.000,0.000) sequences (0.000,0.000) of (0.000,0.000) simple (0.000,0.000) bytecodes. (0.000,0.000) Expressing (0.000,0.000) the (0.000,0.000) original (0.000,0.000) semantics (0.000,0.000) this (0.000,0.000) w (0.000,0.000) ay (0.000,0.000) is (0.000,0.000) not (0.000,0.000) too (0.000,0.000) dif- (0.000,0.000) ficult, (0.000,0.000) and (0.000,0.000) recording (0.000,0.000) simple (0.000,0.000) bytecodes (0.000,0.000) is (0.000,0.000) much (0.000,0.000) easier (0.000,0.000) . (0.000,0.000) This (0.000,0.000) enables (0.000,0.000) us (0.000,0.000) to (0.000,0.000) retain (0.000,0.000) the (0.000,0.000) adv (0.000,0.000) antages (0.000,0.000) of (0.000,0.000) f (0.000,0.000) at (0.000,0.000) bytecodes (0.000,0.000) while (0.000,0.000) a (0.000,0.000) v (0.000,0.000) oiding (0.000,0.000) some (0.000,0.000) of (0.000,0.000) their (0.000,0.000) problems (0.000,0.000) for (0.000,0.000) trace (0.000,0.000) recording. (0.000,0.000) This (0.000,0.000) is (0.000,0.000) particularly (0.000,0.000) ef (0.000,0.000) fecti (0.000,0.000) v (0.000,0.000) e (0.000,0.000) for (0.000,0.000) f (0.000,0.000) at (0.000,0.000) bytecodes (0.000,0.000) that (0.000,0.000) recurse (0.000,0.000) back (0.000,0.000) into (0.000,0.000) the (0.000,0.000) interpreter (0.000,0.000) , (0.000,0.000) for (0.000,0.000) e (0.000,0.000) xample (0.000,0.000) to (0.000,0.000) con (0.000,0.000) v (0.000,0.000) ert (0.000,0.000) an (0.000,0.000) object (0.000,0.000) into (0.000,0.000) a (0.000,0.000) primiti (0.000,0.000) v (0.000,0.000) e (0.000,0.000) v (0.000,0.000) alue (0.000,0.000) by (0.000,0.000) in (0.000,0.000) v (0.000,0.000) oking (0.000,0.000) a (0.000,0.000) well-kno (0.000,0.000) wn (0.000,0.000) method (0.000,0.000) on (0.000,0.000) the (0.000,0.000) object, (0.000,0.000) since (0.000,0.000) it (0.000,0.000) lets (0.000,0.000) us (0.000,0.000) inline (0.000,0.000) this (0.000,0.000) function (0.000,0.000) call. (0.000,0.000) It (0.000,0.000) is (0.000,0.000) important (0.000,0.000) to (0.000,0.000) note (0.000,0.000) that (0.000,0.000) we (0.000,0.000) split (0.000,0.000) f (0.000,0.000) at (0.000,0.000) opcodes (0.000,0.000) into (0.000,0.000) thinner (0.000,0.000) op- (0.000,0.000) codes (0.000,0.000) only (0.000,0.000) during (0.000,0.000) recording. (0.000,0.000) When (0.000,0.000) running (0.000,0.000) purely (0.000,0.000) interpretati (0.000,0.000) v (0.000,0.000) ely (0.000,0.000) (i.e. (0.000,0.000) code (0.000,0.000) that (0.000,0.000) has (0.000,0.000) been (0.000,0.000) blacklisted), (0.000,0.000) the (0.000,0.000) interpreter (0.000,0.000) direct (0.000,0.000) ly (0.000,0.000) and (0.000,0.000) ef- (0.000,0.000) ficiently (0.000,0.000) e (0.000,0.000) x (0.000,0.000) ecutes (0.000,0.000) the (0.000,0.000) f (0.000,0.000) at (0.000,0.000) opcodes. (0.000,0.000) 6.4 (0.000,0.000) Pr (0.000,0.000) eemption (0.000,0.000) SpiderMonk (0.000,0.000) e (0.000,0.000) y (0.000,0.000) , (0.000,0.000) lik (0.000,0.000) e (0.000,0.000) man (0.000,0.000) y (0.000,0.000) VMs, (0.000,0.000) needs (0.000,0.000) to (0.000,0.000) preempt (0.000,0.000) the (0.000,0.000) user (0.000,0.000) program (0.000,0.000) periodically (0.000,0.000) . (0.000,0.000) The (0.000,0.000) main (0.000,0.000) reasons (0.000,0.000) are (0.000,0.000) to (0.000,0.000) pre (0.000,0.000) v (0.000,0.000) ent (0.000,0.000) infinitely (0.000,0.000) looping (0.000,0.000) scripts (0.000,0.000) from (0.000,0.000) locking (0.000,0.000) up (0.000,0.000) the (0.000,0.000) host (0.000,0.000) system (0.000,0.000) and (0.000,0.000) to (0.000,0.000) schedule (0.000,0.000) GC. (0.000,0.000) In (0.000,0.000) the (0.000,0.000) interpreter (0.000,0.000) , (0.000,0.000) this (0.000,0.000) had (0.000,0.000) been (0.000,0.000) implemented (0.000,0.000) by (0.000,0.000) setting (0.000,0.000) a (0.000,0.000) “pre- (0.000,0.000) empt (0.000,0.000) no (0.000,0.000) w” (0.000,0.000) flag (0.000,0.000) that (0.000,0.000) w (0.000,0.000) as (0.000,0.000) check (0.000,0.000) ed (0.000,0.000) on (0.000,0.000) e (0.000,0.000) v (0.000,0.000) ery (0.000,0.000) backw (0.000,0.000) ard (0.000,0.000) jump. (0.000,0.000) This (0.000,0.000) strate (0.000,0.000) gy (0.000,0.000) carried (0.000,0.000) o (0.000,0.000) v (0.000,0.000) er (0.000,0.000) into (0.000,0.000) T (0.000,0.000) raceMonk (0.000,0.000) e (0.000,0.000) y: (0.000,0.000) the (0.000,0.000) VM (0.000,0.000) inserts (0.000,0.000) a (0.000,0.000) guard (0.000,0.000) on (0.000,0.000) the (0.000,0.000) preemption (0.000,0.000) flag (0.000,0.000) at (0.000,0.000) e (0.000,0.000) v (0.000,0.000) ery (0.000,0.000) loop (0.000,0.000) edge. (0.000,0.000) W (0.000,0.000) e (0.000,0.000) measured (0.000,0.000) less (0.000,0.000) than (0.000,0.000) a (0.000,0.000) 1% (0.000,0.000) increase (0.000,0.000) in (0.000,0.000) runtime (0.000,0.000) on (0.000,0.000) most (0.000,0.000) benchmarks (0.000,0.000) for (0.000,0.000) this (0.000,0.000) e (0.000,0.000) xtra (0.000,0.000) guard. (0.000,0.000) In (0.000,0.000) practice, (0.000,0.000) the (0.000,0.000) cost (0.000,0.000) is (0.000,0.000) detectable (0.000,0.000) only (0.000,0.000) for (0.000,0.000) programs (0.000,0.000) with (0.000,0.000) v (0.000,0.000) ery (0.000,0.000) short (0.000,0.000) loops. (0.000,0.000) W (0.000,0.000) e (0.000,0.000) tested (0.000,0.000) and (0.000,0.000) rejected (0.000,0.000) a (0.000,0.000) solution (0.000,0.000) that (0.000,0.000) a (0.000,0.000) v (0.000,0.000) oided (0.000,0.000) the (0.000,0.000) guards (0.000,0.000) by (0.000,0.000) compiling (0.000,0.000) the (0.000,0.000) loop (0.000,0.000) edge (0.000,0.000) as (0.000,0.000) a (0.000,0.000) n (0.000,0.000) unconditional (0.000,0.000) jump, (0.000,0.000) and (0.000,0.000) patching (0.000,0.000) the (0.000,0.000) jump (0.000,0.000) tar (0.000,0.000) get (0.000,0.000) to (0.000,0.000) an (0.000,0.000) e (0.000,0.000) xit (0.000,0.000) routine (0.000,0.000) when (0.000,0.000) preemption (0.000,0.000) is (0.000,0.000) required. (0.000,0.000) This (0.000,0.000) solution (0.000,0.000) can (0.000,0.000) mak (0.000,0.000) e (0.000,0.000) the (0.000,0.000) normal (0.000,0.000) case (0.000,0.000) slightly (0.000,0.000) f (0.000,0.000) aster (0.000,0.000) , (0.000,0.000) b (0.000,0.000) ut (0.000,0.000) then (0.000,0.000) preemption (0.000,0.000) becomes (0.000,0.000) v (0.000,0.000) ery (0.000,0.000) slo (0.000,0.000) w (0.000,0.000) . (0.000,0.000) The (0.000,0.000) implementation (0.000,0.000) w (0.000,0.000) as (0.000,0.000) also (0.000,0.000) v (0.000,0.000) ery (0.000,0.000) comple (0.000,0.000) x, (0.000,0.000) especially (0.000,0.000) trying (0.000,0.000) to (0.000,0.000) restart (0.000,0.000) e (0.000,0.000) x (0.000,0.000) ecution (0.000,0.000) after (0.000,0.000) the (0.000,0.000) preemption. (0.000,0.000) 6.5 (0.000,0.000) Calling (0.000,0.000) Exter (0.000,0.000) nal (0.000,0.000) Functions (0.000,0.000) Lik (0.000,0.000) e (0.000,0.000) most (0.000,0.000) interpreters, (0.000,0.000) SpiderMonk (0.000,0.000) e (0.000,0.000) y (0.000,0.000) has (0.000,0.000) a (0.000,0.000) foreign (0.000,0.000) function (0.000,0.000) inter (0.000,0.000) - (0.000,0.000) f (0.000,0.000) ace (0.000,0.000) (FFI) (0.000,0.000) that (0.000,0.000) allo (0.000,0.000) ws (0.000,0.000) it (0.000,0.000) to (0.000,0.000) call (0.000,0.000) C (0.000,0.000) b (0.000,0.000) uiltins (0.000,0.000) and (0.000,0.000) host (0.000,0.000) system (0.000,0.000) functions (0.000,0.000) (e.g., (0.000,0.000) web (0.000,0.000) bro (0.000,0.000) wser (0.000,0.000) control (0.000,0.000) and (0.000,0.000) DOM (0.000,0.000) access). (0.000,0.000) The (0.000,0.000) FFI (0.000,0.000) has (0.000,0.000) a (0.000,0.000) stan- (0.000,0.000) dard (0.000,0.000) signat (0.000,0.000) ure (0.000,0.000) for (0.000,0.000) JS-callable (0.000,0.000) functions, (0.000,0.000) the (0.000,0.000) k (0.000,0.000) e (0.000,0.000) y (0.000,0.000) ar (0.000,0.000) gument (0.000,0.000) of (0.000,0.000) which (0.000,0.000) is (0.000,0.000) an (0.000,0.000) array (0.000,0.000) of (0.000,0.000) box (0.000,0.000) ed (0.000,0.000) v (0.000,0.000) alues. (0.000,0.000) External (0.000,0.000) functions (0.000,0.000) called (0.000,0.000) through (0.000,0.000) the (0.000,0.000) FFI (0.000,0.000) interact (0.000,0.000) with (0.000,0.000) the (0.000,0.000) program (0.000,0.000) state (0.000,0.000) through (0.000,0.000) an (0.000,0.000) interpreter (0.000,0.000) API (0.000,0.000) (e.g., (0.000,0.000) to (0.000,0.000) read (0.000,0.000) a (0.000,0.000) property (0.000,0.000) from (0.000,0.000) an (0.000,0.000) ar (0.000,0.000) gument). (0.000,0.000) There (0.000,0.000) are (0.000,0.000) also (0.000,0.000) certain (0.000,0.000) inter (0.000,0.000) - (0.000,0.000) preter (0.000,0.000) b (0.000,0.000) uiltins (0.000,0.000) that (0.000,0.000) do (0.000,0.000) not (0.000,0.000) use (0.000,0.000) the (0.000,0.000) FFI, (0.000,0.000) b (0.000,0.000) ut (0.000,0.000) interact (0.000,0.000) with (0.000,0.000) the (0.000,0.000) program (0.000,0.000) state (0.000,0.000) i (0.000,0.000) n (0.000,0.000) the (0.000,0.000) same (0.000,0.000) w (0.000,0.000) ay (0.000,0.000) , (0.000,0.000) such (0.000,0.000) as (0.000,0.000) the (0.000,0.000) CallIteratorNext (0.000,0.000) function (0.000,0.000) used (0.000,0.000) with (0.000,0.000) it (0.000,0.000) erator (0.000,0.000) objects. (0.000,0.000) T (0.000,0.000) raceMonk (0.000,0.000) e (0.000,0.000) y (0.000,0.000) must (0.000,0.000) support (0.000,0.000) this (0.000,0.000) FFI (0.000,0.000) in (0.000,0.000) order (0.000,0.000) to (0.000,0.000) speed (0.000,0.000) up (0.000,0.000) code (0.000,0.000) that (0.000,0.000) interacts (0.000,0.000) with (0.000,0.000) the (0.000,0.000) host (0.000,0.000) system (0.000,0.000) inside (0.000,0.000) hot (0.000,0.000) loops. (0.000,0.000) Calling (0.000,0.000) e (0.000,0.000) xternal (0.000,0.000) functions (0.000,0.000) from (0.000,0.000) T (0.000,0.000) raceMonk (0.000,0.000) e (0.000,0.000) y (0.000,0.000) is (0.000,0.000) potentially (0.000,0.000) dif- (0.000,0.000) ficult (0.000,0.000) because (0.000,0.000) trac (0.000,0.000) es (0.000,0.000) do (0.000,0.000) not (0.000,0.000) update (0.000,0.000) the (0.000,0.000) interpreter (0.000,0.000) state (0.000,0.000) until (0.000,0.000) e (0.000,0.000) xit- (0.000,0.000) ing. (0.000,0.000) In (0.000,0.000) particular (0.000,0.000) , (0.000,0.000) e (0.000,0.000) xternal (0.000,0.000) functions (0.000,0.000) may (0.000,0.000) need (0.000,0.000) the (0.000,0.000) call (0.000,0.000) stack (0.000,0.000) or (0.000,0.000) the (0.000,0.000) global (0.000,0.000) v (0.000,0.000) ariables, (0.000,0.000) b (0.000,0.000) ut (0.000,0.000) the (0.000,0.000) y (0.000,0.000) may (0.000,0.000) be (0.000,0.000) out (0.000,0.000) of (0.000,0.000) date. (0.000,0.000) F (0.000,0.000) or (0.000,0.000) the (0.000,0.000) out-of-date (0.000,0.000) call (0.000,0.000) stack (0.000,0.000) problem, (0.000,0.000) we (0.000,0.000) re (0.000,0.000) f (0.000,0.000) actored (0.000,0.000) some (0.000,0.000) of (0.000,0.000) the (0.000,0.000) interpreter (0.000,0.000) API (0.000,0.000) implementation (0.000,0.000) functions (0.000,0.000) to (0.000,0.000) re-materialize (0.000,0.000) the (0.000,0.000) interpreter (0.000,0.000) call (0.000,0.000) stack (0.000,0.000) on (0.000,0.000) demand. (0.000,0.000) W (0.000,0.000) e (0.000,0.000) de (0.000,0.000) v (0.000,0.000) e (0.000,0.000) loped (0.000,0.000) a (0.000,0.000) C++ (0.000,0.000) static (0.000,0.000) analysis (0.000,0.000) and (0.000,0.000) annotated (0.000,0.000) some (0.000,0.000) inter (0.000,0.000) - (0.000,0.000) preter (0.000,0.000) funct (0.000,0.000) ions (0.000,0.000) in (0.000,0.000) order (0.000,0.000) to (0.000,0.000) v (0.000,0.000) erify (0.000,0.000) that (0.000,0.000) the (0.000,0.000) call (0.000,0.000) stack (0.000,0.000) is (0.000,0.000) refreshed (0.000,0.000) at (0.000,0.000) an (0.000,0.000) y (0.000,0.000) point (0.000,0.000) it (0.000,0.000) needs (0.000,0.000) to (0.000,0.000) be (0.000,0.000) used. (0.000,0.000) In (0.000,0.000) order (0.000,0.000) to (0.000,0.000) access (0.000,0.000) the (0.000,0.000) call (0.000,0.000) stack, (0.000,0.000) a (0.000,0.000) function (0.000,0.000) must (0.000,0.000) be (0.000,0.000) annotated (0.000,0.000) as (0.000,0.000) either (0.000,0.000) F (0.000,0.000) O (0.000,0.000) R (0.000,0.000) C (0.000,0.000) E (0.000,0.000) S (0.000,0.000) S (0.000,0.000) T (0.000,0.000) A (0.000,0.000) C (0.000,0.000) K (0.000,0.000) or (0.000,0.000) R (0.000,0.000) E (0.000,0.000) - (0.000,0.000) Q (0.000,0.000) U (0.000,0.000) I (0.000,0.000) R (0.000,0.000) E (0.000,0.000) S (0.000,0.000) S (0.000,0.000) T (0.000,0.000) A (0.000,0.000) C (0.000,0.000) K (0.000,0.000) . (0.000,0.000) These (0.000,0.000) annotations (0.000,0.000) are (0.000,0.000) also (0.000,0.000) required (0.000,0.000) i (0.000,0.000) n (0.000,0.000) order (0.000,0.000) to (0.000,0.000) call (0.000,0.000) R (0.000,0.000) E (0.000,0.000) Q (0.000,0.000) U (0.000,0.000) I (0.000,0.000) R (0.000,0.000) E (0.000,0.000) S (0.000,0.000) S (0.000,0.000) T (0.000,0.000) A (0.000,0.000) C (0.000,0.000) K (0.000,0.000) functions, (0.000,0.000) which (0.000,0.000) are (0.000,0.000) presumed (0.000,0.000) to (0.000,0.000) access (0.000,0.000) the (0.000,0.000) call (0.000,0.000) stack (0.000,0.000) transi (0.000,0.000) ti (0.000,0.000) v (0.000,0.000) ely (0.000,0.000) . (0.000,0.000) F (0.000,0.000) O (0.000,0.000) R (0.000,0.000) C (0.000,0.000) E (0.000,0.000) S (0.000,0.000) S (0.000,0.000) T (0.000,0.000) A (0.000,0.000) C (0.000,0.000) K (0.000,0.000) is (0.000,0.000) a (0.000,0.000) trusted (0.000,0.000) annotation, (0.000,0.000) applied (0.000,0.000) to (0.000,0.000) only (0.000,0.000) 5 (0.000,0.000) functions, (0.000,0.000) that (0.000,0.000) means (0.000,0.000) the (0.000,0.000) function (0.000,0.000) refreshes (0.000,0.000) the (0.000,0.000) call (0.000,0.000) stack. (0.000,0.000) R (0.000,0.000) E (0.000,0.000) Q (0.000,0.000) U (0.000,0.000) I (0.000,0.000) R (0.000,0.000) E (0.000,0.000) S (0.000,0.000) S (0.000,0.000) T (0.000,0.000) A (0.000,0.000) C (0.000,0.000) K (0.000,0.000) is (0.000,0.000) an (0.000,0.000) untrusted (0.000,0.000) annotation (0.000,0.000) that (0.000,0.000) means (0.000,0.000) the (0.000,0.000) func- (0.000,0.000) tion (0.000,0.000) may (0.000,0.000) only (0.000,0.000) be (0.000,0.000) called (0.000,0.000) if (0.000,0.000) the (0.000,0.000) call (0.000,0.000) stack (0.000,0.000) has (0.000,0.000) already (0.000,0.000) been (0.000,0.000) refreshed. (0.000,0.000) Similarly (0.000,0.000) , (0.000,0.000) we (0.000,0.000) detect (0.000,0.000) when (0.000,0.000) host (0.000,0.000) functions (0.000,0.000) attem (0.000,0.000) pt (0.000,0.000) to (0.000,0.000) directly (0.000,0.000) read (0.000,0.000) or (0.000,0.000) write (0.000,0.000) global (0.000,0.000) v (0.000,0.000) ariables, (0.000,0.000) and (0.000,0.000) force (0.000,0.000) the (0.000,0.000) currently (0.000,0.000) running (0.000,0.000) trace (0.000,0.000) to (0.000,0.000) side (0.000,0.000) e (0.000,0.000) xit. (0.000,0.000) This (0.000,0.000) is (0.000,0.000) necessary (0.000,0.000) since (0.000,0.000) we (0.000,0.000) cache (0.000,0.000) and (0.000,0.000) unbox (0.000,0.000) global (0.000,0.000) v (0.000,0.000) ariables (0.000,0.000) into (0.000,0.000) the (0.000,0.000) acti (0.000,0.000) v (0.000,0.000) ation (0.000,0.000) record (0.000,0.000) during (0.000,0.000) trace (0.000,0.000) e (0.000,0.000) x (0.000,0.000) ecution. (0.000,0.000) Since (0.000,0.000) both (0.000,0.000) call-stack (0.000,0.000) access (0.000,0.000) and (0.000,0.000) global (0.000,0.000) v (0.000,0.000) ariable (0.000,0.000) access (0.000,0.000) are (0.000,0.000) rarely (0.000,0.000) performed (0.000,0.000) by (0.000,0.000) host (0.000,0.000) functions, (0.000,0.000) performance (0.000,0.000) is (0.000,0.000) not (0.000,0.000) significantly (0.000,0.000) af (0.000,0.000) fected (0.000,0.000) by (0.000,0.000) these (0.000,0.000) safety (0.000,0.000) mechanisms. (0.000,0.000) Another (0.000,0.000) problem (0.000,0.000) is (0.000,0.000) that (0.000,0.000) e (0.000,0.000) xternal (0.000,0.000) functions (0.000,0.000) can (0.000,0.000) ree (0.000,0.000) nter (0.000,0.000) the (0.000,0.000) inter (0.000,0.000) - (0.000,0.000) preter (0.000,0.000) by (0.000,0.000) calling (0.000,0.000) scripts, (0.000,0.000) which (0.000,0.000) in (0.000,0.000) turn (0.000,0.000) ag (0.000,0.000) ain (0.000,0.000) m (0.000,0.000) ight (0.000,0.000) w (0.000,0.000) ant (0.000,0.000) to (0.000,0.000) access (0.000,0.000) the (0.000,0.000) call (0.000,0.000) stack (0.000,0.000) or (0.000,0.000) global (0.000,0.000) v (0.000,0.000) ariables. (0.000,0.000) T (0.000,0.000) o (0.000,0.000) address (0.000,0.000) this (0.000,0.000) problem, (0.000,0.000) we (0.000,0.000) made (0.000,0.000) the (0.000,0.000) VM (0.000,0.000) set (0.000,0.000) a (0.000,0.000) flag (0.000,0.000) whene (0.000,0.000) v (0.000,0.000) er (0.000,0.000) the (0.000,0.000) interpreter (0.000,0.000) is (0.000,0.000) r (0.000,0.000) eentered (0.000,0.000) while (0.000,0.000) a (0.000,0.000) com- (0.000,0.000) piled (0.000,0.000) trace (0.000,0.000) is (0.000,0.000) running. (0.000,0.000) Ev (0.000,0.000) ery (0.000,0.000) call (0.000,0.000) to (0.000,0.000) an (0.000,0.000) e (0.000,0.000) xternal (0.000,0.000) function (0.000,0.000) then (0.000,0.000) checks (0.000,0.000) this (0.000,0.000) flag (0.000,0.000) and (0.000,0.000) e (0.000,0.000) xits (0.000,0.000) the (0.000,0.000) trace (0.000,0.000) immediately (0.000,0.000) after (0.000,0.000) returning (0.000,0.000) from (0.000,0.000) the (0.000,0.000) e (0.000,0.000) xternal (0.000,0.000) function (0.000,0.000) call (0.000,0.000) if (0.000,0.000) it (0.000,0.000) is (0.000,0.000) set. (0.000,0.000) There (0.000,0.000) are (0.000,0.000) man (0.000,0.000) y (0.000,0.000) e (0.000,0.000) xternal (0.000,0.000) functions (0.000,0.000) t (0.000,0.000) hat (0.000,0.000) seldom (0.000,0.000) or (0.000,0.000) ne (0.000,0.000) v (0.000,0.000) er (0.000,0.000) reenter (0.000,0.000) , (0.000,0.000) and (0.000,0.000) the (0.000,0.000) y (0.000,0.000) can (0.000,0.000) be (0.000,0.000) called (0.000,0.000) without (0.000,0.000) problem, (0.000,0.000) and (0.000,0.000) will (0.000,0.000) cause (0.000,0.000) trace (0.000,0.000) e (0.000,0.000) xit (0.000,0.000) only (0.000,0.000) if (0.000,0.000) necessary (0.000,0.000) . (0.000,0.000) The (0.000,0.000) FFI’ (0.000,0.000) s (0.000,0.000) box (0.000,0.000) ed (0.000,0.000) v (0.000,0.000) alue (0.000,0.000) array (0.000,0.000) requirement (0.000,0.000) has (0.000,0.000) a (0.000,0.000) performance (0.000,0.000) cost, (0.000,0.000) so (0.000,0.000) we (0.000,0.000) defined (0.000,0.000) a (0.000,0.000) ne (0.000,0.000) w (0.000,0.000) FFI (0.000,0.000) that (0.000,0.000) allo (0.000,0.000) w (0.000,0.000) s (0.000,0.000) C (0.000,0.000) functions (0.000,0.000) to (0.000,0.000) be (0.000,0.000) an- (0.000,0.000) notated (0.000,0.000) with (0.000,0.000) their (0.000,0.000) ar (0.000,0.000) gument (0.000,0.000) types (0.000,0.000) so (0.000,0.000) that (0.000,0.000) the (0.000,0.000) tracer (0.000,0.000) can (0.000,0.000) call (0.000,0.000) them (0.000,0.000) directly (0.000,0.000) , (0.000,0.000) without (0.000,0.000) unnecessary (0.000,0.000) ar (0.000,0.000) gument (0.000,0.000) con (0.000,0.000) v (0.000,0.000) ersions. (0.000,0.000) Currently (0.000,0.000) , (0.000,0.000) we (0.000,0.000) do (0.000,0.000) not (0.000,0.000) support (0.000,0.000) calling (0.000,0.000) nati (0.000,0.000) v (0.000,0.000) e (0.000,0.000) property (0.000,0.000) get (0.000,0.000) and (0.000,0.000) set (0.000,0.000) o (0.000,0.000) v (0.000,0.000) erride (0.000,0.000) functions (0.000,0.000) or (0.000,0.000) DOM (0.000,0.000) functions (0.000,0.000) directly (0.000,0.000) from (0.000,0.000) trace. (0.000,0.000) Support (0.000,0.000) is (0.000,0.000) planned (0.000,0.000) future (0.000,0.000) w (0.000,0.000) ork. (0.000,0.000) 6.6 (0.000,0.000) Corr (0.000,0.000) ectness (0.000,0.000) During (0.000,0.000) de (0.000,0.000) v (0.000,0.000) elopment, (0.000,0.000) we (0.000,0.000) had (0.000,0.000) access (0.000,0.000) to (0.000,0.000) e (0.000,0.000) xisting (0.000,0.000) Ja (0.000,0.000) v (0.000,0.000) aScript (0.000,0.000) test (0.000,0.000) suites, (0.000,0.000) b (0.000,0.000) ut (0.000,0.000) most (0.000,0.000) of (0.000,0.000) them (0.000,0.000) were (0.000,0.000) not (0.000,0.000) designed (0.000,0.000) with (0.000,0.000) tracing (0.000,0.000) VMs (0.000,0.000) in (0.000,0.000) mind (0.000,0.000) and (0.000,0.000) contained (0.000,0.000) fe (0.000,0.000) w (0.000,0.000) loops. (0.000,0.000) One (0.000,0.000) tool (0.000,0.000) that (0.000,0.000) helped (0.000,0.000) us (0.000,0.000) greatly (0.000,0.000) w (0.000,0.000) as (0.000,0.000) Mozilla’ (0.000,0.000) s (0.000,0.000) Ja (0.000,0.000) v (0.000,0.000) aScript (0.000,0.000) fuzz (0.000,0.000) tester (0.000,0.000) , (0.000,0.000) J (0.000,0.000) S (0.000,0.000) F (0.000,0.000) U (0.000,0.000) N (0.000,0.000) F (0.000,0.000) U (0.000,0.000) Z (0.000,0.000) Z (0.000,0.000) , (0.000,0.000) which (0.000,0.000) generates (0.000,0.000) random (0.000,0.000) Ja (0.000,0.000) v (0.000,0.000) aScript (0.000,0.000) programs (0.000,0.000) by (0.000,0.000) nesting (0.000,0.000) random (0.000,0.000) language (0.000,0.000) elements. (0.000,0.000) W (0.000,0.000) e (0.000,0.000) modified (0.000,0.000) J (0.000,0.000) S (0.000,0.000) F (0.000,0.000) U (0.000,0.000) N (0.000,0.000) F (0.000,0.000) U (0.000,0.000) Z (0.000,0.000) Z (0.000,0.000) to (0.000,0.000) generate (0.000,0.000) loops, (0.000,0.000) and (0.000,0.000) also (0.000,0.000) to (0.000,0.000) test (0.000,0.000) more (0.000,0.000) hea (0.000,0.000) vily (0.000,0.000) certain (0.000,0.000) constructs (0.000,0.000) we (0.000,0.000) suspected (0.000,0.000) w (0.000,0.000) ould (0.000,0.000) re (0.000,0.000) v (0.000,0.000) eal (0.000,0.000) fla (0.000,0.000) ws (0.000,0.000) in (0.000,0.000) our (0.000,0.000) implementation. (0.000,0.000) F (0.000,0.000) or (0.000,0.000) e (0.000,0.000) xam- (0.000,0.000) ple, (0.000,0.000) we (0.000,0.000) suspected (0.000,0.000) b (0.000,0.000) ugs (0.000,0.000) in (0.000,0.000) T (0.000,0.000) raceMonk (0.000,0.000) e (0.000,0.000) y’ (0.000,0.000) s (0.000,0.000) handling (0.000,0.000) of (0.000,0.000) type-unstable (0.164,239.103) Figur (0.164,239.103) e (0.164,239.103) 11. (0.164,239.103) Fraction (0.164,239.103) of (0.164,239.103) dynamic (0.164,239.103) bytecodes (0.164,239.103) executed (0.164,239.103) by (0.164,239.103) inter (0.164,239.103) - (0.164,239.103) pr (0.164,239.103) eter (0.164,239.103) and (0.164,239.103) on (0.164,239.103) nati (0.164,239.103) v (0.164,239.103) e (0.164,239.103) traces. (0.164,239.103) The (0.164,239.103) speedup (0.164,239.103) vs. (0.164,239.103) interpreter (0.164,239.103) is (0.164,239.103) sho (0.164,239.103) wn (0.164,239.103) in (0.164,239.103) parentheses (0.164,239.103) ne (0.164,239.103) xt (0.164,239.103) to (0.164,239.103) each (0.164,239.103) test. (0.164,239.103) The (0.164,239.103) fraction (0.164,239.103) of (0.164,239.103) bytecodes (0.164,239.103) e (0.164,239.103) x (0.164,239.103) e- (0.164,239.103) cuted (0.164,239.103) whil (0.164,239.103) e (0.164,239.103) recording (0.164,239.103) is (0.164,239.103) too (0.164,239.103) small (0.164,239.103) to (0.164,239.103) see (0.164,239.103) in (0.164,239.103) this (0.164,239.103) figure, (0.164,239.103) e (0.164,239.103) xcept (0.164,239.103) for (0.164,239.103) crypto-md5 (0.164,239.103) , (0.164,239.103) where (0.164,239.103) fully (0.164,239.103) 3% (0.164,239.103) of (0.164,239.103) bytecodes (0.164,239.103) are (0.164,239.103) e (0.164,239.103) x (0.164,239.103) ecuted (0.164,239.103) while (0.164,239.103) recording. (0.164,239.103) In (0.164,239.103) most (0.164,239.103) of (0.164,239.103) the (0.164,239.103) test (0.164,239.103) s, (0.164,239.103) almost (0.164,239.103) all (0.164,239.103) the (0.164,239.103) bytecodes (0.164,239.103) are (0.164,239.103) e (0.164,239.103) x (0.164,239.103) e- (0.164,239.103) cuted (0.164,239.103) by (0.164,239.103) compiled (0.164,239.103) traces. (0.164,239.103) Three (0.164,239.103) of (0.164,239.103) the (0.164,239.103) benchmarks (0.164,239.103) are (0.164,239.103) not (0.164,239.103) traced (0.164,239.103) at (0.164,239.103) all (0.164,239.103) and (0.164,239.103) run (0.164,239.103) in (0.164,239.103) the (0.164,239.103) interpreter (0.164,239.103) . (0.164,239.103) loops (0.164,239.103) and (0.164,239.103) hea (0.164,239.103) vily (0.164,239.103) branching (0.164,239.103) code, (0.164,239.103) and (0.164,239.103) a (0.164,239.103) specialized (0.164,239.103) fuzz (0.164,239.103) tester (0.164,239.103) in- (0.164,239.103) deed (0.164,239.103) re (0.164,239.103) v (0.164,239.103) ealed (0.164,239.103) se (0.164,239.103) v (0.164,239.103) eral (0.164,239.103) re (0.164,239.103) gressions (0.164,239.103) which (0.164,239.103) we (0.164,239.103) subsequently (0.164,239.103) corrected. (0.164,239.103) 7. (0.164,239.103) Ev (0.164,239.103) aluation (0.164,239.103) W (0.164,239.103) e (0.164,239.103) e (0.164,239.103) v (0.164,239.103) aluated (0.164,239.103) our (0.164,239.103) Ja (0.164,239.103) v (0.164,239.103) aScript (0.164,239.103) tracing (0.164,239.103) implementation (0.164,239.103) using (0.164,239.103) Sun- (0.164,239.103) Spider (0.164,239.103) , (0.164,239.103) the (0.164,239.103) indus (0.164,239.103) try (0.164,239.103) standard (0.164,239.103) Ja (0.164,239.103) v (0.164,239.103) aScript (0.164,239.103) benchmark (0.164,239.103) suite. (0.164,239.103) SunSpi- (0.164,239.103) der (0.164,239.103) consists (0.164,239.103) of (0.164,239.103) 26 (0.164,239.103) short-running (0.164,239.103) (less (0.164,239.103) than (0.164,239.103) 250ms, (0.164,239.103) a (0.164,239.103) v (0.164,239.103) era (0.164,239.103) ge (0.164,239.103) 26ms) (0.164,239.103) Ja (0.164,239.103) v (0.164,239.103) aScript (0.164,239.103) programs. (0.164,239.103) This (0.164,239.103) is (0.164,239.103) in (0.164,239.103) stark (0.164,239.103) contrast (0.164,239.103) to (0.164,239.103) benchmark (0.164,239.103) suites (0.164,239.103) such (0.164,239.103) as (0.164,239.103) SpecJVM98 (0.164,239.103) (3) (0.164,239.103) used (0.164,239.103) to (0.164,239.103) e (0.164,239.103) v (0.164,239.103) aluate (0.164,239.103) desktop (0.164,239.103) and (0.164,239.103) serv (0.164,239.103) er (0.164,239.103) Ja (0.164,239.103) v (0.164,239.103) a (0.164,239.103) VMs. (0.164,239.103) Man (0.164,239.103) y (0.164,239.103) programs (0.164,239.103) in (0.164,239.103) those (0.164,239.103) benchmarks (0.164,239.103) use (0.164,239.103) lar (0.164,239.103) ge (0.164,239.103) data (0.164,239.103) sets (0.164,239.103) and (0.164,239.103) e (0.164,239.103) x (0.164,239.103) ecute (0.164,239.103) for (0.164,239.103) minutes. (0.164,239.103) The (0.164,239.103) SunSpider (0.164,239.103) programs (0.164,239.103) carry (0.164,239.103) out (0.164,239.103) a (0.164,239.103) v (0.164,239.103) ariety (0.164,239.103) of (0.164,239.103) tasks, (0.164,239.103) primarily (0.164,239.103) 3d (0.164,239.103) rendering, (0.164,239.103) bit-bashing, (0.164,239.103) cryptographic (0.164,239.103) encoding, (0.164,239.103) math (0.164,239.103) k (0.164,239.103) ernels, (0.164,239.103) and (0.164,239.103) string (0.164,239.103) processing. (0.164,239.103) All (0.164,239.103) e (0.164,239.103) xperiments (0.164,239.103) were (0.164,239.103) performed (0.164,239.103) on (0.164,239.103) a (0.164,239.103) MacBook (0.164,239.103) Pro (0.164,239.103) with (0.164,239.103) 2.2 (0.164,239.103) GHz (0.164,239.103) Core (0.164,239.103) 2 (0.164,239.103) processor (0.164,239.103) and (0.164,239.103) 2 (0.164,239.103) GB (0.164,239.103) RAM (0.164,239.103) running (0.164,239.103) MacOS (0.164,239.103) 10.5. (0.164,239.103) Benchmark (0.164,239.103) r (0.164,239.103) esults. (0.164,239.103) The (0.164,239.103) main (0.164,239.103) question (0.164,239.103) is (0.164,239.103) whether (0.164,239.103) programs (0.164,239.103) run (0.164,239.103) f (0.164,239.103) aster (0.164,239.103) with (0.164,239.103) tracing. (0.164,239.103) F (0.164,239.103) or (0.164,239.103) this, (0.164,239.103) we (0.164,239.103) ran (0.164,239.103) the (0.164,239.103) standard (0.164,239.103) SunSpider (0.164,239.103) test (0.164,239.103) dri (0.164,239.103) v (0.164,239.103) er (0.164,239.103) , (0.164,239.103) which (0.164,239.103) starts (0.164,239.103) a (0.164,239.103) Ja (0.164,239.103) v (0.164,239.103) aScript (0.164,239.103) interpreter (0.164,239.103) , (0.164,239.103) loads (0.164,239.103) and (0.164,239.103) runs (0.164,239.103) each (0.164,239.103) program (0.164,239.103) once (0.164,239.103) for (0.164,239.103) w (0.164,239.103) armup, (0.164,239.103) then (0.164,239.103) loads (0.164,239.103) and (0.164,239.103) runs (0.164,239.103) each (0.164,239.103) program (0.164,239.103) 10 (0.164,239.103) times (0.164,239.103) and (0.164,239.103) reports (0.164,239.103) the (0.164,239.103) a (0.164,239.103) v (0.164,239.103) erage (0.164,239.103) time (0.164,239.103) tak (0.164,239.103) en (0.164,239.103) by (0.164,239.103) each. (0.164,239.103) W (0.164,239.103) e (0.164,239.103) ran (0.164,239.103) 4 (0.164,239.103) dif (0.164,239.103) fer (0.164,239.103) - (0.164,239.103) ent (0.164,239.103) configurations (0.164,239.103) for (0.164,239.103) comparison: (0.164,239.103) (a) (0.164,239.103) SpiderMonk (0.164,239.103) e (0.164,239.103) y (0.164,239.103) , (0.164,239.103) the (0.164,239.103) baseline (0.164,239.103) interpreter (0.164,239.103) , (0.164,239.103) (b) (0.164,239.103) T (0.164,239.103) raceMonk (0.164,239.103) e (0.164,239.103) y (0.164,239.103) , (0.164,239.103) (d) (0.164,239.103) SquirrelFish (0.164,239.103) Extreme (0.164,239.103) (SFX), (0.164,239.103) the (0.164,239.103) call-threaded (0.164,239.103) Ja (0.164,239.103) v (0.164,239.103) aScript (0.164,239.103) interpreter (0.164,239.103) used (0.164,239.103) in (0.164,239.103) Apple’ (0.164,239.103) s (0.164,239.103) W (0.164,239.103) ebKit, (0.164,239.103) and (0.164,239.103) (e) (0.164,239.103) V8, (0.164,239.103) the (0.164,239.103) method-compiling (0.164,239.103) Ja (0.164,239.103) v (0.164,239.103) aScript (0.164,239.103) VM (0.164,239.103) from (0.164,239.103) Google. (0.164,239.103) Figure (0.164,239.103) 10 (0.164,239.103) sho (0.164,239.103) ws (0.164,239.103) the (0.164,239.103) relati (0.164,239.103) v (0.164,239.103) e (0.164,239.103) speedups (0.164,239.103) achie (0.164,239.103) v (0.164,239.103) ed (0.164,239.103) by (0.164,239.103) tracing, (0.164,239.103) SFX, (0.164,239.103) and (0.164,239.103) V8 (0.164,239.103) ag (0.164,239.103) ainst (0.164,239.103) the (0.164,239.103) baseline (0.164,239.103) (SpiderMonk (0.164,239.103) e (0.164,239.103) y). (0.164,239.103) T (0.164,239.103) racing (0.164,239.103) achie (0.164,239.103) v (0.164,239.103) es (0.164,239.103) the (0.164,239.103) best (0.164,239.103) speedups (0.164,239.103) in (0.164,239.103) inte (0.164,239.103) ger (0.164,239.103) -hea (0.164,239.103) vy (0.164,239.103) be (0.164,239.103) nchmarks, (0.164,239.103) up (0.164,239.103) to (0.164,239.103) the (0.164,239.103) 25x (0.164,239.103) speedup (0.164,239.103) on (0.164,239.103) bitops-bitwise-and (0.164,239.103) . (0.164,239.103) T (0.164,239.103) raceMonk (0.164,239.103) e (0.164,239.103) y (0.164,239.103) is (0.164,239.103) the (0.164,239.103) f (0.164,239.103) astest (0.164,239.103) VM (0.164,239.103) on (0.164,239.103) 9 (0.164,239.103) of (0.164,239.103) the (0.164,239.103) 26 (0.164,239.103) benchmarks (0.164,239.103) ( (0.164,239.103) 3d-morph (0.164,239.103) , (0.164,239.103) bitops-3bit-bits-in-byte (0.164,239.103) , (0.164,239.103) bitops-bitwise- (0.164,239.103) and (0.164,239.103) , (0.164,239.103) crypto-sha1 (0.164,239.103) , (0.164,239.103) math-cordic (0.164,239.103) , (0.164,239.103) math-partial-sums (0.164,239.103) , (0.164,239.103) math- (0.164,239.103) spectral-norm (0.164,239.103) , (0.164,239.103) string-base64 (0.164,239.103) , (0.164,239.103) string-validate-input (0.164,239.103) ). (0.164,502.117) Figur (0.164,502.117) e (0.164,502.117) 10. (0.164,502.117) Speedup (0.164,502.117) vs. (0.164,502.117) a (0.164,502.117) baseline (0.164,502.117) Ja (0.164,502.117) v (0.164,502.117) aScript (0.164,502.117) interpreter (0.164,502.117) (SpiderMonk (0.164,502.117) e (0.164,502.117) y) (0.164,502.117) for (0.164,502.117) our (0.164,502.117) trace-based (0.164,502.117) JIT (0.164,502.117) compiler (0.164,502.117) , (0.164,502.117) Apple’ (0.164,502.117) s (0.164,502.117) SquirrelFish (0.164,502.117) Extreme (0.164,502.117) inline (0.164,502.117) threading (0.164,502.117) interpreter (0.164,502.117) and (0.164,502.117) Google’ (0.164,502.117) s (0.164,502.117) V8 (0.164,502.117) JS (0.164,502.117) compiler (0.164,502.117) . (0.164,502.117) Our (0.164,502.117) system (0.164,502.117) generates (0.164,502.117) particularly (0.164,502.117) ef (0.164,502.117) ficient (0.164,502.117) code (0.164,502.117) for (0.164,502.117) programs (0.164,502.117) that (0.164,502.117) benefit (0.164,502.117) most (0.164,502.117) from (0.164,502.117) type (0.164,502.117) specialization, (0.164,502.117) which (0.164,502.117) includes (0.164,502.117) SunSpider (0.164,502.117) Benchmark (0.164,502.117) programs (0.164,502.117) that (0.164,502.117) perform (0.164,502.117) bit (0.164,502.117) manipulation. (0.164,502.117) W (0.164,502.117) e (0.164,502.117) type-s (0.164,502.117) pecialize (0.164,502.117) the (0.164,502.117) code (0.164,502.117) in (0.164,502.117) question (0.164,502.117) to (0.164,502.117) use (0.164,502.117) inte (0.164,502.117) ger (0.164,502.117) arithmet (0.164,502.117) ic, (0.164,502.117) which (0.164,502.117) substantially (0.164,502.117) impro (0.164,502.117) v (0.164,502.117) es (0.164,502.117) performance. (0.164,502.117) F (0.164,502.117) or (0.164,502.117) one (0.164,502.117) of (0.164,502.117) the (0.164,502.117) benchmark (0.164,502.117) programs (0.164,502.117) we (0.164,502.117) e (0.164,502.117) x (0.164,502.117) ecute (0.164,502.117) 25 (0.164,502.117) times (0.164,502.117) f (0.164,502.117) aster (0.164,502.117) than (0.164,502.117) the (0.164,502.117) SpiderMonk (0.164,502.117) e (0.164,502.117) y (0.164,502.117) interpre (0.164,502.117) ter (0.164,502.117) , (0.164,502.117) and (0.164,502.117) almost (0.164,502.117) 5 (0.164,502.117) times (0.164,502.117) f (0.164,502.117) aster (0.164,502.117) than (0.164,502.117) V8 (0.164,502.117) and (0.164,502.117) SFX. (0.164,502.117) F (0.164,502.117) or (0.164,502.117) a (0.164,502.117) lar (0.164,502.117) ge (0.164,502.117) number (0.164,502.117) of (0.164,502.117) benchmarks (0.164,502.117) all (0.164,502.117) three (0.164,502.117) VMs (0.164,502.117) produce (0.164,502.117) similar (0.164,502.117) results. (0.164,502.117) W (0.164,502.117) e (0.164,502.117) perform (0.164,502.117) w (0.164,502.117) orst (0.164,502.117) on (0.164,502.117) benchmark (0.164,502.117) programs (0.164,502.117) that (0.164,502.117) we (0.164,502.117) do (0.164,502.117) not (0.164,502.117) trace (0.164,502.117) and (0.164,502.117) instead (0.164,502.117) f (0.164,502.117) a (0.164,502.117) ll (0.164,502.117) back (0.164,502.117) onto (0.164,502.117) the (0.164,502.117) interpreter (0.164,502.117) . (0.164,502.117) This (0.164,502.117) includes (0.164,502.117) the (0.164,502.117) recursi (0.164,502.117) v (0.164,502.117) e (0.164,502.117) benchmarks (0.164,502.117) access-binary-trees (0.164,502.117) and (0.164,502.117) control-flow-recursive (0.164,502.117) , (0.164,502.117) for (0.164,502.117) which (0.164,502.117) we (0.164,502.117) currently (0.164,502.117) don’ (0.164,502.117) t (0.164,502.117) generate (0.164,502.117) an (0.164,502.117) y (0.164,502.117) nati (0.164,502.117) v (0.164,502.117) e (0.164,502.117) code. (0.164,502.117) In (0.164,502.117) particular (0.164,502.117) , (0.164,502.117) the (0.164,502.117) bitops (0.164,502.117) benchmarks (0.164,502.117) are (0.164,502.117) short (0.164,502.117) programs (0.164,502.117) that (0.164,502.117) per (0.164,502.117) - (0.164,502.117) form (0.164,502.117) man (0.164,502.117) y (0.164,502.117) bitwise (0.164,502.117) operations, (0.164,502.117) so (0.164,502.117) T (0.164,502.117) raceMonk (0.164,502.117) e (0.164,502.117) y (0.164,502.117) can (0.164,502.117) co (0.164,502.117) v (0.164,502.117) er (0.164,502.117) the (0.164,502.117) en- (0.164,502.117) tire (0.164,502.117) program (0.164,502.117) with (0.164,502.117) 1 (0.164,502.117) or (0.164,502.117) 2 (0.164,502.117) traces (0.164,502.117) that (0.164,502.117) opera (0.164,502.117) te (0.164,502.117) on (0.164,502.117) inte (0.164,502.117) gers. (0.164,502.117) T (0.164,502.117) raceMon- (0.164,502.117) k (0.164,502.117) e (0.164,502.117) y (0.164,502.117) runs (0.164,502.117) all (0.164,502.117) the (0.164,502.117) other (0.164,502.117) progr (0.164,502.117) ams (0.164,502.117) in (0.164,502.117) this (0.164,502.117) set (0.164,502.117) almost (0.164,502.117) entirely (0.164,502.117) as (0.164,502.117) nati (0.164,502.117) v (0.164,502.117) e (0.164,502.117) code. (0.164,502.117) regexp-dna (0.164,502.117) is (0.164,502.117) dominated (0.164,502.117) by (0.164,502.117) re (0.164,502.117) gular (0.164,502.117) e (0.164,502.117) xpression (0.164,502.117) ma (0.164,502.117) tching, (0.164,502.117) which (0.164,502.117) is (0.164,502.117) implemented (0.164,502.117) in (0.164,502.117) all (0.164,502.117) 3 (0.164,502.117) VMs (0.164,502.117) by (0.164,502.117) a (0.164,502.117) special (0.164,502.117) re (0.164,502.117) gular (0.164,502.117) e (0.164,502.117) xpression (0.164,502.117) compiler (0.164,502.117) . (0.164,502.117) Thus, (0.164,502.117) performance (0.164,502.117) on (0.164,502.117) this (0.164,502.117) benchmark (0.164,502.117) has (0.164,502.117) little (0.164,502.117) relation (0.164,502.117) to (0.164,502.117) the (0.164,502.117) trace (0.164,502.117) compilation (0.164,502.117) approach (0.164,502.117) discussed (0.164,502.117) in (0.164,502.117) this (0.164,502.117) paper (0.164,502.117) . (0.164,502.117) T (0.164,502.117) raceMonk (0.164,502.117) e (0.164,502.117) y’ (0.164,502.117) s (0.164,502.117) smaller (0.164,502.117) speedups (0.164,502.117) on (0.164,502.117) the (0.164,502.117) other (0.164,502.117) benchmarks (0.164,502.117) can (0.164,502.117) be (0.164,502.117) attrib (0.164,502.117) uted (0.164,502.117) to (0.164,502.117) a (0.164,502.117) fe (0.164,502.117) w (0.164,502.117) specific (0.164,502.117) causes: (0.164,502.117) • (0.164,502.117) The (0.164,502.117) implementation (0.164,502.117) does (0.164,502.117) not (0.164,502.117) currently (0.164,502.117) trace (0.164,502.117) recursion, (0.164,502.117) so (0.164,502.117) T (0.164,502.117) raceMonk (0.164,502.117) e (0.164,502.117) y (0.164,502.117) achie (0.164,502.117) v (0.164,502.117) es (0.164,502.117) a (0.164,502.117) small (0.164,502.117) speedup (0.164,502.117) or (0.164,502.117) no (0.164,502.117) speedup (0.164,502.117) on (0.164,502.117) benchmarks (0.164,502.117) that (0.164,502.117) use (0.164,502.117) recursion (0.164,502.117) e (0.164,502.117) xtensi (0.164,502.117) v (0.164,502.117) ely: (0.164,502.117) 3d-cube (0.164,502.117) , (0.164,502.117) 3d- (0.164,502.117) raytrace (0.164,502.117) , (0.164,502.117) access-binary-trees (0.164,502.117) , (0.164,502.117) string-tagcloud (0.164,502.117) , (0.164,502.117) and (0.164,502.117) controlflow-recursive (0.164,502.117) . (0.164,502.117) • (0.164,502.117) The (0.164,502.117) implementation (0.164,502.117) does (0.164,502.117) not (0.164,502.117) currently (0.164,502.117) trace (0.164,502.117) eval (0.164,502.117) and (0.164,502.117) some (0.164,502.117) other (0.164,502.117) functions (0.164,502.117) implemented (0.164,502.117) in (0.164,502.117) C. (0.164,502.117) Because (0.164,502.117) date-format- (0.164,502.117) tofte (0.164,502.117) and (0.164,502.117) date-format-xparb (0.164,502.117) use (0.164,502.117) such (0.164,502.117) functions (0.164,502.117) in (0.164,502.117) their (0.164,502.117) main (0.164,502.117) loops, (0.164,502.117) we (0.164,502.117) do (0.164,502.117) not (0.164,502.117) trace (0.164,502.117) them. (0.164,502.117) • (0.164,502.117) The (0.164,502.117) implementation (0.164,502.117) does (0.164,502.117) not (0.164,502.117) currently (0.164,502.117) trace (0.164,502.117) through (0.164,502.117) re (0.164,502.117) gular (0.164,502.117) e (0.164,502.117) xpression (0.164,502.117) replace (0.164,502.117) operations. (0.164,502.117) The (0.164,502.117) replace (0.164,502.117) function (0.164,502.117) can (0.164,502.117) be (0.164,502.117) passed (0.164,502.117) a (0.164,502.117) function (0.164,502.117) object (0.164,502.117) used (0.164,502.117) to (0.164,502.117) compute (0.164,502.117) the (0.164,502.117) replacement (0.164,502.117) te (0.164,502.117) xt. (0.164,502.117) Our (0.164,502.117) implementation (0.164,502.117) currently (0.164,502.117) does (0.164,502.117) not (0.164,502.117) trace (0.164,502.117) functions (0.164,502.117) called (0.164,502.117) as (0.164,502.117) replace (0.164,502.117) functions. (0.164,502.117) The (0.164,502.117) run (0.164,502.117) time (0.164,502.117) of (0.164,502.117) string-unpack-code (0.164,502.117) is (0.164,502.117) dominated (0.164,502.117) by (0.164,502.117) such (0.164,502.117) a (0.164,502.117) replace (0.164,502.117) call. (0.164,502.117) • (0.164,502.117) T (0.164,502.117) w (0.164,502.117) o (0.164,502.117) programs (0.164,502.117) trace (0.164,502.117) well, (0.164,502.117) b (0.164,502.117) ut (0.164,502.117) ha (0.164,502.117) v (0.164,502.117) e (0.164,502.117) a (0.164,502.117) long (0.164,502.117) compilation (0.164,502.117) time. (0.164,502.117) access-nbody (0.164,502.117) forms (0.164,502.117) a (0.164,502.117) lar (0.164,502.117) ge (0.164,502.117) number (0.164,502.117) of (0.164,502.117) traces (0.164,502.117) (81). (0.164,502.117) crypto-md5 (0.164,502.117) forms (0.164,502.117) one (0.164,502.117) v (0.164,502.117) e (0.164,502.117) ry (0.164,502.117) long (0.164,502.117) trace. (0.164,502.117) W (0.164,502.117) e (0.164,502.117) e (0.164,502.117) xpec (0.164,502.117) t (0.164,502.117) to (0.164,502.117) impro (0.164,502.117) v (0.164,502.117) e (0.164,502.117) performance (0.164,502.117) on (0.164,502.117) this (0.164,502.117) programs (0.164,502.117) by (0.164,502.117) impro (0.164,502.117) ving (0.164,502.117) the (0.164,502.117) compilation (0.164,502.117) speed (0.164,502.117) of (0.164,502.117) nano- (0.164,502.117) jit. (0.164,502.117) • (0.164,502.117) Some (0.164,502.117) programs (0.164,502.117) trace (0.164,502.117) v (0.164,502.117) ery (0.164,502.117) well, (0.164,502.117) and (0.164,502.117) speed (0.164,502.117) up (0.164,502.117) compared (0.164,502.117) to (0.164,502.117) the (0.164,502.117) interpreter (0.164,502.117) , (0.164,502.117) b (0.164,502.117) ut (0.164,502.117) are (0.164,502.117) not (0.164,502.117) as (0.164,502.117) f (0.164,502.117) ast (0.164,502.117) as (0.164,502.117) SFX (0.164,502.117) and/or (0.164,502.117) V8, (0.164,502.117) namely (0.164,502.117) bitops-bits-in-byte (0.164,502.117) , (0.164,502.117) bitops-nsieve-bits (0.164,502.117) , (0.164,502.117) access- (0.164,502.117) fannkuch (0.164,502.117) , (0.164,502.117) access-nsieve (0.164,502.117) , (0.164,502.117) and (0.164,502.117) crypto-aes (0.164,502.117) . (0.164,502.117) The (0.164,502.117) reason (0.164,502.117) is (0.164,502.117) not (0.164,502.117) clear (0.164,502.117) , (0.164,502.117) b (0.164,502.117) ut (0.164,502.117) all (0.164,502.117) of (0.164,502.117) these (0.164,502.117) programs (0.164,502.117) ha (0.164,502.117) v (0.164,502.117) e (0.164,502.117) nested (0.164,502.117) loops (0.164,502.117) with (0.164,502.117) small (0.164,502.117) bodies, (0.164,502.117) so (0.164,502.117) we (0.164,502.117) suspec (0.164,502.117) t (0.164,502.117) that (0.164,502.117) the (0.164,502.117) implementation (0.164,502.117) has (0.164,502.117) a (0.164,502.117) rela- (0.164,502.117) ti (0.164,502.117) v (0.164,502.117) ely (0.164,502.117) high (0.164,502.117) cost (0.164,502.117) for (0.164,502.117) calling (0.164,502.117) nested (0.164,502.117) traces. (0.164,502.117) string-fasta (0.164,502.117) traces (0.164,502.117) well, (0.164,502.117) b (0.164,502.117) ut (0.164,502.117) its (0.164,502.117) run (0.164,502.117) time (0.164,502.117) is (0.164,502.117) dominated (0.164,502.117) by (0.164,502.117) string (0.164,502.117) processing (0.164,502.117) b (0.164,502.117) uiltins, (0.164,502.117) which (0.164,502.117) are (0.164,502.117) unaf (0.164,502.117) fected (0.164,502.117) by (0.164,502.117) tracing (0.164,502.117) and (0.164,502.117) seem (0.164,502.117) to (0.164,502.117) be (0.164,502.117) less (0.164,502.117) ef (0.164,502.117) ficient (0.164,502.117) in (0.164,502.117) SpiderMonk (0.164,502.117) e (0.164,502.117) y (0.164,502.117) than (0.164,502.117) in (0.164,502.117) the (0.164,502.117) tw (0.164,502.117) o (0.164,502.117) other (0.164,502.117) VMs. (0.164,502.117) Detailed (0.164,502.117) perf (0.164,502.117) ormance (0.164,502.117) metrics. (0.164,502.117) In (0.164,502.117) Figure (0.164,502.117) 11 (0.164,502.117) we (0.164,502.117) sho (0.164,502.117) w (0.164,502.117) the (0.164,502.117) frac- (0.164,502.117) tion (0.164,502.117) of (0.164,502.117) instructions (0.164,502.117) interprete (0.164,502.117) d (0.164,502.117) and (0.164,502.117) the (0.164,502.117) fraction (0.164,502.117) of (0.164,502.117) instructions (0.164,502.117) e (0.164,502.117) x (0.164,502.117) e- (0.164,502.117) cuted (0.164,502.117) as (0.164,502.117) nati (0.164,502.117) v (0.164,502.117) e (0.164,502.117) code. (0.164,502.117) This (0.164,502.117) figure (0.164,502.117) sho (0.164,502.117) ws (0.164,502.117) that (0.164,502.117) for (0.164,502.117) man (0.164,502.117) y (0.164,502.117) programs, (0.164,502.117) we (0.164,502.117) are (0.164,502.117) able (0.164,502.117) to (0.164,502.117) e (0.164,502.117) x (0.164,502.117) ecute (0.164,502.117) almost (0.164,502.117) all (0.164,502.117) the (0.164,502.117) code (0.164,502.117) nati (0.164,502.117) v (0.164,502.117) ely (0.164,502.117) . (0.164,502.117) Figure (0.164,502.117) 12 (0.164,502.117) breaks (0.164,502.117) do (0.164,502.117) wn (0.164,502.117) the (0.164,502.117) total (0.164,502.117) e (0.164,502.117) x (0.164,502.117) ecution (0.164,502.117) time (0.164,502.117) into (0.164,502.117) four (0.164,502.117) acti (0.164,502.117) v- (0.164,502.117) ities: (0.164,502.117) interpreting (0.164,502.117) bytecodes (0.164,502.117) while (0.164,502.117) not (0.164,502.117) recording, (0.164,502.117) recording (0.164,502.117) traces (0.164,502.117) (including (0.164,502.117) time (0.164,502.117) tak (0.164,502.117) en (0.164,502.117) to (0.164,502.117) interpret (0.164,502.117) the (0.164,502.117) recorded (0.164,502.117) trace), (0.164,502.117) compiling (0.164,502.117) traces (0.164,502.117) to (0.164,502.117) nati (0.164,502.117) v (0.164,502.117) e (0.164,502.117) code, (0.164,502.117) and (0.164,502.117) e (0.164,502.117) x (0.164,502.117) ecuting (0.164,502.117) nati (0.164,502.117) v (0.164,502.117) e (0.164,502.117) code (0.164,502.117) traces. (0.164,502.117) These (0.164,502.117) detailed (0.164,502.117) metrics (0.164,502.117) allo (0.164,502.117) w (0.164,502.117) us (0.164,502.117) to (0.164,502.117) estimate (0.164,502.117) parameters (0.164,502.117) for (0.164,502.117) a (0.164,502.117) simple (0.164,502.117) model (0.164,502.117) of (0.164,502.117) tracing (0.164,502.117) performance. (0.164,502.117) These (0.164,502.117) estimates (0.164,502.117) should (0.164,502.117) be (0.164,502.117) considered (0.164,502.117) v (0.164,502.117) ery (0.164,502.117) rough, (0.164,502.117) as (0.164,502.117) the (0.164,502.117) v (0.164,502.117) alues (0.164,502.117) observ (0.164,502.117) ed (0.164,502.117) on (0.164,502.117) the (0.164,502.117) indi (0.164,502.117) vidual (0.164,502.117) benchmarks (0.164,502.117) ha (0.164,502.117) v (0.164,502.117) e (0.164,502.117) lar (0.164,502.117) ge (0.164,502.117) standard (0.164,502.117) de (0.164,502.117) viations (0.164,502.117) (on (0.164,502.117) the (0.164,502.117) order (0.164,502.117) of (0.164,502.117) the (0.000,0.000) Loops (0.000,0.000) T (0.000,0.000) rees (0.000,0.000) T (0.000,0.000) races (0.000,0.000) Aborts (0.000,0.000) Flushes (0.000,0.000) T (0.000,0.000) re (0.000,0.000) es/Loop (0.000,0.000) T (0.000,0.000) races/T (0.000,0.000) ree (0.000,0.000) T (0.000,0.000) races/Loop (0.000,0.000) Speedup (0.199,479.234) 3d-cube (0.199,479.234) 25 (0.199,479.234) 27 (0.199,479.234) 29 (0.199,479.234) 3 (0.199,479.234) 0 (0.199,479.234) 1.1 (0.199,479.234) 1.1 (0.199,479.234) 1.2 (0.199,479.234) 2.20x (0.199,479.234) 3d-morph (0.199,479.234) 5 (0.199,479.234) 8 (0.199,479.234) 8 (0.199,479.234) 2 (0.199,479.234) 0 (0.199,479.234) 1.6 (0.199,479.234) 1.0 (0.199,479.234) 1.6 (0.199,479.234) 2.86x (0.199,479.234) 3d-raytrace (0.199,479.234) 10 (0.199,479.234) 25 (0.199,479.234) 100 (0.199,479.234) 10 (0.199,479.234) 1 (0.199,479.234) 2.5 (0.199,479.234) 4.0 (0.199,479.234) 10.0 (0.199,479.234) 1.18x (0.199,479.234) access-binary-trees (0.199,479.234) 0 (0.199,479.234) 0 (0.199,479.234) 0 (0.199,479.234) 5 (0.199,479.234) 0 (0.199,479.234) - (0.199,479.234) - (0.199,479.234) - (0.199,479.234) 0.93x (0.199,479.234) access-f (0.199,479.234) annkuch (0.199,479.234) 10 (0.199,479.234) 34 (0.199,479.234) 57 (0.199,479.234) 24 (0.199,479.234) 0 (0.199,479.234) 3.4 (0.199,479.234) 1.7 (0.199,479.234) 5.7 (0.199,479.234) 2.20x (0.199,479.234) access-nbody (0.199,479.234) 8 (0.199,479.234) 16 (0.199,479.234) 18 (0.199,479.234) 5 (0.199,479.234) 0 (0.199,479.234) 2.0 (0.199,479.234) 1.1 (0.199,479.234) 2.3 (0.199,479.234) 4.19x (0.199,479.234) access-nsie (0.199,479.234) v (0.199,479.234) e (0.199,479.234) 3 (0.199,479.234) 6 (0.199,479.234) 8 (0.199,479.234) 3 (0.199,479.234) 0 (0.199,479.234) 2.0 (0.199,479.234) 1.3 (0.199,479.234) 2.7 (0.199,479.234) 3.05x (0.199,479.234) bitops-3bit-bits-in-byte (0.199,479.234) 2 (0.199,479.234) 2 (0.199,479.234) 2 (0.199,479.234) 0 (0.199,479.234) 0 (0.199,479.234) 1.0 (0.199,479.234) 1.0 (0.199,479.234) 1.0 (0.199,479.234) 25.47x (0.199,479.234) bitops-bits-in-byte (0.199,479.234) 3 (0.199,479.234) 3 (0.199,479.234) 4 (0.199,479.234) 1 (0.199,479.234) 0 (0.199,479.234) 1.0 (0.199,479.234) 1.3 (0.199,479.234) 1.3 (0.199,479.234) 8.67x (0.199,479.234) bitops-bitwise-and (0.199,479.234) 1 (0.199,479.234) 1 (0.199,479.234) 1 (0.199,479.234) 0 (0.199,479.234) 0 (0.199,479.234) 1.0 (0.199,479.234) 1.0 (0.199,479.234) 1.0 (0.199,479.234) 25.20x (0.199,479.234) bitops-nsie (0.199,479.234) v (0.199,479.234) e-bits (0.199,479.234) 3 (0.199,479.234) 3 (0.199,479.234) 5 (0.199,479.234) 0 (0.199,479.234) 0 (0.199,479.234) 1.0 (0.199,479.234) 1.7 (0.199,479.234) 1.7 (0.199,479.234) 2.75x (0.199,479.234) controlflo (0.199,479.234) w-recursi (0.199,479.234) v (0.199,479.234) e (0.199,479.234) 0 (0.199,479.234) 0 (0.199,479.234) 0 (0.199,479.234) 1 (0.199,479.234) 0 (0.199,479.234) - (0.199,479.234) - (0.199,479.234) - (0.199,479.234) 0.98x (0.199,479.234) crypto-aes (0.199,479.234) 50 (0.199,479.234) 72 (0.199,479.234) 78 (0.199,479.234) 19 (0.199,479.234) 0 (0.199,479.234) 1.4 (0.199,479.234) 1.1 (0.199,479.234) 1.6 (0.199,479.234) 1.64x (0.199,479.234) crypto-md5 (0.199,479.234) 4 (0.199,479.234) 4 (0.199,479.234) 5 (0.199,479.234) 0 (0.199,479.234) 0 (0.199,479.234) 1.0 (0.199,479.234) 1.3 (0.199,479.234) 1.3 (0.199,479.234) 2.30x (0.199,479.234) crypto-sha1 (0.199,479.234) 5 (0.199,479.234) 5 (0.199,479.234) 10 (0.199,479.234) 0 (0.199,479.234) 0 (0.199,479.234) 1.0 (0.199,479.234) 2.0 (0.199,479.234) 2.0 (0.199,479.234) 5.95x (0.199,479.234) date-format-tofte (0.199,479.234) 3 (0.199,479.234) 3 (0.199,479.234) 4 (0.199,479.234) 7 (0.199,479.234) 0 (0.199,479.234) 1.0 (0.199,479.234) 1.3 (0.199,479.234) 1.3 (0.199,479.234) 1.07x (0.199,479.234) date-format-xparb (0.199,479.234) 3 (0.199,479.234) 3 (0.199,479.234) 11 (0.199,479.234) 3 (0.199,479.234) 0 (0.199,479.234) 1.0 (0.199,479.234) 3.7 (0.199,479.234) 3.7 (0.199,479.234) 0.98x (0.199,479.234) math-cordic (0.199,479.234) 2 (0.199,479.234) 4 (0.199,479.234) 5 (0.199,479.234) 1 (0.199,479.234) 0 (0.199,479.234) 2.0 (0.199,479.234) 1.3 (0.199,479.234) 2.5 (0.199,479.234) 4.92x (0.199,479.234) math-partial-sums (0.199,479.234) 2 (0.199,479.234) 4 (0.199,479.234) 4 (0.199,479.234) 1 (0.199,479.234) 0 (0.199,479.234) 2.0 (0.199,479.234) 1.0 (0.199,479.234) 2.0 (0.199,479.234) 5.90x (0.199,479.234) math-spectral-norm (0.199,479.234) 15 (0.199,479.234) 20 (0.199,479.234) 20 (0.199,479.234) 0 (0.199,479.234) 0 (0.199,479.234) 1.3 (0.199,479.234) 1.0 (0.199,479.234) 1.3 (0.199,479.234) 7.12x (0.199,479.234) re (0.199,479.234) ge (0.199,479.234) xp-dna (0.199,479.234) 2 (0.199,479.234) 2 (0.199,479.234) 2 (0.199,479.234) 0 (0.199,479.234) 0 (0.199,479.234) 1.0 (0.199,479.234) 1.0 (0.199,479.234) 1.0 (0.199,479.234) 4.21x (0.199,479.234) string-base64 (0.199,479.234) 3 (0.199,479.234) 5 (0.199,479.234) 7 (0.199,479.234) 0 (0.199,479.234) 0 (0.199,479.234) 1.7 (0.199,479.234) 1.4 (0.199,479.234) 2.3 (0.199,479.234) 2.53x (0.199,479.234) string-f (0.199,479.234) asta (0.199,479.234) 5 (0.199,479.234) 11 (0.199,479.234) 15 (0.199,479.234) 6 (0.199,479.234) 0 (0.199,479.234) 2.2 (0.199,479.234) 1.4 (0.199,479.234) 3.0 (0.199,479.234) 1.49x (0.199,479.234) string-tagcloud (0.199,479.234) 3 (0.199,479.234) 6 (0.199,479.234) 6 (0.199,479.234) 5 (0.199,479.234) 0 (0.199,479.234) 2.0 (0.199,479.234) 1.0 (0.199,479.234) 2.0 (0.199,479.234) 1.09x (0.199,479.234) string-unpack-code (0.199,479.234) 4 (0.199,479.234) 4 (0.199,479.234) 37 (0.199,479.234) 0 (0.199,479.234) 0 (0.199,479.234) 1.0 (0.199,479.234) 9.3 (0.199,479.234) 9.3 (0.199,479.234) 1.20x (0.199,479.234) string-v (0.199,479.234) alidate-input (0.199,479.234) 6 (0.199,479.234) 10 (0.199,479.234) 13 (0.199,479.234) 1 (0.199,479.234) 0 (0.199,479.234) 1.7 (0.199,479.234) 1.3 (0.199,479.234) 2.2 (0.199,479.234) 1.86x (0.164,502.117) Figur (0.164,502.117) e (0.164,502.117) 13. (0.164,502.117) Detailed (0.164,502.117) trace (0.164,502.117) recording (0.164,502.117) statistics (0.164,502.117) for (0.164,502.117) the (0.164,502.117) SunSpider (0.164,502.117) benchmark (0.164,502.117) set. (0.164,502.117) mean). (0.164,502.117) W (0.164,502.117) e (0.164,502.117) e (0.164,502.117) xclude (0.164,502.117) regexp-dna (0.164,502.117) from (0.164,502.117) the (0.164,502.117) follo (0.164,502.117) wing (0.164,502.117) calculations, (0.164,502.117) because (0.164,502.117) most (0.164,502.117) of (0.164,502.117) its (0.164,502.117) time (0.164,502.117) is (0.164,502.117) spent (0.164,502.117) in (0.164,502.117) the (0.164,502.117) r (0.164,502.117) e (0.164,502.117) gular (0.164,502.117) e (0.164,502.117) xpression (0.164,502.117) matcher (0.164,502.117) , (0.164,502.117) which (0.164,502.117) has (0.164,502.117) much (0.164,502.117) dif (0.164,502.117) ferent (0.164,502.117) performance (0.164,502.117) characteristics (0.164,502.117) from (0.164,502.117) the (0.164,502.117) other (0.164,502.117) programs. (0.164,502.117) (Note (0.164,502.117) that (0.164,502.117) this (0.164,502.117) only (0.164,502.117) mak (0.164,502.117) es (0.164,502.117) a (0.164,502.117) dif (0.164,502.117) ference (0.164,502.117) of (0.164,502.117) about (0.164,502.117) 10% (0.164,502.117) in (0.164,502.117) the (0.164,502.117) results.) (0.164,502.117) Di (0.164,502.117) viding (0.164,502.117) the (0.164,502.117) total (0.164,502.117) e (0.164,502.117) x (0.164,502.117) ecution (0.164,502.117) time (0.164,502.117) in (0.164,502.117) processor (0.164,502.117) clock (0.164,502.117) c (0.164,502.117) ycles (0.164,502.117) by (0.164,502.117) the (0.164,502.117) number (0.164,502.117) of (0.164,502.117) bytecodes (0.164,502.117) e (0.164,502.117) x (0.164,502.117) ecuted (0.164,502.117) in (0.164,502.117) the (0.164,502.117) base (0.164,502.117) interpreter (0.164,502.117) sho (0.164,502.117) ws (0.164,502.117) that (0.164,502.117) on (0.164,502.117) a (0.164,502.117) v (0.164,502.117) erage, (0.164,502.117) a (0.164,502.117) bytecode (0.164,502.117) e (0.164,502.117) x (0.164,502.117) ecute (0.164,502.117) s (0.164,502.117) in (0.164,502.117) about (0.164,502.117) 35 (0.164,502.117) c (0.164,502.117) ycles. (0.164,502.117) Nati (0.164,502.117) v (0.164,502.117) e (0.164,502.117) traces (0.164,502.117) tak (0.164,502.117) e (0.164,502.117) about (0.164,502.117) 9 (0.164,502.117) c (0.164,502.117) ycle (0.164,502.117) s (0.164,502.117) per (0.164,502.117) bytecode, (0.164,502.117) a (0.164,502.117) 3.9x (0.164,502.117) speedup (0.164,502.117) o (0.164,502.117) v (0.164,502.117) er (0.164,502.117) the (0.164,502.117) interpreter (0.164,502.117) . (0.164,502.117) Using (0.164,502.117) similar (0.164,502.117) computations, (0.164,502.117) we (0.164,502.117) find (0.164,502.117) that (0.164,502.117) trace (0.164,502.117) recording (0.164,502.117) tak (0.164,502.117) es (0.164,502.117) about (0.164,502.117) 3800 (0.164,502.117) c (0.164,502.117) ycles (0.164,502.117) per (0.164,502.117) bytecode, (0.164,502.117) and (0.164,502.117) compilation (0.164,502.117) 3150 (0.164,502.117) c (0.164,502.117) ycles (0.164,502.117) per (0.164,502.117) bytecode. (0.164,502.117) Hence, (0.164,502.117) during (0.164,502.117) recording (0.164,502.117) and (0.164,502.117) compiling (0.164,502.117) the (0.164,502.117) VM (0.164,502.117) runs (0.164,502.117) at (0.164,502.117) 1/200 (0.164,502.117) the (0.164,502.117) s (0.164,502.117) peed (0.164,502.117) of (0.164,502.117) the (0.164,502.117) interpreter (0.164,502.117) . (0.164,502.117) Because (0.164,502.117) it (0.164,502.117) costs (0.164,502.117) 6950 (0.164,502.117) c (0.164,502.117) ycles (0.164,502.117) to (0.164,502.117) compile (0.164,502.117) a (0.164,502.117) bytecode, (0.164,502.117) and (0.164,502.117) we (0.164,502.117) sa (0.164,502.117) v (0.164,502.117) e (0.164,502.117) 26 (0.164,502.117) c (0.164,502.117) ycles (0.164,502.117) each (0.164,502.117) time (0.164,502.117) that (0.164,502.117) code (0.164,502.117) is (0.164,502.117) run (0.164,502.117) nati (0.164,502.117) v (0.164,502.117) ely (0.164,502.117) , (0.164,502.117) we (0.164,502.117) break (0.164,502.117) e (0.164,502.117) v (0.164,502.117) en (0.164,502.117) after (0.164,502.117) running (0.164,502.117) a (0.164,502.117) trace (0.164,502.117) 270 (0.164,502.117) times. (0.164,502.117) The (0.164,502.117) other (0.164,502.117) VMs (0.164,502.117) we (0.164,502.117) compared (0.164,502.117) with (0.164,502.117) achie (0.164,502.117) v (0.164,502.117) e (0.164,502.117) an (0.164,502.117) o (0.164,502.117) v (0.164,502.117) erall (0.164,502.117) speedup (0.164,502.117) of (0.164,502.117) 3.0x (0.164,502.117) relati (0.164,502.117) v (0.164,502.117) e (0.164,502.117) to (0.164,502.117) our (0.164,502.117) baseline (0.164,502.117) interpreter (0.164,502.117) . (0.164,502.117) Our (0.164,502.117) estimated (0.164,502.117) nati (0.164,502.117) v (0.164,502.117) e (0.164,502.117) code (0.164,502.117) speedup (0.164,502.117) of (0.164,502.117) 3.9x (0.164,502.117) is (0.164,502.117) significantly (0.164,502.117) better (0.164,502.117) . (0.164,502.117) This (0.164,502.117) suggests (0.164,502.117) that (0.164,502.117) our (0.164,502.117) compilation (0.164,502.117) techniques (0.164,502.117) can (0.164,502.117) generate (0.164,502.117) more (0.164,502.117) ef (0.164,502.117) fi (0.164,502.117) cient (0.164,502.117) nati (0.164,502.117) v (0.164,502.117) e (0.164,502.117) code (0.164,502.117) than (0.164,502.117) an (0.164,502.117) y (0.164,502.117) other (0.164,502.117) current (0.164,502.117) Ja (0.164,502.117) v (0.164,502.117) aScript (0.164,502.117) VM. (0.164,502.117) These (0.164,502.117) estimates (0.164,502.117) also (0.164,502.117) indicate (0.164,502.117) that (0.164,502.117) our (0.164,502.117) startup (0.164,502.117) performance (0.164,502.117) could (0.164,502.117) be (0.164,502.117) substantially (0.164,502.117) better (0.164,502.117) if (0.164,502.117) we (0.164,502.117) impro (0.164,502.117) v (0.164,502.117) ed (0.164,502.117) the (0.164,502.117) speed (0.164,502.117) of (0.164,502.117) trace (0.164,502.117) recording (0.164,502.117) and (0.164,502.117) compilation. (0.164,502.117) The (0.164,502.117) estimated (0.164,502.117) 200x (0.164,502.117) slo (0.164,502.117) wdo (0.164,502.117) wn (0.164,502.117) for (0.164,502.117) recording (0.164,502.117) and (0.164,502.117) compilation (0.164,502.117) is (0.164,502.117) v (0.164,502.117) e (0.164,502.117) ry (0.164,502.117) rough, (0.164,502.117) and (0.164,502.117) may (0.164,502.117) be (0.164,502.117) influenced (0.164,502.117) by (0.164,502.117) startup (0.164,502.117) f (0.164,502.117) actors (0.164,502.117) in (0.164,502.117) the (0.164,502.117) interpreter (0.164,502.117) (e.g., (0.164,502.117) caches (0.164,502.117) that (0.164,502.117) ha (0.164,502.117) v (0.164,502.117) e (0.164,502.117) not (0.164,502.117) w (0.164,502.117) armed (0.164,502.117) up (0.164,502.117) yet (0.164,502.117) during (0.164,502.117) recording). (0.164,502.117) One (0.164,502.117) observ (0.164,502.117) ation (0.164,502.117) supporting (0.164,502.117) this (0.164,502.117) conjecture (0.164,502.117) is (0.164,502.117) that (0.164,502.117) in (0.164,502.117) the (0.164,502.117) tracer (0.164,502.117) , (0.164,502.117) interpreted (0.164,502.117) bytecodes (0.164,502.117) tak (0.164,502.117) e (0.164,502.117) about (0.164,502.117) 180 (0.164,502.117) c (0.164,502.117) ycles (0.164,502.117) to (0.164,502.117) run. (0.164,502.117) Still, (0.164,502.117) recording (0.164,502.117) and (0.164,502.117) compilation (0.164,502.117) are (0.164,502.117) clearly (0.164,502.117) both (0.164,502.117) e (0.164,502.117) xpensi (0.164,502.117) v (0.164,502.117) e, (0.164,502.117) and (0.164,502.117) a (0.164,502.117) better (0.164,502.117) implementation, (0.164,502.117) possibly (0.164,502.117) including (0.164,502.117) redesign (0.164,502.117) of (0.164,502.117) the (0.164,502.117) LIR (0.164,502.117) abstract (0.164,502.117) syntax (0.164,502.117) or (0.164,502.117) encoding, (0.164,502.117) w (0.164,502.117) ould (0.164,502.117) impro (0.164,502.117) v (0.164,502.117) e (0.164,502.117) startup (0.164,502.117) performance. (0.164,502.117) Our (0.164,502.117) performance (0.164,502.117) results (0.164,502.117) confirm (0.164,502.117) that (0.164,502.117) type (0.164,502.117) specialization (0.164,502.117) using (0.164,502.117) trace (0.164,502.117) trees (0.164,502.117) substantially (0.164,502.117) impro (0.164,502.117) v (0.164,502.117) es (0.164,502.117) performance. (0.164,502.117) W (0.164,502.117) e (0.164,502.117) are (0.164,502.117) able (0.164,502.117) to (0.164,502.117) outperform (0.164,502.117) the (0.164,502.117) f (0.164,502.117) astest (0.164,502.117) a (0.164,502.117) v (0.164,502.117) ailable (0.164,502.117) Ja (0.164,502.117) v (0.164,502.117) aScript (0.164,502.117) com (0.164,502.117) piler (0.164,502.117) (V8) (0.164,502.117) and (0.164,502.117) the (0.164,502.117) f (0.164,502.117) astest (0.164,502.117) a (0.164,502.117) v (0.164,502.117) ailable (0.164,502.117) Ja (0.164,502.117) v (0.164,502.117) aScript (0.164,502.117) inline (0.164,502.117) threaded (0.164,502.117) interpret (0.164,502.117) er (0.164,502.117) (SFX) (0.164,502.117) on (0.164,502.117) 9 (0.164,502.117) of (0.164,502.117) 26 (0.164,502.117) benchmarks. (0.164,502.117) 8. (0.164,502.117) Related (0.164,502.117) W (0.164,502.117) ork (0.164,502.117) T (0.164,502.117) race (0.164,502.117) optimization (0.164,502.117) f (0.164,502.117) or (0.164,502.117) dynamic (0.164,502.117) languages. (0.164,502.117) The (0.164,502.117) closest (0.164,502.117) area (0.164,502.117) of (0.164,502.117) related (0.164,502.117) w (0.164,502.117) ork (0.164,502.117) is (0.164,502.117) on (0.164,502.117) applying (0.164,502.117) trace (0.164,502.117) optimization (0.164,502.117) to (0.164,502.117) type-specialize (0.164,502.117) dynamic (0.164,502.117) languages. (0.164,502.117) Existing (0.164,502.117) w (0.164,502.117) ork (0.164,502.117) shares (0.164,502.117) the (0.164,502.117) idea (0.164,502.117) of (0.164,502.117) generating (0.164,502.117) type-specialized (0.164,502.117) code (0.164,502.117) speculat (0.164,502.117) i (0.164,502.117) v (0.164,502.117) ely (0.164,502.117) with (0.164,502.117) guards (0.164,502.117) along (0.164,502.117) interpreter (0.164,502.117) traces. (0.164,502.117) T (0.164,502.117) o (0.164,502.117) our (0.164,502.117) kno (0.164,502.117) wledge, (0.164,502.117) Rigo’ (0.164,502.117) s (0.164,502.117) Psyco (0.164,502.117) (16) (0.164,502.117) is (0.164,502.117) the (0.164,502.117) only (0.164,502.117) published (0.164,502.117) type-specializing (0.164,502.117) trace (0.164,502.117) compiler (0.164,502.117) for (0.164,502.117) a (0.164,502.117) dynamic (0.164,502.117) language (0.164,502.117) (Python). (0.164,502.117) Psyco (0.164,502.117) does (0.164,502.117) not (0.164,502.117) attempt (0.164,502.117) to (0.164,502.117) identify (0.164,502.117) hot (0.164,502.117) loops (0.164,502.117) or (0.164,502.117) inl (0.164,502.117) ine (0.164,502.117) function (0.164,502.117) calls. (0.164,502.117) Instead, (0.164,502.117) Psyco (0.164,502.117) transforms (0.164,502.117) loops (0.164,502.117) to (0.164,502.117) mutual (0.164,502.117) recursion (0.164,502.117) before (0.164,502.117) running (0.164,502.117) and (0.164,502.117) traces (0.164,502.117) all (0.164,502.117) operations. (0.164,502.117) P (0.164,502.117) all’ (0.164,502.117) s (0.164,502.117) LuaJIT (0.164,502.117) is (0.164,502.117) a (0.164,502.117) Lua (0.164,502.117) VM (0.164,502.117) in (0.164,502.117) de (0.164,502.117) v (0.164,502.117) elopment (0.164,502.117) that (0.164,502.117) uses (0.164,502.117) tra (0.164,502.117) ce (0.164,502.117) com- (0.164,502.117) pilation (0.164,502.117) ideas. (0.164,502.117) (1). (0.164,502.117) There (0.164,502.117) are (0.164,502.117) no (0.164,502.117) publications (0.164,502.117) on (0.164,502.117) LuaJIT (0.164,502.117) b (0.164,502.117) ut (0.164,502.117) the (0.164,502.117) cre- (0.164,502.117) ator (0.164,502.117) has (0.164,502.117) told (0.164,502.117) us (0.164,502.117) that (0.164,502.117) LuaJIT (0.164,502.117) has (0.164,502.117) a (0.164,502.117) similar (0.164,502.117) design (0.164,502.117) to (0.164,502.117) our (0.164,502.117) system, (0.164,502.117) b (0.164,502.117) ut (0.164,502.117) will (0.164,502.117) use (0.164,502.117) a (0.164,502.117) less (0.164,502.117) aggressi (0.164,502.117) v (0.164,502.117) e (0.164,502.117) type (0.164,502.117) speculation (0.164,502.117) (e.g., (0.164,502.117) using (0.164,502.117) a (0.164,502.117) floating- (0.164,502.117) point (0.164,502.117) representation (0.164,502.117) for (0.164,502.117) all (0.164,502.117) number (0.164,502.117) v (0.164,502.117) alues) (0.164,502.117) and (0.164,502.117) does (0.164,502.117) not (0.164,502.117) generate (0.164,502.117) nested (0.164,502.117) traces (0.164,502.117) for (0.164,502.117) nested (0.164,502.117) loops. (0.164,502.117) General (0.164,502.117) trace (0.164,502.117) optimization. (0.164,502.117) General (0.164,502.117) trace (0.164,502.117) optimization (0.164,502.117) has (0.164,502.117) a (0.164,502.117) longer (0.164,502.117) history (0.164,502.117) that (0.164,502.117) has (0.164,502.117) treated (0.164,502.117) mostly (0.164,502.117) nati (0.164,502.117) v (0.164,502.117) e (0.164,502.117) code (0.164,502.117) and (0.164,502.117) typed (0.164,502.117) languages (0.164,502.117) lik (0.164,502.117) e (0.164,502.117) Ja (0.164,502.117) v (0.164,502.117) a. (0.164,502.117) Thus, (0.164,502.117) these (0.164,502.117) systems (0.164,502.117) ha (0.164,502.117) v (0.164,502.117) e (0.164,502.117) focused (0.164,502.117) less (0.164,502.117) on (0.164,502.117) type (0.164,502.117) specialization (0.164,502.117) and (0.164,502.117) more (0.164,502.117) on (0.164,502.117) other (0.164,502.117) optimizations. (0.164,502.117) Dynamo (0.164,502.117) (7) (0.164,502.117) by (0.164,502.117) Bala (0.164,502.117) et (0.164,502.117) al, (0.164,502.117) introduced (0.164,502.117) nati (0.164,502.117) v (0.164,502.117) e (0.164,502.117) code (0.164,502.117) tracing (0.164,502.117) as (0.164,502.117) a (0.164,502.117) replacement (0.164,502.117) for (0.164,502.117) profile-guided (0.164,502.117) optimization (0.164,502.117) (PGO). (0.164,502.117) A (0.164,502.117) major (0.164,502.117) goal (0.164,502.117) w (0.164,502.117) as (0.164,502.117) to (0.164,502.117) perform (0.164,502.117) PGO (0.164,502.117) online (0.164,502.117) so (0.164,502.117) that (0.164,502.117) the (0.164,502.117) profile (0.164,502.117) w (0.164,502.117) as (0.164,502.117) specific (0.164,502.117) to (0.164,502.117) the (0.164,502.117) current (0.164,502.117) e (0.164,502.117) x (0.164,502.117) ecution. (0.164,502.117) Dynamo (0.164,502.117) used (0.164,502.117) loop (0.164,502.117) headers (0.164,502.117) as (0.164,502.117) candidate (0.164,502.117) hot (0.164,502.117) traces, (0.164,502.117) b (0.164,502.117) ut (0.164,502.117) did (0.164,502.117) not (0.164,502.117) try (0.164,502.117) to (0.164,502.117) create (0.164,502.117) loop (0.164,502.117) traces (0.164,502.117) specifically (0.164,502.117) . (0.164,502.117) T (0.164,502.117) race (0.164,502.117) trees (0.164,502.117) were (0.164,502.117) originally (0.164,502.117) proposed (0.164,502.117) by (0.164,502.117) Gal (0.164,502.117) et (0.164,502.117) al. (0.164,502.117) (11) (0.164,502.117) in (0.164,502.117) the (0.164,502.117) conte (0.164,502.117) xt (0.164,502.117) of (0.164,502.117) Ja (0.164,502.117) v (0.164,502.117) a, (0.164,502.117) a (0.164,502.117) statically (0.164,502.117) typed (0.164,502.117) language. (0.164,502.117) Their (0.164,502.117) trace (0.164,502.117) trees (0.164,502.117) ac- (0.164,502.117) tually (0.164,502.117) inlined (0.164,502.117) parts (0.164,502.117) of (0.164,502.117) outer (0.164,502.117) loops (0.164,502.117) within (0.164,502.117) the (0.164,502.117) inner (0.164,502.117) loops (0.164,502.117) (because (0.164,239.103) Figur (0.164,239.103) e (0.164,239.103) 12. (0.164,239.103) Fraction (0.164,239.103) of (0.164,239.103) time (0.164,239.103) spent (0.164,239.103) on (0.164,239.103) major (0.164,239.103) VM (0.164,239.103) acti (0.164,239.103) vities. (0.164,239.103) The (0.164,239.103) speedup (0.164,239.103) vs. (0.164,239.103) interpreter (0.164,239.103) is (0.164,239.103) sho (0.164,239.103) wn (0.164,239.103) in (0.164,239.103) parentheses (0.164,239.103) ne (0.164,239.103) xt (0.164,239.103) to (0.164,239.103) each (0.164,239.103) test. (0.164,239.103) Most (0.164,239.103) programs (0.164,239.103) where (0.164,239.103) the (0.164,239.103) VM (0.164,239.103) spends (0.164,239.103) the (0.164,239.103) majority (0.164,239.103) of (0.164,239.103) its (0.164,239.103) time (0.164,239.103) run- (0.164,239.103) ning (0.164,239.103) nati (0.164,239.103) v (0.164,239.103) e (0.164,239.103) code (0.164,239.103) ha (0.164,239.103) v (0.164,239.103) e (0.164,239.103) a (0.164,239.103) good (0.164,239.103) speedup. (0.164,239.103) Recording (0.164,239.103) and (0.164,239.103) compilation (0.164,239.103) costs (0.164,239.103) can (0.164,239.103) be (0.164,239.103) substantial; (0.164,239.103) speeding (0.164,239.103) up (0.164,239.103) those (0.164,239.103) parts (0.164,239.103) of (0.164,239.103) the (0.164,239.103) implemen- (0.164,239.103) tation (0.164,239.103) w (0.164,239.103) ould (0.164,239.103) impro (0.164,239.103) v (0.164,239.103) e (0.164,239.103) SunSpider (0.164,239.103) performance. (0.164,239.103) inner (0.164,239.103) loops (0.164,239.103) become (0.164,239.103) hot (0.164,239.103) first), (0.164,239.103) leading (0.164,239.103) to (0.164,239.103) much (0.164,239.103) greater (0.164,239.103) tail (0.164,239.103) duplica- (0.164,239.103) tion. (0.164,239.103) YETI, (0.164,239.103) from (0.164,239.103) Zaleski (0.164,239.103) et (0.164,239.103) al. (0.164,239.103) (19) (0.164,239.103) applied (0.164,239.103) Dynamo-style (0.164,239.103) tracing (0.164,239.103) to (0.164,239.103) Ja (0.164,239.103) v (0.164,239.103) a (0.164,239.103) in (0.164,239.103) order (0.164,239.103) to (0.164,239.103) achie (0.164,239.103) v (0.164,239.103) e (0.164,239.103) inli (0.164,239.103) ning, (0.164,239.103) indirect (0.164,239.103) jump (0.164,239.103) elimination, (0.164,239.103) and (0.164,239.103) other (0.164,239.103) optimizations. (0.164,239.103) Their (0.164,239.103) primary (0.164,239.103) focus (0.164,239.103) w (0.164,239.103) as (0.164,239.103) on (0.164,239.103) designing (0.164,239.103) an (0.164,239.103) interpreter (0.164,239.103) that (0.164,239.103) could (0.164,239.103) easily (0.164,239.103) be (0.164,239.103) gradually (0.164,239.103) re-engineered (0.164,239.103) as (0.164,239.103) a (0.164,239.103) tracing (0.164,239.103) VM. (0.164,239.103) Sug (0.164,239.103) anuma (0.164,239.103) et (0.164,239.103) al. (0.164,239.103) (18) (0.164,239.103) described (0.164,239.103) re (0.164,239.103) gion-based (0.164,239.103) compilation (0.164,239.103) (RBC), (0.164,239.103) a (0.164,239.103) relati (0.164,239.103) v (0.164,239.103) e (0.164,239.103) of (0.164,239.103) tracing. (0.164,239.103) A (0.164,239.103) re (0.164,239.103) gion (0.164,239.103) is (0.164,239.103) an (0.164,239.103) subprogram (0.164,239.103) w (0.164,239.103) orth (0.164,239.103) optimizing (0.164,239.103) that (0.164,239.103) can (0.164,239.103) include (0.164,239.103) subsets (0.164,239.103) of (0.164,239.103) an (0.164,239.103) y (0.164,239.103) number (0.164,239.103) of (0.164,239.103) methods. (0.164,239.103) Thus, (0.164,239.103) the (0.164,239.103) com- (0.164,239.103) piler (0.164,239.103) has (0.164,239.103) more (0.164,239.103) fle (0.164,239.103) xibility (0.164,239.103) and (0.164,239.103) can (0.164,239.103) potentially (0.164,239.103) generate (0.164,239.103) better (0.164,239.103) code, (0.164,239.103) b (0.164,239.103) ut (0.164,239.103) the (0.164,239.103) profiling (0.164,239.103) and (0.164,239.103) compilation (0.164,239.103) systems (0.164,239.103) are (0.164,239.103) correspondingly (0.164,239.103) more (0.164,239.103) comple (0.164,239.103) x. (0.164,239.103) T (0.164,239.103) ype (0.164,239.103) specialization (0.164,239.103) f (0.164,239.103) or (0.164,239.103) dynamic (0.164,239.103) languages. (0.164,239.103) Dynamic (0.164,239.103) lan- (0.164,239.103) guage (0.164,239.103) implementors (0.164,239.103) ha (0.164,239.103) v (0.164,239.103) e (0.164,239.103) long (0.164,239.103) recognized (0.164,239.103) the (0.164,239.103) im (0.164,239.103) portance (0.164,239.103) of (0.164,239.103) type (0.164,239.103) specialization (0.164,239.103) for (0.164,239.103) performance. (0.164,239.103) Most (0.164,239.103) pre (0.164,239.103) vious (0.164,239.103) w (0.164,239.103) ork (0.164,239.103) has (0.164,239.103) focused (0.164,239.103) on (0.164,239.103) methods (0.164,239.103) instead (0.164,239.103) of (0.164,239.103) traces. (0.164,239.103) Chambers (0.164,239.103) et. (0.164,239.103) al (0.164,239.103) (9) (0.164,239.103) pioneered (0.164,239.103) the (0.164,239.103) idea (0.164,239.103) of (0.164,239.103) compiling (0.164,239.103) multiple (0.164,239.103) v (0.164,239.103) ersions (0.164,239.103) of (0.164,239.103) a (0.164,239.103) procedure (0.164,239.103) specialized (0.164,239.103) for (0.164,239.103) the (0.164,239.103) input (0.164,239.103) types (0.164,239.103) in (0.164,239.103) the (0.164,239.103) lan- (0.164,239.103) guage (0.164,239.103) Self. (0.164,239.103) In (0.164,239.103) one (0.164,239.103) implementation, (0.164,239.103) the (0.164,239.103) y (0.164,239.103) generated (0.164,239.103) a (0.164,239.103) specialized (0.164,239.103) method (0.164,239.103) online (0.164,239.103) each (0.164,239.103) time (0.164,239.103) a (0.164,239.103) method (0.164,239.103) w (0.164,239.103) as (0.164,239.103) called (0.164,239.103) with (0.164,239.103) ne (0.164,239.103) w (0.164,239.103) input (0.164,239.103) types. (0.164,239.103) In (0.164,239.103) another (0.164,239.103) , (0.164,239.103) the (0.164,239.103) y (0.164,239.103) used (0.164,239.103) an (0.164,239.103) of (0.164,239.103) fline (0.164,239.103) whole-program (0.164,239.103) static (0.164,239.103) analysis (0.164,239.103) to (0.164,239.103) infer (0.164,239.103) input (0.164,239.103) types (0.164,239.103) and (0.164,239.103) constant (0.164,239.103) recei (0.164,239.103) v (0.164,239.103) er (0.164,239.103) types (0.164,239.103) at (0.164,239.103) call (0.164,239.103) sites. (0.164,239.103) Interest- (0.164,239.103) ingly (0.164,239.103) , (0.164,239.103) the (0.164,239.103) tw (0.164,239.103) o (0.164,239.103) techniques (0.164,239.103) produced (0.164,239.103) nearly (0.164,239.103) the (0.164,239.103) same (0.164,239.103) performance. (0.164,239.103) Salib (0.164,239.103) (17) (0.164,239.103) designed (0.164,239.103) a (0.164,239.103) type (0.164,239.103) inference (0.164,239.103) algorithm (0.164,239.103) for (0.164,239.103) Python (0.164,239.103) based (0.164,239.103) on (0.164,239.103) the (0.164,239.103) Cartesian (0.164,239.103) Produc (0.164,239.103) t (0.164,239.103) Algorithm (0.164,239.103) and (0.164,239.103) used (0.164,239.103) the (0.164,239.103) results (0.164,239.103) to (0.164,239.103) special- (0.164,239.103) ize (0.164,239.103) on (0.164,239.103) types (0.164,239.103) and (0.164,239.103) translate (0.164,239.103) the (0.164,239.103) program (0.164,239.103) to (0.164,239.103) C++. (0.164,239.103) McClosk (0.164,239.103) e (0.164,239.103) y (0.164,239.103) (14) (0.164,239.103) has (0.164,239.103) w (0.164,239.103) ork (0.164,239.103) in (0.164,239.103) progress (0.164,239.103) based (0.164,239.103) on (0.164,239.103) a (0.164,239.103) language- (0.164,239.103) independent (0.164,239.103) t (0.164,239.103) ype (0.164,239.103) inference (0.164,239.103) that (0.164,239.103) is (0.164,239.103) used (0.164,239.103) to (0.164,239.103) generate (0.164,239.103) ef (0.164,239.103) ficient (0.164,239.103) C (0.164,239.103) implementations (0.164,239.103) of (0.164,239.103) Ja (0.164,239.103) v (0.164,239.103) aScript (0.164,239.103) and (0.164,239.103) Python (0.164,239.103) programs. (0.164,239.103) Nati (0.164,239.103) v (0.164,239.103) e (0.164,239.103) code (0.164,239.103) generation (0.164,239.103) by (0.164,239.103) inter (0.164,239.103) pr (0.164,239.103) eters. (0.164,239.103) The (0.164,239.103) traditional (0.164,239.103) inter (0.164,239.103) - (0.164,239.103) preter (0.164,239.103) design (0.164,239.103) is (0.164,239.103) a (0.164,239.103) virtual (0.164,239.103) machine (0.164,239.103) that (0.164,239.103) directly (0.164,239.103) e (0.164,239.103) x (0.164,239.103) ecutes (0.164,239.103) ASTs (0.164,239.103) or (0.164,239.103) machine-code-lik (0.164,239.103) e (0.164,239.103) bytecodes. (0.164,239.103) Researchers (0.164,239.103) ha (0.164,239.103) v (0.164,239.103) e (0.164,239.103) sho (0.164,239.103) wn (0.164,239.103) ho (0.164,239.103) w (0.164,239.103) to (0.164,239.103) gen- (0.164,239.103) erate (0.164,239.103) nati (0.164,239.103) v (0.164,239.103) e (0.164,239.103) code (0.164,239.103) with (0.164,239.103) nearly (0.164,239.103) the (0.164,239.103) same (0.164,239.103) structure (0.164,239.103) b (0.164,239.103) ut (0.164,239.103) better (0.164,239.103) perfor (0.164,239.103) - (0.164,239.103) mance. (0.164,239.103) Call (0.164,239.103) threading, (0.164,239.103) also (0.164,239.103) kno (0.164,239.103) wn (0.164,239.103) as (0.164,239.103) conte (0.164,239.103) xt (0.164,239.103) threading (0.164,239.103) (8), (0.164,239.103) compiles (0.164,239.103) methods (0.164,239.103) by (0.164,239.103) generating (0.164,239.103) a (0.164,239.103) nati (0.164,239.103) v (0.164,239.103) e (0.164,239.103) call (0.164,239.103) instruction (0.164,239.103) to (0.164,239.103) an (0.164,239.103) interpreter (0.164,239.103) method (0.164,239.103) for (0.164,239.103) each (0.164,239.103) interpreter (0.164,239.103) bytecode. (0.164,239.103) A (0.164,239.103) call-return (0.164,239.103) pair (0.164,239.103) has (0.164,239.103) been (0.164,239.103) sho (0.164,239.103) wn (0.164,239.103) to (0.164,239.103) be (0.164,239.103) a (0.164,239.103) potentially (0.164,239.103) much (0.164,239.103) more (0.164,239.103) e (0.164,239.103) f (0.164,239.103) ficient (0.164,239.103) dispatch (0.164,239.103) mechanism (0.164,239.103) than (0.164,239.103) the (0.164,239.103) indirect (0.164,239.103) jumps (0.164,239.103) used (0.164,239.103) in (0.164,239.103) standard (0.164,239.103) bytecode (0.164,239.103) interpreters. (0.164,239.103) Inline (0.164,239.103) threading (0.164,239.103) (15) (0.164,239.103) copies (0.164,239.103) chunks (0.164,239.103) of (0.164,239.103) interpre (0.164,239.103) ter (0.164,239.103) nati (0.164,239.103) v (0.164,239.103) e (0.164,239.103) code (0.164,239.103) which (0.164,239.103) implement (0.164,239.103) the (0.164,239.103) required (0.164,239.103) bytecodes (0.164,239.103) into (0.164,239.103) a (0.164,239.103) nati (0.164,239.103) v (0.164,239.103) e (0.164,239.103) code (0.164,239.103) cache, (0.164,239.103) thus (0.164,239.103) acting (0.164,239.103) as (0.164,239.103) a (0.164,239.103) simple (0.164,239.103) per (0.164,239.103) -method (0.164,239.103) JIT (0.164,239.103) compi (0.164,239.103) ler (0.164,239.103) that (0.164,239.103) eliminates (0.164,239.103) the (0.164,239.103) dispatch (0.164,239.103) o (0.164,239.103) v (0.164,239.103) erhead. (0.164,239.103) Neither (0.164,239.103) call (0.164,239.103) threading (0.164,239.103) nor (0.164,239.103) inline (0.164,239.103) threading (0.164,239.103) perform (0.164,239.103) type (0.164,239.103) special- (0.164,239.103) ization. (0.164,239.103) Apple’ (0.164,239.103) s (0.164,239.103) SquirrelFish (0.164,239.103) Extreme (0.164,239.103) (5) (0.164,239.103) is (0.164,239.103) a (0.164,239.103) Ja (0.164,239.103) v (0.164,239.103) aScript (0.164,239.103) implementa- (0.164,239.103) tion (0.164,239.103) based (0.164,239.103) on (0.164,239.103) call (0.164,239.103) threading (0.164,239.103) with (0.164,239.103) selecti (0.164,239.103) v (0.164,239.103) e (0.164,239.103) inline (0.164,239.103) threading. (0.164,239.103) Com- (0.164,239.103) bined (0.164,239.103) with (0.164,239.103) ef (0.164,239.103) ficient (0.164,239.103) interpreter (0.164,239.103) engineering, (0.164,239.103) these (0.164,239.103) threading (0.164,239.103) tech- (0.164,239.103) niques (0.164,239.103) ha (0.164,239.103) v (0.164,239.103) e (0.164,239.103) gi (0.164,239.103) v (0.164,239.103) en (0.164,239.103) SFX (0.164,239.103) e (0.164,239.103) xcellent (0.164,239.103) performance (0.164,239.103) on (0.164,239.103) the (0.164,239.103) standard (0.164,239.103) Sun- (0.164,239.103) Spider (0.164,239.103) benchmarks. (0.164,239.103) Google’ (0.164,239.103) s (0.164,239.103) V8 (0.164,239.103) is (0.164,239.103) a (0.164,239.103) Ja (0.164,239.103) v (0.164,239.103) aScript (0.164,239.103) implementation (0.164,239.103) primarily (0.164,239.103) based (0.164,239.103) on (0.164,239.103) inline (0.164,239.103) threading, (0.164,239.103) with (0.164,239.103) call (0.164,239.103) threading (0.164,239.103) only (0.164,239.103) for (0.164,239.103) v (0.164,239.103) ery (0.164,239.103) comple (0.164,239.103) x (0.164,239.103) operations. (0.164,239.103) 9. (0.164,239.103) Conclusions (0.164,239.103) This (0.164,239.103) paper (0.164,239.103) described (0.164,239.103) ho (0.164,239.103) w (0.164,239.103) to (0.164,239.103) run (0.164,239.103) dynamic (0.164,239.103) languages (0.164,239.103) ef (0.164,239.103) ficiently (0.164,239.103) by (0.164,239.103) recording (0.164,239.103) hot (0.164,239.103) traces (0.164,239.103) and (0.164,239.103) generating (0.164,239.103) type-specialized (0.164,239.103) nati (0.164,239.103) v (0.164,239.103) e (0.164,239.103) code. (0.164,239.103) Our (0.164,239.103) technique (0.164,239.103) focuses (0.164,239.103) on (0.164,239.103) aggressi (0.164,239.103) v (0.164,239.103) ely (0.164,239.103) inlined (0.164,239.103) loops, (0.164,239.103) and (0.164,239.103) for (0.164,239.103) each (0.164,239.103) loop, (0.164,239.103) it (0.164,239.103) generates (0.164,239.103) a (0.164,239.103) tree (0.164,239.103) of (0.164,239.103) nati (0.164,239.103) v (0.164,239.103) e (0.164,239.103) code (0.164,239.103) traces (0.164,239.103) represe (0.164,239.103) nting (0.164,239.103) the (0.164,239.103) paths (0.164,239.103) and (0.164,239.103) v (0.164,239.103) alue (0.164,239.103) types (0.164,239.103) through (0.164,239.103) the (0.164,239.103) loop (0.164,239.103) observ (0.164,239.103) ed (0.164,239.103) at (0.164,239.103) run (0.164,239.103) time. (0.164,239.103) W (0.164,239.103) e (0.164,239.103) e (0.164,239.103) xplained (0.164,239.103) ho (0.164,239.103) w (0.164,239.103) to (0.164,239.103) identify (0.164,239.103) loop (0.164,239.103) nesting (0.164,239.103) relationships (0.164,239.103) and (0.164,239.103) generate (0.164,239.103) nested (0.164,239.103) traces (0.164,239.103) in (0.164,239.103) order (0.164,239.103) to (0.164,239.103) a (0.164,239.103) v (0.164,239.103) oid (0.164,239.103) e (0.164,239.103) xcessi (0.164,239.103) v (0.164,239.103) e (0.164,239.103) code (0.164,239.103) duplication (0.164,239.103) due (0.164,239.103) to (0.164,239.103) the (0.164,239.103) man (0.164,239.103) y (0.164,239.103) paths (0.164,239.103) through (0.164,239.103) a (0.164,239.103) loop (0.164,239.103) nest. (0.164,239.103) W (0.164,239.103) e (0.164,239.103) described (0.164,239.103) our (0.164,239.103) type (0.164,239.103) specialization (0.164,239.103) algorithm. (0.164,239.103) W (0.164,239.103) e (0.164,239.103) also (0.164,239.103) des (0.164,239.103) cribed (0.164,239.103) our (0.164,239.103) trace (0.164,239.103) compiler (0.164,239.103) , (0.164,239.103) which (0.164,239.103) translates (0.164,239.103) a (0.164,239.103) trace (0.164,239.103) from (0.164,239.103) an (0.164,239.103) intermediate (0.164,239.103) representation (0.164,239.103) to (0.164,239.103) optimized (0.164,239.103) nati (0.164,239.103) v (0.164,239.103) e (0.164,239.103) code (0.164,239.103) in (0.164,239.103) tw (0.164,239.103) o (0.164,239.103) linear (0.164,239.103) passes. (0.164,239.103) Our (0.164,239.103) e (0.164,239.103) xperimental (0.164,239.103) results (0.164,239.103) sho (0.164,239.103) w (0.164,239.103) that (0.164,239.103) in (0.164,239.103) practice (0.164,239.103) loops (0.164,239.103) typically (0.164,239.103) are (0.164,239.103) entered (0.164,239.103) with (0.164,239.103) only (0.164,239.103) a (0.164,239.103) fe (0.164,239.103) w (0.164,239.103) dif (0.164,239.103) ferent (0.164,239.103) combinations (0.164,239.103) of (0.164,239.103) v (0.164,239.103) alue (0.164,239.103) types (0.164,239.103) of (0.164,239.103) v (0.164,239.103) ariables. (0.164,239.103) Thus, (0.164,239.103) a (0.164,239.103) small (0.164,239.103) number (0.164,239.103) of (0.164,239.103) traces (0.164,239.103) per (0.164,239.103) loop (0.164,239.103) is (0.164,239.103) suf (0.164,239.103) ficient (0.164,239.103) to (0.164,239.103) run (0.164,239.103) a (0.164,239.103) program (0.164,239.103) ef (0.164,239.103) fi (0.164,239.103) ciently (0.164,239.103) . (0.164,239.103) Our (0.164,239.103) e (0.164,239.103) xperiments (0.164,239.103) also (0.164,239.103) sho (0.164,239.103) w (0.164,239.103) that (0.164,239.103) on (0.164,239.103) programs (0.164,239.103) amenable (0.164,239.103) to (0.164,239.103) tracing, (0.164,239.103) we (0.164,239.103) achie (0.164,239.103) v (0.164,239.103) e (0.164,239.103) speedups (0.164,239.103) of (0.164,239.103) 2x (0.164,239.103) to (0.164,239.103) 20x. (0.164,239.103) 10. (0.164,239.103) Futur (0.164,239.103) e (0.164,239.103) W (0.164,239.103) ork (0.164,239.103) W (0.164,239.103) ork (0.164,239.103) is (0.164,239.103) underw (0.164,239.103) ay (0.164,239.103) in (0.164,239.103) a (0.164,239.103) number (0.164,239.103) of (0.164,239.103) areas (0.164,239.103) to (0.164,239.103) further (0.164,239.103) impro (0.164,239.103) v (0.164,239.103) e (0.164,239.103) the (0.164,239.103) performance (0.164,239.103) of (0.164,239.103) our (0.164,239.103) trace-based (0.164,239.103) Ja (0.164,239.103) v (0.164,239.103) aScript (0.164,239.103) compiler (0.164,239.103) . (0.164,239.103) W (0.164,239.103) e (0.164,239.103) currently (0.164,239.103) do (0.164,239.103) not (0.164,239.103) trace (0.164,239.103) across (0.164,239.103) recursi (0.164,239.103) v (0.164,239.103) e (0.164,239.103) function (0.164,239.103) call (0.164,239.103) s, (0.164,239.103) b (0.164,239.103) ut (0.164,239.103) plan (0.164,239.103) to (0.164,239.103) add (0.164,239.103) the (0.164,239.103) support (0.164,239.103) for (0.164,239.103) this (0.164,239.103) capabilit (0.164,239.103) y (0.164,239.103) in (0.164,239.103) the (0.164,239.103) near (0.164,239.103) term. (0.164,239.103) W (0.164,239.103) e (0.164,239.103) are (0.164,239.103) also (0.164,239.103) e (0.164,239.103) xploring (0.164,239.103) adoption (0.164,239.103) of (0.164,239.103) the (0.164,239.103) e (0.164,239.103) xist (0.164,239.103) ing (0.164,239.103) w (0.164,239.103) ork (0.164,239.103) on (0.164,239.103) tree (0.164,239.103) recompilation (0.164,239.103) in (0.164,239.103) the (0.164,239.103) conte (0.164,239.103) xt (0.164,239.103) of (0.164,239.103) the (0.164,239.103) presented (0.164,239.103) dynamic (0.164,239.103) compiler (0.164,239.103) in (0.164,239.103) order (0.164,239.103) to (0.164,239.103) minimize (0.164,239.103) JIT (0.164,239.103) pause (0.164,239.103) times (0.164,239.103) and (0.164,239.103) obtain (0.164,239.103) the (0.164,239.103) best (0.164,239.103) of (0.164,239.103) both (0.164,239.103) w (0.164,239.103) orlds, (0.164,239.103) f (0.164,239.103) ast (0.164,239.103) tree (0.164,239.103) stitching (0.164,239.103) as (0.164,239.103) well (0.164,239.103) as (0.164,239.103) the (0.164,239.103) impro (0.164,239.103) v (0.164,239.103) ed (0.164,239.103) code (0.164,239.103) quality (0.164,239.103) due (0.164,239.103) to (0.164,239.103) tree (0.164,239.103) recompilation. (0.164,239.103) W (0.164,239.103) e (0.164,239.103) also (0.164,239.103) plan (0.164,239.103) on (0.164,239.103) adding (0.164,239.103) support (0.164,239.103) for (0.164,239.103) tracing (0.164,239.103) across (0.164,239.103) re (0.164,239.103) gular (0.164,239.103) e (0.164,239.103) x- (0.164,239.103) pression (0.164,239.103) substitutions (0.164,239.103) using (0.164,239.103) lambda (0.164,239.103) functions, (0.164,239.103) function (0.164,239.103) applica- (0.164,239.103) tions (0.164,239.103) and (0.164,239.103) e (0.164,239.103) xpression (0.164,239.103) e (0.164,239.103) v (0.164,239.103) aluation (0.164,239.103) using (0.164,239.103) eval (0.164,239.103) . (0.164,239.103) All (0.164,239.103) these (0.164,239.103) language (0.164,239.103) constructs (0.164,239.103) are (0.164,239.103) currently (0.164,239.103) e (0.164,239.103) x (0.164,239.103) ecuted (0.164,239.103) via (0.164,239.103) interpretation, (0.164,239.103) which (0.164,239.103) limits (0.164,239.103) our (0.164,239.103) performance (0.164,239.103) for (0.164,239.103) applications (0.164,239.103) that (0.164,239.103) use (0.164,239.103) those (0.164,239.103) features. (0.164,239.103) Ackno (0.164,239.103) wledgments (0.164,239.103) P (0.164,239.103) arts (0.164,239.103) of (0.164,239.103) this (0.164,239.103) ef (0.164,239.103) fort (0.164,239.103) ha (0.164,239.103) v (0.164,239.103) e (0.164,239.103) been (0.164,239.103) sponsored (0.164,239.103) by (0.164,239.103) the (0.164,239.103) National (0.164,239.103) Science (0.164,239.103) F (0.164,239.103) oundation (0.164,239.103) under (0.164,239.103) grants (0.164,239.103) CNS-0615443 (0.164,239.103) and (0.164,239.103) CNS-0627747, (0.164,239.103) as (0.164,239.103) well (0.164,239.103) as (0.164,239.103) by (0.164,239.103) the (0.164,239.103) California (0.164,239.103) MICR (0.164,239.103) O (0.164,239.103) Program (0.164,239.103) and (0.164,239.103) industrial (0.164,239.103) sponsor (0.164,239.103) Sun (0.164,239.103) Microsystems (0.164,239.103) under (0.164,239.103) Project (0.164,239.103) No. (0.164,239.103) 07-127. (0.164,239.103) The (0.164,239.103) U.S. (0.164,239.103) Go (0.164,239.103) v (0.164,239.103) ernment (0.164,239.103) is (0.164,239.103) authorized (0.164,239.103) to (0.164,239.103) reproduce (0.164,239.103) and (0.164,239.103) distrib (0.164,239.103) ute (0.164,239.103) reprints (0.164,239.103) for (0.164,239.103) Go (0.164,239.103) v (0.164,239.103) ernmental (0.164,239.103) purposes (0.164,239.103) notwithstanding (0.164,239.103) an (0.164,239.103) y (0.164,239.103) cop (0.164,239.103) yright (0.164,239.103) annotation (0.164,239.103) thereon. (0.164,239.103) An (0.164,239.103) y (0.164,239.103) opinions, (0.164,239.103) findings, (0.164,239.103) and (0.164,239.103) conclusions (0.164,239.103) or (0.164,239.103) rec- (0.164,239.103) ommendations (0.164,239.103) e (0.164,239.103) xpressed (0.164,239.103) here (0.164,239.103) are (0.164,239.103) those (0.164,239.103) of (0.164,239.103) the (0.164,239.103) author (0.164,239.103) and (0.164,239.103) should (0.000,0.000) not (0.000,0.000) be (0.000,0.000) interpreted (0.000,0.000) as (0.000,0.000) necessarily (0.000,0.000) representing (0.000,0.000) the (0.000,0.000) of (0.000,0.000) ficial (0.000,0.000) vie (0.000,0.000) ws, (0.000,0.000) policies (0.000,0.000) or (0.000,0.000) endorsements, (0.000,0.000) either (0.000,0.000) e (0.000,0.000) xpressed (0.000,0.000) or (0.000,0.000) implied, (0.000,0.000) of (0.000,0.000) the (0.000,0.000) Na- (0.000,0.000) tional (0.000,0.000) Science (0.000,0.000) foundation (0.000,0.000) (NSF), (0.000,0.000) an (0.000,0.000) y (0.000,0.000) other (0.000,0.000) agenc (0.000,0.000) y (0.000,0.000) of (0.000,0.000) the (0.000,0.000) U.S. (0.000,0.000) Go (0.000,0.000) v- (0.000,0.000) ernment, (0.000,0.000) or (0.000,0.000) an (0.000,0.000) y (0.000,0.000) of (0.000,0.000) the (0.000,0.000) companies (0.000,0.000) mentioned (0.000,0.000) abo (0.000,0.000) v (0.000,0.000) e. (0.000,0.000) Refer (0.000,0.000) ences (0.000,0.000) [1] (0.000,0.000) LuaJIT (0.000,0.000) roadmap (0.000,0.000) 2008 (0.000,0.000) - (0.000,0.000) http://lua-users.or (0.000,0.000) g/lists/lua-l/2008- (0.000,0.000) 02/msg00051.html. (0.000,0.000) [2] (0.000,0.000) Mozilla (0.000,0.000) — (0.000,0.000) Firefox (0.000,0.000) web (0.000,0.000) bro (0.000,0.000) wser (0.000,0.000) and (0.000,0.000) Thunderbird (0.000,0.000) email (0.000,0.000) client (0.000,0.000) - (0.000,0.000) http://www (0.000,0.000) .mozilla.com. (0.000,0.000) [3] (0.000,0.000) SPECJVM98 (0.000,0.000) - (0.000,0.000) http://www (0.000,0.000) .spec.or (0.000,0.000) g/jvm98/. (0.000,0.000) [4] (0.000,0.000) SpiderMonk (0.000,0.000) e (0.000,0.000) y (0.000,0.000) (Ja (0.000,0.000) v (0.000,0.000) aScript-C) (0.000,0.000) Engine (0.000,0.000) - (0.000,0.000) http://www (0.000,0.000) .mozilla.or (0.000,0.000) g/js/spidermonk (0.000,0.000) e (0.000,0.000) y/. (0.000,0.000) [5] (0.000,0.000) Surfin’ (0.000,0.000) Saf (0.000,0.000) ari (0.000,0.000) - (0.000,0.000) Blog (0.000,0.000) Archi (0.000,0.000) v (0.000,0.000) e (0.000,0.000) - (0.000,0.000) Announcing (0.000,0.000) SquirrelFish (0.000,0.000) Extreme (0.000,0.000) - (0.000,0.000) http://webkit.or (0.000,0.000) g/blog/214/introducing-squirrelfish-e (0.000,0.000) xtreme/. (0.000,0.000) [6] (0.000,0.000) A. (0.000,0.000) Aho, (0.000,0.000) R. (0.000,0.000) Sethi, (0.000,0.000) J. (0.000,0.000) Ullman, (0.000,0.000) and (0.000,0.000) M. (0.000,0.000) Lam. (0.000,0.000) Compilers: (0.000,0.000) Principles, (0.000,0.000) techniques, (0.000,0.000) and (0.000,0.000) tools, (0.000,0.000) 2006. (0.000,0.000) [7] (0.000,0.000) V (0.000,0.000) . (0.000,0.000) Bala, (0.000,0.000) E. (0.000,0.000) Duesterw (0.000,0.000) ald, (0.000,0.000) and (0.000,0.000) S. (0.000,0.000) Banerjia. (0.000,0.000) Dynamo: (0.000,0.000) A (0.000,0.000) transparent (0.000,0.000) dynamic (0.000,0.000) optimization (0.000,0.000) system (0.000,0.000) . (0.000,0.000) In (0.000,0.000) Pr (0.000,0.000) oceedings (0.000,0.000) of (0.000,0.000) the (0.000,0.000) A (0.000,0.000) CM (0.000,0.000) SIGPLAN (0.000,0.000) Confer (0.000,0.000) ence (0.000,0.000) on (0.000,0.000) Pr (0.000,0.000) o (0.000,0.000) gr (0.000,0.000) amming (0.000,0.000) Langua (0.000,0.000) g (0.000,0.000) e (0.000,0.000) Design (0.000,0.000) and (0.000,0.000) Implementation (0.000,0.000) , (0.000,0.000) pages (0.000,0.000) 1–12. (0.000,0.000) A (0.000,0.000) CM (0.000,0.000) Press, (0.000,0.000) 2000. (0.000,0.000) [8] (0.000,0.000) M. (0.000,0.000) Berndl, (0.000,0.000) B. (0.000,0.000) V (0.000,0.000) itale, (0.000,0.000) M. (0.000,0.000) Zaleski, (0.000,0.000) and (0.000,0.000) A. (0.000,0.000) Bro (0.000,0.000) wn. (0.000,0.000) Conte (0.000,0.000) xt (0.000,0.000) Threading: (0.000,0.000) a (0.000,0.000) Fle (0.000,0.000) xible (0.000,0.000) and (0.000,0.000) Ef (0.000,0.000) ficient (0.000,0.000) Dispatch (0.000,0.000) T (0.000,0.000) echnique (0.000,0.000) for (0.000,0.000) V (0.000,0.000) irtual (0.000,0.000) Machine (0.000,0.000) In- (0.000,0.000) terpreters. (0.000,0.000) In (0.000,0.000) Code (0.000,0.000) Gener (0.000,0.000) ation (0.000,0.000) and (0.000,0.000) Optimization, (0.000,0.000) 2005. (0.000,0.000) CGO (0.000,0.000) 2005. (0.000,0.000) International (0.000,0.000) Symposium (0.000,0.000) on (0.000,0.000) , (0.000,0.000) pages (0.000,0.000) 15–26, (0.000,0.000) 2005. (0.000,0.000) [9] (0.000,0.000) C. (0.000,0.000) Chambers (0.000,0.000) and (0.000,0.000) D. (0.000,0.000) Ung (0.000,0.000) ar (0.000,0.000) . (0.000,0.000) Customization: (0.000,0.000) Optimizing (0.000,0.000) Compiler (0.000,0.000) T (0.000,0.000) echnology (0.000,0.000) for (0.000,0.000) SELF (0.000,0.000) , (0.000,0.000) a (0.000,0.000) Dynamically-T (0.000,0.000) yped (0.000,0.000) O (0.000,0.000) bject-Oriented (0.000,0.000) Pro- (0.000,0.000) gramming (0.000,0.000) Language. (0.000,0.000) In (0.000,0.000) Pr (0.000,0.000) oceedings (0.000,0.000) of (0.000,0.000) the (0.000,0.000) A (0.000,0.000) CM (0.000,0.000) SIGPLAN (0.000,0.000) 1989 (0.000,0.000) Confer (0.000,0.000) ence (0.000,0.000) on (0.000,0.000) Pr (0.000,0.000) o (0.000,0.000) gr (0.000,0.000) amming (0.000,0.000) Langua (0.000,0.000) g (0.000,0.000) e (0.000,0.000) Design (0.000,0.000) and (0.000,0.000) Implementation (0.000,0.000) , (0.000,0.000) pages (0.000,0.000) 146–160. (0.000,0.000) A (0.000,0.000) CM (0.000,0.000) Ne (0.000,0.000) w (0.000,0.000) Y (0.000,0.000) ork, (0.000,0.000) NY (0.000,0.000) , (0.000,0.000) USA, (0.000,0.000) 1989. (0.000,0.000) [10] (0.000,0.000) A (0.000,0.000) . (0.000,0.000) Gal. (0.000,0.000) Ef (0.000,0.000) ficient (0.000,0.000) Bytecode (0.000,0.000) V (0.000,0.000) erification (0.000,0.000) and (0.000,0.000) Compilation (0.000,0.000) in (0.000,0.000) a (0.000,0.000) V (0.000,0.000) irtual (0.000,0.000) Mac (0.000,0.000) hine (0.000,0.000) Dissertation (0.000,0.000) . (0.000,0.000) PhD (0.000,0.000) thesis, (0.000,0.000) Uni (0.000,0.000) v (0.000,0.000) ersity (0.000,0.000) Of (0.000,0.000) California, (0.000,0.000) Irvine, (0.000,0.000) 2006. (0.000,0.000) [11] (0.000,0.000) A. (0.000,0.000) Gal, (0.000,0.000) C. (0.000,0.000) W (0.000,0.000) . (0.000,0.000) Probst, (0.000,0.000) and (0.000,0.000) M. (0.000,0.000) Franz. (0.000,0.000) HotpathVM: (0.000,0.000) An (0.000,0.000) ef (0.000,0.000) fecti (0.000,0.000) v (0.000,0.000) e (0.000,0.000) JIT (0.000,0.000) compiler (0.000,0.000) for (0.000,0.000) resource-constrained (0.000,0.000) de (0.000,0.000) vices. (0.000,0.000) In (0.000,0.000) Pr (0.000,0.000) oceedings (0.000,0.000) of (0.000,0.000) the (0.000,0.000) International (0.000,0.000) Confer (0.000,0.000) ence (0.000,0.000) on (0.000,0.000) V (0.000,0.000) irtual (0.000,0.000) Execution (0.000,0.000) En (0.000,0.000) vir (0.000,0.000) onments (0.000,0.000) , (0.000,0.000) pages (0.000,0.000) 144–153. (0.000,0.000) A (0.000,0.000) CM (0.000,0.000) Press, (0.000,0.000) 2006. (0.000,0.000) [12] (0.000,0.000) C. (0.000,0.000) Garrett, (0.000,0.000) J. (0.000,0.000) Dean, (0.000,0.000) D. (0.000,0.000) Gro (0.000,0.000) v (0.000,0.000) e, (0.000,0.000) and (0.000,0.000) C. (0.000,0.000) Chambers. (0.000,0.000) Measurement (0.000,0.000) and (0.000,0.000) Application (0.000,0.000) of (0.000,0.000) Dynamic (0.000,0.000) Recei (0.000,0.000) v (0.000,0.000) er (0.000,0.000) Class (0.000,0.000) Distrib (0.000,0.000) utions. (0.000,0.000) 1994. (0.000,0.000) [13] (0.000,0.000) J. (0.000,0.000) Ha, (0.000,0.000) M. (0.000,0.000) R. (0.000,0.000) Haghighat, (0.000,0.000) S. (0.000,0.000) Cong, (0.000,0.000) and (0.000,0.000) K. (0.000,0.000) S. (0.000,0.000) McKinle (0.000,0.000) y (0.000,0.000) . (0.000,0.000) A (0.000,0.000) concurrent (0.000,0.000) trace-based (0.000,0.000) just-in-time (0.000,0.000) compiler (0.000,0.000) for (0.000,0.000) ja (0.000,0.000) v (0.000,0.000) ascript. (0.000,0.000) Dept.of (0.000,0.000) Computer (0.000,0.000) Sciences, (0.000,0.000) The (0.000,0.000) Uni (0.000,0.000) v (0.000,0.000) ersity (0.000,0.000) of (0.000,0.000) T (0.000,0.000) e (0.000,0.000) xas (0.000,0.000) at (0.000,0.000) Austin, (0.000,0.000) TR-09-06, (0.000,0.000) 2009. (0.000,0.000) [14] (0.000,0.000) B. (0.000,0.000) McClosk (0.000,0.000) e (0.000,0.000) y (0.000,0.000) . (0.000,0.000) Personal (0.000,0.000) communication. (0.000,0.000) [15] (0.000,0.000) I. (0.000,0.000) Piumarta (0.000,0.000) and (0.000,0.000) F (0.000,0.000) . (0.000,0.000) Riccardi. (0.000,0.000) Optimizing (0.000,0.000) direct (0.000,0.000) threaded (0.000,0.000) code (0.000,0.000) by (0.000,0.000) selec- (0.000,0.000) ti (0.000,0.000) v (0.000,0.000) e (0.000,0.000) inlining. (0.000,0.000) In (0.000,0.000) Pr (0.000,0.000) oceedings (0.000,0.000) of (0.000,0.000) the (0.000,0.000) A (0.000,0.000) CM (0.000,0.000) SIGPLAN (0.000,0.000) 1998 (0.000,0.000) confer (0.000,0.000) ence (0.000,0.000) on (0.000,0.000) Pr (0.000,0.000) o (0.000,0.000) gr (0.000,0.000) amming (0.000,0.000) langua (0.000,0.000) g (0.000,0.000) e (0.000,0.000) design (0.000,0.000) and (0.000,0.000) implementation (0.000,0.000) , (0.000,0.000) pages (0.000,0.000) 291– (0.000,0.000) 300. (0.000,0.000) A (0.000,0.000) CM (0.000,0.000) Ne (0.000,0.000) w (0.000,0.000) Y (0.000,0.000) ork, (0.000,0.000) NY (0.000,0.000) , (0.000,0.000) USA, (0.000,0.000) 1998. (0.000,0.000) [16] (0.000,0.000) A. (0.000,0.000) Rigo. (0.000,0.000) Representation-Based (0.000,0.000) Just-In-time (0.000,0.000) Specialization (0.000,0.000) and (0.000,0.000) the (0.000,0.000) Psyco (0.000,0.000) Prototype (0.000,0.000) for (0.000,0.000) Python. (0.000,0.000) In (0.000,0.000) PEPM (0.000,0.000) , (0.000,0.000) 2004. (0.000,0.000) [17] (0.000,0.000) M (0.000,0.000) . (0.000,0.000) Salib (0.000,0.000) . (0.000,0.000) Starkiller: (0.000,0.000) A (0.000,0.000) Static (0.000,0.000) T (0.000,0.000) ype (0.000,0.000) Inferencer (0.000,0.000) and (0.000,0.000) C (0.000,0.000) ompiler (0.000,0.000) for (0.000,0.000) Python. (0.000,0.000) In (0.000,0.000) Master’ (0.000,0.000) s (0.000,0.000) Thesis (0.000,0.000) , (0.000,0.000) 2004. (0.000,0.000) [18] (0.000,0.000) T (0.000,0.000) . (0.000,0.000) Sug (0.000,0.000) anuma, (0.000,0.000) T (0.000,0.000) . (0.000,0.000) Y (0.000,0.000) asue, (0.000,0.000) and (0.000,0.000) T (0.000,0.000) . (0.000,0.000) Nakatani. (0.000,0.000) A (0.000,0.000) Re (0.000,0.000) gion-Based (0.000,0.000) Compila- (0.000,0.000) tion (0.000,0.000) T (0.000,0.000) echnique (0.000,0.000) for (0.000,0.000) Dynamic (0.000,0.000) Compilers. (0.000,0.000) A (0.000,0.000) CM (0.000,0.000) T (0.000,0.000) r (0.000,0.000) ansactions (0.000,0.000) on (0.000,0.000) Pr (0.000,0.000) o- (0.000,0.000) gr (0.000,0.000) amming (0.000,0.000) Langua (0.000,0.000) g (0.000,0.000) es (0.000,0.000) and (0.000,0.000) Systems (0.000,0.000) (T (0.000,0.000) OPLAS) (0.000,0.000) , (0.000,0.000) 28(1):134–174, (0.000,0.000) 2006. (0.000,0.000) [19] (0.000,0.000) M. (0.000,0.000) Zaleski, (0.000,0.000) A. (0.000,0.000) D. (0.000,0.000) Bro (0.000,0.000) wn, (0.000,0.000) and (0.000,0.000) K. (0.000,0.000) Stoodle (0.000,0.000) y (0.000,0.000) . (0.000,0.000) YETI: (0.000,0.000) A (0.000,0.000) graduallY (0.000,0.000) Extensible (0.000,0.000) Trace (0.000,0.000) Interpreter (0.000,0.000) . (0.000,0.000) In (0.000,0.000) Pr (0.000,0.000) oceedings (0.000,0.000) of (0.000,0.000) the (0.000,0.000) International (0.000,0.000) Confer (0.000,0.000) ence (0.000,0.000) on (0.000,0.000) V (0.000,0.000) irtual (0.000,0.000) Exec (0.000,0.000) ution (0.000,0.000) En (0.000,0.000) vir (0.000,0.000) onments (0.000,0.000) , (0.000,0.000) pages (0.000,0.000) 83–93. (0.000,0.000) A (0.000,0.000) CM (0.000,0.000) Press, (0.000,0.000) 2007.