@grain/binaryen.ml 0.20.1 → 0.21.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 +30 -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.0}/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.0}/opam +4 -4
- binaryen-archive/esy.lock/opam/{dune-configurator.3.6.1 → dune-configurator.3.9.0}/opam +4 -4
- binaryen-archive/esy.lock/opam/{dune-rpc.3.6.1 → dune-rpc.3.9.0}/opam +4 -4
- binaryen-archive/esy.lock/opam/{dune.3.6.1 → dune.3.9.0}/opam +5 -5
- binaryen-archive/esy.lock/opam/{dyn.3.6.1 → dyn.3.9.0}/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.3.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.0}/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.0}/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.0}/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} +0 -9
- 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 +11 -0
- binaryen-archive/src/heap_type.mli +11 -0
- 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} +582 -325
- binaryen-archive/src/op.js +2123 -0
- binaryen-archive/src/op.ml +385 -344
- binaryen-archive/src/op.mli +38 -0
- binaryen-archive/src/passes.ml +30 -0
- binaryen-archive/src/passes.mli +30 -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} +28 -10
- binaryen-archive/src/{binaryen_stubs_types.js → type.js} +28 -0
- binaryen-archive/src/type.ml +16 -0
- binaryen-archive/src/type.mli +4 -0
- binaryen-archive/test/test.expected +1 -1
- 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_expressions.js → expression.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/{binaryen_stubs_type_system.c → type_system.c} +0 -0
- /binaryen-archive/src/{binaryen_stubs_type_system.js → type_system.js} +0 -0
binaryen-archive/src/op.mli
CHANGED
|
@@ -316,3 +316,41 @@ val ref_as_non_null : t
|
|
|
316
316
|
val ref_as_func : t
|
|
317
317
|
val ref_as_data : t
|
|
318
318
|
val ref_as_i31 : t
|
|
319
|
+
val ref_as_extern_internalize : unit -> t
|
|
320
|
+
val ref_as_extern_externalize : unit -> t
|
|
321
|
+
val br_on_null : unit -> t
|
|
322
|
+
val br_on_non_null : unit -> t
|
|
323
|
+
val br_on_cast : unit -> t
|
|
324
|
+
val br_on_cast_fail : unit -> t
|
|
325
|
+
val br_on_func : unit -> t
|
|
326
|
+
val br_on_non_func : unit -> t
|
|
327
|
+
val br_on_data : unit -> t
|
|
328
|
+
val br_on_non_data : unit -> t
|
|
329
|
+
val br_on_i31 : unit -> t
|
|
330
|
+
val br_on_non_i31 : unit -> t
|
|
331
|
+
val string_new_utf8 : unit -> t
|
|
332
|
+
val string_new_wtf8 : unit -> t
|
|
333
|
+
val string_new_replace : unit -> t
|
|
334
|
+
val string_new_wtf16 : unit -> t
|
|
335
|
+
val string_new_utf8_array : unit -> t
|
|
336
|
+
val string_new_wtf8_array : unit -> t
|
|
337
|
+
val string_new_replace_array : unit -> t
|
|
338
|
+
val string_new_wtf16_array : unit -> t
|
|
339
|
+
val string_measure_utf8 : unit -> t
|
|
340
|
+
val string_measure_wtf8 : unit -> t
|
|
341
|
+
val string_measure_wtf16 : unit -> t
|
|
342
|
+
val string_measure_is_usv : unit -> t
|
|
343
|
+
val string_measure_wtf16_view : unit -> t
|
|
344
|
+
val string_encode_utf8 : unit -> t
|
|
345
|
+
val string_encode_wtf8 : unit -> t
|
|
346
|
+
val string_encode_wtf16 : unit -> t
|
|
347
|
+
val string_encode_utf8_array : unit -> t
|
|
348
|
+
val string_encode_wtf8_array : unit -> t
|
|
349
|
+
val string_encode_wtf16_array : unit -> t
|
|
350
|
+
val string_as_wtf8 : unit -> t
|
|
351
|
+
val string_as_wtf16 : unit -> t
|
|
352
|
+
val string_as_iter : unit -> t
|
|
353
|
+
val string_iter_move_advance : unit -> t
|
|
354
|
+
val string_iter_move_rewind : unit -> t
|
|
355
|
+
val string_slice_wtf8 : unit -> t
|
|
356
|
+
val string_slice_wtf16 : unit -> t
|
binaryen-archive/src/passes.ml
CHANGED
|
@@ -45,6 +45,9 @@ let denan = "denan"
|
|
|
45
45
|
(** turns indirect calls into direct ones *)
|
|
46
46
|
let directize = "directize"
|
|
47
47
|
|
|
48
|
+
(** discards global effect info *)
|
|
49
|
+
let discard_global_effects = "discard-global-effects"
|
|
50
|
+
|
|
48
51
|
(** optimizes using the DataFlow SSA IR *)
|
|
49
52
|
let dfo = "dfo"
|
|
50
53
|
|
|
@@ -81,6 +84,9 @@ let generate_dyncalls = "generate-dyncalls"
|
|
|
81
84
|
(** 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
85
|
let generate_i64_dyncalls = "generate-i64-dyncalls"
|
|
83
86
|
|
|
87
|
+
(** generate global effect info (helps later passes) *)
|
|
88
|
+
let generate_global_effects = "generate-global-effects"
|
|
89
|
+
|
|
84
90
|
(** generate Stack IR *)
|
|
85
91
|
let generate_stack_ir = "generate-stack-ir"
|
|
86
92
|
|
|
@@ -117,6 +123,9 @@ let inlining_optimizing = "inlining-optimizing"
|
|
|
117
123
|
(** lower away binaryen intrinsics *)
|
|
118
124
|
let intrinsic_lowering = "intrinsic-lowering"
|
|
119
125
|
|
|
126
|
+
(** wrap imports and exports for JavaScript promise integration *)
|
|
127
|
+
let jspi = "jspi"
|
|
128
|
+
|
|
120
129
|
(** legalizes i64 types on the import/export boundary *)
|
|
121
130
|
let legalize_js_interface = "legalize-js-interface"
|
|
122
131
|
|
|
@@ -181,6 +190,15 @@ let mod_asyncify_always_and_only_unwind = "mod-asyncify-always-and-only-unwind"
|
|
|
181
190
|
(** apply the assumption that asyncify never unwinds *)
|
|
182
191
|
let mod_asyncify_never_unwind = "mod-asyncify-never-unwind"
|
|
183
192
|
|
|
193
|
+
(** creates specialized versions of functions *)
|
|
194
|
+
let monomorphize = "monomorphize"
|
|
195
|
+
|
|
196
|
+
(** creates specialized versions of functions (even if unhelpful) *)
|
|
197
|
+
let monomorphize_always = "monomorphize-always"
|
|
198
|
+
|
|
199
|
+
(** combines multiple memories into a single memory *)
|
|
200
|
+
let multi_memory_lowering = "multi-memory-lowering"
|
|
201
|
+
|
|
184
202
|
(** name list *)
|
|
185
203
|
let nm = "nm"
|
|
186
204
|
|
|
@@ -196,6 +214,9 @@ let optimize_added_constants = "optimize-added-constants"
|
|
|
196
214
|
(** optimizes added constants into load/store offsets, propagating them across locals too *)
|
|
197
215
|
let optimize_added_constants_propagate = "optimize-added-constants-propagate"
|
|
198
216
|
|
|
217
|
+
(** eliminate and reuse casts *)
|
|
218
|
+
let optimize_casts = "optimize-casts"
|
|
219
|
+
|
|
199
220
|
(** optimizes instruction combinations *)
|
|
200
221
|
let optimize_instructions = "optimize-instructions"
|
|
201
222
|
|
|
@@ -269,6 +290,12 @@ let remove_unused_names = "remove-unused-names"
|
|
|
269
290
|
(** sorts functions by access frequency *)
|
|
270
291
|
let reorder_functions = "reorder-functions"
|
|
271
292
|
|
|
293
|
+
(** sorts globals by access frequency *)
|
|
294
|
+
let reorder_globals = "reorder-globals"
|
|
295
|
+
|
|
296
|
+
(** sorts globals by access frequency (even if there are few) *)
|
|
297
|
+
let reorder_globals_always = "reorder-globals-always"
|
|
298
|
+
|
|
272
299
|
(** sorts locals by access frequency *)
|
|
273
300
|
let reorder_locals = "reorder-locals"
|
|
274
301
|
|
|
@@ -293,6 +320,9 @@ let signature_pruning = "signature-pruning"
|
|
|
293
320
|
(** apply more specific subtypes to signature types where possible *)
|
|
294
321
|
let signature_refining = "signature-refining"
|
|
295
322
|
|
|
323
|
+
(** lower sign-ext operations to wasm mvp *)
|
|
324
|
+
let signext_lowering = "signext-lowering"
|
|
325
|
+
|
|
296
326
|
(** miscellaneous globals-related optimizations *)
|
|
297
327
|
let simplify_globals = "simplify-globals"
|
|
298
328
|
|
binaryen-archive/src/passes.mli
CHANGED
|
@@ -45,6 +45,9 @@ val denan : t
|
|
|
45
45
|
val directize : t
|
|
46
46
|
(** turns indirect calls into direct ones *)
|
|
47
47
|
|
|
48
|
+
val discard_global_effects : t
|
|
49
|
+
(** discards global effect info *)
|
|
50
|
+
|
|
48
51
|
val dfo : t
|
|
49
52
|
(** optimizes using the DataFlow SSA IR *)
|
|
50
53
|
|
|
@@ -81,6 +84,9 @@ val generate_dyncalls : t
|
|
|
81
84
|
val generate_i64_dyncalls : t
|
|
82
85
|
(** 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
86
|
|
|
87
|
+
val generate_global_effects : t
|
|
88
|
+
(** generate global effect info (helps later passes) *)
|
|
89
|
+
|
|
84
90
|
val generate_stack_ir : t
|
|
85
91
|
(** generate Stack IR *)
|
|
86
92
|
|
|
@@ -117,6 +123,9 @@ val inlining_optimizing : t
|
|
|
117
123
|
val intrinsic_lowering : t
|
|
118
124
|
(** lower away binaryen intrinsics *)
|
|
119
125
|
|
|
126
|
+
val jspi : t
|
|
127
|
+
(** wrap imports and exports for JavaScript promise integration *)
|
|
128
|
+
|
|
120
129
|
val legalize_js_interface : t
|
|
121
130
|
(** legalizes i64 types on the import/export boundary *)
|
|
122
131
|
|
|
@@ -180,6 +189,15 @@ val mod_asyncify_always_and_only_unwind : t
|
|
|
180
189
|
val mod_asyncify_never_unwind : t
|
|
181
190
|
(** apply the assumption that asyncify never unwinds *)
|
|
182
191
|
|
|
192
|
+
val monomorphize : t
|
|
193
|
+
(** creates specialized versions of functions *)
|
|
194
|
+
|
|
195
|
+
val monomorphize_always : t
|
|
196
|
+
(** creates specialized versions of functions (even if unhelpful) *)
|
|
197
|
+
|
|
198
|
+
val multi_memory_lowering : t
|
|
199
|
+
(** combines multiple memories into a single memory *)
|
|
200
|
+
|
|
183
201
|
val nm : t
|
|
184
202
|
(** name list *)
|
|
185
203
|
|
|
@@ -195,6 +213,9 @@ val optimize_added_constants : t
|
|
|
195
213
|
val optimize_added_constants_propagate : t
|
|
196
214
|
(** optimizes added constants into load/store offsets, propagating them across locals too *)
|
|
197
215
|
|
|
216
|
+
val optimize_casts : t
|
|
217
|
+
(** eliminate and reuse casts *)
|
|
218
|
+
|
|
198
219
|
val optimize_instructions : t
|
|
199
220
|
(** optimizes instruction combinations *)
|
|
200
221
|
|
|
@@ -267,6 +288,12 @@ val remove_unused_names : t
|
|
|
267
288
|
val reorder_functions : t
|
|
268
289
|
(** sorts functions by access frequency *)
|
|
269
290
|
|
|
291
|
+
val reorder_globals : t
|
|
292
|
+
(** sorts globals by access frequency *)
|
|
293
|
+
|
|
294
|
+
val reorder_globals_always : t
|
|
295
|
+
(** sorts globals by access frequency (even if there are few) *)
|
|
296
|
+
|
|
270
297
|
val reorder_locals : t
|
|
271
298
|
(** sorts locals by access frequency *)
|
|
272
299
|
|
|
@@ -291,6 +318,9 @@ val signature_pruning : t
|
|
|
291
318
|
val signature_refining : t
|
|
292
319
|
(** apply more specific subtypes to signature types where possible *)
|
|
293
320
|
|
|
321
|
+
val signext_lowering : t
|
|
322
|
+
(** lower sign-ext operations to wasm mvp *)
|
|
323
|
+
|
|
294
324
|
val simplify_globals : t
|
|
295
325
|
(** miscellaneous globals-related optimizations *)
|
|
296
326
|
|
|
@@ -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);
|
|
@@ -93,6 +83,13 @@ caml_binaryen_type_dataref(value unit) {
|
|
|
93
83
|
CAMLreturn(alloc_BinaryenType(ty));
|
|
94
84
|
}
|
|
95
85
|
|
|
86
|
+
CAMLprim value
|
|
87
|
+
caml_binaryen_type_arrayref(value unit) {
|
|
88
|
+
CAMLparam1(unit);
|
|
89
|
+
BinaryenType ty = BinaryenTypeArrayref();
|
|
90
|
+
CAMLreturn(alloc_BinaryenType(ty));
|
|
91
|
+
}
|
|
92
|
+
|
|
96
93
|
CAMLprim value
|
|
97
94
|
caml_binaryen_type_stringref(value unit) {
|
|
98
95
|
CAMLparam1(unit);
|
|
@@ -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);
|
|
@@ -64,6 +64,13 @@ function caml_binaryen_type_dataref() {
|
|
|
64
64
|
return Binaryen.dataref;
|
|
65
65
|
}
|
|
66
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();
|
|
72
|
+
}
|
|
73
|
+
|
|
67
74
|
//Provides: caml_binaryen_type_stringref
|
|
68
75
|
//Requires: Binaryen
|
|
69
76
|
function 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
|
@@ -44,6 +44,10 @@ external dataref : unit -> t = "caml_binaryen_type_dataref"
|
|
|
44
44
|
|
|
45
45
|
let dataref = dataref ()
|
|
46
46
|
|
|
47
|
+
external arrayref : unit -> t = "caml_binaryen_type_arrayref"
|
|
48
|
+
|
|
49
|
+
let arrayref = arrayref ()
|
|
50
|
+
|
|
47
51
|
external stringref : unit -> t = "caml_binaryen_type_stringref"
|
|
48
52
|
|
|
49
53
|
let stringref = stringref ()
|
|
@@ -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
|
@@ -11,10 +11,14 @@ val anyref : t
|
|
|
11
11
|
val eqref : t
|
|
12
12
|
val i31ref : t
|
|
13
13
|
val dataref : 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
|
binaryen-archive/test/test.ml
CHANGED
|
@@ -36,6 +36,7 @@ let _ =
|
|
|
36
36
|
= "external_base_name")
|
|
37
37
|
|
|
38
38
|
let _ = assert (Memory.is_shared import_wasm_mod "internal_name" = true)
|
|
39
|
+
let _ = assert (Memory.is_64 import_wasm_mod "internal_name" = false)
|
|
39
40
|
|
|
40
41
|
(* Testing Return.get_value *)
|
|
41
42
|
let _ =
|
|
@@ -169,14 +170,14 @@ let _ = assert (Memory.has_memory wasm_mod = false)
|
|
|
169
170
|
let _ =
|
|
170
171
|
Memory.set_memory wasm_mod 1 Memory.unlimited "memory"
|
|
171
172
|
[ segment; passive_segment ]
|
|
172
|
-
false "0"
|
|
173
|
+
false false "0"
|
|
173
174
|
|
|
174
175
|
let _ = assert (Memory.has_memory wasm_mod = true)
|
|
175
176
|
let _ = assert (Memory.get_initial wasm_mod "0" = 1)
|
|
176
177
|
let _ = assert (Memory.has_max wasm_mod "0" = false)
|
|
177
178
|
let _ = assert (Memory.get_max wasm_mod "0" = Memory.unlimited)
|
|
178
179
|
let max_memory_wasm_mod = Module.create ()
|
|
179
|
-
let _ = Memory.set_memory max_memory_wasm_mod 1 2 "memory" [] false "0"
|
|
180
|
+
let _ = Memory.set_memory max_memory_wasm_mod 1 2 "memory" [] false false "0"
|
|
180
181
|
let _ = assert (Memory.has_max max_memory_wasm_mod "0" = true)
|
|
181
182
|
let _ = assert (Memory.get_max max_memory_wasm_mod "0" = 2)
|
|
182
183
|
|
|
@@ -235,11 +236,18 @@ let new_mod = Module.read byts
|
|
|
235
236
|
let _ =
|
|
236
237
|
Module.run_passes new_mod
|
|
237
238
|
[
|
|
239
|
+
Passes.generate_global_effects;
|
|
238
240
|
Passes.name_types;
|
|
239
241
|
Passes.merge_similar_functions;
|
|
240
242
|
Passes.spill_pointers;
|
|
241
243
|
Passes.gufa;
|
|
242
244
|
Passes.gufa_optimizing;
|
|
245
|
+
Passes.reorder_globals;
|
|
246
|
+
Passes.optimize_casts;
|
|
247
|
+
Passes.multi_memory_lowering;
|
|
248
|
+
Passes.monomorphize;
|
|
249
|
+
Passes.signext_lowering;
|
|
250
|
+
Passes.discard_global_effects;
|
|
243
251
|
]
|
|
244
252
|
|
|
245
253
|
let _ =
|
|
@@ -258,10 +266,10 @@ let _ =
|
|
|
258
266
|
Module.Feature.multivalue;
|
|
259
267
|
Module.Feature.gc;
|
|
260
268
|
Module.Feature.memory64;
|
|
261
|
-
Module.Feature.typed_function_references;
|
|
262
269
|
Module.Feature.relaxed_simd;
|
|
263
270
|
Module.Feature.extended_const;
|
|
264
271
|
Module.Feature.strings;
|
|
272
|
+
Module.Feature.multi_memories;
|
|
265
273
|
Module.Feature.all;
|
|
266
274
|
]
|
|
267
275
|
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
opam-version: "2.0"
|
|
2
|
-
synopsis: "Structured concurrency library"
|
|
3
|
-
description:
|
|
4
|
-
"This library offers no backwards compatibility guarantees. Use at your own risk."
|
|
5
|
-
maintainer: ["Jane Street Group, LLC <opensource@janestreet.com>"]
|
|
6
|
-
authors: ["Jane Street Group, LLC <opensource@janestreet.com>"]
|
|
7
|
-
license: "MIT"
|
|
8
|
-
homepage: "https://github.com/ocaml/dune"
|
|
9
|
-
doc: "https://dune.readthedocs.io/"
|
|
10
|
-
bug-reports: "https://github.com/ocaml/dune/issues"
|
|
11
|
-
depends: [
|
|
12
|
-
"dune" {>= "3.5"}
|
|
13
|
-
"ocaml" {>= "4.08.0"}
|
|
14
|
-
"stdune" {= version}
|
|
15
|
-
"dyn" {= version}
|
|
16
|
-
"odoc" {with-doc}
|
|
17
|
-
]
|
|
18
|
-
dev-repo: "git+https://github.com/ocaml/dune.git"
|
|
19
|
-
build: [
|
|
20
|
-
["dune" "subst"] {dev}
|
|
21
|
-
["rm" "-rf" "vendor/csexp"]
|
|
22
|
-
["rm" "-rf" "vendor/pp"]
|
|
23
|
-
[
|
|
24
|
-
"dune"
|
|
25
|
-
"build"
|
|
26
|
-
"-p"
|
|
27
|
-
name
|
|
28
|
-
"-j"
|
|
29
|
-
jobs
|
|
30
|
-
"@install"
|
|
31
|
-
"@doc" {with-doc}
|
|
32
|
-
]
|
|
33
|
-
]
|
|
34
|
-
url {
|
|
35
|
-
src: "https://github.com/ocaml/dune/releases/download/3.6.1/dune-3.6.1.tbz"
|
|
36
|
-
checksum: [
|
|
37
|
-
"sha256=f1d5ac04b7a027f3d549e25cf885ebf7acc135e0291c18e6b43123a799c143ce"
|
|
38
|
-
"sha512=64714ab6155cd04bc33d693fc7a6d9d61aa7a278357eeff159df324e083914fcd556459a3945acacf1bbc3775f2232ab0c78006ab8a434dc58dcf95ffdffac52"
|
|
39
|
-
]
|
|
40
|
-
}
|
|
41
|
-
x-commit-hash: "7d2788fc94a071bca897aefc95f1464911870a4c"
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
From f53247f546375972789b96c3f612cd7f524bf2aa Mon Sep 17 00:00:00 2001
|
|
2
|
-
From: Louis Gesbert <louis.gesbert@ocamlpro.com>
|
|
3
|
-
Date: Mon, 11 Jul 2022 18:12:18 +0200
|
|
4
|
-
Subject: [PATCH] Fix bug when installing with a system compiler
|
|
5
|
-
|
|
6
|
-
See https://discuss.ocaml.org/t/problem-installing-ocamlfind-on-latest-ocamlpro-alpine-docker-image/10147
|
|
7
|
-
---
|
|
8
|
-
src/findlib/Makefile | 2 +-
|
|
9
|
-
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
10
|
-
|
|
11
|
-
diff --git a/src/findlib/Makefile b/src/findlib/Makefile
|
|
12
|
-
index 84514b6f22..ea23f4a10c 100644
|
|
13
|
-
--- a/src/findlib/Makefile
|
|
14
|
-
+++ b/src/findlib/Makefile
|
|
15
|
-
@@ -123,7 +123,7 @@ clean:
|
|
16
|
-
install: all
|
|
17
|
-
$(INSTALLDIR) "$(DESTDIR)$(prefix)$(OCAML_SITELIB)/$(NAME)"
|
|
18
|
-
$(INSTALLDIR) "$(DESTDIR)$(prefix)$(OCAMLFIND_BIN)"
|
|
19
|
-
- $(INSTALLDIR) "$(DESTDIR)$(prefix)$(OCAML_CORE_STDLIB)"
|
|
20
|
-
+ test $(INSTALL_TOPFIND) -eq 0 || $(INSTALLDIR) "$(DESTDIR)$(prefix)$(OCAML_CORE_STDLIB)"
|
|
21
|
-
test $(INSTALL_TOPFIND) -eq 0 || $(INSTALLFILE) topfind "$(DESTDIR)$(prefix)$(OCAML_CORE_STDLIB)/"
|
|
22
|
-
files=`$(SH) $(TOP)/tools/collect_files $(TOP)/Makefile.config \
|
|
23
|
-
findlib.cmi findlib.mli findlib.cma findlib.cmxa findlib$(LIB_SUFFIX) findlib.cmxs \
|
|
24
|
-
--
|
|
25
|
-
2.35.1
|
|
26
|
-
|