Commit Graph

18 Commits

Author SHA1 Message Date
Michael Walker
d4b1ea8bc5 Slightly simplify dependent/dependent' defns 2015-07-21 14:37:36 +01:00
Michael Walker
15f79088c9 Correctly sort prefixes in next 2015-07-21 14:17:16 +01:00
Michael Walker
148cd0a351 Gradually accumulate allThreads in findBacktrack.
Recomputing it every single time is a waste of effort.
2015-07-21 14:16:34 +01:00
Michael Walker
d498ebd355 Extend blocking lookahead.
Adds more information to traces with a new Trace' type, which includes the
*sequence* of actions a thread will perform next, and use that for blocking
lookahead. This allows skipping over things like `_concKnowsAbout`, and so
brings the analysis behaviour of `spawn` in-line with `fork`.

For the test cases, this further reduces the average number of runs to 23.
2015-07-20 18:43:37 +01:00
Michael Walker
c4eefd4849 Avoid decisions which will immediately block.
If a decision will immediately block without changing the global state, then
there is no point in making it: no state will become reachable from it which
isn't reachable through some other option we have available.

This has three parts:

 - When the prefix runs out and the scheduler is making decisions, it filters
   out decisions which will immediately block.

 - When a subtree is being added, it records which decisions will immediately
   block.

 - When backtracking points are being added, it filters out ones in this block
   list.

This optimisation is likely to only be useful when threads are communicating a
lot. For instance, a `parMap id` is totally unaffected by this, but the test
cases drop from an average of 64 runs to 42.
2015-07-20 16:16:46 +01:00
Michael Walker
aadb27ea1f Implement sleep sets for BPOR.
This further improves performance in all cases, although it's still far worse
on some of the included tests, and I have yet to figure out why.

See also: "Partial-Order Methods for the Verication of Concurrent Systems"
  [Godefroid 1996]
2015-07-17 15:34:52 +01:00
Michael Walker
c12cbcf707 Implement BPOR for SCT, return to listy predicates.
This performs better with "real" code (the Par monad) but surprisingly does far
worse with the included tests! The next thing to do is implement the orthogonal
sleep sets algorithm to cut down on available choices even further and
hopefully correct this issue.

See also: "Bounded Partial-Order Reduction" [Coons, Musuvathi, McKinley 2013]
2015-07-16 22:32:30 +01:00
Michael Walker
8944ea97a5 Use schedule bounding as the primary SCT approach.
This allows results to be naturally reported as lazy trees, rather
than as lists representing a tree traversal. This in turn means
that the actual bound can be moved outwards to the testing code, and
not used at all in the runner. Trees let us do nice things with
shrinking and short-circuiting, if we make the (fairly reasonable)
assumption that the children of a buggy result will exhibit the same
bug.

Storing results as trees does complicate the predicate helper
functions somewhat, but I think the clarity gained in the actual
SCT code is well worth it.
2015-06-19 16:50:51 +01:00
Michael Walker
0e3ba970bd Make CRefs interesting 2015-02-20 18:49:19 +00:00
Michael Walker
8af7b814c2 Consider masking changes interesting for SCT 2015-02-14 18:59:11 +00:00
Michael Walker
8faee29b27 Implement throwTo and killThread 2015-02-13 17:13:00 +00:00
Michael Walker
7f26aa9654 Implement STM in Deterministic 2015-02-09 23:22:06 +00:00
Michael Walker
7aceb6a6f9 Implement an atomic-for-testing-purposes function.
This adds a new `MonadConc` primitive, `_concNoTest`, which is (for
all non-test implementations) the identity function. For test
implementations, it is understood as "this action is completely safe
under all schedules, so just execute it all at once and don't consider
any internal interleavings." It is not required to be deterministic,
merely to never fail.

Actions annotated with `_concNoTest` will show up as one step in the
trace, and new `Failure` and `ThreadAction` values have been added.
2015-02-06 16:18:25 +00:00
Michael Walker
c20db31561 Include reason for failure in Deterministic result 2015-02-06 16:04:59 +00:00
Michael Walker
a15a109b60 Give CVars IDs 2015-02-06 11:08:52 +00:00
Michael Walker
bc31ddc5e1 Remove shrinking.
- Tweak order in which schedules are explored to look at simple,
   but not too simple, cases first.

 - Port simplicity logic from shrinking to dupe elimination.
2015-02-04 11:45:08 +00:00
Michael Walker
00ad122b65 Refactor code and update docs to make more not-me friendly 2015-02-01 01:21:42 +00:00
Michael Walker
fbc262c361 Rename and remodularise 2015-01-31 15:50:54 +00:00