Skip to content

Commit 871eeaf

Browse files
authored
Merge pull request #318 from ocaml-multicore/avoid-repetitive-interleaving-search
Avoid repetitive interleaving search in STM_domain
2 parents 8f465d4 + 747b129 commit 871eeaf

File tree

3 files changed

+15
-8
lines changed

3 files changed

+15
-8
lines changed

CHANGES.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22

33
## Next version
44

5-
- ensure `cleanup` is run in the presence of exceptions in
5+
- #318: avoid repetitive interleaving searches in `STM_domain` and `STM_thread`
6+
- #312: Escape and quote `bytes` printed with `STM`'s `bytes` combinator
7+
- #295: ensure `cleanup` is run in the presence of exceptions in
68
- `STM_sequential.agree_prop` and `STM_domain.agree_prop_par`
79
- `Lin_thread.lin_prop` and `Lin_effect.lin_prop`
8-
- #312: Escape and quote `bytes` printed with `STM`'s `bytes` combinator
910

1011
## 0.1.1
1112

lib/STM_domain.ml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ module Make (Spec: Spec) = struct
1818
List.combine cs (Array.to_list res_arr)
1919

2020
let agree_prop_par (seq_pref,cmds1,cmds2) =
21-
assume (all_interleavings_ok seq_pref cmds1 cmds2 Spec.init_state);
2221
let sut = Spec.init_sut () in
2322
let pref_obs = interp_sut_res sut seq_pref in
2423
let wait = Atomic.make true in
@@ -41,13 +40,17 @@ module Make (Spec: Spec) = struct
4140
let max_gen = 3*count in (* precond filtering may require extra generation: max. 3*count though *)
4241
Test.make ~retries:10 ~max_gen ~count ~name
4342
(arb_cmds_triple seq_len par_len)
44-
(repeat rep_count agree_prop_par) (* 25 times each, then 25 * 15 times when shrinking *)
43+
(fun ((seq_pref,cmds1,cmds2) as triple) ->
44+
assume (all_interleavings_ok seq_pref cmds1 cmds2 Spec.init_state);
45+
repeat rep_count agree_prop_par triple) (* 25 times each, then 25 * 15 times when shrinking *)
4546

4647
let neg_agree_test_par ~count ~name =
4748
let rep_count = 25 in
4849
let seq_len,par_len = 20,12 in
4950
let max_gen = 3*count in (* precond filtering may require extra generation: max. 3*count though *)
5051
Test.make_neg ~retries:10 ~max_gen ~count ~name
5152
(arb_cmds_triple seq_len par_len)
52-
(repeat rep_count agree_prop_par) (* 25 times each, then 25 * 15 times when shrinking *)
53+
(fun ((seq_pref,cmds1,cmds2) as triple) ->
54+
assume (all_interleavings_ok seq_pref cmds1 cmds2 Spec.init_state);
55+
repeat rep_count agree_prop_par triple) (* 25 times each, then 25 * 15 times when shrinking *)
5356
end

lib/STM_thread.ml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ module Make (Spec: Spec) = struct
2121

2222
(* Concurrent agreement property based on [Threads] *)
2323
let agree_prop_conc (seq_pref,cmds1,cmds2) =
24-
assume (all_interleavings_ok seq_pref cmds1 cmds2 Spec.init_state);
2524
let sut = Spec.init_sut () in
2625
let obs1,obs2 = ref (Error ThreadNotFinished), ref (Error ThreadNotFinished) in
2726
let pref_obs = interp_sut_res sut seq_pref in
@@ -46,13 +45,17 @@ module Make (Spec: Spec) = struct
4645
let max_gen = 3*count in (* precond filtering may require extra generation: max. 3*count though *)
4746
Test.make ~retries:15 ~max_gen ~count ~name
4847
(arb_cmds_triple seq_len par_len)
49-
(repeat rep_count agree_prop_conc) (* 100 times each, then 100 * 15 times when shrinking *)
48+
(fun ((seq_pref,cmds1,cmds2) as triple) ->
49+
assume (all_interleavings_ok seq_pref cmds1 cmds2 Spec.init_state);
50+
repeat rep_count agree_prop_conc triple) (* 100 times each, then 100 * 15 times when shrinking *)
5051

5152
let neg_agree_test_conc ~count ~name =
5253
let rep_count = 25 in
5354
let seq_len,par_len = 20,12 in
5455
let max_gen = 3*count in (* precond filtering may require extra generation: max. 3*count though *)
5556
Test.make_neg ~retries:15 ~max_gen ~count ~name
5657
(arb_cmds_triple seq_len par_len)
57-
(repeat rep_count agree_prop_conc) (* 25 times each, then 25 * 15 times when shrinking *)
58+
(fun ((seq_pref,cmds1,cmds2) as triple) ->
59+
assume (all_interleavings_ok seq_pref cmds1 cmds2 Spec.init_state);
60+
repeat rep_count agree_prop_conc triple) (* 100 times each, then 100 * 15 times when shrinking *)
5861
end

0 commit comments

Comments
 (0)