You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/cdomains/apron/affineEqualityDenseDomain.apron.ml
+26-15Lines changed: 26 additions & 15 deletions
Original file line number
Diff line number
Diff line change
@@ -30,15 +30,14 @@ struct
30
30
letdim_addchm= timing_wrap "dim add" (dim_add ch) m
31
31
32
32
33
-
letdim_remove (ch: Apron.Dim.change) m~del=
33
+
letdim_remove (ch: Apron.Dim.change) m=
34
34
ifArray.length ch.dim =0|| is_empty m then
35
35
m
36
36
else (
37
-
Array.modifyi (+) ch.dim;
38
-
let m' =ifnot del thenlet m = copy m inArray.fold_left (funyx -> reduce_col_with y x; y) m ch.dim else m in
37
+
let m' =let m = copy m inArray.fold_left (funyx -> reduce_col_with y x; y) m ch.dim in
39
38
remove_zero_rows @@ del_cols m' ch.dim)
40
39
41
-
letdim_removechm~del= timing_wrap "dim remove" (fundel -> dim_remove ch m ~del:del) del
40
+
letdim_removechm= timing_wrap "dim remove" (dim_remove ch) m
42
41
end
43
42
44
43
(** It defines the type t of the affine equality domain (a struct that contains an optional matrix and an apron environment) and provides the functions needed for handling variables (which are defined by RelationDomain.D2) such as add_vars remove_vars.
@@ -234,12 +233,11 @@ struct
234
233
letmeett1t2=
235
234
let sup_env =Environment.lce t1.env t2.env in
236
235
237
-
let t1, t2 =change_d t1 sup_env~add:true~del:false, change_d t2 sup_env~add:true~del:falsein
236
+
let t1, t2 =dimchange2_add t1 sup_env, dimchange2_add t2 sup_env in
238
237
if is_bot t1 || is_bot t2 then
239
238
bot ()
240
239
else
241
-
(* TODO: Why can I be sure that m1 && m2 are all Some here?
242
-
Answer: because is_bot checks if t1.d is None and we checked is_bot before. *)
240
+
(* Option.get, because is_bot checks if t1.d is None and we checked is_bot before. *)
letassign_var_paralleltvv's=(* vv's is a list of pairs of lhs-variables and their rhs-values *)
452
450
let assigned_vars =List.map fst vv's in
453
-
let t = add_vars t assigned_vars in
454
-
let primed_vars =List.init (List.length assigned_vars) (funi -> Var.of_string (Int.to_string i ^"'")) in(* TODO: we use primed vars in analysis, conflict? *)
455
-
let t_primed = add_vars t primed_vars in
451
+
let t = add_vars t assigned_vars in(* introduce all lhs-variables to the relation data structure *)
452
+
let primed_vars =List.init (* create a list with primed variables "i'" for each lhs-variable *)
453
+
(List.length assigned_vars)
454
+
(funi -> Var.of_string (Int.to_string i ^"'"))
455
+
in(* TODO: we use primed integers as var names, conflict? *)
456
+
let t_primed = add_vars t primed_vars in(* introduce primed variables to the relation data structure *)
457
+
(* sequence of assignments: i' = snd vv_i : *)
456
458
let multi_t =List.fold_left2 (funt'v_prime (_,v') -> assign_var t' v_prime v') t_primed primed_vars vv's in
Copy file name to clipboardExpand all lines: src/cdomains/apron/affineEqualityDomain.apron.ml
+26-16Lines changed: 26 additions & 16 deletions
Original file line number
Diff line number
Diff line change
@@ -30,15 +30,14 @@ struct
30
30
letdim_addchm= timing_wrap "dim add" (dim_add ch) m
31
31
32
32
33
-
letdim_remove (ch: Apron.Dim.change) m~del=
33
+
letdim_remove (ch: Apron.Dim.change) m=
34
34
ifArray.length ch.dim =0|| is_empty m then
35
35
m
36
36
else (
37
-
Array.modifyi (+) ch.dim;
38
-
let m' =ifnot del thenArray.fold_left (funyx -> reduce_col y x) m ch.dim else m in
37
+
let m' =Array.fold_left (funyx -> reduce_col y x) m ch.dim in
39
38
remove_zero_rows @@ del_cols m' ch.dim)
40
39
41
-
letdim_removechm~del= timing_wrap "dim remove" (fundel -> dim_remove ch m ~del:del) del
40
+
letdim_removechm= timing_wrap "dim remove" (dim_remove ch) m
42
41
end
43
42
44
43
(** It defines the type t of the affine equality domain (a struct that contains an optional matrix and an apron environment) and provides the functions needed for handling variables (which are defined by RelationDomain.D2) such as add_vars remove_vars.
@@ -235,12 +234,11 @@ struct
235
234
letmeett1t2=
236
235
let sup_env =Environment.lce t1.env t2.env in
237
236
238
-
let t1, t2 =change_d t1 sup_env~add:true~del:false, change_d t2 sup_env~add:true~del:falsein
237
+
let t1, t2 =dimchange2_add t1 sup_env, dimchange2_add t2 sup_env in
239
238
if is_bot t1 || is_bot t2 then
240
239
bot ()
241
240
else
242
-
(* TODO: Why can I be sure that m1 && m2 are all Some here?
243
-
Answer: because is_bot checks if t1.d is None and we checked is_bot before. *)
241
+
(* Option.get, because is_bot checks if t1.d is None and we checked is_bot before. *)
let primed_vars =List.init (List.length assigned_vars) (funi -> Var.of_string (Int.to_string i ^"'")) in(* TODO: we use primed vars in analysis, conflict? *)
449
-
let t_primed = add_vars t primed_vars in
443
+
letassign_var_paralleltvv's=(* vv's is a list of pairs of lhs-variables and their rhs-values *)
444
+
let assigned_vars =List.map fst vv's in
445
+
let t = add_vars t assigned_vars in(* introduce all lhs-variables to the relation data structure *)
446
+
let primed_vars =List.init (* create a list with primed variables "i'" for each lhs-variable *)
447
+
(List.length assigned_vars)
448
+
(funi -> Var.of_string (Int.to_string i ^"'"))
449
+
in(* TODO: we use primed integers as var names, conflict? *)
450
+
let t_primed = add_vars t primed_vars in(* introduce primed variables to the relation data structure *)
451
+
(* sequence of assignments: i' = snd vv_i : *)
450
452
let multi_t =List.fold_left2 (funt'v_prime (_,v') -> assign_var t' v_prime v') t_primed primed_vars vv's in
Array.modifyi (+) cpy; (* this is a hack to restore the original https://antoinemine.github.io/Apron/doc/api/ocaml/Dim.html remove_dimensions semantics for dim_remove *)
183
-
let m' =Array.fold_lefti (funyix -> forget_variable y (x)) m cpy in(* clear m' from relations concerning ch.dim *)
184
-
modify_variables_in_domain m' cpy (-))
181
+
let m' =Array.fold_lefti (funyix -> forget_variable y (x)) m ch.dim in(* clear m' from relations concerning ch.dim *)
182
+
modify_variables_in_domain m' ch.dim (-))
185
183
186
184
letdim_removechm=Timing.wrap "dim remove" (funm -> dim_remove ch m) m
187
185
188
-
letdim_removechm~del=let res = dim_remove ch m inifM.tracing then
186
+
letdim_removechm=let res = dim_remove ch m inifM.tracing then
189
187
M.tracel "dim_remove""dim remove at positions [%s] in { %s } -> { %s }"
EConj.IntMap.fold (funlhsrhsmap -> meet_with_one_conj map lhs rhs) (snd d2') t1 (* even on sparse d2, this will chose the relevant conjs to meet with*)
@@ -655,7 +653,7 @@ struct
655
653
match multi_t.d with
656
654
|Somearrwhennot@@ is_top multi_t ->
657
655
let switched_arr =List.fold_left2 (funmulti_tassigned_varprimed_var-> assign_var multi_t assigned_var primed_var) multi_t assigned_vars primed_vars in
0 commit comments