skip to main content

Formally verified speculation and deoptimization in a JIT compiler

Published:04 January 2021Publication History
Skip Abstract Section

Abstract

Just-in-time compilers for dynamic languages routinely generate code under assumptions that may be invalidated at run-time, this allows for specialization of program code to the common case in order to avoid unnecessary overheads due to uncommon cases. This form of software speculation requires support for deoptimization when some of the assumptions fail to hold. This paper presents a model just-in-time compiler with an intermediate representation that explicits the synchronization points used for deoptimization and the assumptions made by the compiler's speculation. We also present several common compiler optimizations that can leverage speculation to generate improved code. The optimizations are proved correct with the help of a proof assistant. While our work stops short of proving native code generation, we demonstrate how one could use the verified optimization to obtain significant speed ups in an end-to-end setting.

References

  1. John Aycock. 2003. A brief history of just-in-time. ACM Comput. Surv. ( 2003 ). https://doi.org/10.1145/857076.857077 Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. Clément Béra, Eliot Miranda, Marcus Denker, and Stéphane Ducasse. 2016. Practical validation of bytecode to bytecode JIT compiler dynamic deoptimization. Journal of Object Technology (JOT) 15, 2 ( 2016 ). https://doi.org/10.5381/jot. 2016. 15.2.a1 Google ScholarGoogle ScholarCross RefCross Ref
  3. Michael G. Burke, Jong-Deok Choi, Stephen Fink, David Grove, Michael Hind, Vivek Sarkar, Mauricio J. Serrano, V. C. Sreedhar, Harini Srinivasan, and John Whaley. 1999. The Jalapeño Dynamic Optimizing Compiler for Java. In ACM Conference on Java Grande (JAVA). https://doi.org/10.1145/304065.304113 Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. Project Chromium. 2020. V8 JavaScript Engine. https://chromium.googlesource.com/v8/v8.git.Google ScholarGoogle Scholar
  5. Daniele Cono D'Elia and Camil Demetrescu. 2016. Flexible on-stack replacement in LLVM. In Code Generation and Optimization (CGO). https://doi.org/10.1145/2854038.2854061 Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. Gilles Duboscq, Thomas Würthinger, Lukas Stadler, Christian Wimmer, Doug Simon, and Hanspeter Mössenböck. 2013. An Intermediate Representation for Speculative Optimizations in a Dynamic Compiler. In Virtual Machines and Intermediate Languages (VMIL). https://doi.org/10.1145/2542142.2542143 Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. Olivier Flückiger, Guido Chari, Jan Jecmen, Ming-Ho Yee, Jakob Hain, and Jan Vitek. 2019. R melts brains: an IR for ifrst-class environments and lazy efectful arguments. In International Symposium on Dynamic Languages (DLS). https: //doi.org/10.1145/3359619.3359744 Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. Olivier Flückiger, Gabriel Scherer, Ming-Ho Yee, Aviral Goel, Amal Ahmed, and Jan Vitek. 2018. Correctness of speculative optimizations with dynamic deoptimization. 2, POPL ( 2018 ). https://doi.org/10.1145/3158137 Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. A. Gal, B. Eich, M. Shaver, D. Anderson, D. Mandelin, M. R. Haghighat, B. Kaplan, G. Hoare, B. Zbarsky, J. Orendor,f 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 Programming Language Design and Implementation (PLDI). https://doi.org/10. 1145/1542476.1542528 Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. Shu-yu Guo and Jens Palsberg. 2011. The essence of compiling with traces. In Proceedings of the Symposium on Principles of Programming Languages, POPL. https://doi.org/10.1145/1926385.1926450 Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. Andreas Haas, Andreas Rossberg, Derek L Schuf, Ben L Titzer, Michael Holman, Dan Gohman, Luke Wagner, Alon Zakai, and JF Bastien. 2017. Bringing the web up to speed with WebAssembly. In Programming Language Design and Implementation (PLDI). https://doi.org/10.1145/3062341.3062363 Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. Urs Hölzle, Craig Chambers, and David Ungar. 1992. Debugging Optimized Code with Dynamic Deoptimization. In Programming Language Design and Implementation (PLDI). https://doi.org/10.1145/143095.143114 Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. Urs Hölzle and David Ungar. 1994. A Third-generation SELF Implementation: Reconciling Responsiveness with Performance. In Object-oriented Programming Systems, Language, and Applications (OOPSLA). https://doi.org/10.1145/191080.191116 Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. Nurudeen A. Lameed and Laurie J. Hendren. 2013. A Modular Approach to On-stack Replacement in LLVM. In Virtual Execution Environments (VEE). https://doi.org/10.1145/2451512.2451541 Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. Xavier Leroy. 2006. Formal certification of a compiler back-end, or: programming a compiler with a proof assistant. In Principles of Programming Languages (POPL). https://doi.org/10.1145/1111037.1111042 Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. Xavier Leroy. 2009. A formally verified compiler back-end. Journal of Automated Reasoning 43, 4 ( 2009 ), 363-446.Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. Magnus Myreen. 2010. Verified Just-in-time Compiler on x86. In Principles of Programming Languages (POPL). https: //doi.org/10.1145/1706299.1706313 Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. Michael Paleczny, Christopher Vick, and Clif Click. 2001. The Java Hotspot Server Compiler. In Java Virtual Machine Research and Technology (JVM). http://www.usenix.org/events/jvm01/full_papers/paleczny/paleczny.pdfGoogle ScholarGoogle Scholar
  19. Jaroslav Sevcík, Viktor Vafeiadis, Francesco Zappa Nardelli, Suresh Jagannathan, and Peter Sewell. 2013. CompCertTSO: A Verified Compiler for Relaxed-Memory Concurrency. J. ACM 60, 3 ( 2013 ), 22 : 1-22 : 50. https://doi.org/10.1145/2487241. 2487248 Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. Youngju Song, Minki Cho, Dongjoo Kim, Yonghyun Kim, Jeehoon Kang, and Chung-Kil Hur. 2019. CompCertM: CompCert with C-Assembly Linking and Lightweight Modular Verification. Proc. ACM Program. Lang. 4, POPL, Article 23 ( Dec. 2019 ), 31 pages. https://doi.org/10.1145/3371091 Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Formally verified speculation and deoptimization in a JIT compiler

      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

      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!