[pulse][7/9] kill `AddrTracePair`

Summary:
The name had rotten: it should be `AddrHistPair`. There is little value
of exposing the type of the pair `AbstractValue.t * ValueHistory.t`,
just inline its definition everywhere.

Reviewed By: ezgicicek

Differential Revision: D17955283

fbshipit-source-id: d145251e0
master
Jules Villard 5 years ago committed by Facebook Github Bot
parent 4ded39240f
commit 72ee18e445

@ -28,7 +28,7 @@ module Stack : sig
val find_opt : Var.t -> t -> PulseDomain.Stack.value option
val eval : ValueHistory.t -> Var.t -> t -> t * PulseDomain.AddrTracePair.t
val eval : ValueHistory.t -> Var.t -> t -> t * (AbstractValue.t * ValueHistory.t)
(** return the value of the variable in the stack or create a fresh one if needed *)
val mem : Var.t -> t -> bool
@ -47,7 +47,7 @@ module Memory : sig
val add_edge :
AbstractValue.t * ValueHistory.t
-> Access.t
-> PulseDomain.AddrTracePair.t
-> AbstractValue.t * ValueHistory.t
-> Location.t
-> t
-> t
@ -56,7 +56,7 @@ module Memory : sig
val find_opt : AbstractValue.t -> t -> PulseDomain.Memory.cell option
val find_edge_opt : AbstractValue.t -> Access.t -> t -> PulseDomain.AddrTracePair.t option
val find_edge_opt : AbstractValue.t -> Access.t -> t -> (AbstractValue.t * ValueHistory.t) option
val set_cell :
AbstractValue.t * ValueHistory.t -> PulseDomain.Memory.cell -> Location.t -> t -> t
@ -70,7 +70,7 @@ module Memory : sig
val std_vector_reserve : AbstractValue.t -> t -> t
val eval_edge :
AbstractValue.t * ValueHistory.t -> Access.t -> t -> t * PulseDomain.AddrTracePair.t
AbstractValue.t * ValueHistory.t -> Access.t -> t -> t * (AbstractValue.t * ValueHistory.t)
(** [eval_edge (addr,hist) access astate] follows the edge [addr --access--> .] in memory and
returns what it points to or creates a fresh value if that edge didn't exist. *)

@ -13,7 +13,7 @@ open PulseBasicInterface
(* {3 Heap domain } *)
module AddrTracePair = struct
module AddrHistPair = struct
type t = AbstractValue.t * ValueHistory.t [@@deriving compare]
let pp f addr_trace =
@ -31,7 +31,7 @@ module Memory : sig
module Edges : PrettyPrintable.PPMap with type key = Access.t
type edges = AddrTracePair.t Edges.t
type edges = AddrHistPair.t Edges.t
val pp_edges : F.formatter -> edges -> unit
@ -65,9 +65,9 @@ module Memory : sig
val register_address : AbstractValue.t -> t -> t
val add_edge : AbstractValue.t -> Access.t -> AddrTracePair.t -> t -> t
val add_edge : AbstractValue.t -> Access.t -> AddrHistPair.t -> t -> t
val find_edge_opt : AbstractValue.t -> Access.t -> t -> AddrTracePair.t option
val find_edge_opt : AbstractValue.t -> Access.t -> t -> AddrHistPair.t option
val add_attribute : AbstractValue.t -> Attribute.t -> t -> t
@ -93,9 +93,9 @@ end = struct
module Edges = PrettyPrintable.MakePPMap (Access)
type edges = AddrTracePair.t Edges.t [@@deriving compare]
type edges = AddrHistPair.t Edges.t [@@deriving compare]
let pp_edges = Edges.pp ~pp_value:AddrTracePair.pp
let pp_edges = Edges.pp ~pp_value:AddrHistPair.pp
type cell = edges * Attributes.t
@ -224,16 +224,16 @@ module Stack = struct
F.fprintf f "%a%a" pp_ampersand var Var.pp var
end
include PrettyPrintable.MakePPMonoMap (VarAddress) (AddrTracePair)
include PrettyPrintable.MakePPMonoMap (VarAddress) (AddrHistPair)
let pp fmt m =
let pp_item fmt (var_address, v) =
F.fprintf fmt "%a=%a" VarAddress.pp var_address AddrTracePair.pp v
F.fprintf fmt "%a=%a" VarAddress.pp var_address AddrHistPair.pp v
in
PrettyPrintable.pp_collection ~pp_item fmt (bindings m)
let compare = compare AddrTracePair.compare
let compare = compare AddrHistPair.compare
end
type t = {heap: Memory.t; stack: Stack.t}

@ -9,12 +9,9 @@ open! IStd
module F = Format
open PulseBasicInterface
module AddrTracePair : sig
type t = AbstractValue.t * ValueHistory.t [@@deriving compare]
end
module Stack : sig
include PrettyPrintable.MonoMap with type key = Var.t and type value = AddrTracePair.t
include
PrettyPrintable.MonoMap with type key = Var.t and type value = AbstractValue.t * ValueHistory.t
(* need to shadow the declaration in [MonoMap] even though it is unused since [MapS.compare] has a
different type *)
@ -27,7 +24,7 @@ module Memory : sig
module Edges : PrettyPrintable.PPMap with type key = Access.t
type edges = AddrTracePair.t Edges.t
type edges = (AbstractValue.t * ValueHistory.t) Edges.t
val pp_edges : F.formatter -> edges -> unit [@@warning "-32"]
@ -55,9 +52,9 @@ module Memory : sig
val register_address : AbstractValue.t -> t -> t
val add_edge : AbstractValue.t -> Access.t -> AddrTracePair.t -> t -> t
val add_edge : AbstractValue.t -> Access.t -> AbstractValue.t * ValueHistory.t -> t -> t
val find_edge_opt : AbstractValue.t -> Access.t -> t -> AddrTracePair.t option
val find_edge_opt : AbstractValue.t -> Access.t -> t -> (AbstractValue.t * ValueHistory.t) option
val add_attribute : AbstractValue.t -> Attribute.t -> t -> t

@ -12,7 +12,7 @@ type exec_fun =
caller_summary:Summary.t
-> Location.t
-> ret:Ident.t * Typ.t
-> actuals:(PulseDomain.AddrTracePair.t * Typ.t) list
-> actuals:((AbstractValue.t * ValueHistory.t) * Typ.t) list
-> PulseAbductiveDomain.t
-> PulseAbductiveDomain.t list PulseOperations.access_result

@ -5,12 +5,13 @@
* LICENSE file in the root directory of this source tree.
*)
open! IStd
open PulseBasicInterface
type exec_fun =
caller_summary:Summary.t
-> Location.t
-> ret:Ident.t * Typ.t
-> actuals:(PulseDomain.AddrTracePair.t * Typ.t) list
-> actuals:((AbstractValue.t * ValueHistory.t) * Typ.t) list
-> PulseAbductiveDomain.t
-> PulseAbductiveDomain.t list PulseOperations.access_result

