@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
|
@@ -101,6 +101,28 @@ function caml_binaryen_call_indirect__bytecode() {
|
|
|
101
101
|
);
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
+
//Provides: caml_binaryen_call_ref
|
|
105
|
+
//Requires: caml_jsstring_of_string
|
|
106
|
+
//Requires: caml_list_to_js_array
|
|
107
|
+
function caml_binaryen_call_ref(wasm_mod, target, params, typ) {
|
|
108
|
+
return wasm_mod.call_ref(
|
|
109
|
+
target,
|
|
110
|
+
caml_list_to_js_array(params),
|
|
111
|
+
typ
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
//Provides: caml_binaryen_return_call_ref
|
|
116
|
+
//Requires: caml_jsstring_of_string
|
|
117
|
+
//Requires: caml_list_to_js_array
|
|
118
|
+
function caml_binaryen_return_call_ref(wasm_mod, target, params, typ) {
|
|
119
|
+
return wasm_mod.return_call_ref(
|
|
120
|
+
target,
|
|
121
|
+
caml_list_to_js_array(params),
|
|
122
|
+
typ
|
|
123
|
+
);
|
|
124
|
+
}
|
|
125
|
+
|
|
104
126
|
//Provides: caml_binaryen_return_call
|
|
105
127
|
//Requires: caml_jsstring_of_string
|
|
106
128
|
//Requires: caml_list_to_js_array
|
|
@@ -547,6 +569,32 @@ function caml_binaryen_ref_i31(wasm_mod, typ) {
|
|
|
547
569
|
return wasm_mod.ref.i31(typ);
|
|
548
570
|
}
|
|
549
571
|
|
|
572
|
+
//Provides: caml_binaryen_ref_test
|
|
573
|
+
function caml_binaryen_ref_test(wasm_mod, ref, typ) {
|
|
574
|
+
return wasm_mod.ref.test(ref, typ);
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
//Provides: caml_binaryen_ref_cast
|
|
578
|
+
function caml_binaryen_ref_cast(wasm_mod, ref, typ) {
|
|
579
|
+
return wasm_mod.ref.cast(ref, typ);
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
//Provides: caml_binaryen_br_on
|
|
583
|
+
//Requires: caml_jsstring_of_string
|
|
584
|
+
//Requires: Binaryen
|
|
585
|
+
function caml_binaryen_br_on(wasm_mod, op, name, ref, typ) {
|
|
586
|
+
switch (op) {
|
|
587
|
+
case Binaryen.BrOnNull:
|
|
588
|
+
return wasm_mod.br_on_null(caml_jsstring_of_string(name), ref);
|
|
589
|
+
case Binaryen.BrOnNonNull:
|
|
590
|
+
return wasm_mod.br_on_non_null(caml_jsstring_of_string(name), ref);
|
|
591
|
+
case Binaryen.BrOnCast:
|
|
592
|
+
return wasm_mod.br_on_cast(caml_jsstring_of_string(name), ref, typ);
|
|
593
|
+
case Binaryen.BrOnCastFail:
|
|
594
|
+
return wasm_mod.br_on_cast_fail(caml_jsstring_of_string(name), ref, typ);
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
|
|
550
598
|
//Provides: caml_binaryen_i31_get
|
|
551
599
|
function caml_binaryen_i31_get(wasm_mod, typ, signed) {
|
|
552
600
|
if (signed) {
|
|
@@ -882,14 +930,10 @@ function caml_binaryen_expression_id_array_len() {
|
|
|
882
930
|
|
|
883
931
|
//Provides: caml_binaryen_expression_print
|
|
884
932
|
//Requires: Binaryen
|
|
885
|
-
//Requires:
|
|
886
|
-
//Requires: caml_string_of_jsstring
|
|
887
|
-
//Requires: caml_ml_output, caml_ml_string_length
|
|
933
|
+
//Requires: caml_ml_output_str_stdout
|
|
888
934
|
function caml_binaryen_expression_print(expr) {
|
|
889
935
|
var text = Binaryen.emitText(expr);
|
|
890
|
-
|
|
891
|
-
var s = caml_string_of_jsstring(text);
|
|
892
|
-
caml_ml_output(chanid, s, 0, caml_ml_string_length(s));
|
|
936
|
+
caml_ml_output_str_stdout(text);
|
|
893
937
|
}
|
|
894
938
|
|
|
895
939
|
//Provides: caml_binaryen_expression_finalize
|
|
@@ -1296,6 +1340,68 @@ function caml_binaryen_call_indirect_set_return(exp, isReturn) {
|
|
|
1296
1340
|
return Binaryen.CallIndirect.setReturn(exp, caml_js_from_bool(isReturn));
|
|
1297
1341
|
}
|
|
1298
1342
|
|
|
1343
|
+
//Provides: caml_binaryen_call_ref_get_target
|
|
1344
|
+
//Requires: Binaryen
|
|
1345
|
+
function caml_binaryen_call_ref_get_target(exp) {
|
|
1346
|
+
return Binaryen.CallRef.getTarget(exp);
|
|
1347
|
+
}
|
|
1348
|
+
|
|
1349
|
+
//Provides: caml_binaryen_call_ref_set_target
|
|
1350
|
+
//Requires: Binaryen
|
|
1351
|
+
function caml_binaryen_call_ref_set_target(exp, target) {
|
|
1352
|
+
return Binaryen.CallRef.setTarget(exp, target);
|
|
1353
|
+
}
|
|
1354
|
+
|
|
1355
|
+
//Provides: caml_binaryen_call_ref_get_num_operands
|
|
1356
|
+
//Requires: Binaryen
|
|
1357
|
+
function caml_binaryen_call_ref_get_num_operands(exp) {
|
|
1358
|
+
return Binaryen.CallRef.getNumOperands(exp);
|
|
1359
|
+
}
|
|
1360
|
+
|
|
1361
|
+
//Provides: caml_binaryen_call_ref_get_operand_at
|
|
1362
|
+
//Requires: Binaryen
|
|
1363
|
+
function caml_binaryen_call_ref_get_operand_at(exp, index) {
|
|
1364
|
+
return Binaryen.CallRef.getOperandAt(exp, index);
|
|
1365
|
+
}
|
|
1366
|
+
|
|
1367
|
+
//Provides: caml_binaryen_call_ref_set_operand_at
|
|
1368
|
+
//Requires: Binaryen
|
|
1369
|
+
function caml_binaryen_call_ref_set_operand_at(exp, index, operand) {
|
|
1370
|
+
return Binaryen.CallRef.setOperandAt(exp, index, operand);
|
|
1371
|
+
}
|
|
1372
|
+
|
|
1373
|
+
//Provides: caml_binaryen_call_ref_append_operand
|
|
1374
|
+
//Requires: Binaryen
|
|
1375
|
+
function caml_binaryen_call_ref_append_operand(exp, operand) {
|
|
1376
|
+
return Binaryen.CallRef.appendOperand(exp, operand);
|
|
1377
|
+
}
|
|
1378
|
+
|
|
1379
|
+
//Provides: caml_binaryen_call_ref_insert_operand_at
|
|
1380
|
+
//Requires: Binaryen
|
|
1381
|
+
function caml_binaryen_call_ref_insert_operand_at(exp, index, operand) {
|
|
1382
|
+
return Binaryen.CallRef.insertOperandAt(exp, index, operand);
|
|
1383
|
+
}
|
|
1384
|
+
|
|
1385
|
+
//Provides: caml_binaryen_call_ref_remove_operand_at
|
|
1386
|
+
//Requires: Binaryen
|
|
1387
|
+
function caml_binaryen_call_ref_remove_operand_at(exp, index) {
|
|
1388
|
+
return Binaryen.CallRef.removeOperandAt(exp, index);
|
|
1389
|
+
}
|
|
1390
|
+
|
|
1391
|
+
//Provides: caml_binaryen_call_ref_is_return
|
|
1392
|
+
//Requires: Binaryen
|
|
1393
|
+
//Requires: caml_js_to_bool
|
|
1394
|
+
function caml_binaryen_call_ref_is_return(exp) {
|
|
1395
|
+
return caml_js_to_bool(Binaryen.CallRef.isReturn(exp));
|
|
1396
|
+
}
|
|
1397
|
+
|
|
1398
|
+
//Provides: caml_binaryen_call_ref_set_return
|
|
1399
|
+
//Requires: Binaryen
|
|
1400
|
+
//Requires: caml_js_from_bool
|
|
1401
|
+
function caml_binaryen_call_ref_set_return(exp, isReturn) {
|
|
1402
|
+
return Binaryen.CallRef.setReturn(exp, caml_js_from_bool(isReturn));
|
|
1403
|
+
}
|
|
1404
|
+
|
|
1299
1405
|
//Provides: caml_binaryen_local_set_get_value
|
|
1300
1406
|
//Requires: Binaryen
|
|
1301
1407
|
function caml_binaryen_local_set_get_value(exp) {
|
|
@@ -1704,7 +1810,317 @@ function caml_binaryen_ref_func(wasm_mod, name, typ) {
|
|
|
1704
1810
|
|
|
1705
1811
|
//Provides: caml_binaryen_ref_eq
|
|
1706
1812
|
function caml_binaryen_ref_eq(wasm_mod, left, right) {
|
|
1707
|
-
return wasm_mod.ref.
|
|
1813
|
+
return wasm_mod.ref.eq(left, right);
|
|
1814
|
+
}
|
|
1815
|
+
|
|
1816
|
+
// Struct operations
|
|
1817
|
+
|
|
1818
|
+
//Provides: caml_binaryen_struct_new
|
|
1819
|
+
//Requires: caml_list_to_js_array
|
|
1820
|
+
function caml_binaryen_struct_new(wasm_mod, operands, type) {
|
|
1821
|
+
return wasm_mod.struct.new(
|
|
1822
|
+
operands ? caml_list_to_js_array(operands[1]) : null,
|
|
1823
|
+
type
|
|
1824
|
+
);
|
|
1825
|
+
}
|
|
1826
|
+
|
|
1827
|
+
//Provides: caml_binaryen_struct_get
|
|
1828
|
+
//Requires: caml_js_from_bool
|
|
1829
|
+
function caml_binaryen_struct_get(wasm_mod, index, ref, type, signed) {
|
|
1830
|
+
return wasm_mod.struct.get(index, ref, type, caml_js_from_bool(signed));
|
|
1831
|
+
}
|
|
1832
|
+
|
|
1833
|
+
//Provides: caml_binaryen_struct_set
|
|
1834
|
+
function caml_binaryen_struct_set(wasm_mod, index, ref, value) {
|
|
1835
|
+
return wasm_mod.struct.set(index, ref, value);
|
|
1836
|
+
}
|
|
1837
|
+
|
|
1838
|
+
// Array operations
|
|
1839
|
+
|
|
1840
|
+
//Provides: caml_binaryen_array_new
|
|
1841
|
+
function caml_binaryen_array_new(wasm_mod, type, size, init) {
|
|
1842
|
+
return wasm_mod.array.new(type, size, init);
|
|
1843
|
+
}
|
|
1844
|
+
|
|
1845
|
+
//Provides: caml_binaryen_array_new_data
|
|
1846
|
+
//Requires: caml_jsstring_of_string
|
|
1847
|
+
function caml_binaryen_array_new_data(wasm_mod, type, name, offset, size) {
|
|
1848
|
+
return wasm_mod.array.new_data(
|
|
1849
|
+
type,
|
|
1850
|
+
caml_jsstring_of_string(name),
|
|
1851
|
+
offset,
|
|
1852
|
+
size
|
|
1853
|
+
);
|
|
1854
|
+
}
|
|
1855
|
+
|
|
1856
|
+
//Provides: caml_binaryen_array_new_elem
|
|
1857
|
+
//Requires: caml_jsstring_of_string
|
|
1858
|
+
function caml_binaryen_array_new_elem(wasm_mod, type, name, offset, size) {
|
|
1859
|
+
return wasm_mod.array.new_elem(
|
|
1860
|
+
type,
|
|
1861
|
+
caml_jsstring_of_string(name),
|
|
1862
|
+
offset,
|
|
1863
|
+
size
|
|
1864
|
+
);
|
|
1865
|
+
}
|
|
1866
|
+
|
|
1867
|
+
//Provides: caml_binaryen_array_new_fixed
|
|
1868
|
+
//Requires: caml_list_to_js_array
|
|
1869
|
+
function caml_binaryen_array_new_fixed(wasm_mod, type, values) {
|
|
1870
|
+
return wasm_mod.array.new_fixed(type, caml_list_to_js_array(values));
|
|
1871
|
+
}
|
|
1872
|
+
|
|
1873
|
+
//Provides: caml_binaryen_array_get
|
|
1874
|
+
//Requires: caml_js_from_bool
|
|
1875
|
+
function caml_binaryen_array_get(wasm_mod, ref, index, type, signed) {
|
|
1876
|
+
return wasm_mod.array.get(ref, index, type, caml_js_from_bool(signed));
|
|
1877
|
+
}
|
|
1878
|
+
|
|
1879
|
+
//Provides: caml_binaryen_array_set
|
|
1880
|
+
function caml_binaryen_array_set(wasm_mod, ref, index, value) {
|
|
1881
|
+
return wasm_mod.array.set(ref, index, value);
|
|
1882
|
+
}
|
|
1883
|
+
|
|
1884
|
+
//Provides: caml_binaryen_array_len
|
|
1885
|
+
function caml_binaryen_array_len(wasm_mod, ref) {
|
|
1886
|
+
return wasm_mod.array.len(ref);
|
|
1887
|
+
}
|
|
1888
|
+
|
|
1889
|
+
//Provides: caml_binaryen_array_fill
|
|
1890
|
+
function caml_binaryen_array_fill(wasm_mod, ref, index, value, size) {
|
|
1891
|
+
return wasm_mod.array.fill(ref, index, value, size);
|
|
1892
|
+
}
|
|
1893
|
+
|
|
1894
|
+
//Provides: caml_binaryen_array_copy
|
|
1895
|
+
function caml_binaryen_array_copy(
|
|
1896
|
+
wasm_mod,
|
|
1897
|
+
destRef,
|
|
1898
|
+
destIndex,
|
|
1899
|
+
srcRef,
|
|
1900
|
+
srcIndex,
|
|
1901
|
+
length
|
|
1902
|
+
) {
|
|
1903
|
+
return wasm_mod.array.copy(destRef, destIndex, srcRef, srcIndex, length);
|
|
1904
|
+
}
|
|
1905
|
+
|
|
1906
|
+
//Provides: caml_binaryen_array_init_data
|
|
1907
|
+
//Requires: caml_jsstring_of_string
|
|
1908
|
+
function caml_binaryen_array_init_data(wasm_mod, name, ref, index, offset, size) {
|
|
1909
|
+
return wasm_mod.array.init_data(caml_jsstring_of_string(name), ref, index, offset, size);
|
|
1910
|
+
}
|
|
1911
|
+
|
|
1912
|
+
//Provides: caml_binaryen_array_init_data__bytecode
|
|
1913
|
+
//Requires: caml_binaryen_array_init_data
|
|
1914
|
+
function caml_binaryen_array_init_data__bytecode() {
|
|
1915
|
+
return caml_binaryen_array_init_data(
|
|
1916
|
+
arguments[0],
|
|
1917
|
+
arguments[1],
|
|
1918
|
+
arguments[2],
|
|
1919
|
+
arguments[3],
|
|
1920
|
+
arguments[4],
|
|
1921
|
+
arguments[5]
|
|
1922
|
+
);
|
|
1923
|
+
}
|
|
1924
|
+
|
|
1925
|
+
//Provides: caml_binaryen_array_init_elem
|
|
1926
|
+
//Requires: caml_jsstring_of_string
|
|
1927
|
+
function caml_binaryen_array_init_elem(wasm_mod, name, ref, index, offset, size) {
|
|
1928
|
+
return wasm_mod.array.init_elem(caml_jsstring_of_string(name), ref, index, offset, size);
|
|
1929
|
+
}
|
|
1930
|
+
|
|
1931
|
+
//Provides: caml_binaryen_array_copy__bytecode
|
|
1932
|
+
//Requires: caml_binaryen_array_copy
|
|
1933
|
+
function caml_binaryen_array_copy__bytecode() {
|
|
1934
|
+
return caml_binaryen_array_copy(
|
|
1935
|
+
arguments[0],
|
|
1936
|
+
arguments[1],
|
|
1937
|
+
arguments[2],
|
|
1938
|
+
arguments[3],
|
|
1939
|
+
arguments[4],
|
|
1940
|
+
arguments[5]
|
|
1941
|
+
);
|
|
1942
|
+
}
|
|
1943
|
+
|
|
1944
|
+
// Exception handling operations
|
|
1945
|
+
|
|
1946
|
+
//Provides: caml_binaryen_try
|
|
1947
|
+
//Requires: caml_jsstring_of_string, caml_list_to_js_array
|
|
1948
|
+
function caml_binaryen_try(wasm_mod, name, body, catch_tags, catch_bodies, delegate_target) {
|
|
1949
|
+
return wasm_mod.try(
|
|
1950
|
+
name ? caml_jsstring_of_string(name[1]) : null,
|
|
1951
|
+
body,
|
|
1952
|
+
caml_list_to_js_array(catch_tags).map(caml_jsstring_of_string),
|
|
1953
|
+
caml_list_to_js_array(catch_bodies),
|
|
1954
|
+
delegate_target ? caml_jsstring_of_string(delegate_target[1]) : null,
|
|
1955
|
+
);
|
|
1956
|
+
}
|
|
1957
|
+
|
|
1958
|
+
//Provides: caml_binaryen_try__bytecode
|
|
1959
|
+
//Requires: caml_binaryen_try
|
|
1960
|
+
function caml_binaryen_try__bytecode() {
|
|
1961
|
+
return caml_binaryen_try(arguments[0], arguments[1], arguments[2], arguments[3], arguments[4], arguments[5]);
|
|
1962
|
+
}
|
|
1963
|
+
|
|
1964
|
+
//Provides: caml_binaryen_throw
|
|
1965
|
+
//Requires: caml_jsstring_of_string, caml_list_to_js_array
|
|
1966
|
+
function caml_binaryen_throw(wasm_mod, tag, operands) {
|
|
1967
|
+
return wasm_mod.throw(
|
|
1968
|
+
caml_jsstring_of_string(tag),
|
|
1969
|
+
caml_list_to_js_array(operands),
|
|
1970
|
+
);
|
|
1971
|
+
}
|
|
1972
|
+
|
|
1973
|
+
//Provides: caml_binaryen_try_get_name
|
|
1974
|
+
//Requires: Binaryen, caml_string_of_jsstring, to_option
|
|
1975
|
+
function caml_binaryen_try_get_name(expr) {
|
|
1976
|
+
var name = Binaryen.Try.getName(expr);
|
|
1977
|
+
var str = name != null ? caml_string_of_jsstring(name) : null;
|
|
1978
|
+
return to_option(str);
|
|
1979
|
+
}
|
|
1980
|
+
|
|
1981
|
+
//Provides: caml_binaryen_try_set_name
|
|
1982
|
+
//Requires: Binaryen, caml_jsstring_of_string
|
|
1983
|
+
function caml_binaryen_try_set_name(expr, name) {
|
|
1984
|
+
Binaryen.Try.setName(expr, caml_jsstring_of_string(name));
|
|
1985
|
+
}
|
|
1986
|
+
|
|
1987
|
+
//Provides: caml_binaryen_try_get_body
|
|
1988
|
+
//Requires: Binaryen
|
|
1989
|
+
function caml_binaryen_try_get_body(expr) {
|
|
1990
|
+
return Binaryen.Try.getBody(expr);
|
|
1991
|
+
}
|
|
1992
|
+
|
|
1993
|
+
//Provides: caml_binaryen_try_set_body
|
|
1994
|
+
//Requires: Binaryen
|
|
1995
|
+
function caml_binaryen_try_set_body(expr, bodyExpr) {
|
|
1996
|
+
Binaryen.Try.setBody(expr, bodyExpr);
|
|
1997
|
+
}
|
|
1998
|
+
|
|
1999
|
+
//Provides: caml_binaryen_try_get_num_catch_tags
|
|
2000
|
+
//Requires: Binaryen
|
|
2001
|
+
function caml_binaryen_try_get_num_catch_tags(expr) {
|
|
2002
|
+
return Binaryen.Try.getNumCatchTags(expr);
|
|
2003
|
+
}
|
|
2004
|
+
|
|
2005
|
+
//Provides: caml_binaryen_try_get_num_catch_bodies
|
|
2006
|
+
//Requires: Binaryen
|
|
2007
|
+
function caml_binaryen_try_get_num_catch_bodies(expr) {
|
|
2008
|
+
return Binaryen.Try.getNumCatchBodies(expr);
|
|
2009
|
+
}
|
|
2010
|
+
|
|
2011
|
+
//Provides: caml_binaryen_try_get_catch_tag_at
|
|
2012
|
+
//Requires: Binaryen, caml_string_of_jsstring
|
|
2013
|
+
function caml_binaryen_try_get_catch_tag_at(expr, index) {
|
|
2014
|
+
return caml_string_of_jsstring(Binaryen.Try.getCatchTagAt(expr, index));
|
|
2015
|
+
}
|
|
2016
|
+
|
|
2017
|
+
//Provides: caml_binaryen_try_set_catch_tag_at
|
|
2018
|
+
//Requires: Binaryen, caml_jsstring_of_string
|
|
2019
|
+
function caml_binaryen_try_set_catch_tag_at(expr, index, catchTag) {
|
|
2020
|
+
Binaryen.Try.setCatchTagAt(expr, index, caml_jsstring_of_string(catchTag));
|
|
2021
|
+
}
|
|
2022
|
+
|
|
2023
|
+
//Provides: caml_binaryen_try_append_catch_tag
|
|
2024
|
+
//Requires: Binaryen, caml_jsstring_of_string
|
|
2025
|
+
function caml_binaryen_try_append_catch_tag(expr, catchTag) {
|
|
2026
|
+
return Binaryen.Try.appendCatchTag(expr, caml_jsstring_of_string(catchTag));
|
|
2027
|
+
}
|
|
2028
|
+
|
|
2029
|
+
//Provides: caml_binaryen_try_insert_catch_tag_at
|
|
2030
|
+
//Requires: Binaryen, caml_jsstring_of_string
|
|
2031
|
+
function caml_binaryen_try_insert_catch_tag_at(expr, index, catchTag) {
|
|
2032
|
+
Binaryen.Try.insertCatchTagAt(expr, index, caml_jsstring_of_string(catchTag));
|
|
2033
|
+
}
|
|
2034
|
+
|
|
2035
|
+
//Provides: caml_binaryen_try_remove_catch_tag_at
|
|
2036
|
+
//Requires: Binaryen, caml_string_of_jsstring
|
|
2037
|
+
function caml_binaryen_try_remove_catch_tag_at(expr, index) {
|
|
2038
|
+
return caml_string_of_jsstring(Binaryen.Try.removeCatchTagAt(expr, index));
|
|
2039
|
+
}
|
|
2040
|
+
|
|
2041
|
+
//Provides: caml_binaryen_try_get_catch_body_at
|
|
2042
|
+
//Requires: Binaryen
|
|
2043
|
+
function caml_binaryen_try_get_catch_body_at(expr, index) {
|
|
2044
|
+
return Binaryen.Try.getCatchBodyAt(expr, index);
|
|
2045
|
+
}
|
|
2046
|
+
|
|
2047
|
+
//Provides: caml_binaryen_try_set_catch_body_at
|
|
2048
|
+
//Requires: Binaryen
|
|
2049
|
+
function caml_binaryen_try_set_catch_body_at(expr, index, catchExpr) {
|
|
2050
|
+
Binaryen.Try.setCatchBodyAt(expr, index, catchExpr);
|
|
2051
|
+
}
|
|
2052
|
+
|
|
2053
|
+
//Provides: caml_binaryen_try_append_catch_body
|
|
2054
|
+
//Requires: Binaryen
|
|
2055
|
+
function caml_binaryen_try_append_catch_body(expr, catchExpr) {
|
|
2056
|
+
return Binaryen.Try.appendCatchBody(expr, catchExpr);
|
|
2057
|
+
}
|
|
2058
|
+
|
|
2059
|
+
//Provides: caml_binaryen_try_insert_catch_body_at
|
|
2060
|
+
//Requires: Binaryen
|
|
2061
|
+
function caml_binaryen_try_insert_catch_body_at(expr, index, catchExpr) {
|
|
2062
|
+
Binaryen.Try.insertCatchBodyAt(expr, index, catchExpr);
|
|
2063
|
+
}
|
|
2064
|
+
|
|
2065
|
+
//Provides: caml_binaryen_try_remove_catch_body_at
|
|
2066
|
+
//Requires: Binaryen
|
|
2067
|
+
function caml_binaryen_try_remove_catch_body_at(expr, index) {
|
|
2068
|
+
return Binaryen.Try.removeCatchBodyAt(expr, index);
|
|
2069
|
+
}
|
|
2070
|
+
|
|
2071
|
+
//Provides: caml_binaryen_try_has_catch_all
|
|
2072
|
+
//Requires: Binaryen
|
|
2073
|
+
//Requires: caml_js_to_bool
|
|
2074
|
+
function caml_binaryen_try_has_catch_all(expr) {
|
|
2075
|
+
return caml_js_to_bool(Binaryen.Try.hasCatchAll(expr));
|
|
2076
|
+
}
|
|
2077
|
+
|
|
2078
|
+
//Provides: caml_binaryen_throw_get_tag
|
|
2079
|
+
//Requires: Binaryen, caml_string_of_jsstring
|
|
2080
|
+
function caml_binaryen_throw_get_tag(expr) {
|
|
2081
|
+
return caml_string_of_jsstring(Binaryen.Throw.getTag(expr));
|
|
2082
|
+
}
|
|
2083
|
+
|
|
2084
|
+
//Provides: caml_binaryen_throw_set_tag
|
|
2085
|
+
//Requires: Binaryen, caml_jsstring_of_string
|
|
2086
|
+
function caml_binaryen_throw_set_tag(expr, tagName) {
|
|
2087
|
+
Binaryen.Throw.setTag(expr, caml_jsstring_of_string(tagName));
|
|
2088
|
+
}
|
|
2089
|
+
|
|
2090
|
+
//Provides: caml_binaryen_throw_get_num_operands
|
|
2091
|
+
//Requires: Binaryen
|
|
2092
|
+
function caml_binaryen_throw_get_num_operands(expr) {
|
|
2093
|
+
return Binaryen.Throw.getNumOperands(expr);
|
|
2094
|
+
}
|
|
2095
|
+
|
|
2096
|
+
//Provides: caml_binaryen_throw_get_operand_at
|
|
2097
|
+
//Requires: Binaryen
|
|
2098
|
+
function caml_binaryen_throw_get_operand_at(expr, index) {
|
|
2099
|
+
return Binaryen.Throw.getOperandAt(expr, index);
|
|
2100
|
+
}
|
|
2101
|
+
|
|
2102
|
+
//Provides: caml_binaryen_throw_set_operand_at
|
|
2103
|
+
//Requires: Binaryen
|
|
2104
|
+
function caml_binaryen_throw_set_operand_at(expr, index, operandExpr) {
|
|
2105
|
+
Binaryen.Throw.setOperandAt(expr, index, operandExpr);
|
|
2106
|
+
}
|
|
2107
|
+
|
|
2108
|
+
//Provides: caml_binaryen_throw_append_operand
|
|
2109
|
+
//Requires: Binaryen
|
|
2110
|
+
function caml_binaryen_throw_append_operand(expr, operandExpr) {
|
|
2111
|
+
return Binaryen.Throw.appendOperand(expr, operandExpr);
|
|
2112
|
+
}
|
|
2113
|
+
|
|
2114
|
+
//Provides: caml_binaryen_throw_insert_operand_at
|
|
2115
|
+
//Requires: Binaryen
|
|
2116
|
+
function caml_binaryen_throw_insert_operand_at(expr, index, operandExpr) {
|
|
2117
|
+
Binaryen.Throw.insertOperandAt(expr, index, operandExpr);
|
|
2118
|
+
}
|
|
2119
|
+
|
|
2120
|
+
//Provides: caml_binaryen_throw_remove_operand_at
|
|
2121
|
+
//Requires: Binaryen
|
|
2122
|
+
function caml_binaryen_throw_remove_operand_at(expr, index) {
|
|
2123
|
+
return Binaryen.Throw.removeOperandAt(expr, index);
|
|
1708
2124
|
}
|
|
1709
2125
|
|
|
1710
2126
|
// Table operations
|
|
@@ -583,6 +583,44 @@ module Call_indirect = struct
|
|
|
583
583
|
= "caml_binaryen_call_indirect_set_return"
|
|
584
584
|
end
|
|
585
585
|
|
|
586
|
+
module Call_ref = struct
|
|
587
|
+
external make : Module.t -> t -> t list -> Type.t -> t
|
|
588
|
+
= "caml_binaryen_call_ref"
|
|
589
|
+
|
|
590
|
+
(** Module, function value, params, type. *)
|
|
591
|
+
let make mod_ target params typ = make mod_ target params typ
|
|
592
|
+
|
|
593
|
+
external make_return : Module.t -> t -> t list -> Type.t -> t
|
|
594
|
+
= "caml_binaryen_return_call_ref"
|
|
595
|
+
|
|
596
|
+
(** Module, function value, params, type. *)
|
|
597
|
+
let make_return mod_ target params typ = make_return mod_ target params typ
|
|
598
|
+
|
|
599
|
+
external get_target : t -> t = "caml_binaryen_call_ref_get_target"
|
|
600
|
+
external set_target : t -> t -> unit = "caml_binaryen_call_ref_set_target"
|
|
601
|
+
|
|
602
|
+
external get_num_operands : t -> int
|
|
603
|
+
= "caml_binaryen_call_ref_get_num_operands"
|
|
604
|
+
|
|
605
|
+
external get_operand_at : t -> int -> t
|
|
606
|
+
= "caml_binaryen_call_ref_get_operand_at"
|
|
607
|
+
|
|
608
|
+
external set_operand_at : t -> int -> t -> unit
|
|
609
|
+
= "caml_binaryen_call_ref_set_operand_at"
|
|
610
|
+
|
|
611
|
+
external append_operand : t -> t -> int
|
|
612
|
+
= "caml_binaryen_call_ref_append_operand"
|
|
613
|
+
|
|
614
|
+
external insert_operand_at : t -> int -> t -> unit
|
|
615
|
+
= "caml_binaryen_call_ref_insert_operand_at"
|
|
616
|
+
|
|
617
|
+
external remove_operand_at : t -> int -> t
|
|
618
|
+
= "caml_binaryen_call_ref_remove_operand_at"
|
|
619
|
+
|
|
620
|
+
external is_return : t -> bool = "caml_binaryen_call_ref_is_return"
|
|
621
|
+
external set_return : t -> bool -> unit = "caml_binaryen_call_ref_set_return"
|
|
622
|
+
end
|
|
623
|
+
|
|
586
624
|
module Local_get = struct
|
|
587
625
|
external make : Module.t -> int -> Type.t -> t = "caml_binaryen_local_get"
|
|
588
626
|
(** Module, slot, type. *)
|
|
@@ -830,6 +868,192 @@ module Ref = struct
|
|
|
830
868
|
|
|
831
869
|
external eq : Module.t -> t -> t -> t = "caml_binaryen_ref_eq"
|
|
832
870
|
(** Module, left, right *)
|
|
871
|
+
|
|
872
|
+
external test : Module.t -> t -> Type.t -> t = "caml_binaryen_ref_test"
|
|
873
|
+
(** Module, value, type *)
|
|
874
|
+
|
|
875
|
+
external cast : Module.t -> t -> Type.t -> t = "caml_binaryen_ref_cast"
|
|
876
|
+
(** Module, value, type *)
|
|
877
|
+
end
|
|
878
|
+
|
|
879
|
+
module BrOn = struct
|
|
880
|
+
external make : Module.t -> Op.t -> string -> t -> Type.t -> t
|
|
881
|
+
= "caml_binaryen_br_on"
|
|
882
|
+
(** Module, op, label, value, type *)
|
|
883
|
+
end
|
|
884
|
+
|
|
885
|
+
module Struct = struct
|
|
886
|
+
external new_ : Module.t -> t list option -> Heap_type.t -> t
|
|
887
|
+
= "caml_binaryen_struct_new"
|
|
888
|
+
(** Mdoule, operands, type *)
|
|
889
|
+
|
|
890
|
+
external get : Module.t -> int -> t -> Type.t -> bool -> t
|
|
891
|
+
= "caml_binaryen_struct_get"
|
|
892
|
+
(** Module, index, struct, type, signed *)
|
|
893
|
+
|
|
894
|
+
external set : Module.t -> int -> t -> t -> t = "caml_binaryen_struct_set"
|
|
895
|
+
(** Module, index, struct, value *)
|
|
896
|
+
end
|
|
897
|
+
|
|
898
|
+
module Array = struct
|
|
899
|
+
external new_ : Module.t -> Heap_type.t -> t -> t -> t
|
|
900
|
+
= "caml_binaryen_array_new"
|
|
901
|
+
(** Module, type, size, init *)
|
|
902
|
+
|
|
903
|
+
external new_data : Module.t -> Heap_type.t -> string -> t -> t -> t
|
|
904
|
+
= "caml_binaryen_array_new_data"
|
|
905
|
+
(** Module, type, data name, offset, size *)
|
|
906
|
+
|
|
907
|
+
external new_elem : Module.t -> Heap_type.t -> string -> t -> t -> t
|
|
908
|
+
= "caml_binaryen_array_new_elem"
|
|
909
|
+
(** Module, type, seg, offset, size *)
|
|
910
|
+
|
|
911
|
+
external new_fixed : Module.t -> Heap_type.t -> t list -> t
|
|
912
|
+
= "caml_binaryen_array_new_fixed"
|
|
913
|
+
(** Module, type, values *)
|
|
914
|
+
|
|
915
|
+
external get : Module.t -> t -> t -> Type.t -> bool -> t
|
|
916
|
+
= "caml_binaryen_array_get"
|
|
917
|
+
(** Module, array, index, type, signed *)
|
|
918
|
+
|
|
919
|
+
external set : Module.t -> t -> t -> t -> t = "caml_binaryen_array_set"
|
|
920
|
+
(** Module, array, index, value *)
|
|
921
|
+
|
|
922
|
+
external len : Module.t -> t -> t = "caml_binaryen_array_len"
|
|
923
|
+
(** Module, array *)
|
|
924
|
+
|
|
925
|
+
external fill : Module.t -> t -> t -> t -> t -> t = "caml_binaryen_array_fill"
|
|
926
|
+
(** Module, array, index, value, offset *)
|
|
927
|
+
|
|
928
|
+
external copy : Module.t -> t -> t -> t -> t -> t -> t
|
|
929
|
+
= "caml_binaryen_array_copy__bytecode" "caml_binaryen_array_copy"
|
|
930
|
+
(** Module, dest, dest index, src, src index, length *)
|
|
931
|
+
|
|
932
|
+
external init_data : Module.t -> string -> t -> t -> t -> t -> t
|
|
933
|
+
= "caml_binaryen_array_init_data__bytecode" "caml_binaryen_array_init_data"
|
|
934
|
+
(** Module, name, ref, index, offset, size *)
|
|
935
|
+
|
|
936
|
+
external init_elem : Module.t -> string -> t -> t -> t -> t -> t
|
|
937
|
+
= "caml_binaryen_array_init_elem__bytecode" "caml_binaryen_array_init_elem"
|
|
938
|
+
(** Module, seg, ref, index, offset, size *)
|
|
939
|
+
end
|
|
940
|
+
|
|
941
|
+
(** Bindings for `try_table` instruction. *)
|
|
942
|
+
module Try = struct
|
|
943
|
+
external make :
|
|
944
|
+
Module.t ->
|
|
945
|
+
string option ->
|
|
946
|
+
t ->
|
|
947
|
+
string list ->
|
|
948
|
+
t list ->
|
|
949
|
+
string option ->
|
|
950
|
+
t = "caml_binaryen_try__bytecode" "caml_binaryen_try"
|
|
951
|
+
(** Module, name, body, catch tags, catch bodies, delegate target *)
|
|
952
|
+
|
|
953
|
+
(** Module, name, body, catch clauses, catch all *)
|
|
954
|
+
let make wasm_mod name body catch_clauses catch_all =
|
|
955
|
+
let catch_tags, catch_bodies = List.split catch_clauses in
|
|
956
|
+
let catch_bodies =
|
|
957
|
+
match catch_all with
|
|
958
|
+
| Some target -> List.append catch_bodies [ target ]
|
|
959
|
+
| None -> catch_bodies
|
|
960
|
+
in
|
|
961
|
+
make wasm_mod name body catch_tags catch_bodies None
|
|
962
|
+
|
|
963
|
+
external get_name : t -> string option = "caml_binaryen_try_get_name"
|
|
964
|
+
(** expr *)
|
|
965
|
+
|
|
966
|
+
external set_name : t -> string -> unit = "caml_binaryen_try_set_name"
|
|
967
|
+
(** expr, name *)
|
|
968
|
+
|
|
969
|
+
external get_body : t -> t = "caml_binaryen_try_get_body"
|
|
970
|
+
(** expr *)
|
|
971
|
+
|
|
972
|
+
external set_body : t -> t -> unit = "caml_binaryen_try_set_body"
|
|
973
|
+
(** expr, bodyExpr *)
|
|
974
|
+
|
|
975
|
+
external get_num_catch_tags : t -> int
|
|
976
|
+
= "caml_binaryen_try_get_num_catch_tags"
|
|
977
|
+
(** expr *)
|
|
978
|
+
|
|
979
|
+
external get_num_catch_bodies : t -> int
|
|
980
|
+
= "caml_binaryen_try_get_num_catch_bodies"
|
|
981
|
+
(** expr *)
|
|
982
|
+
|
|
983
|
+
external get_catch_tag_at : t -> int -> string
|
|
984
|
+
= "caml_binaryen_try_get_catch_tag_at"
|
|
985
|
+
(** expr, index *)
|
|
986
|
+
|
|
987
|
+
external set_catch_tag_at : t -> int -> string -> unit
|
|
988
|
+
= "caml_binaryen_try_set_catch_tag_at"
|
|
989
|
+
(** expr, index, catchTag *)
|
|
990
|
+
|
|
991
|
+
external append_catch_tag : t -> string -> int
|
|
992
|
+
= "caml_binaryen_try_append_catch_tag"
|
|
993
|
+
(** expr, catchTag *)
|
|
994
|
+
|
|
995
|
+
external insert_catch_tag_at : t -> int -> string -> unit
|
|
996
|
+
= "caml_binaryen_try_insert_catch_tag_at"
|
|
997
|
+
(** expr, index, catchTag *)
|
|
998
|
+
|
|
999
|
+
external remove_catch_tag_at : t -> int -> string
|
|
1000
|
+
= "caml_binaryen_try_remove_catch_tag_at"
|
|
1001
|
+
(** expr, index *)
|
|
1002
|
+
|
|
1003
|
+
external get_catch_body_at : t -> int -> t
|
|
1004
|
+
= "caml_binaryen_try_get_catch_body_at"
|
|
1005
|
+
(** expr, index *)
|
|
1006
|
+
|
|
1007
|
+
external set_catch_body_at : t -> int -> t -> unit
|
|
1008
|
+
= "caml_binaryen_try_set_catch_body_at"
|
|
1009
|
+
(** expr, index, catchExpr *)
|
|
1010
|
+
|
|
1011
|
+
external append_catch_body : t -> t -> int
|
|
1012
|
+
= "caml_binaryen_try_append_catch_body"
|
|
1013
|
+
(** expr, catchExpr *)
|
|
1014
|
+
|
|
1015
|
+
external insert_catch_body_at : t -> int -> t -> unit
|
|
1016
|
+
= "caml_binaryen_try_insert_catch_body_at"
|
|
1017
|
+
(** expr, index, catchExpr *)
|
|
1018
|
+
|
|
1019
|
+
external remove_catch_body_at : t -> int -> t
|
|
1020
|
+
= "caml_binaryen_try_remove_catch_body_at"
|
|
1021
|
+
(** expr, index *)
|
|
1022
|
+
|
|
1023
|
+
external has_catch_all : t -> bool = "caml_binaryen_try_has_catch_all"
|
|
1024
|
+
(** expr *)
|
|
1025
|
+
end
|
|
1026
|
+
|
|
1027
|
+
module Throw = struct
|
|
1028
|
+
external make : Module.t -> string -> t list -> t = "caml_binaryen_throw"
|
|
1029
|
+
(** Module, tag, operands *)
|
|
1030
|
+
|
|
1031
|
+
external get_tag : t -> string = "caml_binaryen_throw_get_tag"
|
|
1032
|
+
(** expr *)
|
|
1033
|
+
|
|
1034
|
+
external set_tag : t -> string -> unit = "caml_binaryen_throw_set_tag"
|
|
1035
|
+
(** expr, tagName *)
|
|
1036
|
+
|
|
1037
|
+
external get_num_operands : t -> int = "caml_binaryen_throw_get_num_operands"
|
|
1038
|
+
(** expr *)
|
|
1039
|
+
|
|
1040
|
+
external get_operand_at : t -> int -> t = "caml_binaryen_throw_get_operand_at"
|
|
1041
|
+
(** expr, index *)
|
|
1042
|
+
|
|
1043
|
+
external set_operand_at : t -> int -> t -> unit
|
|
1044
|
+
= "caml_binaryen_throw_set_operand_at"
|
|
1045
|
+
(** expr, index, operandExpr *)
|
|
1046
|
+
|
|
1047
|
+
external append_operand : t -> t -> int = "caml_binaryen_throw_append_operand"
|
|
1048
|
+
(** expr, operandExpr *)
|
|
1049
|
+
|
|
1050
|
+
external insert_operand_at : t -> int -> t -> unit
|
|
1051
|
+
= "caml_binaryen_throw_insert_operand_at"
|
|
1052
|
+
(** expr, index, operandExpr *)
|
|
1053
|
+
|
|
1054
|
+
external remove_operand_at : t -> int -> t
|
|
1055
|
+
= "caml_binaryen_throw_remove_operand_at"
|
|
1056
|
+
(** expr, index *)
|
|
833
1057
|
end
|
|
834
1058
|
|
|
835
1059
|
module Table = struct
|