Formally Verified Native Code Generation in an Effectful JIT – or: Turning the CompCert Backend into a Formally Verified JIT Compiler

12/06/2022
by   Aurèle Barrière, et al.
0

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.

READ FULL TEXT
research
04/06/2020

Bringing GNU Emacs to Native Code

Emacs Lisp (Elisp) is the Lisp dialect used by the Emacs text editor fam...
research
08/02/2018

Debugging Native Extensions of Dynamic Languages

Many dynamic programming languages such as Ruby and Python enable develo...
research
07/12/2019

Verified Self-Explaining Computation

Common programming tools, like compilers, debuggers, and IDEs, crucially...
research
10/05/2020

Sampling Optimized Code for Type Feedback

To efficiently execute dynamically typed languages, many language implem...
research
06/21/2023

Coqlex: Generating Formally Verified Lexers

A compiler consists of a sequence of phases going from lexical analysis ...
research
05/02/2022

A fast in-place interpreter for WebAssembly

WebAssembly (Wasm) is a compact, well-specified bytecode format that off...
research
05/04/2021

Simple, Light, Yet Formally Verified, Global Common Subexpression Elimination and Loop-Invariant Code Motion

We present an approach for implementing a formally certified loop-invari...

Please sign up or login with your details

Forgot password? Click here to reset