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.
翻译:现代 Just- 时间编译者( 或 JITs) 通常在多个机制间隔, 以实施程序。 为了更快的启动时间和观察执行的初始行为, 最初可以使用翻译。 但是经过一段时间后, JITs 动态地为它们经常执行的部分程序制作本地代码。 虽然有些时间被动态地用在编译中, 但这个机制可以让剩余程序执行的时间更快得多。 这些编译者是包含不同组成部分的复杂软件, 并且非常依赖所执行的不同语言之间的精确互动, 包括堆叠更换。 ConcomCert等传统静态编译者已经被机械化成证据助理, 但迄今为止, JITs 很少被正式化, 部分原因是它们的不纯性及其众多组成部分。 这项工作展示了一个具有动态版本的JIT 本地代码的模型, 在 Coq 中实施并正式核实。 虽然 JIT 部分内容无法在 Coq 书写成, 但是我们提出了一种界定、 和解释 JIT 的精准性效果的证明。