[sledge] Rename joinable to equal_destination

Summary: To be more explicit and clear about when frontier elements are joinable.

Differential Revision: D29441153

fbshipit-source-id: 2a69eed6b
master
Josh Berdine 4 years ago committed by Facebook GitHub Bot
parent bcd1e1e02e
commit 5a4f3b4bcc

@ -12,14 +12,14 @@ open Control_intf
(** An element of work to be scheduled. The scheduling strategies have very (** An element of work to be scheduled. The scheduling strategies have very
few dependencies on elements, mainly some just need to test if two few dependencies on elements, mainly some just need to test if two
elements can be joined. An example element instance is a pair of a elements have the same destination. An example element instance is a
control-flow edge with a symbolic state that has reached the source of pair of a control-flow edge with a symbolic state that has reached the
the edge and has yet to be propagated to the destination. *) source of the edge and has yet to be propagated to the destination. *)
module type Elt = sig module type Elt = sig
type t [@@deriving compare, equal, sexp_of] type t [@@deriving compare, equal, sexp_of]
val pp : t pp val pp : t pp
val joinable : t -> t -> bool val equal_destination : t -> t -> bool
val dnf : t -> t list val dnf : t -> t list
end end
@ -78,8 +78,8 @@ module PriorityQueue (Elt : Elt) : QueueS with type elt = Elt.t = struct
else else
let elts, removed = let elts, removed =
FHeap.fold queue ~init:([], removed') ~f:(fun (elts, removed) elt -> FHeap.fold queue ~init:([], removed') ~f:(fun (elts, removed) elt ->
if Elt.joinable top elt && not (Elts.mem elt removed) then if Elt.equal_destination top elt && not (Elts.mem elt removed)
(elt :: elts, Elts.add elt removed) then (elt :: elts, Elts.add elt removed)
else (elts, removed) ) else (elts, removed) )
in in
Some (top, elts, {queue; removed}) Some (top, elts, {queue; removed})
@ -421,7 +421,7 @@ module Make (Config : Config) (D : Domain) (Queue : Queue) = struct
let pp ppf {depth; edge} = let pp ppf {depth; edge} =
Format.fprintf ppf "%i: %a" depth Edge.pp edge Format.fprintf ppf "%i: %a" depth Edge.pp edge
let joinable x y = let equal_destination x y =
Llair.Block.equal x.edge.dst y.edge.dst Llair.Block.equal x.edge.dst y.edge.dst
&& Stack.equal_as_inlined_location x.edge.stk y.edge.stk && Stack.equal_as_inlined_location x.edge.stk y.edge.stk

Loading…
Cancel
Save