summaryrefslogtreecommitdiff
path: root/src/Interpreter.ml
diff options
context:
space:
mode:
Diffstat (limited to 'src/Interpreter.ml')
-rw-r--r--src/Interpreter.ml33
1 files changed, 15 insertions, 18 deletions
diff --git a/src/Interpreter.ml b/src/Interpreter.ml
index 2789517e..f38cb66e 100644
--- a/src/Interpreter.ml
+++ b/src/Interpreter.ml
@@ -21,6 +21,9 @@ open InterpreterStatements
(* TODO: remove the config parameters when they are useless *)
+(** The local logger *)
+let log = L.interpreter_log
+
module Test = struct
let initialize_context (type_context : C.type_context)
(fun_defs : A.fun_def list) (type_vars : T.type_var list) : C.eval_ctx =
@@ -66,29 +69,23 @@ module Test = struct
let input_svs =
List.map (fun ty -> mk_fresh_symbolic_value ty) inst_sg.inputs
in
- (* Create the abstractions and insert them in the context *)
- let create_abs (ctx : C.eval_ctx) (rg : A.abs_region_group) : C.eval_ctx =
- let abs_id = rg.A.id in
- let parents =
- List.fold_left
- (fun s pid -> V.AbstractionId.Set.add pid s)
- V.AbstractionId.Set.empty rg.A.parents
- in
- let regions =
- List.fold_left
- (fun s rid -> T.RegionId.Set.add rid s)
- T.RegionId.Set.empty rg.A.regions
- in
+ (* Initialize the abstractions as empty (i.e., with no avalues) abstractions *)
+ let empty_absl =
+ create_empty_abstractions_from_abs_region_groups
+ inst_sg.A.regions_hierarchy
+ in
+ (* Add the avalues to the abstractions and insert them in the context *)
+ let insert_abs (ctx : C.eval_ctx) (abs : V.abs) : C.eval_ctx =
(* Project over the values - we use *loan* projectors, as explained above *)
let avalues = List.map mk_aproj_loans_from_symbolic_value input_svs in
- (* Create the abstraction *)
- let abs = { V.abs_id; parents; regions; avalues } in
+ (* Insert the avalues in the abstraction *)
+ let abs = { abs with avalues } in
(* Insert the abstraction in the context *)
let ctx = { ctx with env = Abs abs :: ctx.env } in
(* Return *)
ctx
in
- let ctx = List.fold_left create_abs ctx inst_sg.regions_hierarchy in
+ let ctx = List.fold_left insert_abs ctx empty_absl in
(* Split the variables between return var, inputs and remaining locals *)
let ret_var = List.hd fdef.locals in
let input_vars, local_vars =
@@ -113,7 +110,7 @@ module Test = struct
let fdef = A.FunDefId.nth fun_defs fid in
(* Debug *)
- L.log#ldebug
+ log#ldebug
(lazy ("test_unit_function: " ^ Print.Types.name_to_string fdef.A.name));
(* Sanity check - *)
@@ -164,7 +161,7 @@ module Test = struct
let fdef = A.FunDefId.nth fun_defs fid in
(* Debug *)
- L.log#ldebug
+ log#ldebug
(lazy
("test_function_symbolic: " ^ Print.Types.name_to_string fdef.A.name));