Skip to content

Commit 5685b3d

Browse files
authored
Merge pull request #95 from CertiCoq/coq8.19
Coq 8.19 compatibility
2 parents 7f3785a + da098e6 commit 5685b3d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+671
-653
lines changed

.github/workflows/build.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
opam_file:
2020
- 'coq-certicoq.opam'
2121
image:
22-
- 'yforster/coq:8.17.0--clang-11--compcert-3.12--extlib-0.11.8--equations-1.3--elpi.1.17.1-metacoq-v1.3-8.17'
22+
- 'yforster/coq:8.19.1--clang-11--compcert-3.13.1--extlib-0.12.1--equations-1.3--metacoq-1.3.1'
2323
fail-fast: false # don't stop jobs if one fails
2424
steps:
2525
- uses: actions/checkout@v3
@@ -51,6 +51,6 @@ jobs:
5151
make -C ~/repo/benchmarks all
5252
endGroup
5353
startGroup "Test bootstrapped plugins"
54-
cd repo && ./configure.sh global
54+
cd ~/repo && ./configure.sh global
5555
make -C ~/repo/bootstrap test
5656
endGroup

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -137,3 +137,5 @@ bootstrap/certicoqc/CertiCoq.CertiCoqC.CertiCoqC.certicoqc.c
137137
bootstrap/certicoqc/CertiCoq.CertiCoqC.CertiCoqC.certicoqc.h
138138
bootstrap/certicoqc/tests/test.demo1.c
139139
bootstrap/certicoqc/tests/test.demo1.h
140+
plugin/.filestoinstall
141+
cplugin/.merlin

benchmarks/certicoq_eval.v

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
From Equations Require Import Equations.
22
From Coq Require Import Uint63 Wf_nat ZArith Lia Arith.
33
From CertiCoq Require Import CertiCoq.
4-
4+
CertiCoq -help.
55
Set CertiCoq Build Directory "_build".
66

77
(* This warns about uses of primitive operations, but we compile them fine *)
@@ -13,8 +13,8 @@ Program Definition long_vector n : Vector.t nat n :=
1313
Vector.of_list (List.repeat 1000 n).
1414
Next Obligation. now rewrite List.repeat_length. Qed.
1515

16-
Definition silent_long_vector := 0.
17-
(* Vector.eqb _ Nat.eqb (long_vector 5000) (long_vector 5000). *)
16+
Definition silent_long_vector :=
17+
Vector.eqb _ Nat.eqb (long_vector 5000) (long_vector 5000).
1818

1919
(* Time Eval vm_compute in silent_long_vector. (* Blows up *) *)
2020
(* 1.23s *)
@@ -68,7 +68,7 @@ CertiCoq Eval -time sha_fast_noproofs.
6868
(* Executed in 0.037175 sec *)
6969

7070
Time CertiCoq Eval sha_fast_noproofs.
71-
(* Finished transaction in 0.06 sec *)
71+
(* Finished transaction in 0.02 sec *)
7272

7373
CertiCoq Eval -time sha_fast_noproofs.
7474
(* Executed in 0.045 sec *)
@@ -106,9 +106,9 @@ Definition vs_hard :=
106106
(* Blows up *) Time Eval vm_compute in vs_hard.
107107
*)
108108

109-
(* CertiCoq Eval -time vs_hard. *)
109+
CertiCoq Eval -time vs_hard.
110110
(* Executed in 0.06s *)
111-
(* CertiCoq Eval -time vs_hard. *)
111+
CertiCoq Eval -time vs_hard.
112112

113113
(* CertiCoq Eval -time vs_easy. *)
114114
(* Executed in 0.007s *)

benchmarks/lib/Binom.v

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
Require Import Coq.Arith.Arith
2-
Coq.Numbers.Natural.Peano.NPeano
3-
List.
1+
Require Import Coq.Arith.Arith List.
42

53
Import ListNotations.
64
Import Nat. (* For 8.5.0 *)

benchmarks/lib/Makefile

+45-27
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
## # GNU Lesser General Public License Version 2.1 ##
88
## # (see LICENSE file for the text of the license) ##
99
##########################################################################
10-
## GNUMakefile for Coq 8.17.0
10+
## GNUMakefile for Coq 8.19.1
1111

1212
# For debugging purposes (must stay here, don't move below)
1313
INITIAL_VARS := $(.VARIABLES)
@@ -278,7 +278,7 @@ COQDOCLIBS?=$(COQLIBS_NOML)
278278
# The version of Coq being run and the version of coq_makefile that
279279
# generated this makefile
280280
COQ_VERSION:=$(shell $(COQC) --print-version | cut -d " " -f 1)
281-
COQMAKEFILE_VERSION:=8.17.0
281+
COQMAKEFILE_VERSION:=8.19.1
282282

