@grain/binaryen.ml 0.34.0 → 0.36.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- binaryen-archive/CHANGELOG.md +37 -0
- binaryen-archive/binaryen.opam +3 -3
- binaryen-archive/esy.lock/index.json +366 -391
- binaryen-archive/esy.lock/opam/base.v0.17.3/opam +5 -3
- binaryen-archive/esy.lock/opam/{chrome-trace.3.20.2 → chrome-trace.3.24.1}/opam +6 -8
- binaryen-archive/esy.lock/opam/{cmdliner.1.3.0 → cmdliner.2.1.1}/opam +26 -10
- binaryen-archive/esy.lock/opam/{dune-build-info.3.20.2 → dune-build-info.3.24.2}/opam +6 -8
- binaryen-archive/esy.lock/opam/{dune-configurator.3.20.2 → dune-configurator.3.24.2}/opam +6 -8
- binaryen-archive/esy.lock/opam/{dune.3.20.2 → dune.3.24.2}/opam +15 -10
- binaryen-archive/esy.lock/opam/fix.20250919/opam +1 -0
- binaryen-archive/esy.lock/opam/js_of_ocaml-compiler.6.4.1/opam +67 -0
- binaryen-archive/esy.lock/opam/{menhir.20250912 → menhir.20260209}/opam +6 -4
- binaryen-archive/esy.lock/opam/{menhirCST.20250912 → menhirCST.20260209}/opam +4 -3
- binaryen-archive/esy.lock/opam/menhirGLR.20260209/opam +30 -0
- binaryen-archive/esy.lock/opam/{menhirLib.20250912 → menhirLib.20260209}/opam +5 -4
- binaryen-archive/esy.lock/opam/{menhirSdk.20250912 → menhirSdk.20260209}/opam +5 -4
- binaryen-archive/esy.lock/opam/ocaml-lsp-server.1.23.1/opam +2 -2
- binaryen-archive/esy.lock/opam/{ocaml-version.4.0.3 → ocaml-version.4.1.3}/opam +3 -3
- binaryen-archive/esy.lock/opam/{ocaml_intrinsics_kernel.v0.17.1 → ocaml_intrinsics_kernel.v0.17.2}/opam +3 -3
- binaryen-archive/esy.lock/opam/ocamlbuild.0.16.1/opam +1 -0
- binaryen-archive/esy.lock/opam/ocamlfind.1.9.8/opam +2 -1
- binaryen-archive/esy.lock/opam/{ocamlformat-lib.0.27.0 → ocamlformat-lib.0.29.0}/opam +7 -6
- binaryen-archive/esy.lock/opam/{ocamlformat-rpc-lib.0.28.1 → ocamlformat-rpc-lib.0.29.0}/opam +4 -4
- binaryen-archive/esy.lock/opam/{ocamlformat.0.27.0 → ocamlformat.0.29.0}/opam +6 -5
- binaryen-archive/esy.lock/opam/{ocp-indent.1.7.0 → ocp-indent.1.9.0}/opam +10 -9
- binaryen-archive/esy.lock/opam/ppx_yojson_conv_lib.v0.17.0/opam +2 -0
- binaryen-archive/esy.lock/opam/{ppxlib.0.37.0 → ppxlib.0.39.0~5.6preview}/opam +12 -13
- binaryen-archive/esy.lock/opam/sexplib0.v0.17.0/opam +2 -0
- binaryen-archive/esy.lock/opam/stdio.v0.17.0/opam +3 -1
- binaryen-archive/esy.lock/opam/{xdg.3.20.2 → xdg.3.24.2}/opam +6 -8
- binaryen-archive/package.json +9 -5
- binaryen-archive/src/dune +6 -1
- binaryen-archive/src/export.c +10 -0
- binaryen-archive/src/export.js +13 -0
- binaryen-archive/src/export.ml +4 -0
- binaryen-archive/src/export.mli +1 -0
- binaryen-archive/src/expression.c +636 -0
- binaryen-archive/src/expression.js +423 -7
- binaryen-archive/src/expression.ml +224 -0
- binaryen-archive/src/expression.mli +159 -0
- binaryen-archive/src/heap_type.c +19 -0
- binaryen-archive/src/heap_type.js +12 -0
- binaryen-archive/src/heap_type.ml +10 -1
- binaryen-archive/src/heap_type.mli +8 -1
- binaryen-archive/src/import.c +32 -0
- binaryen-archive/src/import.js +47 -0
- binaryen-archive/src/import.ml +12 -0
- binaryen-archive/src/import.mli +5 -0
- binaryen-archive/src/memory.c +6 -1
- binaryen-archive/src/memory.js +2 -2
- binaryen-archive/src/memory.ml +1 -1
- binaryen-archive/src/memory.mli +1 -1
- binaryen-archive/src/module.js +9 -22
- binaryen-archive/src/module.ml +4 -0
- binaryen-archive/src/module.mli +1 -0
- binaryen-archive/src/module_feature.c +6 -0
- binaryen-archive/src/module_feature.js +6 -0
- binaryen-archive/src/ocaml_helpers.c +17 -0
- binaryen-archive/src/ocaml_helpers.h +9 -0
- binaryen-archive/src/ocaml_helpers.js +11 -0
- binaryen-archive/src/passes.ml +13 -11
- binaryen-archive/src/passes.mli +13 -11
- binaryen-archive/src/tag.c +61 -0
- binaryen-archive/src/tag.js +43 -0
- binaryen-archive/src/tag.ml +11 -0
- binaryen-archive/src/tag.mli +8 -0
- binaryen-archive/src/type.c +5 -3
- binaryen-archive/src/type.js +5 -9
- binaryen-archive/src/type.ml +4 -1
- binaryen-archive/src/type.mli +1 -1
- binaryen-archive/src/type_builder.c +180 -0
- binaryen-archive/src/type_builder.js +116 -0
- binaryen-archive/src/type_builder.ml +67 -0
- binaryen-archive/src/type_builder.mli +28 -0
- binaryen-archive/test/test.expected +323 -33
- binaryen-archive/test/test.ml +220 -4
- binaryen-archive/esy.lock/opam/base-bytes.base/opam +0 -10
- binaryen-archive/esy.lock/opam/js_of_ocaml-compiler.6.2.0/opam +0 -56
- binaryen-archive/esy.lock/opam/stdlib-shims.0.3.0/opam +0 -31
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
type t
|
|
2
|
+
|
|
3
|
+
type struct_field = {
|
|
4
|
+
type_ : Type.t;
|
|
5
|
+
packed_type : Packed_type.t;
|
|
6
|
+
mutable_ : bool;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
(* Source: https://github.com/WebAssembly/binaryen/blob/64ba23996a10e229d46e41eb37736a55af87f79a/src/binaryen-c.h#L3618 *)
|
|
10
|
+
type error =
|
|
11
|
+
| SelfSupertype of int
|
|
12
|
+
| InvalidSupertype of int
|
|
13
|
+
| ForwardSupertypeReference of int
|
|
14
|
+
| ForwardChildReference of int
|
|
15
|
+
|
|
16
|
+
external make : int -> t = "caml_type_builder_create"
|
|
17
|
+
external grow : t -> int -> unit = "caml_type_builder_grow"
|
|
18
|
+
external size : t -> int = "caml_type_builder_get_size"
|
|
19
|
+
|
|
20
|
+
external set_signature_type : t -> int -> Type.t -> Type.t -> unit
|
|
21
|
+
= "caml_type_builder_set_signature_type"
|
|
22
|
+
|
|
23
|
+
external set_struct_type :
|
|
24
|
+
t -> int -> Type.t list -> Packed_type.t list -> bool list -> int -> unit
|
|
25
|
+
= "caml_type_builder_set_struct_type__bytecode"
|
|
26
|
+
"caml_type_builder_set_struct_type"
|
|
27
|
+
|
|
28
|
+
let set_struct_type builder index fields =
|
|
29
|
+
let split_fields fields =
|
|
30
|
+
List.fold_right
|
|
31
|
+
(fun { type_; packed_type; mutable_ } (types, packed_types, mutables) ->
|
|
32
|
+
(type_ :: types, packed_type :: packed_types, mutable_ :: mutables))
|
|
33
|
+
fields ([], [], [])
|
|
34
|
+
in
|
|
35
|
+
let types, packed_types, mutables = split_fields fields in
|
|
36
|
+
set_struct_type builder index types packed_types mutables (List.length types)
|
|
37
|
+
|
|
38
|
+
external set_array_type : t -> int -> Type.t -> Packed_type.t -> bool -> unit
|
|
39
|
+
= "caml_type_builder_set_array_type"
|
|
40
|
+
|
|
41
|
+
external get_temp_heap_type : t -> int -> Heap_type.t
|
|
42
|
+
= "caml_type_builder_get_temp_heap_type"
|
|
43
|
+
|
|
44
|
+
external get_temp_tuple_type : t -> Type.t list -> Type.t
|
|
45
|
+
= "caml_type_builder_get_temp_tuple_type"
|
|
46
|
+
|
|
47
|
+
external get_temp_ref_type : t -> Heap_type.t -> bool -> Type.t
|
|
48
|
+
= "caml_type_builder_get_temp_ref_type"
|
|
49
|
+
|
|
50
|
+
external set_sub_type : t -> int -> Heap_type.t -> unit
|
|
51
|
+
= "caml_type_builder_set_sub_type"
|
|
52
|
+
|
|
53
|
+
external set_open : t -> int -> unit = "caml_type_builder_set_open"
|
|
54
|
+
|
|
55
|
+
external create_rec_group : t -> int -> int -> unit
|
|
56
|
+
= "caml_type_builder_create_rec_group"
|
|
57
|
+
|
|
58
|
+
external build_and_dispose : t -> (Heap_type.t array, int * int) result
|
|
59
|
+
= "caml_type_builder_build_and_dispose"
|
|
60
|
+
|
|
61
|
+
let build_and_dispose builder =
|
|
62
|
+
match build_and_dispose builder with
|
|
63
|
+
| Ok types -> Ok (Array.to_list types)
|
|
64
|
+
| Error (idx, 0) -> Error (SelfSupertype idx)
|
|
65
|
+
| Error (idx, 1) -> Error (InvalidSupertype idx)
|
|
66
|
+
| Error (idx, 2) -> Error (ForwardSupertypeReference idx)
|
|
67
|
+
| Error (idx, _) -> Error (ForwardChildReference idx)
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
type t
|
|
2
|
+
|
|
3
|
+
type struct_field = {
|
|
4
|
+
type_ : Type.t;
|
|
5
|
+
packed_type : Packed_type.t;
|
|
6
|
+
mutable_ : bool;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
(* Source: https://github.com/WebAssembly/binaryen/blob/64ba23996a10e229d46e41eb37736a55af87f79a/src/binaryen-c.h#L3618 *)
|
|
10
|
+
type error =
|
|
11
|
+
| SelfSupertype of int
|
|
12
|
+
| InvalidSupertype of int
|
|
13
|
+
| ForwardSupertypeReference of int
|
|
14
|
+
| ForwardChildReference of int
|
|
15
|
+
|
|
16
|
+
val make : int -> t
|
|
17
|
+
val grow : t -> int -> unit
|
|
18
|
+
val size : t -> int
|
|
19
|
+
val set_signature_type : t -> int -> Type.t -> Type.t -> unit
|
|
20
|
+
val set_struct_type : t -> int -> struct_field list -> unit
|
|
21
|
+
val set_array_type : t -> int -> Type.t -> Packed_type.t -> bool -> unit
|
|
22
|
+
val get_temp_heap_type : t -> int -> Heap_type.t
|
|
23
|
+
val get_temp_tuple_type : t -> Type.t list -> Type.t
|
|
24
|
+
val get_temp_ref_type : t -> Heap_type.t -> bool -> Type.t
|
|
25
|
+
val set_sub_type : t -> int -> Heap_type.t -> unit
|
|
26
|
+
val set_open : t -> int -> unit
|
|
27
|
+
val create_rec_group : t -> int -> int -> unit
|
|
28
|
+
val build_and_dispose : t -> (Heap_type.t list, error) result
|
|
@@ -7,11 +7,16 @@
|
|
|
7
7
|
(i32.const 0)
|
|
8
8
|
)
|
|
9
9
|
(module
|
|
10
|
-
(type $
|
|
11
|
-
(type $1 (
|
|
12
|
-
(type $2 (func (param
|
|
13
|
-
(type $3 (func (param
|
|
14
|
-
(
|
|
10
|
+
(type $List (struct (field $head i31ref) (field $tail (ref null $List))))
|
|
11
|
+
(type $1 (array (mut i8)))
|
|
12
|
+
(type $2 (func (param i32)))
|
|
13
|
+
(type $3 (func (param i32 i32) (result i32)))
|
|
14
|
+
(type $4 (func))
|
|
15
|
+
(type $5 (func (param anyref i32 i32) (result i32)))
|
|
16
|
+
(type $6 (func (param anyref) (result i32)))
|
|
17
|
+
(type $7 (func (param anyref) (result anyref anyref)))
|
|
18
|
+
(type $8 (func (result (ref $1) (ref $List))))
|
|
19
|
+
(import "future-wasi" "write" (func $write (type $5) (param anyref i32 i32) (result i32)))
|
|
15
20
|
(global $max_int64 i64 (i64.const 9223372036854775807))
|
|
16
21
|
(global $max_int64_mut (mut i64) (i64.const 9223372036854775807))
|
|
17
22
|
(global $test_float64_bits f64 (f64.const 1.23))
|
|
@@ -20,11 +25,15 @@
|
|
|
20
25
|
(data $world "world")
|
|
21
26
|
(table $table 1 1 funcref)
|
|
22
27
|
(elem $elem (i32.const 0) $adder)
|
|
28
|
+
(tag $foo (type $2) (param i32))
|
|
29
|
+
(tag $bar (type $2) (param i32))
|
|
23
30
|
(export "adder" (func $adder))
|
|
24
31
|
(export "memory" (memory $0))
|
|
25
32
|
(export "hello" (func $hello))
|
|
33
|
+
(export "try" (func $try))
|
|
34
|
+
(export "gc" (func $gc))
|
|
26
35
|
(start $start)
|
|
27
|
-
(func $adder (type $
|
|
36
|
+
(func $adder (type $3) (param $0 i32) (param $1 i32) (result i32)
|
|
28
37
|
(block $add (result i32)
|
|
29
38
|
(if
|
|
30
39
|
(i32.const 0)
|
|
@@ -44,7 +53,7 @@
|
|
|
44
53
|
)
|
|
45
54
|
)
|
|
46
55
|
)
|
|
47
|
-
(func $start (type $
|
|
56
|
+
(func $start (type $4)
|
|
48
57
|
(block $start
|
|
49
58
|
(memory.init $world
|
|
50
59
|
(i32.const 2048)
|
|
@@ -52,7 +61,7 @@
|
|
|
52
61
|
(i32.const 5)
|
|
53
62
|
)
|
|
54
63
|
(drop
|
|
55
|
-
(call_indirect $table (type $
|
|
64
|
+
(call_indirect $table (type $3)
|
|
56
65
|
(i32.const 3)
|
|
57
66
|
(i32.const 5)
|
|
58
67
|
(i32.const 0)
|
|
@@ -60,30 +69,151 @@
|
|
|
60
69
|
)
|
|
61
70
|
)
|
|
62
71
|
)
|
|
63
|
-
(func $hello (type $
|
|
72
|
+
(func $hello (type $6) (param $0 anyref) (result i32)
|
|
64
73
|
(call $write
|
|
65
74
|
(local.get $0)
|
|
66
75
|
(i32.const 0)
|
|
67
76
|
(i32.const 1)
|
|
68
77
|
)
|
|
69
78
|
)
|
|
79
|
+
(func $try (type $4)
|
|
80
|
+
(block $blk
|
|
81
|
+
(drop
|
|
82
|
+
(try $tc1 (result i32)
|
|
83
|
+
(do
|
|
84
|
+
(throw $foo
|
|
85
|
+
(i32.const 1)
|
|
86
|
+
)
|
|
87
|
+
)
|
|
88
|
+
(catch $foo
|
|
89
|
+
(block $tc1blk2 (result i32)
|
|
90
|
+
(drop
|
|
91
|
+
(pop i32)
|
|
92
|
+
)
|
|
93
|
+
(i32.const 2)
|
|
94
|
+
)
|
|
95
|
+
)
|
|
96
|
+
(catch $bar
|
|
97
|
+
(block $tc1blk3 (result i32)
|
|
98
|
+
(drop
|
|
99
|
+
(pop i32)
|
|
100
|
+
)
|
|
101
|
+
(i32.const 3)
|
|
102
|
+
)
|
|
103
|
+
)
|
|
104
|
+
)
|
|
105
|
+
)
|
|
106
|
+
(try $tc2
|
|
107
|
+
(do
|
|
108
|
+
(throw $foo
|
|
109
|
+
(i32.const 1)
|
|
110
|
+
)
|
|
111
|
+
)
|
|
112
|
+
(catch $foo
|
|
113
|
+
(block $tc2blk2
|
|
114
|
+
(drop
|
|
115
|
+
(pop i32)
|
|
116
|
+
)
|
|
117
|
+
)
|
|
118
|
+
)
|
|
119
|
+
(catch $bar
|
|
120
|
+
(block $tc2blk3
|
|
121
|
+
(drop
|
|
122
|
+
(pop i32)
|
|
123
|
+
)
|
|
124
|
+
)
|
|
125
|
+
)
|
|
126
|
+
)
|
|
127
|
+
(drop
|
|
128
|
+
(try $tc3 (result i32)
|
|
129
|
+
(do
|
|
130
|
+
(i32.const 1)
|
|
131
|
+
)
|
|
132
|
+
(catch $foo
|
|
133
|
+
(block $tc3blk2 (result i32)
|
|
134
|
+
(drop
|
|
135
|
+
(pop i32)
|
|
136
|
+
)
|
|
137
|
+
(i32.const 2)
|
|
138
|
+
)
|
|
139
|
+
)
|
|
140
|
+
(catch_all
|
|
141
|
+
(i32.const 3)
|
|
142
|
+
)
|
|
143
|
+
)
|
|
144
|
+
)
|
|
145
|
+
)
|
|
146
|
+
)
|
|
147
|
+
(func $gc (type $7) (param $0 anyref) (result anyref anyref)
|
|
148
|
+
(local $1 (ref $1))
|
|
149
|
+
(local $2 (ref $List))
|
|
150
|
+
(block $gc_block (type $8) (result (ref $1) (ref $List))
|
|
151
|
+
(local.set $1
|
|
152
|
+
(array.new_fixed $1 2
|
|
153
|
+
(i32.const 0)
|
|
154
|
+
(i32.const 255)
|
|
155
|
+
)
|
|
156
|
+
)
|
|
157
|
+
(array.set $1
|
|
158
|
+
(local.get $1)
|
|
159
|
+
(i32.const 1)
|
|
160
|
+
(i32.const 42)
|
|
161
|
+
)
|
|
162
|
+
(local.set $2
|
|
163
|
+
(struct.new $List
|
|
164
|
+
(ref.cast i31ref
|
|
165
|
+
(local.get $0)
|
|
166
|
+
)
|
|
167
|
+
(struct.new $List
|
|
168
|
+
(ref.i31
|
|
169
|
+
(i32.const 1)
|
|
170
|
+
)
|
|
171
|
+
(struct.new $List
|
|
172
|
+
(ref.i31
|
|
173
|
+
(i32.const 2)
|
|
174
|
+
)
|
|
175
|
+
(struct.new $List
|
|
176
|
+
(ref.i31
|
|
177
|
+
(i32.const 3)
|
|
178
|
+
)
|
|
179
|
+
(ref.null none)
|
|
180
|
+
)
|
|
181
|
+
)
|
|
182
|
+
)
|
|
183
|
+
)
|
|
184
|
+
)
|
|
185
|
+
(tuple.make 2
|
|
186
|
+
(local.get $1)
|
|
187
|
+
(local.get $2)
|
|
188
|
+
)
|
|
189
|
+
)
|
|
190
|
+
)
|
|
70
191
|
)
|
|
71
192
|
(module
|
|
72
|
-
(type $
|
|
73
|
-
(type $1 (
|
|
74
|
-
(type $2 (func (param
|
|
75
|
-
(type $3 (func
|
|
76
|
-
(
|
|
193
|
+
(type $List (struct (field $head i31ref) (field $tail (ref null $List))))
|
|
194
|
+
(type $1 (array (mut i8)))
|
|
195
|
+
(type $2 (func (param i32)))
|
|
196
|
+
(type $3 (func))
|
|
197
|
+
(type $4 (func (param i32 i32) (result i32)))
|
|
198
|
+
(type $5 (func (param anyref i32 i32) (result i32)))
|
|
199
|
+
(type $6 (func (param anyref) (result i32)))
|
|
200
|
+
(type $7 (func (param anyref) (result anyref anyref)))
|
|
201
|
+
(type $8 (func (result (ref (exact $1)) (ref (exact $List)))))
|
|
202
|
+
(import "future-wasi" "write" (func $write (type $5) (param anyref i32 i32) (result i32)))
|
|
77
203
|
(memory $0 1)
|
|
78
204
|
(data $hello (i32.const 0) "hello")
|
|
79
205
|
(data $world "world")
|
|
80
206
|
(table $table 1 1 funcref)
|
|
81
207
|
(elem $elem (i32.const 0) $adder)
|
|
208
|
+
(tag $foo (type $2) (param i32))
|
|
209
|
+
(tag $bar (type $2) (param i32))
|
|
82
210
|
(export "adder" (func $adder))
|
|
83
211
|
(export "memory" (memory $0))
|
|
84
212
|
(export "hello" (func $hello))
|
|
213
|
+
(export "try" (func $try))
|
|
214
|
+
(export "gc" (func $gc))
|
|
85
215
|
(start $start)
|
|
86
|
-
(func $adder (type $
|
|
216
|
+
(func $adder (type $4) (param $0 i32) (param $1 i32) (result i32)
|
|
87
217
|
(i32.add
|
|
88
218
|
(select
|
|
89
219
|
(local.get $0)
|
|
@@ -95,7 +225,7 @@
|
|
|
95
225
|
(local.get $1)
|
|
96
226
|
)
|
|
97
227
|
)
|
|
98
|
-
(func $start (type $
|
|
228
|
+
(func $start (type $3)
|
|
99
229
|
(memory.init $world
|
|
100
230
|
(i32.const 2048)
|
|
101
231
|
(i32.const 0)
|
|
@@ -108,20 +238,101 @@
|
|
|
108
238
|
)
|
|
109
239
|
)
|
|
110
240
|
)
|
|
111
|
-
(func $hello (type $
|
|
241
|
+
(func $hello (type $6) (param $0 anyref) (result i32)
|
|
112
242
|
(call $write
|
|
113
243
|
(local.get $0)
|
|
114
244
|
(i32.const 0)
|
|
115
245
|
(i32.const 1)
|
|
116
246
|
)
|
|
117
247
|
)
|
|
248
|
+
(func $try (type $3)
|
|
249
|
+
(drop
|
|
250
|
+
(try (result i32)
|
|
251
|
+
(do
|
|
252
|
+
(throw $foo
|
|
253
|
+
(i32.const 1)
|
|
254
|
+
)
|
|
255
|
+
)
|
|
256
|
+
(catch $foo
|
|
257
|
+
(drop
|
|
258
|
+
(pop i32)
|
|
259
|
+
)
|
|
260
|
+
(i32.const 2)
|
|
261
|
+
)
|
|
262
|
+
(catch $bar
|
|
263
|
+
(drop
|
|
264
|
+
(pop i32)
|
|
265
|
+
)
|
|
266
|
+
(i32.const 3)
|
|
267
|
+
)
|
|
268
|
+
)
|
|
269
|
+
)
|
|
270
|
+
(try
|
|
271
|
+
(do
|
|
272
|
+
(throw $foo
|
|
273
|
+
(i32.const 1)
|
|
274
|
+
)
|
|
275
|
+
)
|
|
276
|
+
(catch $foo
|
|
277
|
+
(drop
|
|
278
|
+
(pop i32)
|
|
279
|
+
)
|
|
280
|
+
)
|
|
281
|
+
(catch $bar
|
|
282
|
+
(drop
|
|
283
|
+
(pop i32)
|
|
284
|
+
)
|
|
285
|
+
)
|
|
286
|
+
)
|
|
287
|
+
)
|
|
288
|
+
(func $gc (type $7) (param $0 anyref) (result anyref anyref)
|
|
289
|
+
(local $1 (ref (exact $1)))
|
|
290
|
+
(array.set $1
|
|
291
|
+
(local.tee $1
|
|
292
|
+
(array.new_fixed $1 2
|
|
293
|
+
(i32.const 0)
|
|
294
|
+
(i32.const 255)
|
|
295
|
+
)
|
|
296
|
+
)
|
|
297
|
+
(i32.const 1)
|
|
298
|
+
(i32.const 42)
|
|
299
|
+
)
|
|
300
|
+
(tuple.make 2
|
|
301
|
+
(local.get $1)
|
|
302
|
+
(struct.new $List
|
|
303
|
+
(ref.cast i31ref
|
|
304
|
+
(local.get $0)
|
|
305
|
+
)
|
|
306
|
+
(struct.new $List
|
|
307
|
+
(ref.i31
|
|
308
|
+
(i32.const 1)
|
|
309
|
+
)
|
|
310
|
+
(struct.new $List
|
|
311
|
+
(ref.i31
|
|
312
|
+
(i32.const 2)
|
|
313
|
+
)
|
|
314
|
+
(struct.new $List
|
|
315
|
+
(ref.i31
|
|
316
|
+
(i32.const 3)
|
|
317
|
+
)
|
|
318
|
+
(ref.null none)
|
|
319
|
+
)
|
|
320
|
+
)
|
|
321
|
+
)
|
|
322
|
+
)
|
|
323
|
+
)
|
|
324
|
+
)
|
|
118
325
|
)
|
|
119
326
|
(module
|
|
120
|
-
(type $
|
|
121
|
-
(type $
|
|
122
|
-
(type $
|
|
123
|
-
(type $
|
|
124
|
-
(
|
|
327
|
+
(type $type_7 (struct (field i31ref) (field (ref null $type_7))))
|
|
328
|
+
(type $type_6 (array (mut i8)))
|
|
329
|
+
(type $type_3 (func))
|
|
330
|
+
(type $type_1 (func (param anyref i32 i32) (result i32)))
|
|
331
|
+
(type $type_2 (func (param i32 i32) (result i32)))
|
|
332
|
+
(type $type_4 (func (param anyref) (result i32)))
|
|
333
|
+
(type $type_5 (func (param anyref) (result anyref anyref)))
|
|
334
|
+
(type $type_8 (func (result anyref anyref)))
|
|
335
|
+
(import "future-wasi" "write" (func $fimport$0 (type $type_1) (param anyref i32 i32) (result i32)))
|
|
125
336
|
(memory $0 1)
|
|
126
337
|
(data $0 (i32.const 0) "hello")
|
|
127
338
|
(data $1 "world")
|
|
@@ -130,8 +341,10 @@
|
|
|
130
341
|
(export "adder" (func $0))
|
|
131
342
|
(export "memory" (memory $0))
|
|
132
343
|
(export "hello" (func $2))
|
|
344
|
+
(export "try" (func $3))
|
|
345
|
+
(export "gc" (func $4))
|
|
133
346
|
(start $1)
|
|
134
|
-
(func $0 (type $
|
|
347
|
+
(func $0 (type $type_2) (param $0 i32) (param $1 i32) (result i32)
|
|
135
348
|
(i32.add
|
|
136
349
|
(select
|
|
137
350
|
(local.get $0)
|
|
@@ -143,7 +356,7 @@
|
|
|
143
356
|
(local.get $1)
|
|
144
357
|
)
|
|
145
358
|
)
|
|
146
|
-
(func $1 (type $
|
|
359
|
+
(func $1 (type $type_3)
|
|
147
360
|
(memory.init $1
|
|
148
361
|
(i32.const 2048)
|
|
149
362
|
(i32.const 0)
|
|
@@ -156,20 +369,67 @@
|
|
|
156
369
|
)
|
|
157
370
|
)
|
|
158
371
|
)
|
|
159
|
-
(func $2 (type $
|
|
372
|
+
(func $2 (type $type_4) (param $0 anyref) (result i32)
|
|
160
373
|
(call $fimport$0
|
|
161
374
|
(local.get $0)
|
|
162
375
|
(i32.const 0)
|
|
163
376
|
(i32.const 1)
|
|
164
377
|
)
|
|
165
378
|
)
|
|
379
|
+
(func $3 (type $type_3)
|
|
380
|
+
(drop
|
|
381
|
+
(unreachable)
|
|
382
|
+
)
|
|
383
|
+
(unreachable)
|
|
384
|
+
)
|
|
385
|
+
(func $4 (type $type_5) (param $0 anyref) (result anyref anyref)
|
|
386
|
+
(local $1 (ref (exact $type_6)))
|
|
387
|
+
(array.set $type_6
|
|
388
|
+
(local.tee $1
|
|
389
|
+
(array.new_fixed $type_6 2
|
|
390
|
+
(i32.const 0)
|
|
391
|
+
(i32.const 255)
|
|
392
|
+
)
|
|
393
|
+
)
|
|
394
|
+
(i32.const 1)
|
|
395
|
+
(i32.const 42)
|
|
396
|
+
)
|
|
397
|
+
(tuple.make 2
|
|
398
|
+
(local.get $1)
|
|
399
|
+
(struct.new $type_7
|
|
400
|
+
(ref.cast i31ref
|
|
401
|
+
(local.get $0)
|
|
402
|
+
)
|
|
403
|
+
(struct.new $type_7
|
|
404
|
+
(ref.i31
|
|
405
|
+
(i32.const 1)
|
|
406
|
+
)
|
|
407
|
+
(struct.new $type_7
|
|
408
|
+
(ref.i31
|
|
409
|
+
(i32.const 2)
|
|
410
|
+
)
|
|
411
|
+
(struct.new $type_7
|
|
412
|
+
(ref.i31
|
|
413
|
+
(i32.const 3)
|
|
414
|
+
)
|
|
415
|
+
(ref.null none)
|
|
416
|
+
)
|
|
417
|
+
)
|
|
418
|
+
)
|
|
419
|
+
)
|
|
420
|
+
)
|
|
421
|
+
)
|
|
166
422
|
)
|
|
167
423
|
(module
|
|
168
|
-
(type $
|
|
169
|
-
(type $
|
|
170
|
-
(type $
|
|
171
|
-
(type $
|
|
172
|
-
(
|
|
424
|
+
(type $type_7 (struct (field i31ref) (field (ref null $type_7))))
|
|
425
|
+
(type $type_6 (array (mut i8)))
|
|
426
|
+
(type $type_3 (func))
|
|
427
|
+
(type $type_1 (func (param anyref i32 i32) (result i32)))
|
|
428
|
+
(type $type_2 (func (param i32 i32) (result i32)))
|
|
429
|
+
(type $type_4 (func (param anyref) (result i32)))
|
|
430
|
+
(type $type_5 (func (param anyref) (result anyref anyref)))
|
|
431
|
+
(type $type_8 (func (result anyref anyref)))
|
|
432
|
+
(import "future-wasi" "write" (func $fimport$0 (type $type_1) (param anyref i32 i32) (result i32)))
|
|
173
433
|
(memory $0 1)
|
|
174
434
|
(data $0 (i32.const 0) "hello")
|
|
175
435
|
(data $1 "world")
|
|
@@ -178,8 +438,10 @@
|
|
|
178
438
|
(export "adder" (func $0))
|
|
179
439
|
(export "memory" (memory $0))
|
|
180
440
|
(export "hello" (func $2))
|
|
441
|
+
(export "try" (func $3))
|
|
442
|
+
(export "gc" (func $4))
|
|
181
443
|
(start $1)
|
|
182
|
-
(func $0 (type $
|
|
444
|
+
(func $0 (type $type_2) (param $0 i32) (param $1 i32) (result i32)
|
|
183
445
|
local.get $0
|
|
184
446
|
local.get $1
|
|
185
447
|
i32.load
|
|
@@ -188,7 +450,7 @@
|
|
|
188
450
|
local.get $1
|
|
189
451
|
i32.add
|
|
190
452
|
)
|
|
191
|
-
(func $1 (type $
|
|
453
|
+
(func $1 (type $type_3)
|
|
192
454
|
i32.const 2048
|
|
193
455
|
i32.const 0
|
|
194
456
|
i32.const 5
|
|
@@ -198,10 +460,38 @@
|
|
|
198
460
|
call $0
|
|
199
461
|
drop
|
|
200
462
|
)
|
|
201
|
-
(func $2 (type $
|
|
463
|
+
(func $2 (type $type_4) (param $0 anyref) (result i32)
|
|
202
464
|
local.get $0
|
|
203
465
|
i32.const 0
|
|
204
466
|
i32.const 1
|
|
205
467
|
call $fimport$0
|
|
206
468
|
)
|
|
469
|
+
(func $3 (type $type_3)
|
|
470
|
+
unreachable
|
|
471
|
+
)
|
|
472
|
+
(func $4 (type $type_5) (param $0 anyref) (result anyref anyref)
|
|
473
|
+
(local $1 (ref (exact $type_6)))
|
|
474
|
+
i32.const 0
|
|
475
|
+
i32.const 255
|
|
476
|
+
array.new_fixed $type_6 2
|
|
477
|
+
local.tee $1
|
|
478
|
+
i32.const 1
|
|
479
|
+
i32.const 42
|
|
480
|
+
array.set $type_6
|
|
481
|
+
local.get $1
|
|
482
|
+
local.get $0
|
|
483
|
+
ref.cast i31ref
|
|
484
|
+
i32.const 1
|
|
485
|
+
ref.i31
|
|
486
|
+
i32.const 2
|
|
487
|
+
ref.i31
|
|
488
|
+
i32.const 3
|
|
489
|
+
ref.i31
|
|
490
|
+
ref.null none
|
|
491
|
+
struct.new $type_7
|
|
492
|
+
struct.new $type_7
|
|
493
|
+
struct.new $type_7
|
|
494
|
+
struct.new $type_7
|
|
495
|
+
tuple.make 2
|
|
496
|
+
)
|
|
207
497
|
)
|