Commit Graph

2327 Commits

Author SHA1 Message Date
Neil Brown
6818cdc114 Added a few more tests that helped me track down a bug I was introducing 2009-02-09 22:41:40 +00:00
Neil Brown
a30e8cbde5 Tidied up and recoded the addBK function so that is much clearer which bits are Anded and which bits are Ored 2009-02-09 22:26:18 +00:00
Neil Brown
717a4dc0df Added some Or and And wrappers to the Check module, ready to help clear up the code 2009-02-09 22:25:44 +00:00
Neil Brown
0e95d5d15e Added a couple more functions to the Utils module 2009-02-09 22:25:12 +00:00
Neil Brown
4b44da8008 Removed obsolete conditions from the valid set as we search for constraints
Previously, conditions from IF branches were being retained even after the end of the whole IF.  Now I use the just-added information from the flow graph as to when those conditions are no longer applicable.
2009-02-09 17:03:29 +00:00
Neil Brown
c315352647 Added information in the flow graph edges as to when a condition becomes non-usable (e.g. when the branches of an IF merge again) 2009-02-09 16:57:13 +00:00
Neil Brown
904b913ebd Added another helper function to the Utils module 2009-02-09 16:57:02 +00:00
Neil Brown
7f8ced3c3a Upgraded the Par edges in the flow graph from Int to Integer, which makes the design a bit nicer 2009-02-09 16:08:59 +00:00
Neil Brown
7cf83512c5 Added a testcase which I think highlights a problematic bug 2009-02-09 15:55:13 +00:00
Neil Brown
0c975dd2b4 Added support for logical negation in the BK 2009-02-09 15:37:45 +00:00
Neil Brown
4e152a0f70 Added some more replicated tests with more complex combinations of IF conditions 2009-02-09 15:13:53 +00:00
Neil Brown
8477ee9d3f Added support for Or and NotEq in the BK 2009-02-09 13:17:22 +00:00
Neil Brown
9e0b802829 Fixed the generation of the BK from the flow graph constraints so that I will be able to add disjunctions 2009-02-09 13:14:53 +00:00
Neil Brown
2e36a8a218 Fixed a typo in a test name 2009-02-09 13:13:19 +00:00
Neil Brown
f2c7bad3e2 Added a pass that turns directed subscripts into subscripted directed arrays, to make the usage checking easier 2009-02-09 12:14:01 +00:00
Neil Brown
9fecbe4a8e Fixed checkArrayUsage so that it deals correctly with indexing of channel arrays 2009-02-09 12:13:54 +00:00
Neil Brown
e536da9f98 Added an instance of Traversable for ParItems 2009-02-09 12:11:07 +00:00
Neil Brown
1d4a62578a Fixed a typo in one of the testcases 2009-02-09 11:31:34 +00:00
Neil Brown
48b107b099 Made sure that channels are usage checked (by counting them as written variables) 2009-02-09 10:30:44 +00:00
Neil Brown
938ceaf12f Fixed foldUnionVarsBK so that variables without BK are no longer dropped from the usage checking 2009-02-09 10:30:15 +00:00
Neil Brown
b4e79ca62e Realised that channels are not being parallel usage checked at all, and added testcases for them 2009-02-09 10:28:45 +00:00
Neil Brown
00a8be1984 Added some tests ready to check usage checking on channel arrays 2009-02-08 23:40:40 +00:00
Neil Brown
3604ab6412 Added some testcases related to checking the use of abbreviations 2009-02-08 23:25:30 +00:00
Neil Brown
e165030751 Stopped Tock checking arrays that are declared inside the PAR being examined
Fixes #84
2009-02-08 23:08:58 +00:00
Neil Brown
d21e7c7437 Changed the usage checker so that it can cope with background knowledge that it does not end up using being unusable
Previously, if any variable in scope had unusable BK, the usage checker would fail -- even if that variable was not needed in the check (because all BK was processed fully before the later lookup).  So now it is done lazily -- BK is stored with possible errors, which are then ignored unless that BK is looked up and used.
2009-02-08 20:18:52 +00:00
Neil Brown
b638c20ee8 Improved an error message from the usage checking 2009-02-08 19:43:09 +00:00
Neil Brown
a75a195654 Fixed a bug in the flow utils code that was using the old name stack when removing an element 2009-02-08 19:11:58 +00:00
Neil Brown
a71499c268 Filtered out all non-defined names from the background knowledge for each node
Previously, replicators (and possibly other names) could appear at nodes where they weren't even in scope.
2009-02-08 18:42:01 +00:00
Neil Brown
b08ac42547 Augmented the flow graph building to store in each node a list of the names defined at that point 2009-02-08 18:41:30 +00:00
Neil Brown
3da315497a Tidied up the flow graph stuff a little by changing the quintuple state into a record type 2009-02-08 18:17:57 +00:00
Neil Brown
a29197bcab Fixed the usage checking to handle the new test cases
This is two changes.  The first drills down through the BK, adding everything relevant (this helps deal with abbreviations of replicators).  The second is that checkPlainVarUsage now only checks non-array variables, and leaves all the array variables to checkArrayUsage, to prevent false alarms where array accesses with an abbreviation of a replicator were being handled by checkPlainVarUsage instead of checkArrayUsage.  The only downside of all the changes is that multidimensional array accesses (they only worked with all constants before) are now no longer handled.
2009-02-08 17:26:23 +00:00
Neil Brown
ed39f449d9 Improved the formatting when usage check problems and solutions are displayed 2009-02-08 17:12:28 +00:00
Neil Brown
9c4b8e8df1 Changed tocktest so you can pass it -v options for use with the automatic tests 2009-02-08 16:33:53 +00:00
Neil Brown
1c1860ce7e Added lots of new tests for parallel replicators with BK, all of which fail 2009-02-08 16:06:15 +00:00
Neil Brown
c73b307057 Fixed up checkPlainVarUsage to work with the fixed findRepSolutions function
Now all the usage check tests pass, except a couple which fail for other reasons (<> not supported, and the one with twin replicators fails)
2009-02-07 19:14:18 +00:00
Neil Brown
3701154a1b Fixed findRepSolutions to work properly
Previously, it was taking one lot of BK at a time, then checking to see if i and i' could overlap (i.e. i and i' were the array indexes to check), which of course they never could.  It now takes a list of BK to pair up against each other, and asks if 0 can overlap with 0, which it can as long as there is a solution to the replicators.
2009-02-07 19:07:10 +00:00
Neil Brown
fdae05c3f3 Added a helper function for better formatting a series of usage check problems when printing them out 2009-02-07 18:47:31 +00:00
Neil Brown
091acfa848 Added a new helper function to Utils for joining pairs of lists with pairs of lists 2009-02-07 18:45:56 +00:00
Neil Brown
d8b722df89 Added a show instance for BackgroundKnowledge that helps when debugging 2009-02-07 18:45:21 +00:00
Neil Brown
6d8c195c22 Discovered that the problem with my latest test was that strictly less/more than were not being converted into BK (now fixed) 2009-02-05 16:42:50 +00:00
Neil Brown
571815c571 Added another test which shows a problem with the usage checking 2009-02-05 16:27:57 +00:00
Neil Brown
2120a294ed Changed the checking for plain var usage so that if there is a problem in a replicated PAR, it checks for a solution to the replicators to see if that problem can actually ever occur
One remaining problem is that if the BK is different between the two plain var uses being checked, that is currently not dealt with correctly
2009-02-05 16:07:38 +00:00
Neil Brown
95d25c3dbc Moved various functions from the where clause of checkArrayUsage up to the top level 2009-02-05 15:59:09 +00:00
Neil Brown
56a10b403f Added a new function, filterMapByKey, to the Utils module 2009-02-05 15:52:43 +00:00
Neil Brown
2ecd91e36f Changed the array usage checking to always include equations involving replicators
This allows us to check situations like this:

