summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2018-08-31rewrite_defs_pat_string_append: only guard the innermost recursive pattern, ↵Jon French
and use the original ids rather than fresh ones; both to allow referring to matched ids in guards
2018-08-31mappings: Support for unidirectional mapping clausesJon French
2018-08-31riscv prelude: yet more manual monomorphisations for hex_bitsJon French
2018-08-31fix some compiler warningsJon French
2018-08-31sync and centralise the two .merlin filesJon French
2018-08-30C: Fix a bug where function argument type becomes more specific due to flow ↵Alasdair Armstrong
typing Added a regression test as c/test/downcast_fn.sail
2018-08-30Allow additional includes to be specified for C backend.Prashanth Mundkur
2018-08-30C: Fix an issue with struct field being generalised inside polymorphic ↵Alasdair Armstrong
constructors Add a new printing function for debugging that recursively prints constructor types. Fix an interpreter bug when pattern matching on constructors with tuple types.
2018-08-29C: Fix some issues with tuples as arguments to polymorphic constructorsAlasdair Armstrong
Now all we need to do is make sure the RISC-V builtins are mapped to the correct C functions, and RISC-V in C should work (hopefully). We're still missing some of the functions in sail.c for the mappings so those have to be implemented.
2018-08-28fix some compiler not-matched warnings about Typ_bidir and Typ_internal_unknownJon French
2018-08-28add __POS__ argument to Err_unreachable for better error reportingJon French
2018-08-24Fix rewriter issuesAlasdair Armstrong
Allow pat_lits rewrite to map L_unit to wildcard patterns, rather than introducing eq_unit tests as guards. Add a fold_function and fold_funcl functions in rewriter.ml that apply the pattern and expression algebras to top-level functions, which means that they correctly get applied to top-level function patterns when they are used. Currently modifying the re-writing passes to do this introduces some bugs which needs investigated further. The current situation is that top-level patterns and patterns elsewhere are often treated differently because rewrite_exp doesn't (and indeed cannot, due to how the re-writer is structured) rewrite top level patterns. Fix pattern completeness check for unit literals Fix a bug in Sail->ANF transform where blocks were always annotated with type unit incorrectly. This caused issues in pattern literal re-writes where the guard was a block returning a boolean. A test case for this is added as test/c/and_block.sail. Fix a bug caused by nested polymorphic function calls and matching in top-level patterns. Test case is test/c/tl_poly_match.sail. Pass location info through codegen_conversion for better error reporting
2018-08-24parser: emit actual unit for an ident() pattern, not wildcard which causes ↵Jon French
unnecessary problems with mappings/pat_to_exp
2018-08-24fix a couple of pretty print inaccuraciesJon French
2018-08-24support for P_or and P_not patterns in rewrite_defs_mapping_patternsJon French
2018-08-24rewrite_defs_mapping_patterns: support for referring to mapping arguments in ↵Jon French
guards
2018-08-24pat_to_exp support for vector and string concat patterns; fix typing in ↵Jon French
exp_of_mpat
2018-08-24rewrite_defs_pat_lits: rewrite away fewer lits when generating ocaml, for ↵Jon French
cleaner generated code and reduced compiler warnings
2018-08-23Fix interpreter after re-writer changeAlasdair Armstrong
Interpreter used a re-write (vector concat removal) that is dependent on the vector_string_to_bit_list rewriting pass. This fixes the interpreter to work without either vector concat removal, or turning bitstrings into vector literals like [bitzero, bitzero, bitone]. This has the upside of reducing the number of steps the interpreter needs for working with bitvectors so should improve interpreter performance. We also now test all the C compilation tests behave the same using the interpreter. Currently the real number tests fail due to limitations of Lem's rational library (this must be fixed in Lem). This required supporting configuration registers in the interpreter. As such the interpreter was refactored to more cleanly process registers when building an initial global state. The functions are also collected into the global state, which removes the need to search for them in the AST every time a function call happens. This should not only improve performance, but also removes the need to pass an AST into the interpretation functions.
2018-08-23Move vector_string_to_bit_list from its odd place in Rewriter.rewrite_pat to ↵Jon French
an explicit rewrite step in Rewrites, just before pat_lits
2018-08-22Fix a bug in nested vector concatenation patternsAlasdair Armstrong
2018-08-22Revert "rewrite_defs_pat_lits: add an explicit type annotation around ↵Jon French
generated id pattern" This reverts commit 9fdd1ecbed32ebb408256628b6661ccbf5f16c18.
2018-08-22rewrite_defs_pat_lits: add an explicit type annotation around generated id ↵Jon French
pattern
2018-08-21C: Correctly handle the kinds of patterns generated by mappingsAlasdair Armstrong
This change allows the RISC-V spec to compile to C, but more testing is needed to ensure it works correctly.
2018-08-20Refactor tuple conversions in Sail to C compilationAlasdair Armstrong
Make the C l-expression type in Sail more generic and expressive, and refactor the generation of conversions into a seperate codegen_conversion function, which can handle more complex cases than the previous more ad-hoc method.
2018-08-18Correctly handle specialising polymorphic types in nested unionsAlasdair
Ensure that this works even when the union types are dependent in the wrong order, before topologically sorting definitions. We do this by calling fix_variant_ctyps on all cdefs by passing a list of prior cdefs to specialize_variants.
2018-08-18Correctly specialise type annotation in polymorphic functionsAlasdair
2018-08-17Improve builtins testsAlasdair Armstrong
Test the builtin functions by compiling them to C, OCaml, and OCaml via Lem. Split up some of the longer builtin test programs to avoid stack overflows when compiling to OCaml, as 3000+ line long blocks can cause issues with some re-writing steps. Also test constant-folding with builtins (this should reduce the asserts in these files to assert true), and also test constant folding with the C compilation. Fix a bug whereby vectors with heap-allocated elements were not initialized correctly. Fix a bug caused by compiling and optimising empty vector literals. Fix an OCaml test case that broke due to the ref type being used. Now uses references to registers. Fix a bug where Sail would output big integers that lem can't parse. Checks if integer is between Int32.min_int and Int32.max_int and if not, use integerOfString to represent the integer. Really this should be fixed in Lem. Make the python test runner script the default for testing builtins and running the C compilation tests in test/run_tests.sh Add a ocaml_build_dir option that sets a custom build directory for OCaml. This is needed for running OCaml tests in parallel so the builds don't clobber one another.
2018-08-17Coq: also introduce autocast at type annotationsBrian Campbell
2018-08-17Extend guarded patterns rewriting to exception catchingBrian Campbell
Also fix nested matches and generic rewriting under E_throw.
2018-08-16Add the type an expression was checked against to tannots, and use for CoqBrian Campbell
Tweak extra Coq files to match. Tweak early return rewrite to use declared return type, which can always be put into an E_cast.
2018-08-16Use Set rather than Hashtbl in graph.mlAlasdair Armstrong
Removes the need for the node type to have a valid Hash function
2018-08-16Remove unused ref typeAlasdair Armstrong
2018-08-16Various cleanups to ott grammarAlasdair Armstrong
Add additional well-formedness check when calling typing rules
2018-08-15Temporary fix for RISC-V Lem generationBrian Campbell
2018-08-15Get RISC-V on Coq into reasonable state to showBrian Campbell
- Fill in Coq builtins for more of the RISC-V prelude - Update Barriers - More general autocast - Temporary sub_nat definition (until the backend handles nat better) - Patch to bring results into a reasonable state - Use Let rather than Definition for non-dependent top-level values
2018-08-14Improve error messages from C backend, and fix issues with assigning to pointersAlasdair Armstrong
2018-08-14Remove some comments from C outputAlasdair Armstrong
Cleanup some debugging output
2018-08-14Merge remote-tracking branch 'origin/sail2' into polymorphic_variantsAlasdair Armstrong
2018-08-13Add graph library graph.ml, and use to correctly sort type definitionsAlasdair
2018-08-13Remove old specialisation code in specialize.mlAlasdair
2018-08-13Sort ctype_defs in dependency order after specialisationAlasdair
We now generate anonymous types in the correct order, but post specialisation more dependencies can occur between named types, so an additional sorting step is needed to ensure that these happen in the correct order. In theory we could end up with circular dependencies here that don't exist at the Sail source level, but this shouldn't occur often (or ever) in practice. I think this is fixable but it would require some code generator changes.
2018-08-13Coq: drop redundant final wildcard clausesBrian Campbell
Deals with pattern matches generated from mappings, plus the occasional error.
2018-08-13Guarded clauses rewrite: variable patterns subsume enumsBrian Campbell
Prevents redundant clauses.
2018-08-12Coq: handle enums in binders, make top-level patterns exhaustiveBrian Campbell
2018-08-10Coq: add some of string libraryBrian Campbell
2018-08-09Fix a bug by ensuring that monomorphic variant constructors do not get ↵Alasdair Armstrong
lifted types Add a test case for nested variant constructors
2018-08-09Add type information to AP_app constructorsAlasdair Armstrong
2018-08-09Fix bugs involving multi-argument variant type constructorsAlasdair Armstrong
2018-08-09Coq: debugging on top-level letsBrian Campbell