Skip to content

Commit 3efe923

Browse files
committed
Add option for affeq side effect analysis
1 parent a8e1987 commit 3efe923

File tree

2 files changed

+29
-6
lines changed

2 files changed

+29
-6
lines changed

src/analyses/apron/affineEqualityAnalysis.apron.ml

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,27 @@ open Analyses
77
open SparseVector
88
open ListMatrix
99

10-
(* To use the original affineEqualityDomain implementation uncomment this and the AD_Array.
11-
Then replace AD with AD_Array in the functor application.
12-
open ArrayVector
13-
open ArrayMatrix *)
10+
open ArrayVector
11+
open ArrayMatrix
1412

1513
include RelationAnalysis
1614

15+
(* There are two versions of the affeq domain.
16+
1. Sparse without side effects
17+
2. Array with side effects
18+
Default: sparse implementation
19+
The array implementation with side effects of the affeq domain is used when the --enable ana.affeq.side_effects option is set *)
20+
let get_domain: (module RelationDomain.RD) Lazy.t =
21+
lazy (
22+
if GobConfig.get_bool "ana.affeq.side_effects" then
23+
(module AffineEqualityDomainSideEffects.D2 (ArrayVector) (ArrayMatrix))
24+
else
25+
(module AffineEqualityDomain.D2 (SparseVector) (ListMatrix))
26+
)
27+
1728
let spec_module: (module MCPSpec) Lazy.t =
1829
lazy (
19-
let module AD = AffineEqualityDomain.D2 (SparseVector) (ListMatrix) in
20-
(* let module AD_Array = AffineEqualityDomainSideEffects.D2 (ArrayVector) (ArrayMatrix) in *)
30+
let module AD = (val Lazy.force get_domain) in
2131
let module Priv = (val RelationPriv.get_priv ()) in
2232
let module Spec =
2333
struct

src/config/options.schema.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1198,6 +1198,19 @@
11981198
}
11991199
},
12001200
"additionalProperties": false
1201+
},
1202+
"affeq": {
1203+
"title": "ana.affeq",
1204+
"type": "object",
1205+
"properties": {
1206+
"side_effects": {
1207+
"title": "ana.affeq.side_effects",
1208+
"description": "Use side effect Affine Equality analysis (array implementation). Default is false (sparse implementation)",
1209+
"type": "boolean",
1210+
"default": false
1211+
}
1212+
},
1213+
"additionalProperties": false
12011214
}
12021215
},
12031216
"additionalProperties": false

0 commit comments

Comments
 (0)