[starvation] use compare ppx

Reviewed By: ezgicicek

Differential Revision: D13415465

fbshipit-source-id: 54e9a302f
master
Nikos Gorogiannis 6 years ago committed by Facebook Github Bot
parent fcfb6cc361
commit fc80179394

@ -25,8 +25,6 @@ module Raw = struct
let equal_access = [%compare.equal: access] let equal_access = [%compare.equal: access]
let equal_access_list = [%compare.equal: access list]
let may_pp_typ fmt typ = let may_pp_typ fmt typ =
if Config.debug_level_analysis >= 3 then F.fprintf fmt ":%a" (Typ.pp Pp.text) typ if Config.debug_level_analysis >= 3 then F.fprintf fmt ":%a" (Typ.pp Pp.text) typ

@ -74,8 +74,6 @@ val equal : t -> t -> bool
val equal_base : base -> base -> bool val equal_base : base -> base -> bool
val equal_access_list : access list -> access list -> bool
val pp : Format.formatter -> t -> unit val pp : Format.formatter -> t -> unit
val pp_base : Format.formatter -> base -> unit val pp_base : Format.formatter -> base -> unit

@ -15,31 +15,29 @@ 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
let pp = AccessPath.pp let pp = AccessPath.pp

Loading…
Cancel
Save