Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ compcert/test/
*.prof.json.gz
*.v.d
.depend
.depend-files
.loadpath
.loadpath-export
version.v
Expand Down
101 changes: 86 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,20 @@ COMPCERT ?= bundled
ZLIST ?= bundled
ARCH ?=
BITSIZE ?= 64
ATOMIC_MACHINE ?= true
# detects change
DEPEND_FILE = .depend

# Currently only supports bundled compcert. cascompcert shares common files in
# VST/compcert, so when cascompcert is used as a dependency of VST, for those
# commmon files, it uses the VST copy over the cascompcert copy, including
# flocq.
ifeq ($(ATOMIC_MACHINE),true)
ifneq ($(COMPCERT),bundled)
$(error ATOMIC_MACHINE=true requires COMPCERT=bundled)
endif
override FLOCQ = bundled
endif

# # Internal variables #
# Set to true if the bundled CompCert is used
Expand Down Expand Up @@ -305,6 +319,20 @@ else
EXTFLAGS=
endif

# Make CASCompCert's concurrency modules available to VST while retaining the
# bundled CompCert load path.
# This must match cascompcert's FOR_VST=true load path.
ifeq ($(ATOMIC_MACHINE),true)
CASCOMPCERT_R_FLAGS = \
-R cascompcert/x86_cas compcert.x86 \
-R cascompcert/cfrontend_cas compcert.cfrontend \
-R cascompcert/backend compcert.backend \
-R cascompcert/driver compcert.driver \
-R cascompcert/concurrency compcert.concurrency
COMPCERT_R_FLAGS += $(CASCOMPCERT_R_FLAGS)
EXTFLAGS += $(CASCOMPCERT_R_FLAGS)
endif

# Compcert Clightgen flags

CGFLAGS = -DCOMPCERT -short-idents
Expand Down Expand Up @@ -409,6 +437,7 @@ $(info COMPCERT_INFO_PATH_REF=$(COMPCERT_INFO_PATH_REF))
$(info COMPCERT_EXPLICIT_PATH=$(COMPCERT_EXPLICIT_PATH))
$(info COMPCERT_BUILD_FROM_SRC=$(COMPCERT_BUILD_FROM_SRC))
$(info COMPCERT_NEW=$(COMPCERT_NEW))
$(info ATOMIC_MACHINE=$(ATOMIC_MACHINE))
$(info COQFLAGS=$(COQFLAGS))
$(info COMPCERT_R_FLAGS=$(COMPCERT_R_FLAGS))
$(info FLOCQ=$(FLOCQ))
Expand Down Expand Up @@ -768,6 +797,33 @@ endif

# ########## Targets ##########

# Compile CASCompCert targets with its own dependency graph while sharing the
# bundled VST/compcert tree. The force prerequisite makes the child Makefile,
# rather than this wrapper, decide whether an existing .vo is current.
CASCOMPCERT_MAKE = $(MAKE) -C cascompcert FOR_VST=true \
ARCH=$(ARCH) BITSIZE=$(BITSIZE) LIBRARY_FLOCQ=local

# The top-level dependency file names imported CASCompCert objects, but it
# does not contain their internal dependency graph. Ask CASCompCert to
# update every object that the atomic-machine development imports in one
# recursive invocation.
CASCOMPCERT_IMPORTED_VO = \
$(sort $(shell grep '^atomic_machine/' $(DEPEND_FILE) 2>/dev/null | \
grep -o 'cascompcert/[^ ]*\.vo\b'))
CASCOMPCERT_IMPORTED_TARGETS = \
$(patsubst cascompcert/%,%,$(CASCOMPCERT_IMPORTED_VO))

.PHONY: cascompcert-force cascompcert-imports
cascompcert-force:

cascompcert-imports: cascompcert-force
+$(CASCOMPCERT_MAKE) $(CASCOMPCERT_IMPORTED_TARGETS)

# The recursive invocation above produces these files. The empty recipe
# prevents the generic top-level [%.vo] rule from compiling CASCompCert files
# with an incomplete dependency graph.
cascompcert/%.vo: | cascompcert-imports ;

default_target: vst $(PROGSDIR)
vst: _CoqProject msl veric floyd simpleconc

Expand Down Expand Up @@ -807,18 +863,6 @@ lambda-rust-adequacy: lambda-rust-equivalence \
atomic_machine/lambda_rust/machine_safety.vo \
atomic_machine/lambda_rust/adequacy.vo

