Skip to content

Commit 287e26b

Browse files
committed
Use GobList.cartesian_map more
1 parent 2cda2b3 commit 287e26b

File tree

7 files changed

+12
-15
lines changed

7 files changed

+12
-15
lines changed

src/analyses/extractPthread.ml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1197,16 +1197,15 @@ module Spec : Analyses.MCPSpec = struct
11971197
| Wait {cond = cond_var; mutex = mutex}, _, _ ->
11981198
let cond_vars = ExprEval.eval_ptr man cond_var in
11991199
let mutex_vars = ExprEval.eval_ptr man mutex in
1200-
let cond_var_action (v, m) =
1200+
let cond_var_action v m =
12011201
let open Action in
12021202
CondVarWait
12031203
{ cond_var_id = Tbls.CondVarIdTbl.get @@ Variable.show v
12041204
; mid = Tbls.MutexMidTbl.get @@ Variable.show m
12051205
}
12061206
in
12071207
add_actions
1208-
@@ List.map cond_var_action
1209-
@@ List.cartesian_product cond_vars mutex_vars
1208+
@@ GobList.cartesian_map cond_var_action cond_vars mutex_vars
12101209
| _ -> man.local
12111210

12121211
let startstate v =

src/cdomain/value/cdomains/int/intervalSetDomain.ml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,18 +185,18 @@ struct
185185
let binary_op_with_norm op (ik:ikind) (x: t) (y: t) : t*overflow_info = match x, y with
186186
| [], _ -> ([],{overflow=false; underflow=false})
187187
| _, [] -> ([],{overflow=false; underflow=false})
188-
| _, _ -> norm_intvs ik @@ List.map (fun (x,y) -> op x y) (BatList.cartesian_product x y)
188+
| _, _ -> norm_intvs ik @@ GobList.cartesian_map op x y
189189

190190
let binary_op_concat_with_norm op (ik:ikind) (x: t) (y: t) : t*overflow_info = match x, y with
191191
| [], _ -> ([],{overflow=false; underflow=false})
192192
| _, [] -> ([],{overflow=false; underflow=false})
193-
| _, _ -> norm_intvs ik @@ List.concat_map (fun (x,y) -> op x y) (BatList.cartesian_product x y)
193+
| _, _ -> norm_intvs ik @@ List.concat_map (fun (x,y) -> op x y) (BatList.cartesian_product x y) (* TODO: GobList.cartesian_concat_map? *)
194194

195195
let binary_op_with_ovc (x: t) (y: t) op : t*overflow_info = match x, y with
196196
| [], _ -> ([],{overflow=false; underflow=false})
197197
| _, [] -> ([],{overflow=false; underflow=false})
198198
| _, _ ->
199-
let res = List.map op (BatList.cartesian_product x y) in
199+
let res = GobList.cartesian_map (Batteries.curry op) x y in
200200
let intvs = List.concat_map fst res in
201201
let underflow = List.exists (fun (_,{underflow; _}) -> underflow) res in
202202
let overflow = List.exists (fun (_,{overflow; _}) -> underflow) res in

src/cdomains/congruenceClosure.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -379,10 +379,10 @@ module Disequalities = struct
379379
let comp_closure (r1,r2,z) =
380380
let eq_class1 = LMap.comp_t_cmap_repr cmap r1 in
381381
let eq_class2 = LMap.comp_t_cmap_repr cmap r2 in
382-
let to_diseq ((z1, nt1), (z2, nt2)) =
382+
let to_diseq (z1, nt1) (z2, nt2) =
383383
(nt1, nt2, Z.(-z2+z+z1))
384384
in
385-
List.map to_diseq (BatList.cartesian_product eq_class1 eq_class2)
385+
GobList.cartesian_map to_diseq eq_class1 eq_class2
386386
in
387387
List.concat_map comp_closure diseqs
388388
end

src/domains/intDomainProperties.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ struct
9292
let name () = "integerset"
9393

9494
let lift1 = map
95-
let lift2 f x y = BatList.cartesian_product (elements x) (elements y) |> List.map (Batteries.uncurry f) |> of_list
95+
let lift2 f x y = GobList.cartesian_map f (elements x) (elements y) |> of_list
9696

9797
let neg = lift1 Base.neg
9898
let add = lift2 Base.add

tests/unit/cdomains/intDomainTest.ml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,6 @@ struct
483483
assert_bool "-5 ?= not (4 | 12)" (I.equal_to (of_int (-5)) (I.lognot ik b12) = `Top)
484484

485485
let of_list ik is = List.fold_left (fun acc x -> I.join ik acc (I.of_int ik x)) (I.bot ()) is
486-
let cart_op op a b = List.map (BatTuple.Tuple2.uncurry op) (BatList.cartesian_product a b)
487486

488487
let precision ik = snd @@ IntDomain.Size.bits ik
489488
let over_precision ik = Int.succ @@ precision ik
@@ -546,7 +545,7 @@ struct
546545
Test.make ~name:name ~print:shift_test_printer
547546
test_case_gen
548547
(fun (a,b) ->
549-
let expected_subset = cart_op c_op a b |> of_list ik in
548+
let expected_subset = GobList.cartesian_map c_op a b |> of_list ik in
550549
let result = a_op ik (of_list ik a) (of_list ik b) in
551550
I.leq expected_subset result
552551
)

tests/unit/dune

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
)
1212
)
1313
(preprocess (pps ppx_deriving.std ppx_deriving_hash ppx_deriving_yojson))
14-
(flags :standard -linkall))
14+
(flags :standard -open Goblint_std -linkall))
1515

1616
(env
1717
(dev

tests/unit/maindomaintest.ml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,12 +88,11 @@ let nonAssocTestsuite =
8888
)
8989

9090
let old_intdomains intDomains =
91-
BatList.cartesian_product intDomains ikinds
92-
|> List.map (fun (d, ik) ->
91+
GobList.cartesian_map (fun d ik ->
9392
let module D = (val d: IntDomainProperties.S2) in
9493
let module Ikind = struct let ikind () = ik end in
9594
(module IntDomainProperties.WithIkind (D) (Ikind): IntDomainProperties.OldSWithIkind)
96-
)
95+
) intDomains ikinds
9796
let intTestsuite =
9897
old_intdomains intDomains
9998
|> List.concat_map (fun d ->

0 commit comments

Comments
 (0)