Re-ordering forks will change thread IDs, and re-ordering newCRefs
will change CRef IDs (which will then change commit thread IDs when
executing under PSO). So before we can execute a simplified trace, we
have to consistently renumber everything again.
The idea is that, if the dependency function is correct, then any
permutation of independent actions should give the same result.
In practice it's a little more complex, as the dependency function has
some special cases which are only valid because of how it is used. So
an "independence" function which we can use to shuffle any trace
after-the-fact has to work around those cases.
Before:
105,910,870,840 bytes allocated in the heap
24,834,921,776 bytes copied during GC
17,775,024 bytes maximum residency (7973 sample(s))
674,464 bytes maximum slop
50 MB total memory in use (0 MB lost due to fragmentation)
Tot time (elapsed) Avg pause Max pause
Gen 0 196263 colls, 0 par 43.085s 43.734s 0.0002s 0.0225s
Gen 1 7973 colls, 0 par 21.953s 22.359s 0.0028s 0.0778s
TASKS: 204933 (204929 bound, 4 peak workers (4 total), using -N1)
SPARKS: 0 (0 converted, 0 overflowed, 0 dud, 0 GC'd, 0 fizzled)
INIT time 0.001s ( 0.001s elapsed)
MUT time 127.384s (138.737s elapsed)
GC time 65.038s ( 66.093s elapsed)
EXIT time 0.000s ( 0.000s elapsed)
Total time 192.517s (204.831s elapsed)
After:
89,073,483,552 bytes allocated in the heap
20,134,704,256 bytes copied during GC
13,426,968 bytes maximum residency (6623 sample(s))
265,720 bytes maximum slop
38 MB total memory in use (0 MB lost due to fragmentation)
Tot time (elapsed) Avg pause Max pause
Gen 0 165191 colls, 0 par 34.872s 35.319s 0.0002s 0.0111s
Gen 1 6623 colls, 0 par 17.515s 17.831s 0.0027s 0.0509s
TASKS: 173871 (173867 bound, 4 peak workers (4 total), using -N1)
SPARKS: 0 (0 converted, 0 overflowed, 0 dud, 0 GC'd, 0 fizzled)
INIT time 0.001s ( 0.001s elapsed)
MUT time 104.495s (113.498s elapsed)
GC time 52.387s ( 53.150s elapsed)
EXIT time 0.001s ( 0.001s elapsed)
Total time 156.991s (166.650s elapsed)
Closes#168
1. Discard function (if present)
2. Way (if present)
3. Memory type (if present)
4. Name of test
5. Predicate
6. Action
For multi-predicate functions, 4 and 5 are replaced with a list.
Also adds a Functor and Profunctor instance for predicates. The old
predicate type is kept as an alias for the (common) case where both
tyvars are the same.
This also adds forkOS(N) and isCurrentThreadBound to MonadConc, a
breaking change.
Note: forkOSWithUnmask(N) is NOT added to MonadConc, as it isn't
supported in base-4.8 (GHC 7.10). See #132 for the action on this.
A bound thread under test gets a dedicated worker thread, which is
forked bound using the underlying MonadConc. This worker is used for
all lifted actions, with execution as normal otherwise.
This is preparation for adding bound threads. The instance isn't used
in this commit, but the diff is large enough that I feel this should
be a separate commit for ease of review.
Fallout:
- The MonadBaseControl IO instance is gone, as I'm not sure how to do
it generally.
- The pure/IO split is gone, everything is now monadic.
- The execution, SCT, and dejafu functions are of the form (MonadConc
n, MonadRef r n) => ...