atomic_machine/lambda_rust/adequacy.vo: \
atomic_machine/lambda_rust/adequacy.v \
atomic_machine/lambda_rust/equivalence.vo

atomic_machine/lambda_rust/safety_reflection.vo: \
atomic_machine/lambda_rust/safety_reflection.v \
atomic_machine/lambda_rust/adequacy.vo

atomic_machine/lambda_rust/machine_safety.vo: \
atomic_machine/lambda_rust/machine_safety.v \
atomic_machine/lambda_rust/safety_reflection.vo

# TODO:
#
# Add conclib_coqlib, conclib_sublist, and conclib_veric to the targets
Expand Down Expand Up @@ -937,15 +981,41 @@ _CoqProject _CoqProject-export: Makefile util/coqflags $(COMPCERT_CONFIG)
floyd/floyd.coq: floyd/proofauto.vo
coqtop $(COQFLAGS) -load-vernac-object floyd/proofauto -outputstate floyd/floyd -batch

# The .v dependencies are stored in .depend-files, and .depend is regenerated
# if any .v file is added, deleted or edited (e.g. imports changed).
ifeq ($(COMPCERT_NEW),true)
DEPEND_SRC = $(filter $(wildcard *), $(DIRS) refinedVST concurrency/common concurrency/compiler concurrency/juicy concurrency/util paco concurrency/sc_drf)
else
DEPEND_SRC = $(filter $(wildcard *), $(DIRS) refinedVST)
endif
DEPEND_FIND = find $(DEPEND_SRC) -name '*.v' 2>/dev/null | LC_ALL=C sort
DEPEND_LIST = .depend-files

# Run the staleness check if the condition in [ifeq] is an empty string:
# 1. make is not restarted (e.g. to remake a stale .depend), and
# 2. the current make goal is not [depend] or [clean].
# $(DEPEND_FILE) is stale if some .v file is newer, or a freshly computed
# $(DEPEND_SRC) differs from the one generated last time, i.e. $(DEPEND_LIST).
ifeq ($(MAKE_RESTARTS)$(filter depend clean,$(MAKECMDGOALS)),)
DEPEND_STALE := $(shell { $(DEPEND_FIND) | cmp -s - $(DEPEND_LIST) || echo moved; \
find $(DEPEND_SRC) -name '*.v' -newer $(DEPEND_FILE) -print -quit; } 2>/dev/null)
endif
ifneq ($(DEPEND_STALE),)
$(DEPEND_FILE): depend-force
endif

.PHONY: depend-force
depend-force:

.depend depend:
@echo 'coqdep ... >.depend'
ifeq ($(COMPCERT_NEW),true)
# DEPENDENCIES VARIANT COMPCERT_NEW
$(COQDEP) $(DEPFLAGS) 2>&1 >.depend `find $(filter $(wildcard *), $(DIRS) refinedVST concurrency/common concurrency/compiler concurrency/juicy concurrency/util paco concurrency/sc_drf) -name "*.v"` | grep -v 'Warning:.*found in the loadpath' || true
$(COQDEP) $(DEPFLAGS) 2>&1 >.depend `find $(DEPEND_SRC) -name "*.v"` | grep -v 'Warning:.*found in the loadpath' || true
@echo "" >>.depend
else
# DEPENDENCIES DEFAULT
$(COQDEP) $(DEPFLAGS) 2>&1 >.depend `find $(filter $(wildcard *), $(DIRS) refinedVST) -name "*.v"` | grep -v 'Warning:.*found in the loadpath' || true
$(COQDEP) $(DEPFLAGS) 2>&1 >.depend `find $(DEPEND_SRC) -name "*.v"` | grep -v 'Warning:.*found in the loadpath' || true
endif
ifeq ($(COMPCERT_BUILD_FROM_SRC),true)
# DEPENDENCIES TO BUILD COMPCERT FROM SOURCE
Expand All @@ -966,9 +1036,10 @@ ifneq ($(wildcard fcf/src/FCF),)
$(COQDEP) -Q fcf/src/FCF FCF fcf/src/FCF/*.v >>.depend
endif
wc .depend
$(DEPEND_FIND) >$(DEPEND_LIST)

clean:
rm -f $(addprefix veric/version., v vo vos vok glob) .lia.cache .nia.cache floyd/floyd.coq .depend _CoqProject _CoqProject-export $(wildcard */.*.aux) $(wildcard */*.glob) $(wildcard */*.vo */*.vos */*.vok)
rm -f $(addprefix veric/version., v vo vos vok glob) .lia.cache .nia.cache floyd/floyd.coq .depend $(DEPEND_LIST) _CoqProject _CoqProject-export $(wildcard */.*.aux) $(wildcard */*.glob) $(wildcard */*.vo */*.vos */*.vok)
for d in compcert compcert_new cascompcert; do \
if [ -d "$$d" ]; then \
find "$$d" -type f \( -name '*.vo' -o -name '*.vos' -o -name '*.vok' -o -name '*.glob' \) -delete; \
Expand Down
3 changes: 3 additions & 0 deletions atomic_machine/clight_am/theory/ClightAM_DRF.v
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Require Import compcert.concurrency.common.GlobSemantics.

