Commit Graph

57 Commits

Author SHA1 Message Date
Neil Brown
c8b724d2be Merged the latest set of changes from the trunk into the Polyplate branch
I also added the import list to all the Data.Generics imports in the tests (as I did for the other modules recently)
2009-04-10 20:38:29 +00:00
Neil Brown
ddbec737f2 Got all the tests compiling again after recent changes
For some reason, the usage check tests are now very slow to run (perhaps because of all the operator definitions added to each one?), which needs further investigation.
2009-04-10 19:29:40 +00:00
Neil Brown
e457d82f0c Changed FUNCTIONs and PROCs to have optional bodies, and put all the externals into the AST (without bodies)
This may seem like an odd change, but it simplifies the logic a lot.  I kept having problems with passes not operating on externals (e.g. functions-to-procs, adding array sizes, constant folding in array dimensions) and adding a special case every time to also process the externals was getting silly.

Putting the externals in the AST therefore made sense, but I didn't want to just add dummy bodies as this would cause them to throw up errors (e.g. in the type-checking for functions).  So I turned the bodies into a Maybe type, and that has worked out well.

I also stopped storing the formals in csExternals (since they are now in csNames, and the tree), which streamlined that nicely, and stopped me having to keep them up to date.
2009-04-04 14:56:35 +00:00
Neil Brown
e91c075bcf Fixed up a lot of the failing tests
I changed a little bit of the code, but mainly the tests.  Several of the remaining failures are actually real failures, so I need to dig through the rest carefully.  A lot are failing because the C++ backend is broken.
2009-04-01 11:49:37 +00:00
Neil Brown
56e5b8da8e A mega-patch that gets tocktest compiling again
However, around a quarter of the tests currently fail...
2009-03-31 17:56:56 +00:00
Neil Brown
359763380e Fixed the test for the transformConstr pass 2009-02-03 12:37:32 +00:00
Neil Brown
4f83187549 Fixed up all the tests in light of the new recursive procs 2009-01-29 00:56:32 +00:00
Neil Brown
10e6b4ce02 Updated all the tests to work with the new recursive functions 2009-01-29 00:34:12 +00:00
Neil Brown
6693a8b8b9 Changed things in the transformations directory in light of the new step count 2009-01-28 23:46:04 +00:00
Neil Brown
1f4796e07f Fixed all the tests to reflect the new channel-end system, such that they all pass again
This is the last patch (for now) of the set implementing the new channel-end system
2009-01-20 17:41:44 +00:00
Neil Brown
0e7a6c5b98 Added a NameSource field for NameDef that indicates where a name comes from 2008-11-25 17:36:42 +00:00
Neil Brown
bcad0c225f Converted the other pullRepCounts test over to the new system 2008-11-16 19:40:27 +00:00
Neil Brown
fe3dd78db3 Realised that pullRepCounts should pull the counts for PAR and ALT after all, and adjusted one test to reflect this 2008-11-16 18:43:34 +00:00
Neil Brown
bfacb526fb Converted one of the tests for pullRepCounts to use the new mechanism, which in turn exposed that the pass was not altering the definition in the state (which it may as well) 2008-11-16 18:25:53 +00:00
Neil Brown
771297632d Finished converting all the cases in testInputCase to use the new occam EDSL 2008-11-16 16:57:52 +00:00
Neil Brown
b82395dc81 Tried changing an existing test from using oZ to oA which revealed a problem with the csNames comparison (and matching the map orderings) 2008-11-16 13:05:30 +00:00
Neil Brown
278b80932e Converted one of the input case tests to use the occam EDSL, making it much clearer 2008-11-16 12:24:41 +00:00
Neil Brown
42e4ca5c92 Adjusted an existing testcase for the changes in OccamEDSL 2008-11-16 12:24:24 +00:00
Neil Brown
a570f2eff3 Renamed the variables in the occam EDSL to be less likely to clash in other modules 2008-11-15 20:11:52 +00:00
Neil Brown
f4d9c791ef Simplified the occam EDSL by removing the unnecessary monad in favour of plain lists, and added a way to separate expected output from input 2008-11-15 20:06:47 +00:00
Neil Brown
7764ed9326 Added a module for easily knocking up fragments of occam code to test, but need to remove some of the extravagance in the design (including an unnecessary monad) 2008-11-15 19:29:56 +00:00
Neil Brown
5bc88ec1fc Fixed another test that was broken during the change to Rep 2008-06-04 18:43:50 +00:00
Neil Brown
41ff60cb78 Removed the Rep constructor from Structured and instead added a Rep constructor to SpecType
This way, all replicators are declared like other names, and their scope is considered replicated.  This simplifies the code a little.

Fixes #55
2008-06-04 17:00:43 +00:00
Neil Brown
ba66cce89f Moved all the remaining pass information to be with the passes themselves, and adjusted the tests accordingly
All the passes now have their information (name, pre-requisites and post- properties) stored at the point where the pass is declared, which means the pass lists are just a simple list of pass functions.

The main consequence of this change was that the tests had to be changed.  Now, instead of taking a "pass applied to data" item (type: PassM b), they take both the pass (type: Pass) and source data (type: b), and apply them later.  This was the decision that involved the simplest changes to the existing tests (simply unbracketing the application of the pass to the source).  I also had to include a few old-style versions though (testPass', testPassShouldFail') for where the functions were being used to test things that weren't actually passes (mainly StructureOccam).

Fixes #48
2008-06-02 14:31:19 +00:00
Adam Sampson
36e7353ee7 Take NameType out of NameDef.
NameType is only really needed in the parser, so this takes it out of
NameDef, meaning that later passes defining names no longer need to
set an arbitrary NameType for them. The parser gets slightly more
complicated (because some productions now have to return a SpecType
and a NameType too), but lots of other code gets simpler.

