Skip to content

Commit 5e7c5c7

Browse files
committed
Keep only NonePriv3 in BasePriv
1 parent 814997a commit 5e7c5c7

File tree

2 files changed

+3
-154
lines changed

2 files changed

+3
-154
lines changed

src/analyses/basePriv.ml

Lines changed: 1 addition & 152 deletions
Original file line numberDiff line numberDiff line change
@@ -101,160 +101,11 @@ module DigestWrapper(Digest: Digest):PrivatizationWrapper = functor (GBase:Latt
101101
end)
102102

103103

104-
(* No Privatization *)
104+
(** No Privatization. *)
105105
module NonePriv: S =
106106
struct
107107
include NoFinalize
108108

109-
module G = BaseDomain.VD
110-
module V = VarinfoV
111-
module D = Lattice.Unit
112-
113-
let init () = ()
114-
115-
let startstate () = ()
116-
117-
let lock ask getg st m = st
118-
let unlock ask getg sideg st m = st
119-
120-
let escape ask getg sideg st escaped = st
121-
let enter_multithreaded ask getg sideg st = st
122-
let threadenter = old_threadenter
123-
let threadspawn ask getg sideg st = st
124-
125-
let iter_sys_vars getg vq vf =
126-
match vq with
127-
| VarQuery.Global g -> vf g
128-
| _ -> ()
129-
130-
131-
let read_global ask getg (st: BaseComponents (D).t) x =
132-
getg x
133-
134-
let write_global ?(invariant=false) ask getg sideg (st: BaseComponents (D).t) x v =
135-
if invariant then (
136-
(* Do not impose invariant, will not hold without privatization *)
137-
if M.tracing then M.tracel "set" ~var:x.vname "update_one_addr: BAD! effect = '%B', or else is private! " (not invariant);
138-
st
139-
)
140-
else (
141-
(* Here, an effect should be generated, but we add it to the local
142-
* state, waiting for the sync function to publish it. *)
143-
(* Copied from MainFunctor.update_variable *)
144-
if ((get_bool "exp.volatiles_are_top") && (is_always_unknown x)) then
145-
{st with cpa = CPA.add x (VD.top ()) st.cpa}
146-
else
147-
{st with cpa = CPA.add x v st.cpa}
148-
)
149-
150-
let sync ask getg sideg (st: BaseComponents (D).t) reason =
151-
(* For each global variable, we create the side effect *)
152-
let side_var (v: varinfo) (value) (st: BaseComponents (D).t) =
153-
if M.tracing then M.traceli "globalize" ~var:v.vname "Tracing for %s" v.vname;
154-
let res =
155-
if is_global ask v then begin
156-
if M.tracing then M.tracec "globalize" "Publishing its value: %a" VD.pretty value;
157-
sideg v value;
158-
{st with cpa = CPA.remove v st.cpa}
159-
end else
160-
st
161-
in
162-
if M.tracing then M.traceu "globalize" "Done!";
163-
res
164-
in
165-
(* We fold over the local state, and side effect the globals *)
166-
CPA.fold side_var st.cpa st
167-
168-
let thread_join ?(force=false) ask get e st = st
169-
let thread_return ask get set tid st = st
170-
171-
let invariant_global ask getg g =
172-
ValueDomain.invariant_global getg g
173-
174-
let invariant_vars ask getg st = []
175-
end
176-
177-
module NonePriv2: S =
178-
struct
179-
include NoFinalize
180-
181-
module G = VD
182-
module V = VarinfoV
183-
module D = Lattice.Unit
184-
185-
let init () = ()
186-
187-
let startstate () = ()
188-
189-
let lock ask getg st m = st
190-
let unlock ask getg sideg st m = st
191-
192-
let read_global (ask: Queries.ask) getg (st: BaseComponents (D).t) x =
193-
VD.join (CPA.find x st.cpa) (getg x)
194-
195-
let write_global ?(invariant=false) (ask: Queries.ask) getg sideg (st: BaseComponents (D).t) x v =
196-
if not invariant then
197-
sideg x v;
198-
{st with cpa = CPA.add x v st.cpa} (* TODO: pointless when invariant *)
199-
200-
let sync ask getg sideg (st: BaseComponents (D).t) reason =
201-
let branched_sync () =
202-
(* required for branched thread creation *)
203-
CPA.iter (fun x v ->
204-
if is_global ask x then
205-
sideg x v
206-
) st.cpa;
207-
st
208-
in
209-
match reason with
210-
| `Join when ConfCheck.branched_thread_creation () ->
211-
branched_sync ()
212-
| `JoinCall f when ConfCheck.branched_thread_creation_at_call ask f ->
213-
branched_sync ()
214-
| `Join
215-
| `JoinCall _
216-
| `Return
217-
| `Normal
218-
| `Init
219-
| `Thread ->
220-
st
221-
222-
let escape ask getg sideg (st: BaseComponents (D).t) escaped =
223-
CPA.iter (fun x v ->
224-
if EscapeDomain.EscapedVars.mem x escaped then
225-
sideg x v
226-
) st.cpa;
227-
st
228-
229-
let enter_multithreaded ask getg sideg (st: BaseComponents (D).t) =
230-
CPA.iter (fun x v ->
231-
if is_global ask x then
232-
sideg x v
233-
) st.cpa;
234-
st
235-
236-
let threadenter ask st = st
237-
let threadspawn ask get set st = st
238-
239-
let thread_join ?(force=false) ask get e st = st
240-
let thread_return ask get set tid st = st
241-
242-
let iter_sys_vars getg vq vf =
243-
match vq with
244-
| VarQuery.Global g ->
245-
vf g;
246-
| _ -> ()
247-
248-
let invariant_global ask getg g =
249-
ValueDomain.invariant_global getg g
250-
251-
let invariant_vars ask getg st = []
252-
end
253-
254-
module NonePriv3: S =
255-
struct
256-
include NoFinalize
257-
258109
module G = VD
259110
module V = VarinfoV
260111
module D = Lattice.Unit
@@ -2177,8 +2028,6 @@ let priv_module: (module S) Lazy.t =
21772028
let module Priv: S =
21782029
(val match get_string "ana.base.privatization" with
21792030
| "none" -> (module NonePriv: S)
2180-
| "none2" -> (module NonePriv2: S)
2181-
| "none3" -> (module NonePriv3: S)
21822031
| "vojdani" -> (module VojdaniPriv: S)
21832032
| "mutex-oplus" -> (module PerMutexOplusPriv)
21842033
| "mutex-meet" -> (module PerMutexMeetPriv)

src/config/options.schema.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -759,9 +759,9 @@
759759
"privatization": {
760760
"title": "ana.base.privatization",
761761
"description":
762-
"Which privatization to use? none/none2/vojdani/mutex-oplus/mutex-meet/mutex-meet-tid/protection/protection-read/mine/mine-nothread/mine-W/mine-W-noinit/lock/lock-tid/write/write-tid/write+lock/write+lock-tid",
762+
"Which privatization to use? none/vojdani/mutex-oplus/mutex-meet/mutex-meet-tid/protection/protection-read/mine/mine-nothread/mine-W/mine-W-noinit/lock/lock-tid/write/write-tid/write+lock/write+lock-tid",
763763
"type": "string",
764-
"enum": ["none", "none2", "none3", "vojdani", "mutex-oplus", "mutex-meet", "protection", "protection-tid", "protection-atomic", "protection-read", "protection-read-tid", "protection-read-atomic", "mine", "mine-nothread", "mine-W", "mine-W-noinit", "lock", "lock-tid", "write", "write-tid", "write+lock", "write+lock-tid", "mutex-meet-tid"],
764+
"enum": ["none", "vojdani", "mutex-oplus", "mutex-meet", "protection", "protection-tid", "protection-atomic", "protection-read", "protection-read-tid", "protection-read-atomic", "mine", "mine-nothread", "mine-W", "mine-W-noinit", "lock", "lock-tid", "write", "write-tid", "write+lock", "write+lock-tid", "mutex-meet-tid"],
765765
"default": "protection-read"
766766
},
767767
"priv": {

0 commit comments

Comments
 (0)