Skip to content

Commit ec3e1d2

Browse files
fix(constraints): apply assign to sync-split states before join
Agent-Logs-Url: https://github.com/goblint/analyzer/sessions/9fbe3c8e-0b5b-4c06-af38-fee7944ab663 Co-authored-by: michael-schwarz <13812333+michael-schwarz@users.noreply.github.com>
1 parent 4f93251 commit ec3e1d2

2 files changed

Lines changed: 22 additions & 14 deletions

File tree

src/analyses/mCP.ml

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -173,13 +173,13 @@ struct
173173
in
174174
iter (uncurry side_one) @@ group_assoc_eq V.equal xs
175175

176-
let rec do_splits ?(local_tf=Fun.id) man pv (xs:(int * (Obj.t * Events.t list)) list) emits =
176+
let rec do_splits man pv (xs:(int * (Obj.t * Events.t list)) list) emits =
177177
let split_one n (d,emits') =
178178
let nv = assoc_replace (n,d) pv in
179179
(* Do split-specific emits before general emits.
180180
[emits] and [do_emits] are in reverse order.
181181
[emits'] is in normal order. *)
182-
man.split (local_tf (do_emits man (emits @ List.rev emits') nv false)) []
182+
man.split (do_emits man (emits @ List.rev emits') nv false) []
183183
in
184184
iter (uncurry split_one) xs
185185

@@ -510,7 +510,7 @@ struct
510510
let d = do_emits man !emits d q in
511511
if q then raise Deadcode else d
512512

513-
let rec sync_with_split_tf transform_splits (man:(D.t, G.t, C.t, V.t) man) reason =
513+
let sync (man:(D.t, G.t, C.t, V.t) man) reason =
514514
let spawns = ref [] in
515515
let splits = ref [] in
516516
let sides = ref [] in
@@ -523,19 +523,10 @@ struct
523523
let d, q = map_deadcode f @@ spec_list man.local in
524524
do_sideg man !sides;
525525
do_spawns man !spawns;
526-
let local_tf =
527-
if transform_splits then
528-
fun d -> sync_with_split_tf false {man with local = d} reason
529-
else
530-
Fun.id
531-
in
532-
do_splits ~local_tf man d !splits !emits;
526+
do_splits man d !splits !emits;
533527
let d = do_emits man !emits d q in
534528
if q then raise Deadcode else d
535529

536-
and sync (man:(D.t, G.t, C.t, V.t) man) reason =
537-
sync_with_split_tf true man reason
538-
539530
let enter (man:(D.t, G.t, C.t, V.t) man) r f a =
540531
let spawns = ref [] in
541532
let sides = ref [] in

src/framework/constraints.ml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,10 +140,27 @@ struct
140140

141141
let common_joins man ds splits spawns = common_join man (bigsqcup ds) splits spawns
142142

143+
let man_with_local (man: (D.t, S.G.t, S.C.t, S.V.t) man) (local: D.t) : (D.t, S.G.t, S.C.t, S.V.t) man =
144+
let rec man' =
145+
{ man with
146+
ask = (fun (type a) (q: a Queries.t) -> S.query man' q);
147+
local;
148+
}
149+
in
150+
man'
151+
143152
let tf_assign var edge prev_node lv e getl sidel demandl getg sideg d =
144153
let man, r, spawns = common_man var edge prev_node d getl sidel demandl getg sideg in
154+
let sync_splits = !r in
155+
r := [];
145156
let d = S.assign man lv e in (* Force transfer function to be evaluated before dereferencing in common_join argument. *)
146-
common_join man d !r !spawns
157+
let ds =
158+
List.filter_map (fun split_d ->
159+
try Some (S.assign (man_with_local man split_d) lv e)
160+
with Deadcode -> None
161+
) sync_splits
162+
in
163+
common_joins man (d :: ds) !r !spawns
147164

148165
let tf_vdecl var edge prev_node v getl sidel demandl getg sideg d =
149166
let man, r, spawns = common_man var edge prev_node d getl sidel demandl getg sideg in

0 commit comments

Comments
 (0)