Skip to content

Commit e8cc8e6

Browse files
committed
Now, abstr. GC available also for TD - but just removal of contribs
1 parent 09b8d91 commit e8cc8e6

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

src/solver/td_simplified_ref_improved.ml

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
(** Top-down solver with side effects. Baseline for comparisons with td_parallel solvers ([td_simplified_ref]).
22
This is the same as ([td_simplified]), but it uses records for solver that instead of multiple hashmaps.
3-
Additionally, an origin hashmap is maintained to allow for narrowing on globals ...
3+
This solver implements update rules with widening delay and narrowing gas.
4+
An origin hashmap is maintained to allow for narrowing on globals to terminate more often.
5+
Also, abstract GC is supported - if desired.
46
*)
57

68
open Batteries
@@ -24,6 +26,7 @@ module Base : GenericEqSolver =
2426
wpoint: bool;
2527
stable: bool;
2628
called: bool;
29+
contrib: VS.t
2730
}
2831

2932
(*
@@ -41,6 +44,7 @@ module Base : GenericEqSolver =
4144
}
4245

4346
let gas_default = ref (10,3)
47+
let abs_GC = ref true
4448

4549
let warrow (a,delay,gas,narrow) b =
4650
let (delay0,_) = !gas_default in
@@ -84,7 +88,8 @@ module Base : GenericEqSolver =
8488
value = S.Dom.bot ();
8589
wpoint = false;
8690
stable = false;
87-
called = false
91+
called = false;
92+
contrib = VS.empty
8893
} in
8994
HM.replace data x data_x;
9095
let orig_x = {
@@ -182,12 +187,19 @@ alternatively, distinguish contribs by session number?
182187
| None -> S.Dom.bot ()
183188
| Some f ->
184189
let sigma = HM.create 10 in
190+
let new_set = ref VS.empty in
185191
let add_sigma y d =
186192
let d = try S.Dom.join d (HM.find sigma y) with _ -> d in
187193
HM.replace sigma y d;
194+
new_set := VS.add y !new_set;
188195
side x y d in
189-
f (query x) add_sigma
190-
196+
let d = f (query x) add_sigma in
197+
let x_ref = init x in
198+
let old_set = !x_ref.contrib in
199+
let _ = x_ref := {!x_ref with contrib = !new_set} in
200+
let _ = if !abs_GC then VS.iter (fun y -> try HM.find sigma y; () with
201+
| _ -> side x y (S.Dom.bot ())) old_set in
202+
d
191203

192204
and iterate x = (* ~(inner) solve in td3 *)
193205

0 commit comments

Comments
 (0)