|
|
@ -15,29 +15,27 @@ module Lock = struct
|
|
|
|
(* TODO (T37174859): change to [HilExp.t] *)
|
|
|
|
(* TODO (T37174859): change to [HilExp.t] *)
|
|
|
|
type t = AccessPath.t
|
|
|
|
type t = AccessPath.t
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
type var = Var.t
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let compare_var = Var.compare_modulo_this
|
|
|
|
|
|
|
|
|
|
|
|
(* compare type, base variable modulo this and access list *)
|
|
|
|
(* compare type, base variable modulo this and access list *)
|
|
|
|
let compare (((base, typ), aclist) as lock) (((base', typ'), aclist') as lock') =
|
|
|
|
let compare lock lock' =
|
|
|
|
if phys_equal lock lock' then 0
|
|
|
|
if phys_equal lock lock' then 0
|
|
|
|
else
|
|
|
|
else [%compare: (var * Typ.t) * AccessPath.access list] lock lock'
|
|
|
|
let res = Typ.compare typ typ' in
|
|
|
|
|
|
|
|
if not (Int.equal res 0) then res
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
let res = Var.compare_modulo_this base base' in
|
|
|
|
|
|
|
|
if not (Int.equal res 0) then res
|
|
|
|
|
|
|
|
else List.compare AccessPath.compare_access aclist aclist'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let equal lock lock' = Int.equal 0 (compare lock lock')
|
|
|
|
let equal = [%compare.equal: t]
|
|
|
|
|
|
|
|
|
|
|
|
let equal_modulo_base (((root, typ), aclist) as l) (((root', typ'), aclist') as l') =
|
|
|
|
let equal_modulo_base (((root, typ), aclist) as l) (((root', typ'), aclist') as l') =
|
|
|
|
if phys_equal l l' then true
|
|
|
|
phys_equal l l'
|
|
|
|
else
|
|
|
|
||
|
|
|
|
match (root, root') with
|
|
|
|
match (root, root') with
|
|
|
|
| Var.LogicalVar _, Var.LogicalVar _ ->
|
|
|
|
| Var.LogicalVar _, Var.LogicalVar _ ->
|
|
|
|
(* only class objects are supposed to appear as idents *)
|
|
|
|
(* only class objects are supposed to appear as idents *)
|
|
|
|
equal l l'
|
|
|
|
equal l l'
|
|
|
|
| Var.ProgramVar _, Var.ProgramVar _ ->
|
|
|
|
| Var.ProgramVar _, Var.ProgramVar _ ->
|
|
|
|
Typ.equal typ typ' && AccessPath.equal_access_list aclist aclist'
|
|
|
|
[%compare.equal: Typ.t * AccessPath.access list] (typ, aclist) (typ', aclist')
|
|
|
|
| _, _ ->
|
|
|
|
| _, _ ->
|
|
|
|
false
|
|
|
|
false
|
|
|
|
|
|
|
|
|
|
|
|