The code that removed free names was the only thing outside the parser
using NameType, and it now makes a more sensible decision based on the
SpecType. Since unscoped names previously didn't have a SpecType at
all, I've added an Unscoped constructor to it and arranged matters
such that unscoped names now get a proper entry in csNames.

Fixes #61.
2008-06-02 10:13:14 +00:00
Neil Brown
3daf82d318 Merged Alternative and AlternativeCond into a single Alternative item that always has a pre-condition 2008-04-03 14:52:37 +00:00
Neil Brown
f7141bda6f Corrected transformConstr0 2008-03-21 20:02:33 +00:00
Neil Brown
b496912c51 Fixed conflicts with Adam's dimension changes 2008-03-19 17:49:32 +00:00
Neil Brown
722499b05d Adjusted the test for transformConstr to work properly with the new array constructor type 2008-03-19 13:29:02 +00:00
Neil Brown
db0467f1ca Adjusted the rain passes to use the new array constructor type, and weaned a few of them off everywhereM 2008-03-19 13:24:15 +00:00
Adam Sampson
52d72647ae Fix the transformConstr0 test by defining x. 2008-03-20 11:23:45 +00:00
Adam Sampson
b1416bb0cf Change A.Dimension to take an Expression, not an Int.
This touches an awful lot of code, but cgtest07/17 (arrays and retyping) pass.

This is useful because there are going to be places in the future where we'll
want to represent dimensions that are known at runtime but not at compile time
-- for example, mobile allocations, or dynamically-sized arrays. It simplifies
the code in a number of places.

However, we do now need to be careful that expressions containing variables do
not leak into the State, since they won't be affected by later passes.

Two caveats (marked as FIXMEs in the source):

- Retypes checking in the occam parser is disabled, since the plan is to move
  it out to a pass anyway.
- There's some (now very obvious) duplication, particularly in the backend, of
  bits of code that construct expressions for the total size of an array
  (either in bytes or elements); this should be moved to a couple of helper
  functions that everything can use.
2008-03-18 16:45:38 +00:00
Neil Brown
5c43172e46 Added an annotation to array subscripts to indicate whether they should have a run-time check added or not 2008-03-09 14:30:19 +00:00
Neil Brown
ba75f5b06c Removed the initialiser expression on the Declaration item in the AST 2008-03-09 00:23:13 +00:00
Neil Brown
6d4f1dd702 Added labels to all the top-level tests that didn't have one 2008-02-28 16:11:01 +00:00
Neil Brown
86c17fed99 Added a pass for pulling up the replicator counts in SEQs so that the count is constant for the whole loop 2008-02-27 19:33:44 +00:00
Neil Brown
9b521c9b07 Added tests for testing that testTransformProtocolInput transformed protocol inputs in ALTs 2008-02-27 17:19:47 +00:00
Neil Brown
5c7bb1296b Altered transformProtocolInput to only bother flattening inputs with more than one item 2008-02-27 17:01:19 +00:00
Neil Brown
9b570996ca Added a pass to flatten protocol inputs down into multiple sequential input statements 2008-02-27 16:45:27 +00:00
Neil Brown
f9625ce495 Adjusted the tests for functionsToProcs to include the new style of functions 2008-02-25 22:02:21 +00:00
Neil Brown
1edaacae89 Altered the AST to allow a function to be either an ExpressionList (classical occam) or a Process (Rain/proposed new occam) 2008-02-24 19:29:31 +00:00
Neil Brown
74f3cb7fc2 Removed the export of "m" in TestUtils, instead moving the definition to each module that uses it (less confusing that way) 2008-02-24 18:55:44 +00:00
Neil Brown
acd57d74de Changed the A.Structured type to be parameterised
This patch is actually an amalgam of multiple (already large) patches.  Those patches conflicted (parameterised Structured vs. changes to usage checking and FlowGraph) and encountered a nasty bug in darcs 1 involving exponential time (see http://wiki.darcs.net/DarcsWiki/ConflictsFAQ for more details).  Reasoning that half an hour (of 100% CPU use) was too long to apply patches, I opted to re-record the parameterised Structured changes as this new large patch.  Here are the commit messages originally used for the patches (which, as mentioned, were already large patches):

A gigantic patch switching all the non-test modules over to using parameterised A.Structured
Changed the FlowGraph module again to handle any sort of Structured you want to pass to it (mainly for testing)
A further gigantic patch changing all the tests to work with the new parameterised Structured
Fixed a nasty bug involving functions being named incorrectly inside transformInputCase
Added a hand-written instance of Data for Structured that allows us to use ext1M properly
Fixed a few warnings in the code
2008-02-05 19:40:27 +00:00
Neil Brown
bdda623d7e Added types to all the cases where the monomorhpism restriction applied 2008-01-26 20:51:11 +00:00
Neil Brown
26dd2fa5c4 Renamed the TestUtil and TreeUtil modules to TestUtils and TreeUtils, to be consistent with the Utils module 2007-12-13 19:05:29 +00:00
Neil Brown
7fe77146d0 Added some more documentation in the PassTest module. 2007-11-12 18:03:25 +00:00
Neil Brown
6b95827cab Added an optional initialiser-expression to Declaration in the AST, and changed the rest of the code accordingly 2007-10-24 23:50:00 +00:00
Neil Brown
acca3d03fd Removed the A.Main item from the AST entirely 2007-10-17 13:43:40 +00:00
Neil Brown
d98cb21415 Added support for transforming ALT guards to the input-case -> case pass 2007-10-13 23:56:36 +00:00
Neil Brown
8b2e14f3bd Added tests and implementation for a new pass for transforming input-case statements into case statements 2007-10-13 23:28:41 +00:00