283283
# COQ_SRC_SUBDIRS is for user-overriding, usually to add
284284
# `user-contrib/Foo` to the includes, we keep COQCORE_SRC_SUBDIRS for
@@ -293,18 +293,26 @@ CAMLDOCFLAGS:=$(filter-out -annot, $(filter-out -bin-annot, $(CAMLFLAGS)))
293293
CAMLFLAGS+=$(OCAMLWARN)
294294

295295
ifneq (,$(TIMING))
296-
TIMING_ARG=-time
297-
ifeq (after,$(TIMING))
298-
TIMING_EXT=after-timing
296+
ifeq (after,$(TIMING))
297+
TIMING_EXT=after-timing
298+
else
299+
ifeq (before,$(TIMING))
300+
TIMING_EXT=before-timing
301+
else
302+
TIMING_EXT=timing
303+
endif
304+
endif
305+
TIMING_ARG=-time-file $<.$(TIMING_EXT)
299306
else
300-
ifeq (before,$(TIMING))
301-
TIMING_EXT=before-timing
302-
else
303-
TIMING_EXT=timing
304-
endif
307+
TIMING_ARG=
305308
endif
309+
310+
ifneq (,$(PROFILING))
311+
PROFILE_ARG=-profile $<.prof.json
312+
PROFILE_ZIP=gzip $<.prof.json
306313
else
307-
TIMING_ARG=
314+
PROFILE_ARG=
315+
PROFILE_ZIP=true
308316
endif
309317

310318
# Files #######################################################################
@@ -592,13 +600,24 @@ beautify: $(BEAUTYFILES)
592600
# There rules can be extended in Makefile.local
593601
# Extensions can't assume when they run.
594602

603+
# We use $(file) to avoid generating a very long command string to pass to the shell
604+
# (cf https://coq.zulipchat.com/#narrow/stream/250632-Coq-Platform-devs-.26-users/topic/Strange.20command.20length.20limit.20on.20Linux)
605+
# However Apple ships old make which doesn't have $(file) so we need a fallback
606+
$(file >.hasfile,1)
607+
HASFILE:=$(shell if [ -e .hasfile ]; then echo 1; rm .hasfile; fi)
608+
609+
MKFILESTOINSTALL= $(if $(HASFILE),$(file >.filestoinstall,$(FILESTOINSTALL)),\
610+
$(shell rm -f .filestoinstall) \
611+
$(foreach x,$(FILESTOINSTALL),$(shell printf '%s\n' "$x" >> .filestoinstall)))
612+
595613
# findlib needs the package to not be installed, so we remove it before
596614
# installing it (see the call to findlib_remove)
597615
install: META
598-
$(HIDE)code=0; for f in $(FILESTOINSTALL); do\
616+
@$(MKFILESTOINSTALL)
617+
$(HIDE)code=0; for f in $$(cat .filestoinstall); do\
599618
if ! [ -f "$$f" ]; then >&2 echo $$f does not exist; code=1; fi \
600619
done; exit $$code
601-
$(HIDE)for f in $(FILESTOINSTALL); do\
620+
$(HIDE)for f in $$(cat .filestoinstall); do\
602621
df="`$(COQMKFILE) -destination-of "$$f" $(COQLIBS)`";\
603622
if [ "$$?" != "0" -o -z "$$df" ]; then\
604623
echo SKIP "$$f" since it has no logical path;\
@@ -611,6 +630,7 @@ install: META
611630
$(call findlib_remove)
612631
$(call findlib_install, META $(FINDLIBFILESTOINSTALL))
613632
$(HIDE)$(MAKE) install-extra -f "$(SELF)"
633+
@rm -f .filestoinstall
614634
install-extra::
615635
@# Extension point
616636
.PHONY: install install-extra
@@ -642,18 +662,20 @@ install-doc:: html mlihtml
642662

643663
uninstall::
644664
@# Extension point
665+
@$(MKFILESTOINSTALL)
645666
$(call findlib_remove)
646-
$(HIDE)for f in $(FILESTOINSTALL); do \
667+
$(HIDE)for f in $$(cat .filestoinstall); do \
647668
df="`$(COQMKFILE) -destination-of "$$f" $(COQLIBS)`" &&\
648669
instf="$(COQLIBINSTALL)/$$df/`basename $$f`" &&\
649670
rm -f "$$instf" &&\
650671
echo RM "$$instf" ;\
651672
done
652-
$(HIDE)for f in $(FILESTOINSTALL); do \
673+
$(HIDE)for f in $$(cat .filestoinstall); do \
653674
df="`$(COQMKFILE) -destination-of "$$f" $(COQLIBS)`" &&\
654675
echo RMDIR "$(COQLIBINSTALL)/$$df/" &&\
655676
(rmdir "$(COQLIBINSTALL)/$$df/" 2>/dev/null || true); \
656677
done
678+
@rm -f .filestoinstall
657679

