[pulse] better AbductiveDomain.leq

Summary:
It's a potentially expensive operation given that it does graph
isomorphism twice on equal values so add a fast path for when they are
the same pointer. Also comparing "skipped calls" doesn't need to care
about traces.

Reviewed By: da319

Differential Revision: D26022022

fbshipit-source-id: 8178df37b
master
Jules Villard 4 years ago committed by Facebook GitHub Bot
parent 65b5919958
commit b9747bdc08

@ -119,8 +119,9 @@ let set_isl_status status astate = {astate with isl_status= status}
let set_path_condition path_condition astate = {astate with path_condition} let set_path_condition path_condition astate = {astate with path_condition}
let leq ~lhs ~rhs = let leq ~lhs ~rhs =
SkippedCalls.leq ~lhs:lhs.skipped_calls ~rhs:rhs.skipped_calls phys_equal lhs rhs
&& equal_isl_status lhs.isl_status rhs.isl_status || SkippedCalls.leq ~lhs:lhs.skipped_calls ~rhs:rhs.skipped_calls
&& ((not Config.pulse_isl) || equal_isl_status lhs.isl_status rhs.isl_status)
&& &&
match match
BaseDomain.isograph_map BaseDomain.empty_mapping BaseDomain.isograph_map BaseDomain.empty_mapping

@ -31,6 +31,8 @@ let continue astate = ContinueProgram astate
let mk_initial pdesc = ContinueProgram (AbductiveDomain.mk_initial pdesc) let mk_initial pdesc = ContinueProgram (AbductiveDomain.mk_initial pdesc)
let leq ~lhs ~rhs = let leq ~lhs ~rhs =
phys_equal lhs rhs
||
match (lhs, rhs) with match (lhs, rhs) with
| AbortProgram astate1, AbortProgram astate2 | ExitProgram astate1, ExitProgram astate2 -> | AbortProgram astate1, AbortProgram astate2 | ExitProgram astate1, ExitProgram astate2 ->
AbductiveDomain.leq ~lhs:(astate1 :> AbductiveDomain.t) ~rhs:(astate2 :> AbductiveDomain.t) AbductiveDomain.leq ~lhs:(astate1 :> AbductiveDomain.t) ~rhs:(astate2 :> AbductiveDomain.t)

@ -23,6 +23,10 @@ module SkippedTrace = struct
let widen ~prev ~next ~num_iters:_ = join prev next let widen ~prev ~next ~num_iters:_ = join prev next
end end
include AbstractDomain.Map (Procname) (SkippedTrace) module M = AbstractDomain.Map (Procname) (SkippedTrace)
include M
let yojson_of_t = [%yojson_of: _] let yojson_of_t = [%yojson_of: _]
(* ignore traces, just compare if the set of skipped procedures is the same *)
let leq ~lhs ~rhs = M.equal (fun _ _ -> true) lhs rhs

Loading…
Cancel
Save