let combinePredecessors (s: stmt) ~old new_ =
if (State_set.length !(new_.value)) = 0
then None
else begin
if old.counter_unroll >= slevel
then
let stored_value = find_current (Kstmt s) in
let sum =
Relations_type.Model.join
(State_set.join !(new_.value))
(State_set.join !(old.value))
in
if (State_set.exists
(fun e -> Relations_type.Model.is_included sum e)
stored_value.superposition)
then None
else begin
Some {counter_unroll = old.counter_unroll ;
value = ref (State_set.singleton sum);}
end
else begin try
let merged = State_set.merge_into !(new_.value) !(old.value) in
let new_counter_unroll =
old.counter_unroll + (State_set.cardinal !(new_.value)) in
if new_counter_unroll >= !counter_unroll_target
then begin
Value_parameters.result ~once:true
"Semantic level unrolling superposing up to %d states"
!counter_unroll_target;
counter_unroll_target := !counter_unroll_target + 100;
end;
let result =
Some
{ value = ref merged ;
counter_unroll =
old.counter_unroll + (State_set.cardinal !(new_.value)) }
in
result
with State_set.Unchanged -> None
end
end