PAR i = 0 FOR 10
  IF
    i = 0
      a[10] := 3
    TRUE
      a[i] := 3

Previously this would have been flagged unsafe (because 10 can overlap with 10 between the replicated branches).

But with this change, the equations on the replicators (including: i'>=i+1, i = 0, i' = 0) are included alongside 10=10, so there is no solution over all because the replicator equations prevent a solution (i.e. the 10 can't be used twice in parallel).
2009-02-05 15:47:41 +00:00
Neil Brown
f1cc74e88e Made sure that background knowledge is mirrored to primed replicators where needed in the background knowledge
Previously, constraints on a replicator from BK (such as i >= 3) were not being mirrored to the other copy of the replicator (so the constraint i' >= 3 was not added, which was causing problems)
2009-02-05 14:54:43 +00:00
Neil Brown
42fa9b12e2 Added a lot more testcases related to background knowledge in usage checking 2009-02-05 14:53:42 +00:00
Neil Brown
0cbe5de96c Added a few more tests to help make sure I don't break anything 2009-02-04 13:08:11 +00:00
Neil Brown
3915afc079 Made checkParAssignUsage and checkProcCallArgsUsage use background knowledge by making them work primarily from the flow graph 2009-02-04 12:24:16 +00:00
Neil Brown
d6530051ab Added another usage check tests 2009-02-04 11:54:50 +00:00