skip to main content
research-article

Tracing compilation by abstract interpretation

Published:08 January 2014Publication History
Skip Abstract Section

Abstract

Tracing 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 to detect so-called hot paths, i.e., the most frequently executed paths. Then, it uses some store information available at runtime to optimize hot paths. The result is a residual program where the optimized hot paths are guarded by sufficient conditions ensuring the equivalence of the optimized path and the original program. The residual program is persistently mutated during its execution, e.g., to add new optimized paths or to merge existing paths. Tracing compilation is thus fundamentally different than traditional static compilation. Nevertheless, despite the remarkable practical success of tracing compilation, very little is known about its theoretical foundations.

We formalize tracing compilation of programs using abstract interpretation. The monitoring (viz., hot path detection) phase corresponds to an abstraction of the trace semantics that captures the most frequent occurrences of sequences of program points together with an abstraction of their corresponding stores, e.g., a type environment. The optimization (viz., residual program generation) phase 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 and to prove them correct. We instantiate it to prove the correctness of dynamic type specialization. We show that our framework is more general than a recent model of tracing compilation introduced in POPL~2011 by Guo and Palsberg (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.

Skip Supplemental Material Section

Supplemental Material

d1_left_t4.mp4

References

  1. V. Bala, E. Duesterwald, and S. Banerjia. Dynamo: a transparent dynamic optimization system. In Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI 2000), pages 1--12, New York, NY, USA, 2000. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. R. Barbuti, N. De Francesco, A. Santone, and G. Vaglini. Abstract interpretation of trace semantics for concurrent calculi. Information Processing Letters, 70(2):69--78, 1999. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. M. Bebenita, F. Brandner, M. Fahndrich, F. Logozzo, W. Schulte, N. Tillmann, and H. Venter. SPUR: a trace-based JIT compiler for CIL. In Proceedings of the ACM International Conference on Object Oriented Programming Systems Languages and Applications (OOPSLA 2010), pages 708--725, New York, NY, USA, 2010. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. I. Böhm, T.J.K. Edler von Koch, S.C. Kyle, B. Franke, and N. Topham. 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 2011), pages 74--85, New York, NY, USA, 2011. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. C.F. Bolz, A. Cuni, M. Fijałkowski, M. Leuschel, S. Pedroni, and A. Rigo. Allocation removal by partial evaluation in a tracing JIT. In Proceedings of the 20th ACM SIGPLAN Workshop on Partial Evaluation and Program Manipulation (PEPM 2011), pages 43--52. ACM, 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. C.F. Bolz, A. Cuni, M. Fijalkowski, and A. Rigo. Tracing the metalevel: PyPy's tracing JIT compiler. In Proceedings of the 4thWorkshop on the Implementation, Compilation, Optimization of Object-Oriented Languages and Programming Systems (ICOOOLPS 2009), pages 18--25, New York, NY, USA, 2009. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. C. Colby and P. Lee. Trace-based program analysis. In Proceedings of the 23rd ACM SIGACT-SIGPLAN Symposium on Principles of Programming Languages (POPL 1996), pages 195--207, New York, NY, USA, 1996. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. P. Cousot. Constructive design of a hierarchy of semantics of a transition system by abstract interpretation (extended abstract). Electronic Notes in Theoretical Computer Science, 6(0):77--102, 1997. Proceedings of the 13th Annual Conference on Mathematical Foundations of Progamming Semantics (MFPS XIII).Google ScholarGoogle ScholarCross RefCross Ref
  9. P. Cousot. Constructive design of a hierarchy of semantics of a transition system by abstract interpretation. Theoretical Computer Science, 277(1-2):47--103, 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. P. Cousot and R. Cousot. 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 1977), pages 238--252, New York, NY, USA, 1977. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. P. Cousot and R. Cousot. Systematic design of program analysis frameworks. In Proceedings of the 6th ACM SIGACT-SIGPLAN Symposium on Principles of Programming Languages (POPL 1979), pages 269--282, New York, NY, USA, 1979. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. P. Cousot and R. Cousot. Systematic design of program transformation frameworks by abstract interpretation. In Proceedings of the 29th ACM SIGACT-SIGPLAN Symposium on Principles of Programming Languages (POPL 2002), pages 178--190, New York, NY, USA, 2002. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. Mozilla Foundation. TraceMonkey. wiki.mozilla.org, October 2010.Google ScholarGoogle Scholar
  14. Mozilla Foundation. IonMonkey. wiki.mozilla.org, May 2013.Google ScholarGoogle Scholar
  15. 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. 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 2009), pages 465--478, New York, NY, USA, 2009. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. A. Gal, C.W. Probst, and M. Franz. HotPathVM: an effective JIT compiler for resource-constrained devices. In Proceedings of the 2nd International Conference on Virtual Execution Environments (VEE 2006), pages 144--153. ACM, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. S. Guo and J. Palsberg. The essence of compiling with traces. In Proceedings of the 38th ACM SIGACT-SIGPLAN Symposium on Principles of Programming Languages (POPL 2011), pages 563--574, New York, NY, USA, 2011. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. M. Handjieva and S. Tzolovski. Refining static analyses by tracebased partitioning using control flow. In Proceedings of the 5th International Static Analysis Symposium (SAS 1998), volume 1503 of LNCS, pages 200--214. Springer, 1998.Google ScholarGoogle Scholar
  19. Facebook Inc. The HipHop Virtual Machine, Facebook Engineering, December 2011.Google ScholarGoogle Scholar
  20. Google Inc. A new crankshaft for V8, The Chromium Blog, December 2010.Google ScholarGoogle Scholar
  21. Ecma International. ECMAScript Language Specification. Standard ECMA-262, Edition 5.1, June 2011.Google ScholarGoogle Scholar
  22. F. Logozzo. Class invariants as abstract interpretation of trace semantics. Computer Languages, Systems and Structures, 35(2):100--142, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. R. Milner. Communication and Concurrency. Prentice Hall, 1995. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. M. Pall. The LuaJIT Project. luajit.org, 2005.Google ScholarGoogle Scholar
  25. X. Rival. Symbolic transfer function-based approaches to certified compilation. In Proceedings of the 31st ACM SIGACT-SIGPLAN Symposium on Principles of Programming Languages (POPL 2004), New York, NY, USA, 2004. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. X. Rival and L. Mauborgne. The trace partitioning abstract domain. ACM Trans. Program. Lang. Syst., 29(5), 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. D.A. Schmidt. Trace-based abstract interpretation of operational semantics. Lisp Symb. Comput., 10(3):237--271, 1998. Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. F. Spoto and T. Jensen. Class analyses as abstract interpretations of trace semantics. ACM Trans. Program. Lang. Syst., 25(5):578--630, 2003. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Tracing compilation by abstract interpretation

              Recommendations

              Comments

              Login options

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

              Sign in

              Full Access

              • Published in

                cover image ACM SIGPLAN Notices
                ACM SIGPLAN Notices  Volume 49, Issue 1
                POPL '14
                January 2014
                661 pages
                ISSN:0362-1340
                EISSN:1558-1160
                DOI:10.1145/2578855
                Issue’s Table of Contents
                • cover image ACM Conferences
                  POPL '14: Proceedings of the 41st ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages
                  January 2014
                  702 pages
                  ISBN:9781450325448
                  DOI:10.1145/2535838

                Copyright © 2014 ACM

                Publisher

                Association for Computing Machinery

                New York, NY, United States

                Publication History

                • Published: 8 January 2014

                Check for updates

                Qualifiers

                • research-article

              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!