@grain/binaryen.ml 0.19.0 → 0.20.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 +38 -0
- binaryen-archive/README.md +0 -16
- binaryen-archive/binaryen.opam +5 -5
- binaryen-archive/dune-project +1 -1
- binaryen-archive/dune-workspace +1 -1
- binaryen-archive/esy.lock/index.json +285 -290
- binaryen-archive/esy.lock/opam/{base.v0.14.3 → base.v0.15.1}/opam +4 -4
- binaryen-archive/esy.lock/opam/{chrome-trace.3.5.0 → chrome-trace.3.6.1}/opam +5 -5
- binaryen-archive/esy.lock/opam/{dune-build-info.3.5.0 → dune-build-info.3.6.1}/opam +6 -6
- binaryen-archive/esy.lock/opam/{dune-configurator.3.5.0 → dune-configurator.3.6.1}/opam +5 -5
- binaryen-archive/esy.lock/opam/{dune-rpc.3.5.0 → dune-rpc.3.6.1}/opam +5 -5
- binaryen-archive/esy.lock/opam/{dune.3.5.0 → dune.3.6.1}/opam +6 -6
- binaryen-archive/esy.lock/opam/{dyn.3.5.0 → dyn.3.6.1}/opam +5 -5
- binaryen-archive/esy.lock/opam/{fiber.3.5.0 → fiber.3.6.1}/opam +5 -5
- binaryen-archive/esy.lock/opam/{js_of_ocaml-compiler.4.0.0 → js_of_ocaml-compiler.4.1.0}/opam +9 -10
- binaryen-archive/esy.lock/opam/menhir.20220210/opam +1 -1
- binaryen-archive/esy.lock/opam/menhirLib.20220210/opam +1 -1
- binaryen-archive/esy.lock/opam/menhirSdk.20220210/opam +1 -1
- binaryen-archive/esy.lock/opam/{ocaml-lsp-server.1.14.1 → ocaml-lsp-server.1.12.4}/opam +5 -5
- binaryen-archive/esy.lock/opam/{ocamlformat.0.20.1 → ocamlformat.0.24.1}/opam +12 -12
- binaryen-archive/esy.lock/opam/{odoc-parser.1.0.1 → odoc-parser.2.0.0}/opam +4 -4
- binaryen-archive/esy.lock/opam/{ordering.3.5.0 → ordering.3.6.1}/opam +5 -5
- binaryen-archive/esy.lock/opam/{sexplib0.v0.14.0 → sexplib0.v0.15.1}/opam +3 -3
- binaryen-archive/esy.lock/opam/{stdio.v0.14.0 → stdio.v0.15.0}/opam +4 -4
- binaryen-archive/esy.lock/opam/{stdune.3.5.0 → stdune.3.6.1}/opam +5 -5
- binaryen-archive/esy.lock/opam/{topkg.1.0.5 → topkg.1.0.6}/opam +22 -19
- binaryen-archive/esy.lock/opam/{xdg.3.5.0 → xdg.3.6.1}/opam +5 -5
- binaryen-archive/package.json +8 -8
- binaryen-archive/src/binaryen_stubs_expressions.c +43 -33
- binaryen-archive/src/binaryen_stubs_expressions.js +221 -42
- binaryen-archive/src/binaryen_stubs_features.c +6 -0
- binaryen-archive/src/binaryen_stubs_features.js +6 -0
- binaryen-archive/src/binaryen_stubs_heap_types.c +95 -0
- binaryen-archive/src/binaryen_stubs_heap_types.js +65 -0
- binaryen-archive/src/binaryen_stubs_imports.c +8 -6
- binaryen-archive/src/binaryen_stubs_imports.js +6 -6
- binaryen-archive/src/binaryen_stubs_memory.c +55 -16
- binaryen-archive/src/binaryen_stubs_memory.js +64 -15
- binaryen-archive/src/binaryen_stubs_modules.c +8 -6
- binaryen-archive/src/binaryen_stubs_modules.js +6 -6
- binaryen-archive/src/binaryen_stubs_packed_types.c +26 -0
- binaryen-archive/src/binaryen_stubs_packed_types.js +17 -0
- binaryen-archive/src/binaryen_stubs_type_system.c +40 -0
- binaryen-archive/src/binaryen_stubs_type_system.js +29 -0
- binaryen-archive/src/binaryen_stubs_types.c +44 -0
- binaryen-archive/src/binaryen_stubs_types.js +36 -0
- binaryen-archive/src/dune +35 -12
- binaryen-archive/src/expression.ml +21 -24
- binaryen-archive/src/expression.mli +9 -9
- binaryen-archive/src/heap_type.ml +15 -0
- binaryen-archive/src/heap_type.mli +12 -0
- binaryen-archive/src/import.ml +4 -2
- binaryen-archive/src/import.mli +2 -2
- binaryen-archive/src/memory.ml +19 -5
- binaryen-archive/src/memory.mli +9 -10
- binaryen-archive/src/module.ml +12 -2
- binaryen-archive/src/module.mli +3 -2
- binaryen-archive/src/ocaml_helpers.h +1 -0
- binaryen-archive/src/packed_type.ml +13 -0
- binaryen-archive/src/packed_type.mli +5 -0
- binaryen-archive/src/type.ml +19 -0
- binaryen-archive/src/type.mli +7 -0
- binaryen-archive/src/type_system.ml +7 -0
- binaryen-archive/src/type_system.mli +7 -0
- binaryen-archive/test/dune +19 -20
- binaryen-archive/test/test.expected +29 -5
- binaryen-archive/test/test.ml +33 -15
- binaryen-archive/esy.lock/overrides/opam__s__js__of__ocaml_compiler_opam__c__4.0.0_opam_override/package.json +0 -3
binaryen-archive/test/test.ml
CHANGED
|
@@ -26,12 +26,16 @@ let _ =
|
|
|
26
26
|
"external_base_name" true
|
|
27
27
|
|
|
28
28
|
let _ =
|
|
29
|
-
assert (
|
|
29
|
+
assert (
|
|
30
|
+
Import.memory_import_get_module import_wasm_mod "internal_name"
|
|
31
|
+
= "external_name")
|
|
30
32
|
|
|
31
33
|
let _ =
|
|
32
|
-
assert (
|
|
34
|
+
assert (
|
|
35
|
+
Import.memory_import_get_base import_wasm_mod "internal_name"
|
|
36
|
+
= "external_base_name")
|
|
33
37
|
|
|
34
|
-
let _ = assert (Memory.is_shared import_wasm_mod = true)
|
|
38
|
+
let _ = assert (Memory.is_shared import_wasm_mod "internal_name" = true)
|
|
35
39
|
|
|
36
40
|
(* Testing Return.get_value *)
|
|
37
41
|
let _ =
|
|
@@ -52,7 +56,9 @@ let params () = Type.create [| Type.int32; Type.int32 |]
|
|
|
52
56
|
let results = Type.int32
|
|
53
57
|
let x () = Expression.Local_get.make wasm_mod 0 Type.int32
|
|
54
58
|
let y () = Expression.Local_get.make wasm_mod 1 Type.int32
|
|
55
|
-
|
|
59
|
+
|
|
60
|
+
let load =
|
|
61
|
+
Expression.Load.make wasm_mod 1 ~signed:true 0 0 Type.int32 (y ()) "0"
|
|
56
62
|
|
|
57
63
|
let select =
|
|
58
64
|
Expression.Select.make wasm_mod
|
|
@@ -88,7 +94,15 @@ let call_adder =
|
|
|
88
94
|
|
|
89
95
|
let start =
|
|
90
96
|
Function.add_function wasm_mod "start" Type.none Type.none [||]
|
|
91
|
-
(Expression.
|
|
97
|
+
(Expression.Block.make wasm_mod ~return_type:Type.none "start"
|
|
98
|
+
[
|
|
99
|
+
Expression.Memory_init.make wasm_mod 1
|
|
100
|
+
(Expression.Const.make wasm_mod (Literal.int32 2048l))
|
|
101
|
+
(Expression.Const.make wasm_mod (Literal.int32 0l))
|
|
102
|
+
(Expression.Const.make wasm_mod (Literal.int32 5l))
|
|
103
|
+
"0";
|
|
104
|
+
Expression.Drop.make wasm_mod call_adder;
|
|
105
|
+
])
|
|
92
106
|
|
|
93
107
|
let _ = Export.add_function_export wasm_mod "adder" "adder"
|
|
94
108
|
let _ = Table.add_table wasm_mod "table" 1 1 Type.funcref
|
|
@@ -155,18 +169,22 @@ let _ = assert (Memory.has_memory wasm_mod = false)
|
|
|
155
169
|
let _ =
|
|
156
170
|
Memory.set_memory wasm_mod 1 Memory.unlimited "memory"
|
|
157
171
|
[ segment; passive_segment ]
|
|
158
|
-
false
|
|
172
|
+
false "0"
|
|
159
173
|
|
|
160
174
|
let _ = assert (Memory.has_memory wasm_mod = true)
|
|
161
|
-
let _ = assert (Memory.get_initial wasm_mod = 1)
|
|
162
|
-
let _ = assert (Memory.has_max wasm_mod = false)
|
|
163
|
-
let _ = assert (Memory.get_max wasm_mod = Memory.unlimited)
|
|
175
|
+
let _ = assert (Memory.get_initial wasm_mod "0" = 1)
|
|
176
|
+
let _ = assert (Memory.has_max wasm_mod "0" = false)
|
|
177
|
+
let _ = assert (Memory.get_max wasm_mod "0" = Memory.unlimited)
|
|
164
178
|
let max_memory_wasm_mod = Module.create ()
|
|
165
|
-
let _ = Memory.set_memory max_memory_wasm_mod 1 2 "memory" [] false
|
|
166
|
-
let _ = assert (Memory.has_max max_memory_wasm_mod = true)
|
|
167
|
-
let _ = assert (Memory.get_max max_memory_wasm_mod = 2)
|
|
179
|
+
let _ = Memory.set_memory max_memory_wasm_mod 1 2 "memory" [] false "0"
|
|
180
|
+
let _ = assert (Memory.has_max max_memory_wasm_mod "0" = true)
|
|
181
|
+
let _ = assert (Memory.get_max max_memory_wasm_mod "0" = 2)
|
|
168
182
|
|
|
169
|
-
|
|
183
|
+
let _ =
|
|
184
|
+
assert (
|
|
185
|
+
Bytes.equal (Memory.get_segment_data wasm_mod 1) (Bytes.of_string "world"))
|
|
186
|
+
|
|
187
|
+
(* Create an imported "write" function i32 (externref, i32, i32) *)
|
|
170
188
|
(* Similar to the example here: https://bytecodealliance.org/articles/reference-types-in-wasmtime *)
|
|
171
189
|
|
|
172
190
|
let _ =
|
|
@@ -236,13 +254,13 @@ let _ =
|
|
|
236
254
|
Module.Feature.typed_function_references;
|
|
237
255
|
Module.Feature.relaxed_simd;
|
|
238
256
|
Module.Feature.extended_const;
|
|
257
|
+
Module.Feature.strings;
|
|
239
258
|
Module.Feature.all;
|
|
240
259
|
]
|
|
241
260
|
|
|
242
261
|
let _ = Module.validate new_mod
|
|
243
262
|
let _ = Module.print new_mod
|
|
244
|
-
|
|
245
|
-
let _ = Module.print_stack_ir new_mod
|
|
263
|
+
let _ = Module.print_stack_ir new_mod false
|
|
246
264
|
|
|
247
265
|
(* Dispose the modules 👋 *)
|
|
248
266
|
|