You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
69 lines
2.3 KiB
69 lines
2.3 KiB
7 years ago
|
(*
|
||
|
* Copyright (c) 2018 - present Facebook, Inc.
|
||
|
* All rights reserved.
|
||
|
*
|
||
|
* This source code is licensed under the BSD style license found in the
|
||
|
* LICENSE file in the root directory of this source tree. An additional grant
|
||
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||
|
*)
|
||
|
|
||
|
open! IStd
|
||
|
module F = Format
|
||
|
|
||
|
(** Abstraction of a path that represents a lock, special-casing equality and comparisons
|
||
|
to work over type, base variable modulo this and access list *)
|
||
7 years ago
|
module LockIdentity : PrettyPrintable.PrintableOrderedType with type t = AccessPath.t
|
||
7 years ago
|
|
||
|
(** A lock event. Equality/comparison disregards the call trace but includes location. *)
|
||
|
module LockEvent : sig
|
||
7 years ago
|
type t = private {lock: LockIdentity.t; loc: Location.t; trace: CallSite.t list}
|
||
|
|
||
|
include PrettyPrintable.PrintableOrderedType with type t := t
|
||
7 years ago
|
|
||
|
val owner_class : t -> Typ.name option
|
||
|
(** Class of the root variable of the path representing the lock *)
|
||
|
end
|
||
|
|
||
7 years ago
|
module LockState : AbstractDomain.WithBottom
|
||
7 years ago
|
|
||
|
(** Represents either
|
||
|
- the existence of a program path from the current method to the eventual acquisition of a lock
|
||
7 years ago
|
("eventually"), or,
|
||
|
- the "first" lock being taken *in the current method* and, before its release, the eventual
|
||
|
acquisition of "eventually" *)
|
||
7 years ago
|
module LockOrder : sig
|
||
7 years ago
|
type t = private {first: LockEvent.t option; eventually: LockEvent.t}
|
||
7 years ago
|
|
||
7 years ago
|
include PrettyPrintable.PrintableOrderedType with type t := t
|
||
7 years ago
|
|
||
|
val get_pair : t -> (LockEvent.t * LockEvent.t) option
|
||
7 years ago
|
(** return the pair (b, eventually) if first is Some b *)
|
||
7 years ago
|
|
||
7 years ago
|
val may_deadlock : t -> t -> bool
|
||
|
(** check if two pairs are symmetric in terms of locks, where locks are compared modulo the
|
||
|
variable name at the root of each path. *)
|
||
7 years ago
|
|
||
7 years ago
|
val make_loc_trace : t -> Errlog.loc_trace
|
||
7 years ago
|
end
|
||
|
|
||
|
module LockOrderDomain : sig
|
||
7 years ago
|
include PrettyPrintable.PPSet with type elt = LockOrder.t
|
||
7 years ago
|
|
||
|
include AbstractDomain.WithBottom with type astate = t
|
||
|
end
|
||
|
|
||
7 years ago
|
include AbstractDomain.WithBottom
|
||
7 years ago
|
|
||
7 years ago
|
val acquire : LockIdentity.t -> astate -> Location.t -> astate
|
||
7 years ago
|
|
||
7 years ago
|
val release : LockIdentity.t -> astate -> astate
|
||
7 years ago
|
|
||
|
type summary = LockOrderDomain.astate
|
||
|
|
||
|
val pp_summary : F.formatter -> summary -> unit
|
||
7 years ago
|
|
||
|
val to_summary : astate -> summary
|
||
|
|
||
|
val integrate_summary :
|
||
|
caller_state:astate -> callee_summary:summary -> Typ.Procname.t -> Location.t -> astate
|