init : int -> t

This commit is contained in:
Granahir2 2024-06-09 00:23:46 +02:00
parent a41dedd362
commit d26445d151
4 changed files with 6 additions and 6 deletions

View file

@ -30,7 +30,7 @@ module type DOMAIN =
type t type t
(* initial environment, with all variables initialized to 0 *) (* initial environment, with all variables initialized to 0 *)
val init: t val init: int -> t
(* empty set of environments *) (* empty set of environments *)
val bottom: t val bottom: t

View file

@ -98,7 +98,7 @@ open Domain
module NonRelational (V : VALUE_DOMAIN) : DOMAIN = struct module NonRelational (V : VALUE_DOMAIN) : DOMAIN = struct
module VMap = VarMap module VMap = VarMap
type t = Bot | E of V.t VMap.t type t = Bot | E of V.t VMap.t
let init = E VMap.empty (* Nonpresent variables are 0 *) let init _ = E VMap.empty (* Nonpresent variables are 0 *)
let bottom = Bot let bottom = Bot

View file

@ -5,7 +5,7 @@ open Domain
module type ITERABLE = sig module type ITERABLE = sig
type t (*type of a node abst*) type t (*type of a node abst*)
val bottom : t val bottom : t
val init : t val init : int -> t
val do_compute : arc -> t (*source*) -> (arc -> unit) -> (func -> t -> t) -> t (*to accumulate*) val do_compute : arc -> t (*source*) -> (arc -> unit) -> (func -> t -> t) -> t (*to accumulate*)
val accumulate : arc -> t (*source*) -> t (*old dst*) -> t*bool (*dst*) val accumulate : arc -> t (*source*) -> t (*old dst*) -> t*bool (*dst*)
@ -15,7 +15,7 @@ module SimpleIterable (D : DOMAIN) : ITERABLE = struct
type t = D.t type t = D.t
let bottom = D.bottom let bottom = D.bottom
let init = D.init let init x = D.init x
let do_compute a src cb_fail cb_fun = match a.arc_inst with let do_compute a src cb_fail cb_fun = match a.arc_inst with
| CFG_skip _ -> src | CFG_skip _ -> src
@ -63,7 +63,7 @@ module DisjunctiveIterable (D : DOMAIN) : ITERABLE = struct
type t = D.t SCRMap.t type t = D.t SCRMap.t
let bottom = SCRMap.empty let bottom = SCRMap.empty
let init = SCRMap.singleton [] D.init let init x = SCRMap.singleton [] (D.init x)
let do_compute a src cb_fail cb_fun = match a.arc_inst with let do_compute a src cb_fail cb_fun = match a.arc_inst with
| CFG_skip _ -> src | CFG_skip _ -> src

View file

@ -57,7 +57,7 @@ module Iterator (I : ITERABLE) = struct
func_exit = cfg.cfg_init_exit; func_exit = cfg.cfg_init_exit;
func_args = []; func_args = [];
func_ret = None; func_ret = None;
func_calls = []} I.init in func_calls = []} (I.init (List.length cfg.cfg_vars))in
let rec do_main l = match l with let rec do_main l = match l with
| x::_ when x.func_name = "main" -> do_fun x init_st | x::_ when x.func_name = "main" -> do_fun x init_st
| _::q -> do_main q | _::q -> do_main q