|
26 | 26 | (* For hashconsing together with incremental we need to re-hashcons old values. |
27 | 27 | * For HashconsLifter.D this is done on any lattice operation, so we can replace x with `join bot x` to hashcons it again and get a new tag for it. |
28 | 28 | * For HashconsLifter.C we call hashcons only in `context` which is in Analyses.Spec but not in Analyses.GlobConstrSys, i.e. not visible to the solver. *) |
29 | | - (* The default for this should be identity, except for HConsed below where we want to have the side-effect and return a value with the updated tag. *) |
| 29 | + (* The default for functors should pass the call to their argument modules, except for HConsed below where we want to have the side-effect and return a value with the updated tag. *) |
30 | 30 | val relift: t -> t |
31 | 31 | end |
32 | 32 |
|
@@ -162,39 +162,40 @@ struct |
162 | 162 | let arbitrary () = QCheck.map ~rev:unlift lift (Base.arbitrary ()) |
163 | 163 | end |
164 | 164 |
|
165 | | -module HashCached (M: S) = |
| 165 | +module HashCached (Base: S) = |
166 | 166 | struct |
167 | | - module LazyHash = LazyEval.Make (struct type t = M.t type result = int let eval = M.hash end) |
| 167 | + module LazyHash = LazyEval.Make (struct type t = Base.t type result = int let eval = Base.hash end) |
168 | 168 |
|
169 | | - let name () = "HashCached " ^ M.name () |
| 169 | + let name () = "HashCached " ^ Base.name () |
170 | 170 |
|
171 | 171 | type t = |
172 | 172 | { |
173 | | - m: M.t; |
| 173 | + m: Base.t; |
174 | 174 | lazy_hash: LazyHash.t; |
175 | 175 | } |
176 | 176 |
|
177 | 177 | let lift m = {m; lazy_hash = LazyHash.make m} |
178 | 178 | let unlift {m; _} = m |
| 179 | + let relift x = lift @@ Base.relift x.m |
179 | 180 |
|
180 | 181 | let lift_f f x = f (unlift x) |
181 | 182 | let lift_f' f x = lift @@ lift_f f x |
182 | 183 | let lift_f2 f x y = f (unlift x) (unlift y) |
183 | 184 | let lift_f2' f x y = lift @@ lift_f2 f x y |
184 | 185 |
|
185 | | - let equal = lift_f2 M.equal |
186 | | - let compare = lift_f2 M.compare |
| 186 | + let equal = lift_f2 Base.equal |
| 187 | + let compare = lift_f2 Base.compare |
187 | 188 | let hash x = LazyHash.force x.lazy_hash |
188 | | - let show = lift_f M.show |
| 189 | + let show = lift_f Base.show |
189 | 190 |
|
190 | | - let pretty () = lift_f (M.pretty ()) |
| 191 | + let pretty () = lift_f (Base.pretty ()) |
191 | 192 |
|
192 | | - let printXml f = lift_f (M.printXml f) |
193 | | - let to_yojson = lift_f (M.to_yojson) |
| 193 | + let printXml f = lift_f (Base.printXml f) |
| 194 | + let to_yojson = lift_f (Base.to_yojson) |
194 | 195 |
|
195 | | - let arbitrary () = QCheck.map ~rev:unlift lift (M.arbitrary ()) |
| 196 | + let arbitrary () = QCheck.map ~rev:unlift lift (Base.arbitrary ()) |
196 | 197 |
|
197 | | - let tag = lift_f M.tag |
| 198 | + let tag = lift_f Base.tag |
198 | 199 | end |
199 | 200 |
|
200 | 201 |
|
|
0 commit comments