@grain/binaryen.ml 0.20.1 → 0.22.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 +64 -0
- binaryen-archive/binaryen.opam +3 -3
- binaryen-archive/esy.lock/index.json +491 -426
- binaryen-archive/esy.lock/opam/{base.v0.15.1 → base.v0.16.1}/opam +7 -4
- binaryen-archive/esy.lock/opam/{chrome-trace.3.6.1 → chrome-trace.3.9.1}/opam +4 -4
- binaryen-archive/esy.lock/opam/{cmdliner.1.1.1 → cmdliner.1.2.0}/opam +2 -2
- binaryen-archive/esy.lock/opam/{csexp.1.5.1 → csexp.1.5.2}/opam +7 -9
- binaryen-archive/esy.lock/opam/{dune-build-info.3.6.1 → dune-build-info.3.9.1}/opam +4 -4
- binaryen-archive/esy.lock/opam/{dune-configurator.3.6.1 → dune-configurator.3.9.1}/opam +4 -4
- binaryen-archive/esy.lock/opam/{dune-rpc.3.6.1 → dune-rpc.3.9.1}/opam +4 -4
- binaryen-archive/esy.lock/opam/{dune.3.6.1 → dune.3.9.1}/opam +5 -5
- binaryen-archive/esy.lock/opam/{dyn.3.6.1 → dyn.3.9.1}/opam +4 -4
- binaryen-archive/esy.lock/opam/fiber.3.7.0/opam +39 -0
- binaryen-archive/esy.lock/opam/{fix.20220121 → fix.20230505}/opam +3 -3
- binaryen-archive/esy.lock/opam/gen.1.1/opam +31 -0
- binaryen-archive/esy.lock/opam/{js_of_ocaml-compiler.4.1.0 → js_of_ocaml-compiler.5.4.0}/opam +10 -10
- binaryen-archive/esy.lock/opam/{menhir.20220210 → menhir.20230608}/opam +4 -4
- binaryen-archive/esy.lock/opam/{menhirLib.20220210 → menhirLib.20230608}/opam +4 -4
- binaryen-archive/esy.lock/opam/{menhirSdk.20220210 → menhirSdk.20230608}/opam +4 -4
- binaryen-archive/esy.lock/opam/{ocamlbuild.0.14.2 → ocamlbuild.0.14.2+win}/opam +13 -14
- binaryen-archive/esy.lock/opam/ocamlfind.1.9.6/files/0001-Harden-test-for-OCaml-5.patch +12 -0
- binaryen-archive/esy.lock/opam/{ocamlfind.1.9.5 → ocamlfind.1.9.6}/opam +8 -7
- binaryen-archive/esy.lock/opam/{ocamlformat-rpc-lib.0.24.1 → ocamlformat-rpc-lib.0.25.1}/opam +4 -4
- binaryen-archive/esy.lock/opam/ocamlformat.0.24.1/opam +1 -1
- binaryen-archive/esy.lock/opam/{ordering.3.6.1 → ordering.3.9.1}/opam +4 -4
- binaryen-archive/esy.lock/opam/{ppx_yojson_conv_lib.v0.15.0 → ppx_yojson_conv_lib.v0.16.0}/opam +3 -3
- binaryen-archive/esy.lock/opam/{ppxlib.0.28.0 → ppxlib.0.29.1}/opam +5 -5
- binaryen-archive/esy.lock/opam/sedlex.3.2/opam +48 -0
- binaryen-archive/esy.lock/opam/{sexplib0.v0.15.1 → sexplib0.v0.16.0}/opam +3 -3
- binaryen-archive/esy.lock/opam/{stdio.v0.15.0 → stdio.v0.16.0}/opam +4 -4
- binaryen-archive/esy.lock/opam/{stdune.3.6.1 → stdune.3.9.1}/opam +4 -4
- binaryen-archive/esy.lock/opam/{topkg.1.0.6 → topkg.1.0.7}/opam +2 -2
- binaryen-archive/esy.lock/opam/{xdg.3.6.1 → xdg.3.9.1}/opam +4 -4
- binaryen-archive/esy.lock/opam/{yojson.2.0.2 → yojson.2.1.0}/opam +33 -23
- binaryen-archive/esy.lock/overrides/opam__s__ocamlbuild_opam__c__0.14.2+win_opam_override/files/ocamlbuild-0.14.2.patch +0 -0
- binaryen-archive/esy.lock/overrides/opam__s__ocamlfind_opam__c__1.9.6_opam_override/files/findlib.patch +11 -0
- binaryen-archive/package.json +3 -3
- binaryen-archive/src/array_type.c +29 -0
- binaryen-archive/src/array_type.js +17 -0
- binaryen-archive/src/array_type.ml +8 -0
- binaryen-archive/src/array_type.mli +3 -0
- binaryen-archive/src/dune +38 -32
- binaryen-archive/src/{binaryen_stubs_exports.c → export.c} +0 -8
- binaryen-archive/src/{binaryen_stubs_expressions.c → expression.c} +24 -15
- binaryen-archive/src/{binaryen_stubs_expressions.js → expression.js} +20 -6
- binaryen-archive/src/expression.ml +14 -5
- binaryen-archive/src/expression.mli +10 -2
- binaryen-archive/src/{binaryen_stubs_functions.c → function.c} +0 -24
- binaryen-archive/src/{binaryen_stubs_globals.c → global.c} +0 -25
- binaryen-archive/src/heap_type.c +171 -0
- binaryen-archive/src/heap_type.js +131 -0
- binaryen-archive/src/heap_type.ml +12 -1
- binaryen-archive/src/heap_type.mli +12 -1
- binaryen-archive/src/{binaryen_stubs_literals.c → literal.c} +0 -9
- binaryen-archive/src/{binaryen_stubs_memory.c → memory.c} +15 -5
- binaryen-archive/src/{binaryen_stubs_memory.js → memory.js} +11 -1
- binaryen-archive/src/memory.ml +6 -3
- binaryen-archive/src/memory.mli +10 -1
- binaryen-archive/src/{binaryen_stubs_modules.c → module.c} +0 -9
- binaryen-archive/src/module.ml +4 -5
- binaryen-archive/src/module.mli +1 -1
- binaryen-archive/src/{binaryen_stubs_features.c → module_feature.c} +6 -6
- binaryen-archive/src/{binaryen_stubs_features.js → module_feature.js} +6 -6
- binaryen-archive/src/ocaml_helpers.c +87 -0
- binaryen-archive/src/ocaml_helpers.h +33 -0
- binaryen-archive/src/{binaryen_stubs_ops.c → op.c} +597 -333
- binaryen-archive/src/op.js +2129 -0
- binaryen-archive/src/op.ml +499 -352
- binaryen-archive/src/op.mli +46 -7
- binaryen-archive/src/passes.ml +46 -0
- binaryen-archive/src/passes.mli +45 -0
- binaryen-archive/src/signature_type.c +23 -0
- binaryen-archive/src/signature_type.js +11 -0
- binaryen-archive/src/signature_type.ml +5 -0
- binaryen-archive/src/signature_type.mli +2 -0
- binaryen-archive/src/struct_type.c +39 -0
- binaryen-archive/src/struct_type.js +23 -0
- binaryen-archive/src/struct_type.ml +11 -0
- binaryen-archive/src/struct_type.mli +4 -0
- binaryen-archive/src/{binaryen_stubs_tables.c → table.c} +0 -25
- binaryen-archive/src/{binaryen_stubs_types.c → type.c} +30 -12
- binaryen-archive/src/{binaryen_stubs_types.js → type.js} +31 -3
- binaryen-archive/src/type.ml +18 -2
- binaryen-archive/src/type.mli +5 -1
- binaryen-archive/src/{binaryen_stubs_type_system.c → type_system.c} +0 -6
- binaryen-archive/src/{binaryen_stubs_type_system.js → type_system.js} +0 -6
- binaryen-archive/src/type_system.ml +0 -1
- binaryen-archive/src/type_system.mli +0 -1
- binaryen-archive/test/test.expected +13 -13
- binaryen-archive/test/test.ml +11 -3
- binaryen-archive/esy.lock/opam/fiber.3.6.1/opam +0 -41
- binaryen-archive/esy.lock/opam/ocamlfind.1.9.5/files/0001-Fix-bug-when-installing-with-a-system-compiler.patch +0 -26
- binaryen-archive/esy.lock/overrides/opam__s__ocamlfind_opam__c__1.9.5_opam_override/files/findlib.patch +0 -485
- binaryen-archive/src/binaryen_stubs_heap_types.c +0 -95
- binaryen-archive/src/binaryen_stubs_heap_types.js +0 -65
- binaryen-archive/src/binaryen_stubs_ops.js +0 -1895
- /binaryen-archive/esy.lock/overrides/{opam__s__ocamlbuild_opam__c__0.14.2_opam_override → opam__s__ocamlbuild_opam__c__0.14.2+win_opam_override}/files/winpatch.patch +0 -0
- /binaryen-archive/esy.lock/overrides/{opam__s__ocamlbuild_opam__c__0.14.2_opam_override → opam__s__ocamlbuild_opam__c__0.14.2+win_opam_override}/package.json +0 -0
- /binaryen-archive/esy.lock/overrides/{opam__s__ocamlfind_opam__c__1.9.5_opam_override → opam__s__ocamlfind_opam__c__1.9.6_opam_override}/package.json +0 -0
- /binaryen-archive/src/{binaryen_stubs_exports.js → export.js} +0 -0
- /binaryen-archive/src/{binaryen_stubs_functions.js → function.js} +0 -0
- /binaryen-archive/src/{binaryen_stubs_globals.js → global.js} +0 -0
- /binaryen-archive/src/{binaryen_stubs_imports.c → import.c} +0 -0
- /binaryen-archive/src/{binaryen_stubs_imports.js → import.js} +0 -0
- /binaryen-archive/src/{binaryen_stubs_literals.js → literal.js} +0 -0
- /binaryen-archive/src/{binaryen_stubs_modules.js → module.js} +0 -0
- /binaryen-archive/src/{binaryen_stubs_packed_types.c → packed_type.c} +0 -0
- /binaryen-archive/src/{binaryen_stubs_packed_types.js → packed_type.js} +0 -0
- /binaryen-archive/src/{binaryen_stubs_settings.c → settings.c} +0 -0
- /binaryen-archive/src/{binaryen_stubs_settings.js → settings.js} +0 -0
- /binaryen-archive/src/{binaryen_stubs_tables.js → table.js} +0 -0
binaryen-archive/src/op.mli
CHANGED
|
@@ -210,6 +210,17 @@ val or_vec128 : t
|
|
|
210
210
|
val xor_vec128 : t
|
|
211
211
|
val and_not_vec128 : t
|
|
212
212
|
val bitselect_vec128 : t
|
|
213
|
+
val relaxed_fma_vec_f32x4 : t
|
|
214
|
+
val relaxed_fms_vec_f32x4 : t
|
|
215
|
+
val relaxed_fma_vec_f64x4 : t
|
|
216
|
+
val relaxed_fms_vec_f64x4 : t
|
|
217
|
+
val laneselect_i8x16 : t
|
|
218
|
+
val laneselect_i16x8 : t
|
|
219
|
+
val laneselect_i32x4 : t
|
|
220
|
+
val laneselect_i64x2 : t
|
|
221
|
+
val dot_i8x16_i7x16_add_s_to_vec_i32x4 : t
|
|
222
|
+
val any_true_vec128 : t
|
|
223
|
+
val popcnt_vec_i8x16 : t
|
|
213
224
|
val abs_vec_i8x16 : t
|
|
214
225
|
val neg_vec_i8x16 : t
|
|
215
226
|
val all_true_vec_i8x16 : t
|
|
@@ -308,11 +319,39 @@ val narrow_u_vec_i16x8_to_vec_i8x16 : t
|
|
|
308
319
|
val narrow_s_vec_i32x4_to_vec_i16x8 : t
|
|
309
320
|
val narrow_u_vec_i32x4_to_vec_i16x8 : t
|
|
310
321
|
val swizzle_vec8x16 : t
|
|
311
|
-
val ref_is_null : t
|
|
312
|
-
val ref_is_func : t
|
|
313
|
-
val ref_is_data : t
|
|
314
|
-
val ref_is_i31 : t
|
|
315
322
|
val ref_as_non_null : t
|
|
316
|
-
val
|
|
317
|
-
val
|
|
318
|
-
val
|
|
323
|
+
val ref_as_extern_internalize : t
|
|
324
|
+
val ref_as_extern_externalize : t
|
|
325
|
+
val br_on_null : t
|
|
326
|
+
val br_on_non_null : t
|
|
327
|
+
val br_on_cast : t
|
|
328
|
+
val br_on_cast_fail : t
|
|
329
|
+
val string_new_utf8 : t
|
|
330
|
+
val string_new_wtf8 : t
|
|
331
|
+
val string_new_replace : t
|
|
332
|
+
val string_new_wtf16 : t
|
|
333
|
+
val string_new_utf8_array : t
|
|
334
|
+
val string_new_wtf8_array : t
|
|
335
|
+
val string_new_replace_array : t
|
|
336
|
+
val string_new_wtf16_array : t
|
|
337
|
+
val string_new_from_code_point : t
|
|
338
|
+
val string_measure_utf8 : t
|
|
339
|
+
val string_measure_wtf8 : t
|
|
340
|
+
val string_measure_wtf16 : t
|
|
341
|
+
val string_measure_is_usv : t
|
|
342
|
+
val string_measure_wtf16_view : t
|
|
343
|
+
val string_encode_utf8 : t
|
|
344
|
+
val string_encode_wtf8 : t
|
|
345
|
+
val string_encode_wtf16 : t
|
|
346
|
+
val string_encode_utf8_array : t
|
|
347
|
+
val string_encode_wtf8_array : t
|
|
348
|
+
val string_encode_wtf16_array : t
|
|
349
|
+
val string_as_wtf8 : t
|
|
350
|
+
val string_as_wtf16 : t
|
|
351
|
+
val string_as_iter : t
|
|
352
|
+
val string_iter_move_advance : t
|
|
353
|
+
val string_iter_move_rewind : t
|
|
354
|
+
val string_slice_wtf8 : t
|
|
355
|
+
val string_slice_wtf16 : t
|
|
356
|
+
val string_eq_equal : t
|
|
357
|
+
val string_eq_compare : t
|
binaryen-archive/src/passes.ml
CHANGED
|
@@ -15,6 +15,9 @@ let dae = "dae"
|
|
|
15
15
|
(** removes arguments to calls in an lto-like manner, and optimizes where we removed *)
|
|
16
16
|
let dae_optimizing = "dae-optimizing"
|
|
17
17
|
|
|
18
|
+
(** refine and merge abstract (never-created) types *)
|
|
19
|
+
let abstract_type_refining = "abstract-type-refining"
|
|
20
|
+
|
|
18
21
|
(** reduce # of locals by coalescing *)
|
|
19
22
|
let coalesce_locals = "coalesce-locals"
|
|
20
23
|
|
|
@@ -45,6 +48,9 @@ let denan = "denan"
|
|
|
45
48
|
(** turns indirect calls into direct ones *)
|
|
46
49
|
let directize = "directize"
|
|
47
50
|
|
|
51
|
+
(** discards global effect info *)
|
|
52
|
+
let discard_global_effects = "discard-global-effects"
|
|
53
|
+
|
|
48
54
|
(** optimizes using the DataFlow SSA IR *)
|
|
49
55
|
let dfo = "dfo"
|
|
50
56
|
|
|
@@ -81,6 +87,9 @@ let generate_dyncalls = "generate-dyncalls"
|
|
|
81
87
|
(** generate dynCall functions used by emscripten ABI, but only for functions with i64 in their signature (which cannot be invoked via the wasm table without JavaScript BigInt support). *)
|
|
82
88
|
let generate_i64_dyncalls = "generate-i64-dyncalls"
|
|
83
89
|
|
|
90
|
+
(** generate global effect info (helps later passes) *)
|
|
91
|
+
let generate_global_effects = "generate-global-effects"
|
|
92
|
+
|
|
84
93
|
(** generate Stack IR *)
|
|
85
94
|
let generate_stack_ir = "generate-stack-ir"
|
|
86
95
|
|
|
@@ -117,6 +126,9 @@ let inlining_optimizing = "inlining-optimizing"
|
|
|
117
126
|
(** lower away binaryen intrinsics *)
|
|
118
127
|
let intrinsic_lowering = "intrinsic-lowering"
|
|
119
128
|
|
|
129
|
+
(** wrap imports and exports for JavaScript promise integration *)
|
|
130
|
+
let jspi = "jspi"
|
|
131
|
+
|
|
120
132
|
(** legalizes i64 types on the import/export boundary *)
|
|
121
133
|
let legalize_js_interface = "legalize-js-interface"
|
|
122
134
|
|
|
@@ -181,6 +193,19 @@ let mod_asyncify_always_and_only_unwind = "mod-asyncify-always-and-only-unwind"
|
|
|
181
193
|
(** apply the assumption that asyncify never unwinds *)
|
|
182
194
|
let mod_asyncify_never_unwind = "mod-asyncify-never-unwind"
|
|
183
195
|
|
|
196
|
+
(** creates specialized versions of functions *)
|
|
197
|
+
let monomorphize = "monomorphize"
|
|
198
|
+
|
|
199
|
+
(** creates specialized versions of functions (even if unhelpful) *)
|
|
200
|
+
let monomorphize_always = "monomorphize-always"
|
|
201
|
+
|
|
202
|
+
(** combines multiple memories into a single memory *)
|
|
203
|
+
let multi_memory_lowering = "multi-memory-lowering"
|
|
204
|
+
|
|
205
|
+
(** combines multiple memories into a single memory, trapping if the read or write is larger than the length of the memory's data *)
|
|
206
|
+
let multi_memory_lowering_with_bounds_checks =
|
|
207
|
+
"multi-memory-lowering-with-bounds-checks"
|
|
208
|
+
|
|
184
209
|
(** name list *)
|
|
185
210
|
let nm = "nm"
|
|
186
211
|
|
|
@@ -196,6 +221,9 @@ let optimize_added_constants = "optimize-added-constants"
|
|
|
196
221
|
(** optimizes added constants into load/store offsets, propagating them across locals too *)
|
|
197
222
|
let optimize_added_constants_propagate = "optimize-added-constants-propagate"
|
|
198
223
|
|
|
224
|
+
(** eliminate and reuse casts *)
|
|
225
|
+
let optimize_casts = "optimize-casts"
|
|
226
|
+
|
|
199
227
|
(** optimizes instruction combinations *)
|
|
200
228
|
let optimize_instructions = "optimize-instructions"
|
|
201
229
|
|
|
@@ -266,9 +294,18 @@ let remove_unused_nonfunction_module_elements =
|
|
|
266
294
|
(** removes names from locations that are never branched to *)
|
|
267
295
|
let remove_unused_names = "remove-unused-names"
|
|
268
296
|
|
|
297
|
+
(** remove unused private GC types *)
|
|
298
|
+
let remove_unused_types = "remove-unused-types"
|
|
299
|
+
|
|
269
300
|
(** sorts functions by access frequency *)
|
|
270
301
|
let reorder_functions = "reorder-functions"
|
|
271
302
|
|
|
303
|
+
(** sorts globals by access frequency *)
|
|
304
|
+
let reorder_globals = "reorder-globals"
|
|
305
|
+
|
|
306
|
+
(** sorts globals by access frequency (even if there are few) *)
|
|
307
|
+
let reorder_globals_always = "reorder-globals-always"
|
|
308
|
+
|
|
272
309
|
(** sorts locals by access frequency *)
|
|
273
310
|
let reorder_locals = "reorder-locals"
|
|
274
311
|
|
|
@@ -293,6 +330,9 @@ let signature_pruning = "signature-pruning"
|
|
|
293
330
|
(** apply more specific subtypes to signature types where possible *)
|
|
294
331
|
let signature_refining = "signature-refining"
|
|
295
332
|
|
|
333
|
+
(** lower sign-ext operations to wasm mvp *)
|
|
334
|
+
let signext_lowering = "signext-lowering"
|
|
335
|
+
|
|
296
336
|
(** miscellaneous globals-related optimizations *)
|
|
297
337
|
let simplify_globals = "simplify-globals"
|
|
298
338
|
|
|
@@ -356,6 +396,12 @@ let trap_mode_clamp = "trap-mode-clamp"
|
|
|
356
396
|
(** replace trapping operations with js semantics *)
|
|
357
397
|
let trap_mode_js = "trap-mode-js"
|
|
358
398
|
|
|
399
|
+
(** merge types to their supertypes where possible *)
|
|
400
|
+
let type_merging = "type-merging"
|
|
401
|
+
|
|
402
|
+
(** create new nominal types to help other optimizations *)
|
|
403
|
+
let type_ssa = "type-ssa"
|
|
404
|
+
|
|
359
405
|
(** removes local.tees, replacing them with sets and gets *)
|
|
360
406
|
let untee = "untee"
|
|
361
407
|
|
binaryen-archive/src/passes.mli
CHANGED
|
@@ -15,6 +15,9 @@ val dae : t
|
|
|
15
15
|
val dae_optimizing : t
|
|
16
16
|
(** removes arguments to calls in an lto-like manner, and optimizes where we removed *)
|
|
17
17
|
|
|
18
|
+
val abstract_type_refining : t
|
|
19
|
+
(** refine and merge abstract (never-created) types *)
|
|
20
|
+
|
|
18
21
|
val coalesce_locals : t
|
|
19
22
|
(** reduce # of locals by coalescing *)
|
|
20
23
|
|
|
@@ -45,6 +48,9 @@ val denan : t
|
|
|
45
48
|
val directize : t
|
|
46
49
|
(** turns indirect calls into direct ones *)
|
|
47
50
|
|
|
51
|
+
val discard_global_effects : t
|
|
52
|
+
(** discards global effect info *)
|
|
53
|
+
|
|
48
54
|
val dfo : t
|
|
49
55
|
(** optimizes using the DataFlow SSA IR *)
|
|
50
56
|
|
|
@@ -81,6 +87,9 @@ val generate_dyncalls : t
|
|
|
81
87
|
val generate_i64_dyncalls : t
|
|
82
88
|
(** generate dynCall functions used by emscripten ABI, but only for functions with i64 in their signature (which cannot be invoked via the wasm table without JavaScript BigInt support). *)
|
|
83
89
|
|
|
90
|
+
val generate_global_effects : t
|
|
91
|
+
(** generate global effect info (helps later passes) *)
|
|
92
|
+
|
|
84
93
|
val generate_stack_ir : t
|
|
85
94
|
(** generate Stack IR *)
|
|
86
95
|
|
|
@@ -117,6 +126,9 @@ val inlining_optimizing : t
|
|
|
117
126
|
val intrinsic_lowering : t
|
|
118
127
|
(** lower away binaryen intrinsics *)
|
|
119
128
|
|
|
129
|
+
val jspi : t
|
|
130
|
+
(** wrap imports and exports for JavaScript promise integration *)
|
|
131
|
+
|
|
120
132
|
val legalize_js_interface : t
|
|
121
133
|
(** legalizes i64 types on the import/export boundary *)
|
|
122
134
|
|
|
@@ -180,6 +192,18 @@ val mod_asyncify_always_and_only_unwind : t
|
|
|
180
192
|
val mod_asyncify_never_unwind : t
|
|
181
193
|
(** apply the assumption that asyncify never unwinds *)
|
|
182
194
|
|
|
195
|
+
val monomorphize : t
|
|
196
|
+
(** creates specialized versions of functions *)
|
|
197
|
+
|
|
198
|
+
val monomorphize_always : t
|
|
199
|
+
(** creates specialized versions of functions (even if unhelpful) *)
|
|
200
|
+
|
|
201
|
+
val multi_memory_lowering : t
|
|
202
|
+
(** combines multiple memories into a single memory *)
|
|
203
|
+
|
|
204
|
+
val multi_memory_lowering_with_bounds_checks : t
|
|
205
|
+
(** combines multiple memories into a single memory, trapping if the read or write is larger than the length of the memory's data *)
|
|
206
|
+
|
|
183
207
|
val nm : t
|
|
184
208
|
(** name list *)
|
|
185
209
|
|
|
@@ -195,6 +219,9 @@ val optimize_added_constants : t
|
|
|
195
219
|
val optimize_added_constants_propagate : t
|
|
196
220
|
(** optimizes added constants into load/store offsets, propagating them across locals too *)
|
|
197
221
|
|
|
222
|
+
val optimize_casts : t
|
|
223
|
+
(** eliminate and reuse casts *)
|
|
224
|
+
|
|
198
225
|
val optimize_instructions : t
|
|
199
226
|
(** optimizes instruction combinations *)
|
|
200
227
|
|
|
@@ -264,9 +291,18 @@ val remove_unused_nonfunction_module_elements : t
|
|
|
264
291
|
val remove_unused_names : t
|
|
265
292
|
(** removes names from locations that are never branched to *)
|
|
266
293
|
|
|
294
|
+
val remove_unused_types : t
|
|
295
|
+
(** remove unused private GC types *)
|
|
296
|
+
|
|
267
297
|
val reorder_functions : t
|
|
268
298
|
(** sorts functions by access frequency *)
|
|
269
299
|
|
|
300
|
+
val reorder_globals : t
|
|
301
|
+
(** sorts globals by access frequency *)
|
|
302
|
+
|
|
303
|
+
val reorder_globals_always : t
|
|
304
|
+
(** sorts globals by access frequency (even if there are few) *)
|
|
305
|
+
|
|
270
306
|
val reorder_locals : t
|
|
271
307
|
(** sorts locals by access frequency *)
|
|
272
308
|
|
|
@@ -291,6 +327,9 @@ val signature_pruning : t
|
|
|
291
327
|
val signature_refining : t
|
|
292
328
|
(** apply more specific subtypes to signature types where possible *)
|
|
293
329
|
|
|
330
|
+
val signext_lowering : t
|
|
331
|
+
(** lower sign-ext operations to wasm mvp *)
|
|
332
|
+
|
|
294
333
|
val simplify_globals : t
|
|
295
334
|
(** miscellaneous globals-related optimizations *)
|
|
296
335
|
|
|
@@ -354,6 +393,12 @@ val trap_mode_clamp : t
|
|
|
354
393
|
val trap_mode_js : t
|
|
355
394
|
(** replace trapping operations with js semantics *)
|
|
356
395
|
|
|
396
|
+
val type_merging : t
|
|
397
|
+
(** merge types to their supertypes where possible *)
|
|
398
|
+
|
|
399
|
+
val type_ssa : t
|
|
400
|
+
(** create new nominal types to help other optimizations *)
|
|
401
|
+
|
|
357
402
|
val untee : t
|
|
358
403
|
(** removes local.tees, replacing them with sets and gets *)
|
|
359
404
|
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
#define CAML_NAME_SPACE
|
|
2
|
+
#include <caml/mlvalues.h>
|
|
3
|
+
#include <caml/fail.h>
|
|
4
|
+
#include <caml/memory.h>
|
|
5
|
+
|
|
6
|
+
#include "binaryen-c.h"
|
|
7
|
+
#include "ocaml_helpers.h"
|
|
8
|
+
|
|
9
|
+
CAMLprim value
|
|
10
|
+
caml_binaryen_signature_type_get_params(value _heapType) {
|
|
11
|
+
CAMLparam1(_heapType);
|
|
12
|
+
BinaryenHeapType heapType = BinaryenHeapType_val(_heapType);
|
|
13
|
+
BinaryenType ty = BinaryenSignatureTypeGetParams(heapType);
|
|
14
|
+
CAMLreturn(alloc_BinaryenType(ty));
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
CAMLprim value
|
|
18
|
+
caml_binaryen_signature_type_get_results(value _heapType) {
|
|
19
|
+
CAMLparam1(_heapType);
|
|
20
|
+
BinaryenHeapType heapType = BinaryenHeapType_val(_heapType);
|
|
21
|
+
BinaryenType ty = BinaryenSignatureTypeGetResults(heapType);
|
|
22
|
+
CAMLreturn(alloc_BinaryenType(ty));
|
|
23
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
//Provides: caml_binaryen_signature_type_get_params
|
|
2
|
+
//Requires: Binaryen
|
|
3
|
+
function caml_binaryen_signature_type_get_params(heapType) {
|
|
4
|
+
return Binaryen._BinaryenSignatureTypeGetParams(heapType);
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
//Provides: caml_binaryen_signature_type_get_results
|
|
8
|
+
//Requires: Binaryen
|
|
9
|
+
function caml_binaryen_signature_type_get_results(heapType) {
|
|
10
|
+
return Binaryen._BinaryenSignatureTypeGetResults(heapType);
|
|
11
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
#define CAML_NAME_SPACE
|
|
2
|
+
#include <caml/mlvalues.h>
|
|
3
|
+
#include <caml/fail.h>
|
|
4
|
+
#include <caml/memory.h>
|
|
5
|
+
|
|
6
|
+
#include "binaryen-c.h"
|
|
7
|
+
#include "ocaml_helpers.h"
|
|
8
|
+
|
|
9
|
+
CAMLprim value
|
|
10
|
+
caml_binaryen_struct_type_get_num_fields(value _heapType) {
|
|
11
|
+
CAMLparam1(_heapType);
|
|
12
|
+
BinaryenHeapType heapType = BinaryenHeapType_val(_heapType);
|
|
13
|
+
CAMLreturn(Val_int(BinaryenStructTypeGetNumFields(heapType)));
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
CAMLprim value
|
|
17
|
+
caml_binaryen_struct_type_get_field_type(value _heapType, value _index) {
|
|
18
|
+
CAMLparam2(_heapType, _index);
|
|
19
|
+
BinaryenHeapType heapType = BinaryenHeapType_val(_heapType);
|
|
20
|
+
BinaryenIndex index = Int_val(_index);
|
|
21
|
+
BinaryenType ty = BinaryenStructTypeGetFieldType(heapType, index);
|
|
22
|
+
CAMLreturn(alloc_BinaryenType(ty));
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
CAMLprim value
|
|
26
|
+
caml_binaryen_struct_type_get_field_packed_type(value _heapType, value _index) {
|
|
27
|
+
CAMLparam2(_heapType, _index);
|
|
28
|
+
BinaryenHeapType heapType = BinaryenHeapType_val(_heapType);
|
|
29
|
+
BinaryenIndex index = Int_val(_index);
|
|
30
|
+
CAMLreturn(Val_int(BinaryenStructTypeGetFieldPackedType(heapType, index)));
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
CAMLprim value
|
|
34
|
+
caml_binaryen_struct_type_is_field_mutable(value _heapType, value _index) {
|
|
35
|
+
CAMLparam2(_heapType, _index);
|
|
36
|
+
BinaryenHeapType heapType = BinaryenHeapType_val(_heapType);
|
|
37
|
+
BinaryenIndex index = Int_val(_index);
|
|
38
|
+
CAMLreturn(Val_bool(BinaryenStructTypeIsFieldMutable(heapType, index)));
|
|
39
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
//Provides: caml_binaryen_struct_type_get_num_fields
|
|
2
|
+
//Requires: Binaryen
|
|
3
|
+
function caml_binaryen_struct_type_get_num_fields(heapType) {
|
|
4
|
+
return Binaryen._BinaryenStructTypeGetNumFields(heapType);
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
//Provides: caml_binaryen_struct_type_get_field_type
|
|
8
|
+
//Requires: Binaryen
|
|
9
|
+
function caml_binaryen_struct_type_get_field_type(heapType, index) {
|
|
10
|
+
return Binaryen._BinaryenStructTypeGetFieldType(heapType, index);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
//Provides: caml_binaryen_struct_type_get_field_packed_type
|
|
14
|
+
//Requires: Binaryen
|
|
15
|
+
function caml_binaryen_struct_type_get_field_packed_type(heapType, index) {
|
|
16
|
+
return Binaryen._BinaryenStructTypeGetFieldPackedType(heapType, index);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
//Provides: caml_binaryen_struct_type_is_field_mutable
|
|
20
|
+
//Requires: Binaryen
|
|
21
|
+
function caml_binaryen_struct_type_is_field_mutable(heapType, index) {
|
|
22
|
+
return Binaryen._BinaryenStructTypeIsFieldMutable(heapType, index);
|
|
23
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
external get_num_fields : Heap_type.t -> int
|
|
2
|
+
= "caml_binaryen_struct_type_get_num_fields"
|
|
3
|
+
|
|
4
|
+
external get_field_type : Heap_type.t -> int -> Type.t
|
|
5
|
+
= "caml_binaryen_struct_type_get_field_type"
|
|
6
|
+
|
|
7
|
+
external get_field_packed_type : Heap_type.t -> int -> Packed_type.t
|
|
8
|
+
= "caml_binaryen_struct_type_get_field_packed_type"
|
|
9
|
+
|
|
10
|
+
external is_field_mutable : Heap_type.t -> int -> bool
|
|
11
|
+
= "caml_binaryen_struct_type_is_field_mutable"
|
|
@@ -7,31 +7,6 @@
|
|
|
7
7
|
#include "binaryen-c.h"
|
|
8
8
|
#include "ocaml_helpers.h"
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
/* Allocating an OCaml custom block to hold the given BinaryenTableRef */
|
|
12
|
-
static value alloc_BinaryenTableRef(BinaryenTableRef table)
|
|
13
|
-
{
|
|
14
|
-
value v = caml_alloc_custom(&binaryen_ops, sizeof(BinaryenTableRef), 0, 1);
|
|
15
|
-
BinaryenTableRef_val(v) = table;
|
|
16
|
-
return v;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
/* Allocating an OCaml custom block to hold the given BinaryenElementSegmentRef */
|
|
20
|
-
static value alloc_BinaryenElementSegmentRef(BinaryenElementSegmentRef elem)
|
|
21
|
-
{
|
|
22
|
-
value v = caml_alloc_custom(&binaryen_ops, sizeof(BinaryenElementSegmentRef), 0, 1);
|
|
23
|
-
BinaryenElementSegmentRef_val(v) = elem;
|
|
24
|
-
return v;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
/* Allocating an OCaml custom block to hold the given BinaryenExpressionRef */
|
|
28
|
-
static value alloc_BinaryenExpressionRef(BinaryenExpressionRef exp)
|
|
29
|
-
{
|
|
30
|
-
value v = caml_alloc_custom(&binaryen_ops, sizeof(BinaryenExpressionRef), 0, 1);
|
|
31
|
-
BinaryenExpressionRef_val(v) = exp;
|
|
32
|
-
return v;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
10
|
CAMLprim value
|
|
36
11
|
caml_binaryen_add_table(value _module, value _table, value _initial, value _maximum, value _tableType) {
|
|
37
12
|
CAMLparam5(_module, _table, _initial, _maximum, _tableType);
|
|
@@ -6,16 +6,6 @@
|
|
|
6
6
|
#include "binaryen-c.h"
|
|
7
7
|
#include "ocaml_helpers.h"
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
/* Allocating an OCaml custom block to hold the given BinaryenType */
|
|
11
|
-
static value alloc_BinaryenType(BinaryenType typ)
|
|
12
|
-
{
|
|
13
|
-
value v = caml_alloc_custom(&binaryen_ops, sizeof(BinaryenType), 0, 1);
|
|
14
|
-
BinaryenType_val(v) = typ;
|
|
15
|
-
return v;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
|
|
19
9
|
CAMLprim value
|
|
20
10
|
caml_binaryen_type_none(value unit) {
|
|
21
11
|
CAMLparam1(unit);
|
|
@@ -87,9 +77,16 @@ caml_binaryen_type_i31ref(value unit) {
|
|
|
87
77
|
}
|
|
88
78
|
|
|
89
79
|
CAMLprim value
|
|
90
|
-
|
|
80
|
+
caml_binaryen_type_structref(value unit) {
|
|
81
|
+
CAMLparam1(unit);
|
|
82
|
+
BinaryenType ty = BinaryenTypeStructref();
|
|
83
|
+
CAMLreturn(alloc_BinaryenType(ty));
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
CAMLprim value
|
|
87
|
+
caml_binaryen_type_arrayref(value unit) {
|
|
91
88
|
CAMLparam1(unit);
|
|
92
|
-
BinaryenType ty =
|
|
89
|
+
BinaryenType ty = BinaryenTypeArrayref();
|
|
93
90
|
CAMLreturn(alloc_BinaryenType(ty));
|
|
94
91
|
}
|
|
95
92
|
|
|
@@ -121,6 +118,27 @@ caml_binaryen_type_stringview_iter(value unit) {
|
|
|
121
118
|
CAMLreturn(alloc_BinaryenType(ty));
|
|
122
119
|
}
|
|
123
120
|
|
|
121
|
+
CAMLprim value
|
|
122
|
+
caml_binaryen_type_nullref(value unit) {
|
|
123
|
+
CAMLparam1(unit);
|
|
124
|
+
BinaryenType ty = BinaryenTypeNullref();
|
|
125
|
+
CAMLreturn(alloc_BinaryenType(ty));
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
CAMLprim value
|
|
129
|
+
caml_binaryen_type_null_externref(value unit) {
|
|
130
|
+
CAMLparam1(unit);
|
|
131
|
+
BinaryenType ty = BinaryenTypeNullExternref();
|
|
132
|
+
CAMLreturn(alloc_BinaryenType(ty));
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
CAMLprim value
|
|
136
|
+
caml_binaryen_type_null_funcref(value unit) {
|
|
137
|
+
CAMLparam1(unit);
|
|
138
|
+
BinaryenType ty = BinaryenTypeNullFuncref();
|
|
139
|
+
CAMLreturn(alloc_BinaryenType(ty));
|
|
140
|
+
}
|
|
141
|
+
|
|
124
142
|
CAMLprim value
|
|
125
143
|
caml_binaryen_type_unreachable(value unit) {
|
|
126
144
|
CAMLparam1(unit);
|
|
@@ -58,10 +58,17 @@ function caml_binaryen_type_i31ref() {
|
|
|
58
58
|
return Binaryen.i31ref;
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
//Provides:
|
|
61
|
+
//Provides: caml_binaryen_type_structref
|
|
62
62
|
//Requires: Binaryen
|
|
63
|
-
function
|
|
64
|
-
return Binaryen.
|
|
63
|
+
function caml_binaryen_type_structref() {
|
|
64
|
+
return Binaryen.structref;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
//Provides: caml_binaryen_type_arrayref
|
|
68
|
+
//Requires: Binaryen
|
|
69
|
+
function caml_binaryen_type_arrayref() {
|
|
70
|
+
// TODO: Binaryen v111 didn't expose this directly
|
|
71
|
+
return Binaryen._BinaryenTypeArrayref();
|
|
65
72
|
}
|
|
66
73
|
|
|
67
74
|
//Provides: caml_binaryen_type_stringref
|
|
@@ -88,6 +95,27 @@ function caml_binaryen_type_stringview_iter() {
|
|
|
88
95
|
return Binaryen.stringview_iter;
|
|
89
96
|
}
|
|
90
97
|
|
|
98
|
+
//Provides: caml_binaryen_type_nullref
|
|
99
|
+
//Requires: Binaryen
|
|
100
|
+
function caml_binaryen_type_nullref() {
|
|
101
|
+
// TODO: Binaryen v111 didn't expose this directly
|
|
102
|
+
return Binaryen._BinaryenTypeNullref();
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
//Provides: caml_binaryen_type_null_externref
|
|
106
|
+
//Requires: Binaryen
|
|
107
|
+
function caml_binaryen_type_null_externref() {
|
|
108
|
+
// TODO: Binaryen v111 didn't expose this directly
|
|
109
|
+
return Binaryen._BinaryenTypeNullExternref();
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
//Provides: caml_binaryen_type_null_funcref
|
|
113
|
+
//Requires: Binaryen
|
|
114
|
+
function caml_binaryen_type_null_funcref() {
|
|
115
|
+
// TODO: Binaryen v111 didn't expose this directly
|
|
116
|
+
return Binaryen._BinaryenTypeNullFuncref();
|
|
117
|
+
}
|
|
118
|
+
|
|
91
119
|
//Provides: caml_binaryen_type_unreachable
|
|
92
120
|
//Requires: Binaryen
|
|
93
121
|
function caml_binaryen_type_unreachable() {
|
binaryen-archive/src/type.ml
CHANGED
|
@@ -40,9 +40,13 @@ external i31ref : unit -> t = "caml_binaryen_type_i31ref"
|
|
|
40
40
|
|
|
41
41
|
let i31ref = i31ref ()
|
|
42
42
|
|
|
43
|
-
external
|
|
43
|
+
external structref : unit -> t = "caml_binaryen_type_structref"
|
|
44
44
|
|
|
45
|
-
let
|
|
45
|
+
let structref = structref ()
|
|
46
|
+
|
|
47
|
+
external arrayref : unit -> t = "caml_binaryen_type_arrayref"
|
|
48
|
+
|
|
49
|
+
let arrayref = arrayref ()
|
|
46
50
|
|
|
47
51
|
external stringref : unit -> t = "caml_binaryen_type_stringref"
|
|
48
52
|
|
|
@@ -60,6 +64,18 @@ external stringview_iter : unit -> t = "caml_binaryen_type_stringview_iter"
|
|
|
60
64
|
|
|
61
65
|
let stringview_iter = stringview_iter ()
|
|
62
66
|
|
|
67
|
+
external nullref : unit -> t = "caml_binaryen_type_nullref"
|
|
68
|
+
|
|
69
|
+
let nullref = nullref ()
|
|
70
|
+
|
|
71
|
+
external null_externref : unit -> t = "caml_binaryen_type_null_externref"
|
|
72
|
+
|
|
73
|
+
let null_externref = null_externref ()
|
|
74
|
+
|
|
75
|
+
external null_funcref : unit -> t = "caml_binaryen_type_null_funcref"
|
|
76
|
+
|
|
77
|
+
let null_funcref = null_funcref ()
|
|
78
|
+
|
|
63
79
|
external unreachable : unit -> t = "caml_binaryen_type_unreachable"
|
|
64
80
|
|
|
65
81
|
let unreachable = unreachable ()
|
binaryen-archive/src/type.mli
CHANGED
|
@@ -10,11 +10,15 @@ val funcref : t
|
|
|
10
10
|
val anyref : t
|
|
11
11
|
val eqref : t
|
|
12
12
|
val i31ref : t
|
|
13
|
-
val
|
|
13
|
+
val structref : t
|
|
14
|
+
val arrayref : t
|
|
14
15
|
val stringref : t
|
|
15
16
|
val stringview_wtf8 : t
|
|
16
17
|
val stringview_wtf16 : t
|
|
17
18
|
val stringview_iter : t
|
|
19
|
+
val nullref : t
|
|
20
|
+
val null_externref : t
|
|
21
|
+
val null_funcref : t
|
|
18
22
|
val unreachable : t
|
|
19
23
|
val auto : t
|
|
20
24
|
val create : t array -> t
|
|
@@ -7,12 +7,6 @@
|
|
|
7
7
|
#include "ocaml_helpers.h"
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
CAMLprim value
|
|
11
|
-
caml_binaryen_type_system_equirecursive(value unit) {
|
|
12
|
-
CAMLparam1(unit);
|
|
13
|
-
CAMLreturn(Val_int(BinaryenTypeSystemEquirecursive()));
|
|
14
|
-
}
|
|
15
|
-
|
|
16
10
|
CAMLprim value
|
|
17
11
|
caml_binaryen_type_system_nominal(value unit) {
|
|
18
12
|
CAMLparam1(unit);
|
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
//Provides: caml_binaryen_type_system_equirecursive
|
|
2
|
-
//Requires: Binaryen
|
|
3
|
-
function caml_binaryen_type_system_equirecursive() {
|
|
4
|
-
return Binaryen._BinaryenTypeSystemEquirecursive();
|
|
5
|
-
}
|
|
6
|
-
|
|
7
1
|
//Provides: caml_binaryen_type_system_nominal
|
|
8
2
|
//Requires: Binaryen
|
|
9
3
|
function caml_binaryen_type_system_nominal() {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
type t = int
|
|
2
2
|
|
|
3
|
-
external equirecursive : unit -> t = "caml_binaryen_type_system_equirecursive"
|
|
4
3
|
external nominal : unit -> t = "caml_binaryen_type_system_nominal"
|
|
5
4
|
external isorecursive : unit -> t = "caml_binaryen_type_system_isorecursive"
|
|
6
5
|
external get_type_system : unit -> t = "caml_binaryen_get_type_system"
|