-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update to Coq 8.14 #39
Conversation
I guess @andrew-appel knows best how to update the compcert/ directory for compatibility with 8.14.0, that's the only missing bit now. |
We should move to CompCert 3.9, which builds in Coq 8.14, instead of CompCert 3.5, which is (apparently) what's in certicoq/compcert right now. It looks like there's a certicoq branch called compcert-3.7. Perhaps this is a good start. Between CompCert 3.7 and CompCert 3.9, in the subset of the CompCert files that we have here, there is only a very small change (a boolean attribute field has become an option, easy to adapt to). We should also consider accessing the flocq library directly through opam, instead of copying flocq into a subdirectory of compcert. This feature of CompCert is called "external flocq", and was not available in CompCert 3.5. I do not suggest moving to CompCert 3.10 at this time, because it will require a bit more work to achieve compatibility with CompCert 3.10's new representation of structure fields. |
Ok, I've updated the compcert files to 3.9 and tried to keep the same subset as before. I installed coq-flocq-3.4.2 from opam and removed the flocq/ directory as well. I could adapt the compiler .v files relatively easily and the printClight / printAST functionality as well. The plugin compiles now and in benchmarks/tests.v runs to completion but I couldn't test the generated code. I had to make one change in the extracted code I'm unsure about, while cutting a new dependency on
I modifed it to have |
I think |
The CI is all green now, but that doesn't mean that certicoq works, I don't know if it would be preferable to merge now (so we can all move to 8.14) or wait until someone can check that it behaves properly. |
I pulled the branch last night and setup a new opam switch. Confirmed that everything builds; will deep dive into the tests (+ uvrooster) tonight or tomorrow Copy/paste setup commands for anyone else following along: opam switch create coq-8.14 ocaml-system
eval $(opam env)
opam repo --switch=coq-8.14 add coq-released https://coq.inria.fr/opam/released
opam update --switch=coq-8.14
opam install --switch=coq-8.14 coq.8.14.0 coq-flocq.3.4.2
git clone [email protected]:mattam82/certicoq.git
cd certicoq
git checkout -b master-coq-8.14
git pull origin master-coq-8.14
git submodule update --init --recursive
pushd submodules/Equations
opam install --switch=coq-8.14 ./coq-equations.opam
popd
pushd submodules/coq-ext-lib
opam install --switch=coq-8.14 ./coq-ext-lib.opam
popd
pushd submodules/metacoq
opam install --switch=coq-8.14 ./*.opam
popd
opam exec --switch=coq-8.14 -- make -j 4
opam exec --switch=coq-8.14 -- make plugin |
I tested the The build fails for demo1.c but I suspect the fix will be easy. The error can be replicated by applying the
|
@intoverflow I'm getting PHP flashbacks :) Jokes aside, this can be fixed by either
|
@joomy I think there's more going on here. I just tried both of the proposes fixes but neither works. Would you mind taking a look? Are we mixing
|
Definition generate_printer |
Here we declare v
:
Line 544 in 6cda38e
_v <- gensym "v" ;; |
Here we use it as an Evar
:
Line 709 in 6cda38e
(Evar _v val :: nil) ;;; |
Here we use it as an Etempvar
:
Line 727 in 6cda38e
((Etempvar _v val) :: nil) ;;; |
The problem is not unique to the printing functions
Here is some C code from the benchmarks (CertiCoq.Benchmarks.tests.demo1.c
). Note that sometimes l1_113
has $
, but not always:
void app_uncurried_102(struct thread_info *$tinfo, unsigned long long $m_111, unsigned long long $l_112)
{
unsigned long long l1_113;
unsigned long long a_114;
unsigned long long y_115;
unsigned long long y_116;
struct stack_frame frame;
unsigned long long root[2];
unsigned long long *alloc;
unsigned long long *limit;
unsigned long long *args;
_Bool arg;
$alloc = (*$tinfo).alloc;
$limit = (*$tinfo).limit;
$args = (*$tinfo).args;
frame.next = root;
frame.root = root;
frame.prev = (*$tinfo).fp;
if ((l_112 & 1) == 0) {
switch (*((unsigned long long *) $l_112 + 18446744073709551615LLU)
& 255LLU) {
default:
$l1_113 = *((unsigned long long *) $l_112 + 0LLU);
@mattam82 Thank you again for putting this together. I have diagnosed and fixed the issues in the code generator (see branch https://github.com/CertiCoq/certicoq/tree/coq-8.14/main). With those fixes now in place, I can confirm that your PR works as intended. In the interest of moving fast, I will merge your PR then follow-up with a separate PR for the fixes. |
This is a WIP PR to update CertiCoq to the latest MetaCoq (with the change of case representation) and Coq 8.14.
I managed to adapt most of the pipeline including the L6 prototype generation.
-
I have tested check_roundtrip works in Prototype.v and tried my best to fix gen_case_tree but some bug must have been introduced still. @joom or @john-ml could you have a look?-Also, I don't know how to resolve the problem with the dependency on flocq+compcert, maybe VST wizards can tell me as we are apparently using the same trick there.
I updated the submodules so you can get the same working environment as myself if you want to test it.
In general, things are simplified for CertiCoq: we no longer need the case branches expansion and stripping we used to do, so we have one phase less (L3->L3_eta disappears, and L3_eta->L4 is simpler).