Abstract
The technique of trace-based just-in-time compilation was introduced by Bala et al. and was further developed by Gal et al. It currently enjoys success in Mozilla Firefox's JavaScript engine. A trace-based JIT compiler leverages run-time profiling to optimize frequently-executed paths while enabling the optimized code to ``bail out'' to the original code when the path has been invalidated. This optimization strategy differs from those of other JIT compilers and opens the question of which trace optimizations are sound. In this paper we present a framework for reasoning about the soundness of trace optimizations, and we show that some traditional optimization techniques are sound when used in a trace compiler while others are unsound. The converse is also true: some trace optimizations are sound when used in a traditional compiler while others are unsound. So, traditional and trace optimizations form incomparable sets. Our setting is an imperative calculus for which tracing is explicitly spelled out in the semantics. We define optimization soundness via a notion of bisimulation, and we show that sound optimizations lead to confluence and determinacy of stores.
Supplemental Material
- Vasanth Bala, Evelyn Duesterwald, and Sanjeev Banerjia. Dynamo: A transparent dynamic optimization system. In PLDI '00, pages 1--12. ACM, 2000. Google Scholar
Digital Library
- Michael Bebenita, Florian Brandner, Manuel Fahndrich, Francesco Logozzo, Wolfram Schulte, Nikolai Tillmann, and Herman Venter. SPUR: A trace-based JIT compiler for CIL. In OOPSLA '10, 2010. Google Scholar
Digital Library
- Michael Bebenita, Mason Chang, Gregor Wagner, Christian Wimmer, Andreas Gal, and Michael Franz. Trace-based compilation in execution environments without interpreters. In PPPJ '10, 2010. Google Scholar
Digital Library
- Mason Chang, Edwin W. Smith, Rick Reitmaier, Michael Bebenita, Andreas Gal, Christian Wimmer, Brendan Eich, and Michael Franz. Tracing for web 3.0: trace compilation for the next generation web applications. In VEE, pages 71--80, 2009. Google Scholar
Digital Library
- Joëlle Despeyroux. Proof of translation in natural semantics. In LICS, pages 193--205, 1986.Google Scholar
- Cormac Flanagan and Matthias Felleisen. The semantics of future and its use in program optimization. In POPL '95, pages 209--220. ACM, 1995. Google Scholar
Digital Library
- Andreas Gal. Efficient bytecode verification and compilation in a virtual machine. PhD thesis, 2006. Adviser: Michael Franz. Google Scholar
Digital Library
- Andreas Gal, Brendan Eich, Mike Shaver, David Anderson, David Mandelin, Mohammad R. Haghighat, Blake Kaplan, Graydon Hoare, Boris Zbarsky, Jason Orendorff, Jesse Ruderman, Edwin W. Smith, Rick Reitmaier, Michael Bebenita, Mason Chang, and Michael Franz. Trace-based just-in-time type specialization for dynamic languages. In PLDI '09, pages 465--478. ACM, 2009. Google Scholar
Digital Library
- A. J. Kfoury, Michael A. Arbib, and Robert N. Moll. A Programming Approach to Computability. Springer-Verlag, 1982. Google Scholar
Digital Library
- Vasileios Koutavas and Mitchell Wand. Small bisimulations for reasoning about higher-order imperative programs. In POPL '06, pages 141--152. ACM, 2006. Google Scholar
Digital Library
- David Lacey, Neil D. Jones, Eric Van Wyk, and Carl Christian Frederiksen. Proving correctness of compiler optimizations by temporal logic. In POPL '02, pages 283--294. ACM, 2002. Google Scholar
Digital Library
- Sorin Lerner, Todd Millstein, and Craig Chambers. Automatically proving the correctness of compiler optimizations. In PLDI '03, pages 220--231. ACM, 2003. Google Scholar
Digital Library
- Mozilla Metrics. Firefox usage: https://metrics.mozilla.com/.Google Scholar
- Robin Milner. Communication and Concurrency. Prentice Hall, 1995. Google Scholar
Digital Library
- Magnus O. Myreen. Verified just-in-time compiler on x86. In POPL '10, pages 107--118. ACM, 2010. Google Scholar
Digital Library
- Frank Pfenning. A proof of the Church-Rosser theorem and its rep- resentation in a logical framework. Journal of Automated Reasoning, 1993.Google Scholar
- Kristian Støvring and Soren B. Lassen. A complete, co-inductive syntactic theory of sequential control and state. In POPL '07, pages 161--172. ACM, 2007. Google Scholar
Digital Library
- Eijiro Sumii and Benjamin C. Pierce. A bisimulation for dynamic sealing. In POPL '04, pages 161--172. ACM, 2004. Google Scholar
Digital Library
- Eijiro Sumii and Benjamin C. Pierce. A bisimulation for type abstraction and recursion. In POPL '05, pages 63--74. ACM, 2005. Google Scholar
Digital Library
- Mitchell Wand. Compiler correctness for parallel languages. In FPCA, pages 120--134, 1995. Google Scholar
Digital Library
- Mitchell Wand and William D. Clinger. Set constraints for destructive array update optimization. Journal of Functional Programmng, 11(3):319--346, 2001. Google Scholar
Digital Library
- Mitchell Wand and Igor Siveroni. Constraint systems for useless variable elimination. In POPL '99, pages 291--302. ACM, 1999. Google Scholar
Digital Library
Index Terms
The essence of compiling with traces
Recommendations
The essence of compiling with traces
POPL '11: Proceedings of the 38th annual ACM SIGPLAN-SIGACT symposium on Principles of programming languagesThe technique of trace-based just-in-time compilation was introduced by Bala et al. and was further developed by Gal et al. It currently enjoys success in Mozilla Firefox's JavaScript engine. A trace-based JIT compiler leverages run-time profiling to ...
Compiling Embedded Programs to Byte Code
PADL '02: Proceedings of the 4th International Symposium on Practical Aspects of Declarative LanguagesFunctional languages have proven substantially useful for hosting embedded domain-specific languages. They provide an infrastructure rich enough to define both a convenient syntax for the embedded language, a type system for embedded programs, and an ...
Trace-based compilation in execution environments without interpreters
PPPJ '10: Proceedings of the 8th International Conference on the Principles and Practice of Programming in JavaTrace-based compilation is a technique used in managed language runtimes to detect and compile frequently executed program paths. The goal is to reduce compilation time and improve code quality by only considering "hot" parts of methods for compilation. ...









Comments