@ -18,7 +18,7 @@ module Closures : sig
(** assert the validity of the addresses captured by the lambda *)
end
val eval : Location.t -> Exp.t -> t -> (t * PulseDomain.AddrTracePair.t) access_result
val eval : Location.t -> Exp.t -> t -> (t * (AbstractValue.t * ValueHistory.t)) access_result
(** Use the stack and heap to evaluate the given expression down to an abstract address representing
its value.
@ -32,26 +32,26 @@ end
val assert_is_true : Location.t -> condition:Exp.t -> t -> (t * TBool.t) access_result
val eval_deref : Location.t -> Exp.t -> t -> (t * PulseDomain.AddrTracePair.t) access_result
val eval_deref : Location.t -> Exp.t -> t -> (t * (AbstractValue.t * ValueHistory.t)) access_result
(** Like [eval] but evaluates [*exp]. *)
val eval_access :
Location.t
-> PulseDomain.AddrTracePair.t
-> AbstractValue.t * ValueHistory.t
-> PulseDomain.Memory.Access.t
-> t
-> (t * PulseDomain.AddrTracePair.t) access_result
-> (t * (AbstractValue.t * ValueHistory.t)) access_result
(** Like [eval] but starts from an address instead of an expression, checks that it is valid, and if
so dereferences it according to the access. *)
val havoc_id : Ident.t -> ValueHistory.t -> t -> t
val havoc_deref :
Location.t -> PulseDomain.AddrTracePair.t -> ValueHistory.t -> t -> t access_result
Location.t -> AbstractValue.t * ValueHistory.t -> ValueHistory.t -> t -> t access_result
val havoc_field :
Location.t
-> PulseDomain.AddrTracePair.t
-> AbstractValue.t * ValueHistory.t
-> Typ.Fieldname.t
-> ValueHistory.t
-> t
@ -63,27 +63,27 @@ val write_id : Ident.t -> PulseDomain.Stack.value -> t -> t
val write_deref :
Location.t
-> ref:PulseDomain.AddrTracePair.t
-> obj:PulseDomain.AddrTracePair.t
-> ref:AbstractValue.t * ValueHistory.t
-> obj:AbstractValue.t * ValueHistory.t
-> t
-> t access_result
(** write the edge [ref --*--> obj] *)
val invalidate :
Location.t -> Invalidation.t -> PulseDomain.AddrTracePair.t -> t -> t access_result
Location.t -> Invalidation.t -> AbstractValue.t * ValueHistory.t -> t -> t access_result
(** record that the address is invalid *)
val invalidate_deref :
Location.t -> Invalidation.t -> PulseDomain.AddrTracePair.t -> t -> t access_result
Location.t -> Invalidation.t -> AbstractValue.t * ValueHistory.t -> t -> t access_result
(** record that what the address points to is invalid *)
val invalidate_array_elements :
Location.t -> Invalidation.t -> PulseDomain.AddrTracePair.t -> t -> t access_result
Location.t -> Invalidation.t -> AbstractValue.t * ValueHistory.t -> t -> t access_result
(** record that all the array elements that address points to is invalid *)
val shallow_copy :
Location.t
-> PulseDomain.AddrTracePair.t
-> AbstractValue.t * ValueHistory.t
-> t
-> (t * (AbstractValue.t * ValueHistory.t)) access_result
(** returns the address of a new cell with the same edges as the original *)

Loading…
Cancel
Save