Skip to content

Commit 3d5c65d

Browse files
committed
Add Lattice.Lift2Conf
1 parent 38942f9 commit 3d5c65d

File tree

7 files changed

+22
-12
lines changed

7 files changed

+22
-12
lines changed

src/analyses/base.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ struct
5454

5555
module G =
5656
struct
57-
include Lattice.Lift2 (Priv.G) (VD) (Printable.DefaultNames)
57+
include Lattice.Lift2Conf (struct let expand1 = false let expand2 = false end) (Priv.G) (VD) (Printable.DefaultNames)
5858

5959
let priv = function
6060
| `Bot -> Priv.G.bot ()

src/analyses/basePriv.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -799,7 +799,7 @@ struct
799799
struct
800800
(* weak: G -> (2^M -> WeakRange) *)
801801
(* sync: M -> (2^M -> SyncRange) *)
802-
include Lattice.Lift2 (GWeak) (GSync) (Printable.DefaultNames)
802+
include Lattice.Lift2Conf (struct let expand1 = false let expand2 = false end) (GWeak) (GSync) (Printable.DefaultNames)
803803

804804
let weak = function
805805
| `Bot -> GWeak.bot ()

src/analyses/commonPriv.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ struct
198198

199199
module G =
200200
struct
201-
include Lattice.Lift2 (GMutex) (GThread) (Printable.DefaultNames)
201+
include Lattice.Lift2Conf (struct let expand1 = false let expand2 = false end) (GMutex) (GThread) (Printable.DefaultNames)
202202

203203
let mutex = function
204204
| `Bot -> GMutex.bot ()

src/analyses/mutexAnalysis.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ struct
132132

133133
module G =
134134
struct
135-
include Lattice.Lift2 (GProtecting) (GProtected) (Printable.DefaultNames)
135+
include Lattice.Lift2Conf (struct let expand1 = false let expand2 = false end) (GProtecting) (GProtected) (Printable.DefaultNames)
136136

137137
let protecting = function
138138
| `Bot -> GProtecting.bot ()

src/analyses/raceAnalysis.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ struct
194194

195195
module G =
196196
struct
197-
include Lattice.Lift2 (OffsetTrie) (MemoSet) (Printable.DefaultNames)
197+
include Lattice.Lift2Conf (struct let expand1 = false let expand2 = false end) (OffsetTrie) (MemoSet) (Printable.DefaultNames)
198198

199199
let access = function
200200
| `Bot -> OffsetTrie.bot ()

src/common/domains/printable.ml

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -370,21 +370,23 @@ struct
370370
let relift = Option.map Base.relift
371371
end
372372

373-
module Lift2 (Base1: S) (Base2: S) (N: LiftingNames) =
373+
module Lift2Conf (Conf: EitherConf) (Base1: S) (Base2: S) (N: LiftingNames) =
374374
struct
375375
type t = [`Bot | `Lifted1 of Base1.t | `Lifted2 of Base2.t | `Top] [@@deriving eq, ord, hash]
376376
include Std
377377
include N
378378

379379
let pretty () (state:t) =
380380
match state with
381+
(* TODO: expand *)
381382
| `Lifted1 n -> Base1.pretty () n
382383
| `Lifted2 n -> Base2.pretty () n
383384
| `Bot -> text bot_name
384385
| `Top -> text top_name
385386

386387
let show state =
387388
match state with
389+
(* TODO: expand *)
388390
| `Lifted1 n -> Base1.show n
389391
| `Lifted2 n -> Base2.show n
390392
| `Bot -> bot_name
@@ -399,16 +401,22 @@ struct
399401
let printXml f = function
400402
| `Bot -> BatPrintf.fprintf f "<value>\n<data>\n%s\n</data>\n</value>\n" N.bot_name
401403
| `Top -> BatPrintf.fprintf f "<value>\n<data>\n%s\n</data>\n</value>\n" N.top_name
402-
| `Lifted1 x -> BatPrintf.fprintf f "<value>\n<map>\n<key>\nLifted1\n</key>\n%a</map>\n</value>\n" Base1.printXml x
403-
| `Lifted2 x -> BatPrintf.fprintf f "<value>\n<map>\n<key>\nLifted2\n</key>\n%a</map>\n</value>\n" Base2.printXml x
404+
| `Lifted1 x when Conf.expand1 -> BatPrintf.fprintf f "<value>\n<map>\n<key>\nLifted1\n</key>\n%a</map>\n</value>\n" Base1.printXml x
405+
| `Lifted1 x -> Base1.printXml f x
406+
| `Lifted2 x when Conf.expand2 -> BatPrintf.fprintf f "<value>\n<map>\n<key>\nLifted2\n</key>\n%a</map>\n</value>\n" Base2.printXml x
407+
| `Lifted2 x -> Base2.printXml f x
404408

405409
let to_yojson = function
406410
| `Bot -> `String N.bot_name
407411
| `Top -> `String N.top_name
408-
| `Lifted1 x -> `Assoc [ Base1.name (), Base1.to_yojson x ]
409-
| `Lifted2 x -> `Assoc [ Base2.name (), Base2.to_yojson x ]
412+
| `Lifted1 x when Conf.expand1 -> `Assoc [ Base1.name (), Base1.to_yojson x ]
413+
| `Lifted1 x -> Base1.to_yojson x
414+
| `Lifted2 x when Conf.expand2 -> `Assoc [ Base2.name (), Base2.to_yojson x ]
415+
| `Lifted2 x -> Base2.to_yojson x
410416
end
411417

418+
module Lift2 = Lift2Conf (struct let expand1 = true let expand2 = true end)
419+
412420
module type ProdConfiguration =
413421
sig
414422
val expand_fst: bool

src/domain/lattice.ml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -336,9 +336,9 @@ struct
336336
| _ -> x
337337
end
338338

339-
module Lift2 (Base1: S) (Base2: S) (N: Printable.LiftingNames) =
339+
module Lift2Conf (Conf: Printable.EitherConf) (Base1: S) (Base2: S) (N: Printable.LiftingNames) =
340340
struct
341-
include Printable.Lift2 (Base1) (Base2) (N)
341+
include Printable.Lift2Conf (Conf) (Base1) (Base2) (N)
342342

343343
let bot () = `Bot
344344
let is_bot x = x = `Bot
@@ -408,6 +408,8 @@ struct
408408

409409
end
410410

411+
module Lift2 = Lift2Conf (struct let expand1 = true let expand2 = true end)
412+
411413
module ProdConf (C: Printable.ProdConfiguration) (Base1: S) (Base2: S) =
412414
struct
413415
include Printable.ProdConf (C) (Base1) (Base2)

0 commit comments

Comments
 (0)