Skip to content

Commit

Permalink
Add global invariant to maylocksdigest
Browse files Browse the repository at this point in the history
  • Loading branch information
sim642 committed Nov 30, 2023
1 parent 90f1a62 commit 21e0644
Showing 1 changed file with 20 additions and 6 deletions.
26 changes: 20 additions & 6 deletions src/analyses/mayLocksDigest.ml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,27 @@ module Arg =
struct
module D = LockDomain.MayLocksetNoRW
module P = IdentityP (D)
module G = DefaultSpec.G
module V = DefaultSpec.V

let add ctx (l,r) =
D.add l ctx.local

let remove ctx l =
module V =
struct
include StdV
include LockDomain.Addr
end
module G = SetDomain.Make (D)

let add (ctx: (D.t, G.t, D.t, V.t) ctx) (l,r) =
let l's = ctx.global l in
G.iter (fun l' ->
if not (D.mem l ctx.local && not (D.mem l l')) then
ctx.split (D.add l (D.union ctx.local l')) []
) l's;
if D.mem l ctx.local then
raise Deadcode
else
D.add l ctx.local (* for initial empty *)

let remove (ctx: (D.t, G.t, D.t, V.t) ctx) l =
ctx.sideg l (G.singleton ctx.local);
ctx.local
end

Expand Down

0 comments on commit 21e0644

Please sign in to comment.