658680
.PHONY: uninstall
659681

@@ -784,12 +806,6 @@ $(filter-out $(MLLIBFILES:.mllib=.cmxs) $(MLPACKFILES:.mlpack=.cmxs) $(addsuffix
784806
$(HIDE)$(TIMER) $(CAMLOPTLINK) $(CAMLDEBUG) $(CAMLFLAGS) $(FINDLIBPKGS) \
785807
-shared -o $@ $<
786808

787-
ifneq (,$(TIMING))
788-
TIMING_EXTRA = > $<.$(TIMING_EXT)
789-
else
790-
TIMING_EXTRA =
791-
endif
792-
793809
# can't make
794810
# https://www.gnu.org/software/make/manual/make.html#Static-Pattern
795811
# work with multiple target rules
@@ -800,20 +816,22 @@ ifneq (,$(filter grouped-target,$(.FEATURES)))
800816
define globvorule=
801817

802818
# take care to $$ variables using $< etc
803-
$(1).vo $(1).glob &: $(1).v | $(VDFILE)
804-
$(SHOW)COQC $(1).v
805-
$(HIDE)$$(TIMER) $(COQC) $(COQDEBUG) $(TIMING_ARG) $(COQFLAGS) $(COQLIBS) $(1).v $$(TIMING_EXTRA)
819+
$(1).vo $(1).glob &: $(1).v | $$(VDFILE)
820+
$$(SHOW)COQC $(1).v
821+
$$(HIDE)$$(TIMER) $$(COQC) $$(COQDEBUG) $$(TIMING_ARG) $$(PROFILE_ARG) $$(COQFLAGS) $$(COQLIBS) $(1).v
822+
$$(HIDE)$$(PROFILE_ZIP)
806823
ifeq ($(COQDONATIVE), "yes")
807-
$(SHOW)COQNATIVE $(1).vo
808-
$(HIDE)$(call TIMER,$(1).vo.native) $(COQNATIVE) $(COQLIBS) $(1).vo
824+
$$(SHOW)COQNATIVE $(1).vo
825+
$$(HIDE)$$(call TIMER,$(1).vo.native) $$(COQNATIVE) $$(COQLIBS) $(1).vo
809826
endif
810827

811828
endef
812829
else
813830

814831
$(VOFILES): %.vo: %.v | $(VDFILE)
815832
$(SHOW)COQC $<
816-
$(HIDE)$(TIMER) $(COQC) $(COQDEBUG) $(TIMING_ARG) $(COQFLAGS) $(COQLIBS) $< $(TIMING_EXTRA)
833+
$(HIDE)$(TIMER) $(COQC) $(COQDEBUG) $(TIMING_ARG) $(PROFILE_ARG) $(COQFLAGS) $(COQLIBS) $<
834+
$(HIDE)$(PROFILE_ZIP)
817835
ifeq ($(COQDONATIVE), "yes")
818836
$(SHOW)COQNATIVE $@
819837
$(HIDE)$(call TIMER,[email protected]) $(COQNATIVE) $(COQLIBS) $@

bootstrap/certicoqc/Makefile

+13-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,15 @@
22
CCOMPILER := $(shell { command -v clang-11 || command -v clang || command -v gcc; } 2>/dev/null)
33
# clang options
44
CCOMPILEROPTS = -fPIC -fomit-frame-pointer -g -c -I . -I $(RUNTIME_DIR) -I ${OCAMLLIB} -w -Wno-everything -O2
5+
UNAME=$(shell uname -s)
6+
ifeq '$(UNAME)' 'Darwin'
7+
SED= $(shell which gsed)
8+
ifeq '$(SED)' ''
9+
$(error "Must have gsed installed on MacOS, try e.g. brew install gsed")
10+
endif
11+
else
512
SED=`which gsed || which sed`
13+
endif
614

715
# CompCert compiler
816
CCOMPCOMPILER := $(CCOMPILER)
@@ -35,8 +43,12 @@ ifeq '$(CERTICOQ_CONFIG)' 'local'
3543

3644
TESTCOQOPTS = $(COQOPTS)
3745
else
46+
ifeq '$(CERTICOQ_CONFIG)' 'global'
3847
COQOPTS = -I . -Q theories CertiCoq.CertiCoqC
3948
TESTCOQOPTS =
49+
else
50+
$(error "Must first set CERTICOQ_CONFIG by running ./configure.sh")
51+
endif
4052
endif
4153

4254
PKGS = -package coq-core,coq-core.clib,coq-core.config,coq-core.engine,coq-core.gramlib,coq-core.interp,coq-core.kernel,coq-core.lib,coq-core.library,coq-core.toplevel,coq-core.vernac,coq-core.plugins.ltac
@@ -127,4 +139,4 @@ install: theories/compile.vo certicoqc_plugin.cmxs
127139

128140
.PHONY: plugin test
129141

130-
.NOTPARALLEL:
142+
.NOTPARALLEL:

coq-certicoq.opam

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
opam-version: "2.0"
2-
version: "dev+8.17"
2+
version: "dev+8.19"
33
maintainer: "The CertiCoq Team"
44
homepage: "https://certicoq.org/"
55
dev-repo: "git+https://github.com/CertiCoq/certicoq"
@@ -33,12 +33,12 @@ depends: [
3333
"ocaml"
3434
"conf-clang"
3535
"stdlib-shims"
36-
"coq" {>= "8.17" & < "8.18~"}
37-
"coq-compcert" {= "3.12"}
38-
"coq-equations" {= "1.3+8.17"}
39-
"coq-metacoq-erasure-plugin" {= "8.17.dev"}
40-
"coq-metacoq-safechecker-plugin" {= "8.17.dev"}
41-
"coq-ext-lib" {>= "0.11.8"}
36+
"coq" {>= "8.19" & < "8.20~"}
37+
"coq-compcert" {= "3.13.1"}
38+
"coq-equations" {= "1.3+8.19"}
39+
"coq-metacoq-erasure-plugin" {= "1.3.1+8.19"}
40+
"coq-metacoq-safechecker-plugin" {= "1.3.1+8.19"}
41+
"coq-ext-lib" {>= "0.12"}
4242
]
4343

4444
synopsis: "A Verified Compiler for Gallina, Written in Gallina "

cplugin/CoqMsgFFI.v

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ CertiCoq Register [
1111
coq_msg_notice => "coq_msg_notice",
1212
coq_msg_debug => "coq_msg_debug",
1313
coq_user_error => "coq_user_error" ]
14-
Include [ "coq_c_ffi.h" "coq_ffi.h" as library ].
14+
Include [ Library "coq_c_ffi.h" "coq_ffi.h" ].

cplugin/Makefile.local

+3-2
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,13 @@ CAMLFLAGS+=-w -32 # Unused values
77
CAMLFLAGS+=-w -39 # Unused rec flagss
88
CAMLFLAGS+=-w -20 # Unused arguments
99
CAMLFLAGS+=-w -60 # Unused functor arguments
10-
CAMLPKGS+=-package coq-metacoq-template-ocaml.plugin,stdlib-shims
10+
CAMLPKGS += -package coq-metacoq-template-ocaml.plugin,stdlib-shims
1111

1212
CC=$(shell which gcc || which clang-11)
1313

1414
merlin-hook::
15-
$(HIDE)echo 'FLG $(OPENS)' >> .merlin
15+
$(HIDE)echo 'PKG coq-metacoq-template-ocaml.plugin' >> .merlin
16+
$(HIDE)echo 'PKG stdlib-shims' >> .merlin
1617

1718
get_ordinal.o: get_ordinal.c
1819
$(CC) -c -o $@ -I runtime $<

cplugin/PrimFloats.v

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@ CertiCoq Register [
2020
Coq.Floats.PrimFloat.of_uint63 => "prim_float_of_uint63" with tinfo,
2121
Coq.Floats.PrimFloat.next_up => "prim_float_next_up" with tinfo,
2222
Coq.Floats.PrimFloat.next_down => "prim_float_next_down" with tinfo ]
23-
Include [ "prim_floats.h" as library ].
23+
Include [ Library "prim_floats.h" ].

cplugin/PrimInt63.v

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,4 @@ CertiCoq Register [
2727
Coq.Numbers.Cyclic.Int63.PrimInt63.lor => "prim_int63_lor",
2828
Coq.Numbers.Cyclic.Int63.PrimInt63.lxor => "prim_int63_lxor"
2929
]
30-
Include [ "prim_int63.h" as library ].
30+
Include [ Library "prim_int63.h" ].

0 commit comments

Comments
 (0)