Locate glob_step.
2 changes: 1 addition & 1 deletion cascompcert
Submodule cascompcert updated 58 files
+3 −0 .gitignore
+105 −0 CAS_README.md
+57 −15 Makefile
+2 −4 cfrontend/Clight.v
+0 −0 cfrontend_cas/Cexec.v
+0 −0 cfrontend_cas/Cminorgen.v
+0 −0 cfrontend_cas/Cminorgenproof.v
+0 −0 cfrontend_cas/Csharpminor.v
+0 −0 cfrontend_cas/Cshmgen.v
+0 −0 cfrontend_cas/Cshmgenproof.v
+0 −0 cfrontend_cas/Ctyping.v
+0 −0 cfrontend_cas/Initializers.v
+0 −0 cfrontend_cas/Initializersproof.v
+0 −0 cfrontend_cas/SimplExpr.v
+0 −0 cfrontend_cas/SimplExprproof.v
+0 −0 cfrontend_cas/SimplExprspec.v
+0 −0 cfrontend_cas/SimplLocals.v
+0 −0 cfrontend_cas/SimplLocalsproof.v
+16 −16 common/Memory.v
+4 −4 common/Memtype.v
+92 −0 concurrency/common/clight_val_casted.v
+8 −11 concurrency/common/val_casted.v
+1 −1 concurrency/comp_correct/ClightLang.v
+36 −14 concurrency/comp_correct/cfrontend/Clight_local.v
+102 −72 concurrency/comp_correct/cfrontend/Cop_fp.v
+1 −1 concurrency/comp_correct/localize/ClightLocalize.v
+3 −2 concurrency/comp_correct/localize/Cop_fp_local.v
+4 −0 concurrency/comp_correct/localize/Localize.v
+23 −22 concurrency/comp_correct/localize/MemClosures_local.v
+3 −12 concurrency/comp_correct/x86/Op_fp.v
+1 −1 configure
+0 −0 x86_cas/Asm.v
+0 −0 x86_cas/AsmToJSON.ml
+0 −0 x86_cas/AsmToJSON.mli
+0 −0 x86_cas/Asmexpand.ml
+0 −0 x86_cas/Asmgen.v
+0 −0 x86_cas/Asmgenproof.v
+0 −0 x86_cas/Asmgenproof1.v
+0 −0 x86_cas/CBuiltins.ml
+0 −0 x86_cas/CombineOp.v
+0 −0 x86_cas/CombineOpproof.v
+0 −0 x86_cas/ConstpropOp.vp
+0 −0 x86_cas/ConstpropOpproof.v
+0 −0 x86_cas/Conventions1.v
+0 −0 x86_cas/Machregs.v
+0 −0 x86_cas/Machregsaux.ml
+0 −0 x86_cas/Machregsaux.mli
+0 −0 x86_cas/NeedOp.v
+0 −0 x86_cas/Op.v
+0 −0 x86_cas/PrintOp.ml
+0 −0 x86_cas/SelectLong.vp
+0 −0 x86_cas/SelectLongproof.v
+0 −0 x86_cas/SelectOp.vp
+0 −0 x86_cas/SelectOpproof.v
+0 −0 x86_cas/Stacklayout.v
+0 −0 x86_cas/TargetPrinter.ml
+0 −0 x86_cas/ValueAOp.v
+0 −0 x86_cas/extractionMachdep.v
6 changes: 6 additions & 0 deletions ivst.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,9 @@ Proof. intros. rewrite H H0 //. Qed.
```

TODO: maybe move this to some library

## Atomic Machine
(The project related to this section is WIP)
```
make atomic_machine/ClightAM_DRF.vo
```
Loading