10.1145/1926385.1926450acmconferencesArticle/Chapter ViewAbstractPublication PagespoplConference Proceedingsconference-collections
research-article

The essence of compiling with traces

Authors Info & Claims
Published:26 January 2011Publication History

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

51-mpeg-4.mp4

References

  1. Vasanth Bala, Evelyn Duesterwald, and Sanjeev Banerjia. Dynamo: A transparent dynamic optimization system. In PLDI '00, pages 1--12. ACM, 2000. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  3. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  4. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  5. Joëlle Despeyroux. Proof of translation in natural semantics. In LICS, pages 193--205, 1986.Google ScholarGoogle Scholar
  6. Cormac Flanagan and Matthias Felleisen. The semantics of future and its use in program optimization. In POPL '95, pages 209--220. ACM, 1995. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. Andreas Gal. Efficient bytecode verification and compilation in a virtual machine. PhD thesis, 2006. Adviser: Michael Franz. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  9. A. J. Kfoury, Michael A. Arbib, and Robert N. Moll. A Programming Approach to Computability. Springer-Verlag, 1982. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. Vasileios Koutavas and Mitchell Wand. Small bisimulations for reasoning about higher-order imperative programs. In POPL '06, pages 141--152. ACM, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  12. Sorin Lerner, Todd Millstein, and Craig Chambers. Automatically proving the correctness of compiler optimizations. In PLDI '03, pages 220--231. ACM, 2003. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. Mozilla Metrics. Firefox usage: https://metrics.mozilla.com/.Google ScholarGoogle Scholar
  14. Robin Milner. Communication and Concurrency. Prentice Hall, 1995. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. Magnus O. Myreen. Verified just-in-time compiler on x86. In POPL '10, pages 107--118. ACM, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. Frank Pfenning. A proof of the Church-Rosser theorem and its rep- resentation in a logical framework. Journal of Automated Reasoning, 1993.Google ScholarGoogle Scholar
  17. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  18. Eijiro Sumii and Benjamin C. Pierce. A bisimulation for dynamic sealing. In POPL '04, pages 161--172. ACM, 2004. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. Eijiro Sumii and Benjamin C. Pierce. A bisimulation for type abstraction and recursion. In POPL '05, pages 63--74. ACM, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. Mitchell Wand. Compiler correctness for parallel languages. In FPCA, pages 120--134, 1995. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. Mitchell Wand and William D. Clinger. Set constraints for destructive array update optimization. Journal of Functional Programmng, 11(3):319--346, 2001. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. Mitchell Wand and Igor Siveroni. Constraint systems for useless variable elimination. In POPL '99, pages 291--302. ACM, 1999. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. The essence of compiling with traces

              Reviews

              William M. Waite

              A widely quoted rule of thumb says that a program spends 90 percent of its time in ten percent of its code. Can we record sequences of instructions (traces) that the program executes very frequently, optimize them in isolation, and make the program run a lot faster__?__ Guo and Palsberg provide us with the theory to safely do just that. Using notation developed in the late 1980s to describe concurrent processes, they characterize the process of recording traces, and prove that some optimizations are sound and others are not. Their goal is to provide a framework for reasoning about the soundness of trace optimizations, not to validate any particular optimization strategy. The treatment is formal, although it includes good examples to develop the reader's intuition. Since I had no experience with the proof techniques used, I found the paper heavy going. The authors provide an excellent reference list, with pointers to sources that are necessary for understanding the notation and terminology. After some concentrated study, I could follow their development, but I'm not convinced that I would be able to reason about a different optimization without more background. Online Computing Reviews Service

              Access critical reviews of Computing literature here

              Become a reviewer for Computing Reviews.

              Comments

              Login options

              Check if you have access through your login credentials or your institution to get full access on this article.

              Sign in
              • Published in

                cover image ACM Conferences
                POPL '11: Proceedings of the 38th annual ACM SIGPLAN-SIGACT symposium on Principles of programming languages
                January 2011
                652 pages
                ISBN:9781450304900
                DOI:10.1145/1926385
                • cover image ACM SIGPLAN Notices
                  ACM SIGPLAN Notices  Volume 46, Issue 1
                  POPL '11
                  January 2011
                  624 pages
                  ISSN:0362-1340
                  EISSN:1558-1160
                  DOI:10.1145/1925844
                  Issue’s Table of Contents

                Copyright © 2011 ACM

                Publisher

                Association for Computing Machinery

                New York, NY, United States

                Publication History

                • Published: 26 January 2011

                Permissions

                Request permissions about this article.

                Request Permissions

                Check for updates

                Qualifiers

                • research-article

                Acceptance Rates

                POPL '11 Paper Acceptance Rate 49 of 209 submissions, 23%Overall Acceptance Rate 770 of 3,892 submissions, 20%

              PDF Format

              View or Download as a PDF file.

              PDF

              eReader

              View online with eReader.

              eReader
              About Cookies On This Site

              We use cookies to ensure that we give you the best experience on our website.

              Learn more

              Got it!