具有动态去优化的推测优化的正确性
Correctness of Speculative Optimizations with Dynamic Deoptimization
摘要:
高性能的动态语言实现大量使用推测性优化,以达到接近静态编译语言的速度。这些优化通常由实时编译器执行,该编译器在一组关于程序状态及其环境的假设下生成代码。在某些情况下,程序可以执行在不再有效的假设下编译的代码。然后,实现必须在运行中对程序进行去优化;这需要找到不依赖于无效假设的语义等效代码,将程序状态转换为目标代码所期望的状态,并转移控制。本文着眼于优化和去优化之间的相互作用,并表明,推理投机是令人惊讶的容易时,假设是明确的程序表示。这种见解是证明了编译器的中间表示,命名为\sourir,建模后的动态语言的高层次表示。传统的编译器优化,如常数折叠,死代码消除,函数内联被证明是正确的存在的假设。此外,本文还建立了特定于去优化的编译器转换的正确性:即无限制去优化,谓词提升和假设组合。
英文摘要:
High-performance dynamic language implementations make heavy use of speculative optimizations to achieve speeds close to statically compiled languages. These optimizations are typically performed by a just-in-time compiler that generates code under a set of assumptions about the state of the program and its environment. In certain cases, a program may execute code compiled under assumptions that are no longer valid. The implementation must then deoptimize the program on-the-fly; this entails finding semantically equivalent code that does not rely on invalid assumptions, translating program state to that expected by the target code, and transferring control. This paper looks at the interaction between optimization and deoptimization, and shows that reasoning about speculation is surprisingly easy when assumptions are made explicit in the program representation. This insight is demonstrated on a compiler intermediate representation, named \sourir, modeled after the high-level representation for a dynamic language. Traditional compiler optimizations such constant folding, dead code elimination, and function inlining are shown to be correct in the presence of assumptions. Furthermore, the paper establishes the correctness of compiler transformations specific to deoptimization: namely unrestricted deoptimization, predicate hoisting, and assume composition.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。