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.
- John Aycock. 2003. A brief history of just-in-time. ACM Comput. Surv. ( 2003 ). https://doi.org/10.1145/857076.857077 Google Scholar
Digital Library
- 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 Scholar
Cross Ref
- 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 Scholar
Digital Library
- Project Chromium. 2020. V8 JavaScript Engine. https://chromium.googlesource.com/v8/v8.git.Google Scholar
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- Xavier Leroy. 2009. A formally verified compiler back-end. Journal of Automated Reasoning 43, 4 ( 2009 ), 363-446.Google Scholar
Digital Library
- Magnus Myreen. 2010. Verified Just-in-time Compiler on x86. In Principles of Programming Languages (POPL). https: //doi.org/10.1145/1706299.1706313 Google Scholar
Digital Library
- 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 Scholar
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
Index Terms
Formally verified speculation and deoptimization in a JIT compiler
Recommendations
Formally Verified Native Code Generation in an Effectful JIT: Turning the CompCert Backend into a Formally Verified JIT Compiler
Modern Just-in-Time compilers (or JITs) typically interleave several mechanisms to execute a program. For faster startup times and to observe the initial behavior of an execution, interpretation can be initially used. But after a while, JITs ...
A formally verified compiler for Lustre
PLDI '17The correct compilation of block diagram languages like Lustre, Scade, and a discrete subset of Simulink is important since they are used to program critical embedded control software. We describe the specification and verification in an Interactive ...
Synthesizing JIT Compilers for In-Kernel DSLs
Computer Aided VerificationAbstractModern operating systems allow user-space applications to submit code for kernel execution through the use of in-kernel domain specific languages (DSLs). Applications use these DSLs to customize system policies and add new functionality. For ...






Comments