1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
module Value = Runtime.Value
module Typ = Runtime.Type.Typ
module Run = Runtime.Dynamic_Runner.Signature
open Error
open Util.Source
module type IMPL = sig
val eval_extern_init : Value.t list -> Value.t
val eval_extern_func_lctk_call : Value.t list -> Value.t list
val eval_extern_func_call : Value.t list -> Value.t list
val eval_extern_method_call : Value.t list -> Value.t list
val init_arch_state : Value.t
end
module Make (A : IMPL) : Run.EXTERN = struct
let init_mode _ = ()
let checkpoint () : int = 0
let seff (before : int) (after : int) : bool = before <> after
let clear () = ()
module Cache = struct
let cache_on () = ()
let cache_off () = ()
end
let eval_extern_rel (name : string) (values_input : Value.t list) :
Run.rel_result =
try
Run.Pass
(match name with
| "ExternFunctionCall_eval_lctk" ->
A.eval_extern_func_lctk_call values_input
| "ExternFunctionCall_eval" -> A.eval_extern_func_call values_input
| "ExternMethodCall_eval" -> A.eval_extern_method_call values_input
| _ ->
error no_region
(Format.asprintf "unimplemented extern relation: %s" name))
with Util.Error.ExternError (at, msg) -> Run.Fail (at, msg)
let eval_extern_func (name : string) (_typs : Typ.t list)
(values_input : Value.t list) : Run.func_result =
try
Run.Pass
(match name with
| "init_objectState" -> A.eval_extern_init values_input
| "init_archState" -> A.init_arch_state
| _ ->
error no_region
(Format.asprintf "unimplemented extern function: %s" name))
with Util.Error.ExternError (at, msg) -> Run.Fail (at, msg)
end