Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove intermediate module definition in AffineEqualityAnalysis #1349

Merged
merged 2 commits into from
Feb 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions src/analyses/apron/affineEqualityAnalysis.apron.ml
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,10 @@ include RelationAnalysis
let spec_module: (module MCPSpec) Lazy.t =
lazy (
let module AD = AffineEqualityDomain.D2 (VectorMatrix.ArrayVector) (VectorMatrix.ArrayMatrix) in
let module RD: RelationDomain.RD =
struct
module V = AffineEqualityDomain.V
include AD
end
in
sim642 marked this conversation as resolved.
Show resolved Hide resolved
let module Priv = (val RelationPriv.get_priv ()) in
let module Spec =
struct
include SpecFunctor (Priv) (RD) (RelationPrecCompareUtil.DummyUtil)
include SpecFunctor (Priv) (AD) (RelationPrecCompareUtil.DummyUtil)
let name () = "affeq"
end
in
Expand Down
11 changes: 2 additions & 9 deletions src/analyses/apron/apronAnalysis.apron.ml
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,11 @@ let spec_module: (module MCPSpec) Lazy.t =
let module Man = (val ApronDomain.get_manager ()) in
let module AD = ApronDomain.D2 (Man) in
let diff_box = GobConfig.get_bool "ana.apron.invariant.diff-box" in
let module AD = (val if diff_box then (module ApronDomain.BoxProd (AD): ApronDomain.S3) else (module AD)) in
let module RD: RelationDomain.RD =
struct
module V = ApronDomain.V
include AD
type var = Apron.Var.t
end
in
let module AD = (val if diff_box then (module ApronDomain.BoxProd (AD): RelationDomain.RD) else (module AD)) in
let module Priv = (val RelationPriv.get_priv ()) in
let module Spec =
struct
include SpecFunctor (Priv) (RD) (ApronPrecCompareUtil.Util)
include SpecFunctor (Priv) (AD) (ApronPrecCompareUtil.Util)
let name () = "apron"
end
in
Expand Down
8 changes: 3 additions & 5 deletions src/cdomains/apron/affineEqualityDomain.apron.ml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ module Mpqf = struct
let hash x = 31 * (Z.hash (get_den x)) + Z.hash (get_num x)
end

module V = RelationDomain.V

(** It defines the type t of the affine equality domain (a struct that contains an optional matrix and an apron environment) and provides the functions needed for handling variables (which are defined by RelationDomain.D2) such as add_vars remove_vars.
Furthermore, it provides the function get_coeff_vec that parses an apron expression into a vector of coefficients if the apron expression has an affine form. *)
module VarManagement (Vec: AbstractVector) (Mx: AbstractMatrix)=
Expand Down Expand Up @@ -240,7 +238,7 @@ struct
include VarManagement (Vc) (Mx)

module Bounds = ExpressionBounds (Vc) (Mx)

module V = RelationDomain.V
module Convert = SharedFunctions.Convert (V) (Bounds) (struct let allow_global = true end) (SharedFunctions.Tracked)

type var = V.t
Expand Down Expand Up @@ -703,9 +701,9 @@ struct
let unmarshal t = t
end

module D2(Vc: AbstractVector) (Mx: AbstractMatrix): RelationDomain.S3 with type var = Var.t =
module D2(Vc: AbstractVector) (Mx: AbstractMatrix): RelationDomain.RD with type var = Var.t =
struct
module D = D (Vc) (Mx)
include SharedFunctions.AssertionModule (V) (D)
include SharedFunctions.AssertionModule (D.V) (D)
include D
end
7 changes: 6 additions & 1 deletion src/cdomains/apron/apronDomain.apron.ml
Original file line number Diff line number Diff line change
Expand Up @@ -779,6 +779,7 @@ module type S2 =
(* TODO: ExS3 or better extend RelationDomain.S3 directly?*)
sig
module Man: Manager
module V: RV
include module type of AOps (Tracked) (Man)
include SLattice with type t = Man.mt A.t

Expand All @@ -803,6 +804,7 @@ sig
include SLattice
include AOps with type t := t

module V: RV
module Tracked: RelationDomain.Tracked

val assert_inv : t -> exp -> bool -> bool Lazy.t -> t
Expand All @@ -813,6 +815,7 @@ end
module D2 (Man: Manager) : S2 with module Man = Man =
struct
include D (Man)
module V = RelationDomain.V

type marshal = OctagonD.marshal

Expand Down Expand Up @@ -926,8 +929,10 @@ struct
|> Lincons1Set.elements
end

module BoxProd (D: S3): S3 =
module BoxProd (D: S3): RD =
struct
module V = D.V
type var = V.t
module BP0 = BoxProd0 (D)
module Tracked = SharedFunctions.Tracked
include BP0
Expand Down
1 change: 0 additions & 1 deletion src/cdomains/apron/relationDomain.apron.ml
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@ end
module type S3 =
sig
include S2

val cil_exp_of_lincons1: Lincons1.t -> exp option
val invariant: t -> Lincons1.t list
end
Expand Down