Compositional CompCert is a respecification and proof of CompCert 2.1 (http://compcert.inria.fr/) to support compositional separate compilation.
The files are distributed as a modification of standard CompCert 2.1: The compiler files are the same but there are two sets of proofs, one for standard CompCert and the second for Compositional CompCert. Both sets of proofs are buildable.
In general, files suffixed *_coop.v
and *_eff.v
are the compositional
variants of standard CompCert intermediate language semantics (*_coop.v
is the
base interaction semantics of a given IL; *_eff.v
is the effectful version).
Files suffixed *_comp.v
, for "compositional," are the compositional variants of the standard
CompCert proofs. The compositional proofs can typically be found in the same
directory as their standard CompCert counterparts.
Compositional CompCert builds under:
- Coq 8.4pl4 (http://coq.inria.fr/),
- Ssreflect 1.5 (http://ssr.msr-inria.inria.fr/), and
- MathComp 1.5 (http://ssr.msr-inria.inria.fr/).
If you do not have Ssreflect+MathComp, you should be able to build everything
but the files in the linking/
subdirectory (horizontal composition/proofs)
but we make no guarantees.
To build, clone the repository, go to the root directory, and type:
./configure ia32-linux
make
To install the ccomp
binary and runtime libraries system-wide,
type make install
as root
.
If your Ssreflect or MathComp are installed in a nonstandard place (e.g., in
your home directory rather than system-wide), edit variables SSREFLECT
and
MATHCOMP
in the Makefile to point to the appropriate installation directories.
Otherwise, leave both SSREFLECT
and MATHCOMP
equal the empty string ""
.
An HTML rendering of the code is browsable at:
In the cfrontend/
and backend/
directories, source and target language
definitions used in each phase are generally suffixed *_eff.v
(often importing
files suffixed *_coop.v
). The compositional compiler correctness proofs are
suffixed *_comp.v
, to distinguish from the standard CompCert proofs.
-
driver/CompositionalCompiler.v
Proves Theorem 3 (Section 6).
-
linking/CompositionalComplements.v
Proves Corollary 2 (Section 6).
C frontend compiler phases and proofs:
- SimplLocals
- Cshmgen
- Cminorgen
Backend compiler phases and proofs:
- Selection
- RTLgen
- Tailcall
- Renumbering
- Allocation
- Tunneling
- Linearize
- CleanupLabels
- Stacking
- Asmgen
Proof that CompCert IA32 Asm is a "nucular" semantics:
Interaction Semantics of the intermediate languages used in Compositional CompCert.
- Clight
- Csharpminor
- Cminor
- CminorSel
- RTL
- LTL
- Linear
- Mach
- IA32 Asm
-
Defines Interaction Semantics (Section 2).
-
Defines Structured Injections (Section 4).
-
Defines Structured Simulations (Section 4). Concordance for this file:
replace_locals
is the function namedexport
in the paper.replace_externs
is the function namedimport
in the paper.
-
Various derived structured simulations, specialized for particular use cases.
-
Proves Theorem 1 (Section 5), that simulations compose vertically. The main subproofs are:
- internal_diagram_trans.v proves transitivity of the internal step diagram.
- interpolation_II.v proves the interpolation lemma required to prove transitivity of the external step diagram.
-
Defines a variant of simulations suitable for closed programs.
-
Corollaries of closed program simulation.
-
Defines the reach-closure operation used in Structured Simulations and Reach-Closed Semantics.
-
Proves a number of rely-guarantee compatibility lemmas used in the linking proof.
-
A notion of Interaction Semantics that never store invalid pointers in memory. Why "nucular"? We call the memory invariant that is preserved by such semantics the "WMD" condition, as defined in file mem_welldefined.v.
-
Defines Linking Semantics (Section 3). The linking semantics (\mathcal{L}) is defined twice: First as a function (to Prop), and then as an inductive relation. The two versions are proved to coincide.
-
A few lemmas on linking semantics.
-
States Theorem 2 (Section 5).
-
States the main linking simulation invariant, used to prove Theorem 2. Subsidiary files include: linking/disjointness.v.
-
Proves Theorem 2 (Section 5). The two main subproofs (for the call and return cases, respectively) are:
-
Defines Reach-Closed Semantics (Section 5). The definition has been weakened slightly since the POPL submission, to facilitate the proof, in
linking/safe_clight_rc.v
, that all safe Clight programs are RC. -
Lemmas on Reach-Closed Semantics.
-
Proves that all safe Clight programs are RC (a new theorem not in the paper). This is a slightly counterintuitive result that relies on the fact that safe Clight programs cannot fabricate pointers (recall that even in C, casting integers to pointers is only implementation-defined).
-
Defines Reach-Closed Contextual Equivalence and proves Corollary 1 (Section 5).
-
Demonstrates one way in which to construct an interaction semantics that is just a mathematical relation in Gallina.
-
Lemmas concerning reachability.
-
Lemmas about well-founded orders.