Module Checker__Location
type location
=
{
root : root;
path : path;
}
location
is a compile-time notion of memory locations.location
s start with aroot
, and can be refined further via apath
. Example:x .field1.field2 root ^^^ path ^^^^^^^^^^^^^^ ( * y ) .field root ^^^ path ^^^ ^^^^^^
and root
=
|
Var of Checker.IR.variable
|
Abs of abstract_loc
root
s of locations can either be concrete program variables (viaVar
), or abstract locations (viaAbs
), which are abstract tokens that represent a set of other locations.Locations starting with program variables (
Var
) are called "concrete", and locations starting with abstract locations (Abs
) are called "abstract".The
Var
constructor accepts an abstract location rather than a variable name. This helps avoid issues with name clash. A mapping between variable names and the corresponding abstract locations should be maintained elsewhere
and abstract_loc
= private int
and path
= Checker.IR.path
val absloc_generator : < generate : abstract_loc; reset : unit; >
val gen_absloc : unit -> abstract_loc
generate a new fresh abstract location. A wrapper of
absloc_generator
val var_to_loc : Checker.IR.variable -> location
create a location starting with a program variable with an empty path
val abs_to_loc : abstract_loc -> location
create a location starting with an abstract location with an empty path
val lvalue_to_loc : Checker.IR.lvalue -> location
create a location corresponding to a lvalue
type relation
=
|
Eq
|
Irr
|
Lt of path
|
Gt of path
the relation between two locations or paths. The intuition behind the notion of "large" and "small" is how much a location covers. Detailed meaning of each case is:
a `Eq` b
means thata
andb
are exactly identicala `Irr` b
means thata
andb
are disjointa `Lt path` b
means thata
refers to a part ofb
, i.e.a = b.path
a `Gt path` b
means thatb
refers to a part ofa
, i.e.b = a.path
module ConstrSet : sig ... end
the
ConstrSet
submodule provides a data type for tracking constraints on abstract locations. Letl1
,l2
be twolocation
s. Herel2
must start with an abstract location, hence represents a set of locations. Now constraints are of the forml1 in l2
, meaning that the set of locations denoted byl2
must containl1
.l2
is called the superset andl1
is called the subset in the constraint