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
(* SPDX-License-Identifier: AGPL-3.0-or-later *)
(* Copyright © 2021-2024 OCamlPro *)
(* Written by the Owi programmers *)
include Link_env
type t = Symbolic_extern_func.extern_func Link_env.t
let get_memory env id =
match get_memory env id with
| Error e -> Symbolic_choice_with_memory.trap e
| Ok orig_mem ->
let f (t : Thread_with_memory.t) =
let memories = Thread_with_memory.memories t in
Symbolic_memory.get_memory (Link_env.id env) orig_mem memories id
in
Symbolic_choice_with_memory.with_thread f
let get_table (env : t) i : Symbolic_table.t Symbolic_choice_with_memory.t =
match get_table env i with
| Error e -> Symbolic_choice_with_memory.trap e
| Ok orig_table ->
let f (t : Thread_with_memory.t) =
let tables = Thread_with_memory.tables t in
Symbolic_table.get_table (Link_env.id env) orig_table tables i
in
Symbolic_choice_with_memory.with_thread f
let get_data env n =
match get_data env n with
| Error e -> Symbolic_choice_with_memory.trap e
| Ok orig_data -> Symbolic_choice_with_memory.return orig_data
let get_global (env : t) i : Symbolic_global.t Symbolic_choice_with_memory.t =
match get_global env i with
| Error e -> Symbolic_choice_with_memory.trap e
| Ok orig_global ->
let f (t : Thread_with_memory.t) =
let globals = Thread_with_memory.globals t in
Symbolic_global.get_global (Link_env.id env) orig_global globals i
in
Symbolic_choice_with_memory.with_thread f