module Runtime: Runtime_mem.Create
(
D
)
(
A
)
(
R
)
module F: D.F
The memory is composed of 2 parts: one that deals with the values,
and the other one that handle allocation information. More over, there
is a table in the Pre
memory to handle logic variables that are used for
the initial value of the parameters.
type
m_mbits
val t_mbits : Formula.tau
type
mem_bits = m_mbits F.term
type
m_alloc
val t_alloc : Formula.tau
type
mem_alloc = m_alloc F.term
type
m_mem
val t_mem : Formula.tau
type
memory = {
|
vbits : F.var ; |
|
valloc : F.var ; |
}
type
mem = memory *
F.var Cil_datatype.Varinfo.Hashtbl.t option
val vbits_of_mem : memory * 'a -> F.var
val valloc_of_mem : memory * 'a -> F.var
val logic_of_mem : 'a * 'b -> 'b
val mbits_of_mem : memory * 'a -> mem_bits
val malloc_of_mem : memory * 'a -> mem_alloc
val tcomp_of_comp : Cil_types.compinfo -> Cil_types.typ
val cil_field_info : Cil_types.fieldinfo -> int * int
val cil_field_offset : Cil_types.fieldinfo -> int
val cil_field_size : Cil_types.fieldinfo -> int
val name_of_var : D.Xindex.t -> D.name
val name_of_field : D.Findex.t -> D.integer
----- Formats :
val format_of_c_int_type : Ctypes.c_int -> D.format
val format_of_c_float_type : Ctypes.c_float -> D.format
val format_of_addr : 'a -> 'b D.F.term
Size and offset are sometimes known constants. We can choose to
represent them are simple int
and compute values as far as possible,
or to keep them as named terms.
The first solution gives smaller - yet easier provable - goals,
but if if fails, the user has few information the understand the problem.
We will try to have both solutions in order to be able to test them.
val compute_int_mode : Runtime_mem.compute_int_mode
type 'a
tint = D.integer
integer terms with a phantom type to mark what kind of object it is.
module Aint: sig
.. end
type
m_addr
Phantom types to tag the terms
type
m_offset
type
m_size
type
m_zone
type
t_addr = m_addr tint
Specialized type of D.integer terms
type
t_offset = m_offset tint
type
t_size = m_size tint
type
t_zone = m_zone F.term
module Tint: sig
.. end
about size and offset
val sizeof_c_object : Ctypes.c_object -> Tint.x_size
Extracted specification from runtime.why
see definitions and axioms in
runtime.why
type
m_bits
type
t_bits = m_bits F.term
type
m_dzone
type
dzone = m_dzone F.term
module RtLib: sig
.. end
val z_from_bits : t_bits -> D.format -> D.integer
val real_from_bits : t_bits -> D.format -> D.real
module Model: sig
.. end
val startof : 'a -> 'b -> 'a
val cast_loc_to_loc : 'a -> 'b -> 'c -> 'c
about zone
Mwp requires a type dzone
defined as m_zone F.term
that represent why formula of the model why zone type
(which name is given by tau_of_zone
below).
Because we need to provide function such as dzone_union
,
this dzone
is defined as a set of the rt_zone
defined in WHY.
val tau_of_dzone : Formula.tau
val xzone_assigned : Tint.x_addr D.assigned -> Tint.x_zone
val dzone_assigned : Tint.x_addr D.assigned -> dzone
val dzone_empty : unit -> dzone
val dzone_subset : dzone ->
dzone -> F.pred
val dzone_union : dzone ->
dzone -> dzone
val effect_supported : bool
Regions
type
region
val pp_region : 'a -> 'b -> unit
val region_assigned : 'a -> 'b
val region_empty : 'a -> 'b
val region_union : 'a -> 'b -> 'c
val region_included : 'a -> 'b -> 'c
val region_separated : 'a -> 'b -> 'c
val region_fingerprint : 'a -> 'b -> 'c
val region_supported : bool
val int_format_for_hyp : Ctypes.c_object -> D.format option
val add_int_format_hyp : Formula.m_format F.term ->
Ctypes.c_object -> F.pred -> F.pred
module VarDecl: D.Register
(
sig
end
)
module Fields: D.Register
(
sig
end
)
module Data: sig
.. end
module DF: Data_mem.Create
(
Data
)
val load : memory *
F.var Cil_datatype.Varinfo.Hashtbl.t option ->
Ctypes.c_object ->
Tint.x_addr -> Data.value
val store : memory * 'a ->
Tint.x_addr ->
Ctypes.c_object ->
Data.value -> mem_bits
include Data
about bits
bits
type is used to represent the values that are stored in the memory.
We have functions that encode/decode bits to/from ACSL logic values
depending on the intermediate C type t
.
val format_of_compinfo : Cil_types.compinfo -> Data.D.format
val format_of_array : Ctypes.arrayinfo -> Data.D.format
val rt_format_of_ctype : Ctypes.c_object -> D.format
val value_of_bits : Ctypes.c_object -> t_bits -> Data.value
Compute the logic value from bits interpreted with type t
.
val bits_of_value : 'a -> value -> t_bits
Frame Environment
type
frame = {
}
val new_frame : Kernel_function.t ->
m_here:mem option ->
m_pre:mem option ->
m_post:mem option ->
F.var option -> frame
val new_mem : unit -> memory
val find_mem_at : frame -> Clabels.c_label -> mem
Raises Not_found
when the label has no memory.
val mem_at : frame -> Clabels.c_label -> mem
val result : frame -> F.var * Cil_types.typ
val exit_status : frame -> F.var
val set_exit_status : frame ->
F.var -> frame
val get_exit_status : frame -> F.var option
Validity
val valid : memory * 'a ->
Tint.x_addr D.assigned -> F.pred
val separated : Tint.x_addr D.assigned ->
Tint.x_addr D.assigned -> F.pred
val tbits_of_var : F.var -> t_bits
val subst_havoc : frame ->
Tint.x_addr D.assigned -> D.havoc list
val assigns_goal : frame ->
Clabels.c_label ->
Tint.x_addr D.assigned list ->
Clabels.c_label -> F.pred
val assigns_supported : bool
Special locations
val base_address : memory * 'a ->
Tint.x_addr -> Tint.x_addr
val block_length : memory * 'a ->
Tint.x_addr -> t_size
User-defined Predicates
type
closure =
| |
Mem of string |
| |
Alloc of string |
val pp_closure : Format.formatter -> closure -> unit
val userdef_frame : unit -> frame
val userdef_signature : frame ->
'a -> 'b -> F.var list * closure list
val userdef_closure : memory * 'a ->
closure -> Formula.abstract F.term
val label_at_closure : closure -> string
Mwp.S requirements
val update_at_label : frame -> Clabels.c_label -> D.F.pred -> D.F.pred
val quantify_at_label : frame -> Clabels.c_label -> D.F.pred -> D.F.pred
val subst_lval : frame ->
Ctypes.c_object ->
Tint.x_addr ->
Data.value -> D.F.pred -> D.F.pred
val subst_result : frame -> value option -> D.F.pred -> D.F.pred
val local_scope : frame ->
Cil_datatype.Varinfo.Hashtbl.key list -> Mcfg.scope -> D.F.pred -> D.F.pred
type
goal = F.pred
val make_goal : 'a -> 'b -> 'b