@@ -14,13 +14,13 @@ module FwdWBuSolver (System: FwdGlobConstrSys) = struct
1414 module GM = Hashtbl. Make (System. GVar )
1515 module LM = Hashtbl. Make (System. LVar )
1616
17+ (*
1718 module OM = LM
1819 let source x = x
20+ *)
1921
20- (*
2122 module OM = Hashtbl. Make (Node )
2223 let source = System.LVar. node
23- *)
2424
2525 let gas_default = ref (10 ,3 )
2626
@@ -42,16 +42,13 @@ module FwdWBuSolver (System: FwdGlobConstrSys) = struct
4242 let (delay0,_) = ! gas_default in
4343 if G. equal a b then (a,delay,gas,narrow)
4444 else if G. leq b a then
45- (
46- if narrow then (G. narrow a b,delay,gas,true )
47- else if gas< = 0 then (a,delay,gas,false )
48- else (G. narrow a b, delay,gas-1 ,true )
49- )
45+ if narrow then (G. narrow a b,delay,gas,true )
46+ else if gas< = 0 then (a,delay,gas,false )
47+ else (G. narrow a b, delay,gas-1 ,true )
5048 else if narrow then (G. join a b,delay0,gas,false )
5149 else if delay < = 0 then (G. widen a (G. join a b),0 ,gas,false )
5250 else (G. join a b, delay-1 ,gas,false )
5351
54-
5552(*
5653 work list just for checking ...
5754*)
@@ -94,7 +91,6 @@ module FwdWBuSolver (System: FwdGlobConstrSys) = struct
9491 type glob = {value : G .t ; init : G .t ; infl : LS .t ; last : G .t LM .t ;
9592 from : (G .t * int * int * bool * LS .t ) OM .t }
9693
97-
9894 let glob: glob GM. t = GM. create 100
9995
10096 (* auxiliary functions for globals *)
@@ -131,7 +127,6 @@ module FwdWBuSolver (System: FwdGlobConstrSys) = struct
131127 LS. fold (fun x d -> G. join d (LM. find last x)) set (G. bot() )
132128
133129 (* determine the join of all last contribs of unknowns with same orig *)
134-
135130 (* now the getters for globals *)
136131
137132 let get_global x g =
@@ -291,6 +286,24 @@ module FwdWBuSolver (System: FwdGlobConstrSys) = struct
291286 let _ = LM. iter (set_local x) sigma in
292287 ()
293288
289+ and wrap_new (x ,f ) d =
290+ let sigma = LM. create 10 in
291+ let tau = GM. create 10 in
292+ let add_sigma y d =
293+ let d = try D. join d (LM. find sigma y) with _ -> d in
294+ LM. replace sigma y d in
295+ (*
296+ set_local y x d in
297+ *)
298+ let add_tau g d =
299+ let d = try G. join d (GM. find tau g) with _ -> d in
300+ GM. replace tau g d;
301+ set_global x g d in
302+ let _ = f d (fun _ -> raise (Failure " Locals queried in rhs??" ))
303+ add_sigma (get_global x) add_tau in
304+ let _ = LM. iter (set_local x) sigma in
305+ ()
306+
294307(*
295308 now the actual propagation!
296309*)
@@ -304,7 +317,7 @@ module FwdWBuSolver (System: FwdGlobConstrSys) = struct
304317 | Some f ->
305318 let _ = rloc.called := true in
306319 let _ = rloc.aborted := false in
307- let _ = wrap (x,f) rloc.loc_value in
320+ let _ = wrap_new (x,f) rloc.loc_value in
308321 let _ = rloc.called := false in
309322 if ! (rloc.aborted) then (
310323 if tracing then trace " iter" " re-iter" ;
0 commit comments