论文标题
在有效的JIT中正式验证的本机代码生成 - 或:将Compcert后端变成正式验证的JIT编译器
Formally Verified Native Code Generation in an Effectful JIT -- or: Turning the CompCert Backend into a Formally Verified JIT Compiler
论文作者
论文摘要
现代的即时编译器(或JIT)通常会交织几种机制来执行程序。对于更快的启动时间并观察执行的初始行为,可以最初使用解释。但是过了一会儿,jits为他们经常执行的程序的一部分动态生成本机代码。尽管一段时间是在动态编译的,但这种机制使程序执行的剩余时间更快。此类编译器是具有各种组件的复杂软件,非常依赖于执行的不同语言之间的精确相互作用,包括堆栈重置。像Compcert这样的传统静态编译器已经在证明助手中进行了机械化,但到目前为止,JIT的正式化几乎没有正式化,部分原因是它们的性质不清晰和众多组件。这项工作提出了一种模型JIT,该模型具有动态的本机代码,并在COQ中实现并正式验证。尽管JIT的某些部分无法用COQ编写,但我们提出了一种证明方法来划定,指定和理由JIT的不纯粹效果。我们认为,正式验证完整的JIT的艰巨任务应借鉴本机代码生成的现有证据。为此,我们的工作在动态汇编过程中成功重复了CompCert及其正确性证明。最后,我们的原型可以提取和执行。
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 dynamically produce native code for parts of the program they execute often. Although some time is spent compiling dynamically, this mechanism makes for much faster times for the remaining of the program execution. Such compilers are complex pieces of software with various components, and greatly rely on a precise interplay between the different languages being executed, including on-stack-replacement. Traditional static compilers like CompCert have been mechanized in proof assistants, but JITs have been scarcely formalized so far, partly due to their impure nature and their numerous components. This work presents a model JIT with dynamic generation of native code, implemented and formally verified in Coq. Although some parts of a JIT cannot be written in Coq, we propose a proof methodology to delimit, specify and reason on the impure effects of a JIT. We argue that the daunting task of formally verifying a complete JIT should draw on existing proofs of native code generation. To this end, our work successfully reuses CompCert and its correctness proofs during dynamic compilation. Finally, our prototype can be extracted and executed.