Abstract
Tracing just-in-time compilation is a popular compilation technique for the efficient implementation of dynamic languages, which is commonly used for JavaScript, Python, and PHP. It relies on two key ideas. First, it monitors program execution in order to detect so-called hot paths, that is, the most frequently executed program paths. Then, hot paths are optimized by exploiting some information on program stores that is available and therefore gathered at runtime. The result is a residual program where the optimized hot paths are guarded by sufficient conditions ensuring some form of equivalence with the original program. The residual program is persistently mutated during its execution, for example, to add new optimized hot paths or to merge existing paths. Tracing compilation is thus fundamentally different from traditional static compilation. Nevertheless, despite the practical success of tracing compilation, very little is known about its theoretical foundations. We provide a formal model of tracing compilation of programs using abstract interpretation. The monitoring phase (viz., hot path detection) corresponds to an abstraction of the trace semantics of the program that captures the most frequent occurrences of sequences of program points together with an abstraction of their corresponding stores, for example, a type environment. The optimization phase (viz., residual program generation) corresponds to a transform of the original program that preserves its trace semantics up to a given observation as modeled by some abstraction. We provide a generic framework to express dynamic optimizations along hot paths and to prove them correct. We instantiate it to prove the correctness of dynamic type specialization and constant variable folding. We show that our framework is more general than the model of tracing compilation introduced by Guo and Palsberg [2011], which is based on operational bisimulations. In our model, we can naturally express hot path reentrance and common optimizations like dead-store elimination, which are either excluded or unsound in Guo and Palsberg’s framework.
- K. Adams, J. Evans, B. Maher, G. Ottoni, A. Paroski, B. Simmers, E. Smith, and O. Yamauchi. 2014. The Hiphop virtual machine. In Proceedings of the 2014 ACM International Conference on Object Oriented Programming Systems Languages (OOPSLA’14). ACM, New York, NY, 777--790. DOI:http://dx.doi.org/10.1145/2660193.2660199 Google Scholar
Digital Library
- V. Bala, E. Duesterwald, and S. Banerjia. 2000. Dynamo: A transparent dynamic optimization system. In Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI’00). ACM, New York, NY, 1--12. DOI:http://dx.doi.org/10.1145/349299.349303 Google Scholar
Digital Library
- R. Barbuti, N. De Francesco, A. Santone, and G. Vaglini. 1999. Abstract interpretation of trace semantics for concurrent calculi. Inform. Process. Lett. 70, 2 (1999), 69--78. DOI:http://dx.doi.org/10.1016/S0020-0190(99)00042-3 Google Scholar
Digital Library
- S. Bauman, R. Bolz, C. F. Hirschfeld, V. Krilichev, T. Pape, J. G. Siek, and S. Tobin-Hochstadt. 2015. Pycket: A tracing JIT for a functional language. In Proceedings of the 20th ACM SIGPLAN International Conference on Functional Programming (ICFP’15). ACM, New York, NY, 22--34. DOI:http://dx.doi.org/10.1145/2784731.2784740 Google Scholar
Digital Library
- M. Bebenita, F. Brandner, M. Fahndrich, F. Logozzo, W. Schulte, N. Tillmann, and H. Venter. 2010. SPUR: A trace-based JIT compiler for CIL. In Proceedings of the ACM International Conference on Object Oriented Programming Systems Languages and Applications (OOPSLA’10). ACM, New York, NY, 708--725. DOI:http://dx.doi.org/10.1145/1869459.1869517 Google Scholar
Digital Library
- I. Böhm, T. J. K. Edler von Koch, S. C. Kyle, B. Franke, and N. Topham. 2011. Generalized just-in-time trace compilation using a parallel task farm in a dynamic binary translator. In Proceedings of the 32nd ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI’11). ACM, New York, NY, 74--85. DOI:http://dx.doi.org/10.1145/1993498.1993508 Google Scholar
Digital Library
- C. F. Bolz, A. Cuni, M. Fijałkowski, M. Leuschel, S. Pedroni, and A. Rigo. 2011. Allocation removal by partial evaluation in a tracing JIT. In Proceedings of the 20th ACM SIGPLAN Workshop on Partial Evaluation and Program Manipulation (PEPM’11). ACM, ACM, New York, NY, 43--52. DOI:http://dx.doi.org/10.1145/1929501.1929508 Google Scholar
Digital Library
- C. F. Bolz, A. Cuni, M. Fijalkowski, and A. Rigo. 2009. Tracing the meta-level: PyPy’s tracing JIT compiler. In Proceedings of the 4th Workshop on the Implementation, Compilation, Optimization of Object-Oriented Languages and Programming Systems (ICOOOLPS’09). ACM, New York, NY, 18--25. DOI:http://dx.doi.org/10.1145/1565824.1565827 Google Scholar
Digital Library
- C. Colby and P. Lee. 1996. Trace-based program analysis. In Proceedings of the 23rd ACM SIGACT-SIGPLAN Symposium on Principles of Programming Languages (POPL’96). ACM, New York, NY, 195--207. DOI:http://dx.doi.org/10.1145/237721.237776 Google Scholar
Digital Library
- P. Cousot. 1997. Constructive design of a hierarchy of semantics of a transition system by abstract interpretation (Extended Abstract). Electron. Notes Theor. Comput. Sci. 6, 0 (1997), 77--102. DOI:http://dx.doi.org/10.1016/S1571-0661(05)80168-9. Proceedings of the 13th Annual Conference on Mathematical Foundations of Progamming Semantics (MFPS XIII).Google Scholar
Cross Ref
- P. Cousot. 2002. Constructive design of a hierarchy of semantics of a transition system by abstract interpretation. Theor. Comput. Sci. 277, 1--2 (2002), 47--103. Google Scholar
Digital Library
- P. Cousot and R. Cousot. 1977. Abstract interpretation: A unified lattice model for static analysis of programs by construction or approximation of fixpoints. In Proceedings of the 4th ACM SIGACT-SIGPLAN Symposium on Principles of Programming Languages (POPL’77). ACM, New York, NY, 238--252. DOI:http://dx.doi.org/10.1145/512950.512973 Google Scholar
Digital Library
- P. Cousot and R. Cousot. 1979. Systematic design of program analysis frameworks. In Proceedings of the 6th ACM SIGACT-SIGPLAN Symposium on Principles of Programming Languages (POPL’79). ACM, New York, NY, 269--282. DOI:http://dx.doi.org/10.1145/567752.567778 Google Scholar
Digital Library
- P. Cousot and R. Cousot. 2002. Systematic design of program transformation frameworks by abstract interpretation. In Proceedings of the 29th ACM SIGACT-SIGPLAN Symposium on Principles of Programming Languages (POPL’02). ACM, New York, NY, 178--190. DOI:http://dx.doi.org/10.1145/503272.503290 Google Scholar
Digital Library
- S. Dissegna, F. Logozzo, and F. Ranzato. 2014. Tracing compilation by abstract interpretation. In Proceedings of the 41st ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL’14). ACM, New York, NY, 47--59. DOI:http://dx.doi.org/10.1145/2535838.2535866 Google Scholar
Digital Library
- Ecma International. 2015. Standard ECMA-262, ECMAScript 2015 Language Specification (6th ed.). Retrieved from http://www.ecma-international.org/ecma-262/6.0.Google Scholar
- Facebook Inc. 2013. The HipHop Virtual Machine. (Oct. 2013). https://www.facebook.com/hhvm.Google Scholar
- A. Gal, B. Eich, M. Shaver, D. Anderson, D. Mandelin, M. R. Haghighat, B. Kaplan, G. Hoare, B. Zbarsky, J. Orendorff, J. Ruderman, E. W. Smith, R. Reitmaier, M. Bebenita, M. Chang, and M. Franz. 2009. Trace-based just-in-time type specialization for dynamic languages. In Proceedings of the 2009 ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI’09). ACM, New York, NY, 465--478. Google Scholar
Digital Library
- A. Gal, C. W. Probst, and M. Franz. 2006. HotPathVM: An effective JIT compiler for resource-constrained devices. In Proceedings of the 2nd International Conference on Virtual Execution Environments (VEE’06). ACM, New York, NY, 144--153. DOI:http://dx.doi.org/10.1145/1542476.1542528 Google Scholar
Digital Library
- Google Inc. 2010. A New Crankshaft for V8. (Dec. 2010). The Chromium Blog. http://blog.chromium.org/2010/12/new-crankshaft-for-v8.html.Google Scholar
- S. Guo and J. Palsberg. 2011. The essence of compiling with traces. In Proceedings of the 38th ACM SIGACT-SIGPLAN Symposium on Principles of Programming Languages (POPL 2011). ACM, New York, NY, 563--574. DOI:http://dx.doi.org/10.1145/1926385.1926450 Google Scholar
Digital Library
- M. Handjieva and S. Tzolovski. 1998. Refining static analyses by trace-based partitioning using control flow. In Proceedings of the 5th International Static Analysis Symposium (SAS’98), Lecture Notes in Computer Science, Vol. 1503. Springer, Berlin, 200--214. DOI:http://dx.doi.org/10.1007/3-540-49727-7_12Google Scholar
- C. Häubl and H. Mössenböck. 2011. Trace-based compilation for the Java HotSpot virtual machine. In Proceedings of the 9th International Conference on Principles and Practice of Programming in Java (PPPJ’11). ACM, New York, NY, 129--138. DOI:http://dx.doi.org/10.1145/2093157.2093176 Google Scholar
Digital Library
- C. Häubl, C. Wimmer, and H. Mössenböck. 2014. Trace transitioning and exception handling in a trace-based JIT compiler for Java. ACM Trans. Archit. Code Optim. 11, 1, Article 6 (Feb. 2014), 26 pages. DOI:http://dx.doi.org/10.1145/2579673 Google Scholar
Digital Library
- H. Inoue, H. Hayashizaki, Peng Wu, and T. Nakatani. 2011. A trace-based Java JIT compiler retrofitted from a method-based compiler. In Proceedings of the 9th Annual IEEE/ACM International Symposium on Code Generation and Optimization (CGO’11). IEEE Computer Society, Washington, DC, 246--256. DOI:http://dx.doi.org/10.1109/CGO.2011.5764692 Google Scholar
Digital Library
- F. Logozzo. 2009. Class invariants as abstract interpretation of trace semantics. Comput. Lang., Syst. Struct. 35, 2 (2009), 100--142. DOI:http://dx.doi.org/10.1016/j.cl.2005.01.001 Google Scholar
Digital Library
- R. Milner. 1995. Communication and Concurrency. Prentice Hall, Englewood Cliffs, NJ. Google Scholar
Digital Library
- Mozilla Foundation. 2010. TraceMonkey. (Oct. 2010). MozillaWiki. https://wiki.mozilla.org/JavaScript:TraceMonkey.Google Scholar
- Mozilla Foundation. 2013. IonMonkey. (May 2013). MozillaWiki. https://wiki.mozilla.org/IonMonkey.Google Scholar
- M. Pall. 2005. The LuaJIT Project. (2005). http://luajit.org.Google Scholar
- X. Rival. 2004. Symbolic transfer function-based approaches to certified compilation. In Proceedings of the 31st ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages(POPL’04). ACM, New York, NY, 1--13. DOI:http://dx.doi.org/10.1145/964001.964002 Google Scholar
Digital Library
- X. Rival and L. Mauborgne. 2007. The trace partitioning abstract domain. ACM Trans. Program. Lang. Syst. 29, 5, Article 26 (2007), 51 pages. DOI:http://dx.doi.org/10.1145/1275497.1275501 Google Scholar
Digital Library
- T. Schilling. 2013. Trace-Based Just-In-Time Compilation for Lazy Functional Programming Languages. Ph.D. dissertation. University of Kent, UK.Google Scholar
- D. A. Schmidt. 1998. Trace-based abstract interpretation of operational semantics. Lisp Symb. Comput. 10, 3 (1998), 237--271. DOI:http://dx.doi.org/10.1023/A:1007734417713 Google Scholar
Digital Library
- F. Spoto and T. Jensen. 2003. Class analyses as abstract interpretations of trace semantics. ACM Trans. Program. Lang. Syst. 25, 5 (2003), 578--630. DOI:http://dx.doi.org/10.1145/937563.937565 Google Scholar
Digital Library
- M. N. Wegman and F. K. Zadeck. 1991. Constant propagation with conditional branches. ACM Trans. Program. Lang. Syst. 13, 2 (1991), 181--210. DOI:http://dx.doi.org/10.1145/103135.103136 Google Scholar
Digital Library
Index Terms
An Abstract Interpretation-Based Model of Tracing Just-in-Time Compilation
Recommendations
Tracing compilation by abstract interpretation
POPL '14: Proceedings of the 41st ACM SIGPLAN-SIGACT Symposium on Principles of Programming LanguagesTracing just-in-time compilation is a popular compilation schema for the efficient implementation of dynamic languages, which is commonly used for JavaScript, Python, and PHP. It relies on two key ideas. First, it monitors the execution of the program ...
Tracing compilation by abstract interpretation
POPL '14Tracing just-in-time compilation is a popular compilation schema for the efficient implementation of dynamic languages, which is commonly used for JavaScript, Python, and PHP. It relies on two key ideas. First, it monitors the execution of the program ...
A flexible framework for studying trace-based just-in-time compilation
STRAF, a minimalistic meta-compilation framework for experimenting with trace-based compilation for interpreters, is proposed.The STRAF framework enables tracing of a range of interpreters, given that these interpreters satisfy a minimal set of ...






Comments