Commit Graph

614 Commits

Author SHA1 Message Date
Michael Walker
55a6239503 Update build status link in README 2015-08-16 00:19:05 +01:00
Michael Walker
046847c714 Upgrade to Stackage LTS 3.0 2015-08-15 23:45:22 +01:00
Michael Walker
3544ad08c3 Fix compiler warnings 2015-08-14 15:50:11 +01:00
Michael Walker
15fb0c391b Drop the default implementations of putCVar and takeCVar 2015-08-14 15:27:50 +01:00
Michael Walker
faa0febdba Fix some inconsistencies in class docs 2015-08-14 15:26:43 +01:00
Michael Walker
4a76ecedcc Add Applicative constraint to classes for pre-AMP GHC 2015-08-14 15:25:06 +01:00
Michael Walker
0e558b271f Handle exceptions in CVar functions as in MVar functions 2015-08-14 15:06:03 +01:00
Michael Walker
dea286a582 Add Functor context to sctBoundedM for pre-AMP GHC 2015-08-10 10:37:42 +01:00
Michael Walker
d32ee150bd Reduce code duplication with Identity monad 2015-08-09 21:00:11 +01:00
Michael Walker
a9f25fbb71 Update README 2015-08-01 15:20:20 +01:00
Michael Walker
79ed016dda Build with LTS by default 2015-08-01 15:20:20 +01:00
Michael Walker
ac12036bad Use Sequence for backtracking points, rather than ++ a lot 2015-07-24 19:57:46 +01:00
Michael Walker
37d25048d3 Improve memory usage of pbBacktrack 2015-07-24 17:44:48 +01:00
Michael Walker
7aa7f5cc80 Use 'maximumBy' rather than 'sortBy' in 'next'.
Also swap the order of the append in 'prefixes'. For some reason this makes it
work much better in the test cases. No idea why.
2015-07-24 17:25:28 +01:00
Michael Walker
929eceab95 Inline ThreadId information into BacktrackStep 2015-07-24 16:35:23 +01:00
Michael Walker
a6055a30a0 Use strict IntMaps where possible. 2015-07-24 15:47:24 +01:00
Michael Walker
9d2c3cd42e Comment the tricky bits in Test.DejaFu.SCT more 2015-07-21 17:28:28 +01:00
Michael Walker
5649c4d2a7 Use Set instead of [] where it makes sense.
A lot of the places where lists were used, there was an assumed invariant that
there would be no duplicate entries, for some criteria of equality. In some
cases this was enforced by `nub`, in others not. Sets are a much better choice
here, as they actually enforce the invariant, with better complexity for some
operations.
2015-07-21 16:09:47 +01:00
Michael Walker
112a7cd138 Add some instances for NonEmpty 2015-07-21 16:09:11 +01:00
Michael Walker
c786a30448 Fix accidentally recursive binding 2015-07-21 15:30:29 +01:00
Michael Walker
3c1dadffa6 Take advantage of the fact that tagged is sorted 2015-07-21 14:38:00 +01:00
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
338c98b617 Add function to unsafely convert a list to a NonEmpty 2015-07-20 18:42:19 +01:00
Michael Walker
ac48769ea0 Wrap up scheduler state in a record 2015-07-20 16:45:29 +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
a0c31f28fa Use Jenkins instead of Travis. 2015-07-19 12:20:18 +01:00
Michael Walker
a8cc4dcab5 Stackify 2015-07-19 04:39:39 +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
23c350c4b1 Fix/ignore hlint warnings 2015-07-10 18:30:34 +01:00
Michael Walker
1c8720a635 Give schedulers one-step lookahead 2015-07-10 18:27:50 +01:00
Michael Walker
89ec649d92 Don't pre-empt guaranteed blocks.
Pre-empting an action which is guaranteed to block is just the same
as letting it block and then inserting a regular non-pre-emptive
context switch.
2015-07-10 15:49:23 +01:00
Michael Walker
2ca7337b01 Avoid scheduling decisions which immediately block (in PB-bounded runner) 2015-07-08 20:06:15 +01:00
Michael Walker
e92d639537 Export ThreadAction' type 2015-07-08 20:05:58 +01:00
Michael Walker
6e01de2e85 Make available the full state of every CVar to SCT runners 2015-07-08 19:15:18 +01:00
Michael Walker
9ca54fea17 Include one-step lookahead in traces 2015-07-08 18:55:30 +01:00
Michael Walker
dab69aebcc Make alwaysTrue2 result less confusing when applied to one schedule only. 2015-07-08 18:20:08 +01:00
Michael Walker
05e2d2f1e4 Fix issue with identifying only-read STM transactions as only creating new CTVars. 2015-07-08 18:18:56 +01:00
Michael Walker
426707f382 Make the stmAtomic test actually test STM atomicity 2015-07-08 18:18:18 +01:00
Michael Walker
8794276a3e Add a Show instance for SCTTrees 2015-07-08 18:17:48 +01:00
Michael Walker
df69f4778c Improve error reporting in alwaysTrue2 (less zealous about short-circuiting 2015-06-24 15:59:54 +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
1d085f4ea9 More transformer instances (inc. strict versions) 2015-05-30 01:45:20 +01:00
Michael Walker
d2178c2814 Add some transformer instances 2015-05-29 16:51:51 +01:00
Michael Walker
a93f8202e4 Add dejafus/dejafusIO variants to take a pre-emption bound 2015-05-26 04:14:10 +01:00
Michael Walker
192777c2c9 STMLike type synonyms to shrink type sigs 2015-05-09 19:56:54 +01:00
Michael Walker
0a4bdeee68 Add source-repository to cabal file 2015-03-13 15:01:03 +00:00