summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2019-02-12Add a CHANGELOG fileAlasdair Armstrong
Fix a bug where we generated empty definitions which pre 4.07 versions of OCaml don't appear to support.
2019-02-12Merge remote-tracking branch 'origin/sail2' into asl_flow2Alasdair Armstrong
2019-02-12Improvements for emacs modeAlasdair Armstrong
2019-02-11Add an additional test caseAlasdair
Make LEXP_deref an inference rule. This should allow strictly more programs to type-check.
2019-02-11Expand type synonyms for E_constraint and E_sizeofAlasdair
2019-02-11Add tests for implicit argumentsAlasdair Armstrong
2019-02-11Get the order of overrides correct during topsortBrian Campbell
2019-02-08Cleanup src MakefileAlasdair
When we are building from git, we put the git version info in manifest.ml, so we'll get the following from sail -v Sail $last_git_tag ($branch @ $commit_sha) If we are be built from opam we can't assume we are in a git repository as opam downloads specific tags as tarballs, so instead we check for the precense of SHARE_DIR which is set by our opam build script, and instead output Sail 0.8 (sail2 @ opam) which is the next git tag (current is 0.7.1, this must be updated by hand), the branch name from which opam releases are generated and then opam rather than the commit SHA. I also removed the Makefile-non-opam file as it's bitrotted and unused
2019-02-08Slightly tweak the help message.Prashanth Mundkur
2019-02-08Add parameterization support for bitfields.Prashanth Mundkur
This supports the following syntax: type xlen : Int = 64 type ylen : Int = 1 type xlenbits = bits(xlen) bitfield Mstatus : xlenbits = { SD : xlen - ylen, SXL : xlen - ylen - 1 .. xlen - ylen - 3 }
2019-02-08Add missing functions to HOL monad wrapperThomas Bauereiss
Also make the rewriter keep failed assertions in output when pruning blocks.
2019-02-08Resurrect Sail output option (with new name: -output_sail)Brian Campbell
2019-02-08Prevent top_sort throwing away overloads (and other multiple definitions)Brian Campbell
Previously it would quietly throw away all definitions for an id except one. This usually doesn't matter, but some rewrites use overloaded identifiers and can break if the definition is lost.
2019-02-08Allow internal AST nodes in input when -dmagic_hash is onBrian Campbell
2019-02-08Updates for asl_parserAlasdair Armstrong
Tweak colours of monomorphistion test output
2019-02-08Rewrite type definitions in rewrite_nexp_idsThomas Bauereiss
For example, in type xlen : Int = 64 type xlenbits = bits(xlen) rewrite the 'xlen' in the definition of 'xlenbits' to the constant 64 in order to simplify Lem generation. In order to facilitate this, pass through the global typing environment to the rewriting steps (in the AST itself, type definitions don't carry annotations with environments).
2019-02-08Remove dead code from type-checkerAlasdair
add_num_def and get_num_def are no longer used. The rewrite pass that used them would fail on Nexp_ids because of this, but seeing as that never happened we can probably assume that particular line of code is simply never touched by any of our models or test suite?
2019-02-07Replace equality check for declared effects by subset checkThomas Bauereiss
2019-02-07Monomorphisation tweaks for v8.5Thomas Bauereiss
Various tweaks to the monomorphisation rewrites. Disable old sizeof rewriting for Lem backend and rely on the type checker rewriting implicit arguments. Also avoid unifying nexps with sums, as this can easily fail due to commutativity and associativity.
2019-02-07Add a symbol for new implicit arguments for backwards compatabilityAlasdair Armstrong
Fix monomorphisation tests
2019-02-07Fix implicits in v8.2 public ARM specAlasdair Armstrong
2019-02-06Emacs mode understands relationships between Sail filesAlasdair
Allow a file sail.json in the same directory as the sail source file which contains the ordering and options needed for sail files involved in a specific ISA definition. I have an example for v8.5 in sail-arm. The interactive Sail process running within emacs then knows about the relationship between Sail files, so C-c C-l works for files in the ARM spec. Also added a C-c C-x command to jump to a type error. Requires yojson library to build interactive Sail.
2019-02-06Improve emacs modeAlasdair Armstrong
Can now use C-c C-s to start an interactive Sail process, C-c C-l to load a file, and C-c C-q to kill the sail process. Type errors are highlighted in the emacs buffer (like with merlin for OCaml) with a tooltip for the type-error, as well as being displayed in the minibuffer. Need to add a C-c C-x command like merlin to jump to the error, and figure out how to handle multiple files nicely, as well as hooking the save function like tuareg/merlin, but this is already enough to make working with small examples quite a bit more pleasant.
2019-02-06Fix some testsAlasdair Armstrong
2019-02-06Make sure type synonym errors have correct location infoAlasdair Armstrong
2019-02-06Remove all sizeof rewriting from C compilationAlasdair
All sizeof expressions now removed by the type-checker, so it's now properly a type error if they cannot be removed rather than a bizarre re-write error. This also greatly improves compilation speed overall, at the expense of the first type-checking pass.
2019-02-05Simpler implicit argumentsAlasdair Armstrong
Rather than using sizeof-rewriting which is slow and error-prone, just make implicit function arguments explicit, so: val ZeroExtend : forall 'n 'm, 'm >= 'n. (implicit('m), bits('n)) -> bits('m) let x : bits(32) = ZeroExtend(0xFFFF) would be re-written (by the typechecker itself) into val ZeroExtend : forall 'n 'm, 'm >= 'n. (implicit('m), bits('n)) -> bits('m) let x : bits(32) = ZeroExtend(32, 0xFFFF) then all we need to do is map implicit -> int in a rewrite, and use trivial sizeof-rewriting only. We pretty much never want to use the form of sizeof-rewriting that propagates function arguments through multiple functions because it's extremely error-prone. Anything that isn't re-writable via trivial sizeof rewriting should be a type error, so it would be good to re-write sizeof expressions within the type-checker.
2019-02-05Ensure Lem output doesn't fail if there's a termination measure presentBrian Campbell
2019-02-05Use more general types for lexps in the internal lets rewriting passBrian Campbell
This reduces the amount of unnecessary complex existentials that appear during rewriting.
2019-02-05The alpha equivalence check should keep tyvars that only appear in constraintsBrian Campbell
2019-02-05Handle a few more cases in mono rewritesThomas Bauereiss
2019-02-04Fix some warningsAlasdair Armstrong
2019-02-04Add dec_str builtin to lemAlasdair Armstrong
2019-02-04Test lem output by running end-to-end tests using ocaml via lemAlasdair Armstrong
2019-02-04Fix behavior for fallthrough cases in catch blocksAlasdair Armstrong
Make all backends behave the same when a catch block does not catch a specific exception.
2019-02-02Avoid unification on ambiguous return typesAlasdair
Usually we want to unify on return types, but in the case of constraint unification (especially during rewriting) we can find ourselves in the situation where unifying too eagerly on a return type like bool('p & 'q) can cause us to instantiate 'p and 'q in the wrong order (as & should really respect commutativity and associativity during typechecking to avoid being overly brittle). Originally I simply avoided adding cases for unify on NC_and/NC_or and similar to avoid these cases, but this lead to the undesirable situation where identical types wouldn't unify with each other for an empty set of goals, which should be a trivial property of the unification functions. The solution is therefore to identify type variables in ambiguous positions, and remove them from the list of goals during unification. All type variables still have to be resolved by the time we finish checking each application, but this has the added bonus of making order much less important when it comes to instantiating type variables. Currently I am overly conservative about what qualifies as ambigious, but this set should be expanded
2019-02-02Monomorphisation tests all pass so add them to standard regression testsAlasdair
2019-02-02Merge remote-tracking branch 'origin/sail2' into asl_flow2Alasdair
2019-02-01Fix missing typedef cases in OCaml outputAlasdair
2019-02-01Expand integer synonymsAlasdair Armstrong
2019-02-01Add tracing instrumention for SMTAlasdair Armstrong
Fix pretty printer bug
2019-01-31Fix an unnecessary cast insertion on assignmentsBrian Campbell
2019-01-31Turn on cast insertion for -lem_mwords and revert b826df25Brian Campbell
now that cast insertion can handle RISC-V Also inserts specs for casts in they're not present
2019-01-31Drop type annotations in top-level nexp rewriting in favour of valspecsBrian Campbell
otherwise the valspec rewriting will be inconsistent with the type annotation. Note that the type checker will have introduced valspecs where necessary.
2019-01-31Make cast insertion handle more complex nexps and pushing casts into blocksBrian Campbell
# Conflicts: # src/monomorphise.ml
2019-01-31Merge branch 'monads' into asl_flow2Thomas Bauereiss
2019-01-31Further restrict attention to Int kidsThomas Bauereiss
2019-01-31Monomorphisation: improve cast insertion and nexp rewriting on variantsBrian Campbell
It now pushes casts into lets and constructor applications, and so supports the case needed for RISC-V.
2019-01-31Add missing cases to constraint comparisonBrian Campbell
2019-01-31Support case splitting on variables as well as sizeof in cast introductionBrian Campbell