@grain/binaryen.ml 0.35.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 +20 -0
- binaryen-archive/binaryen.opam +3 -3
- binaryen-archive/esy.lock/index.json +338 -462
- binaryen-archive/esy.lock/opam/base.v0.17.3/opam +1 -1
- binaryen-archive/esy.lock/opam/{chrome-trace.3.21.1 → 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.21.1 → dune-build-info.3.24.2}/opam +6 -8
- binaryen-archive/esy.lock/opam/{dune-configurator.3.21.1 → dune-configurator.3.24.2}/opam +6 -8
- binaryen-archive/esy.lock/opam/{dune-rpc.3.21.1 → dune-rpc.3.20.2}/opam +5 -5
- binaryen-archive/esy.lock/opam/{dune.3.21.1 → dune.3.24.2}/opam +13 -9
- binaryen-archive/esy.lock/opam/{dyn.3.21.1 → dyn.3.20.2}/opam +6 -6
- 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/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 -5
- binaryen-archive/esy.lock/opam/ocamlbuild.0.16.1/opam +1 -0
- binaryen-archive/esy.lock/opam/{ocamlc-loc.3.21.1 → ocamlc-loc.3.20.2}/opam +6 -6
- 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/{ordering.3.21.1 → ordering.3.20.2}/opam +6 -6
- binaryen-archive/esy.lock/opam/{ppxlib.0.37.0 → ppxlib.0.39.0~5.6preview}/opam +12 -13
- binaryen-archive/esy.lock/opam/{stdune.3.21.1 → stdune.3.20.2}/opam +7 -9
- binaryen-archive/esy.lock/opam/{xdg.3.21.1 → xdg.3.24.2}/opam +6 -8
- binaryen-archive/package.json +9 -5
- binaryen-archive/src/dune +4 -1
- binaryen-archive/src/expression.c +345 -0
- binaryen-archive/src/expression.js +241 -7
- binaryen-archive/src/expression.ml +106 -0
- binaryen-archive/src/expression.mli +72 -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/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 +7 -20
- 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 +9 -0
- binaryen-archive/src/ocaml_helpers.h +5 -0
- binaryen-archive/src/ocaml_helpers.js +11 -0
- binaryen-archive/src/passes.ml +10 -4
- binaryen-archive/src/passes.mli +11 -5
- binaryen-archive/src/type.c +5 -3
- binaryen-archive/src/type.js +2 -3
- 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 +188 -25
- binaryen-archive/test/test.ml +131 -4
- binaryen-archive/esy.lock/opam/base-bytes.base/opam +0 -10
- binaryen-archive/esy.lock/opam/fs-io.3.21.1/opam +0 -41
- 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
- binaryen-archive/esy.lock/opam/top-closure.3.21.1/opam +0 -40
|
@@ -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,135 @@ 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
|
+
);
|
|
1708
1942
|
}
|
|
1709
1943
|
|
|
1710
1944
|
// Exception handling 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,74 @@ 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 *)
|
|
833
939
|
end
|
|
834
940
|
|
|
835
941
|
(** Bindings for `try_table` instruction. *)
|
|
@@ -161,6 +161,21 @@ module Call_indirect : sig
|
|
|
161
161
|
val set_return : t -> bool -> unit
|
|
162
162
|
end
|
|
163
163
|
|
|
164
|
+
module Call_ref : sig
|
|
165
|
+
val make : Module.t -> t -> t list -> Type.t -> t
|
|
166
|
+
val make_return : Module.t -> t -> t list -> Type.t -> t
|
|
167
|
+
val get_target : t -> t
|
|
168
|
+
val set_target : t -> t -> unit
|
|
169
|
+
val get_num_operands : t -> int
|
|
170
|
+
val get_operand_at : t -> int -> t
|
|
171
|
+
val set_operand_at : t -> int -> t -> unit
|
|
172
|
+
val append_operand : t -> t -> int
|
|
173
|
+
val insert_operand_at : t -> int -> t -> unit
|
|
174
|
+
val remove_operand_at : t -> int -> t
|
|
175
|
+
val is_return : t -> bool
|
|
176
|
+
val set_return : t -> bool -> unit
|
|
177
|
+
end
|
|
178
|
+
|
|
164
179
|
module Local_get : sig
|
|
165
180
|
val make : Module.t -> int -> Type.t -> t
|
|
166
181
|
end
|
|
@@ -348,6 +363,63 @@ module Ref : sig
|
|
|
348
363
|
|
|
349
364
|
val eq : Module.t -> t -> t -> t
|
|
350
365
|
(** Module, left, right *)
|
|
366
|
+
|
|
367
|
+
val test : Module.t -> t -> Type.t -> t
|
|
368
|
+
(** Module, value, type *)
|
|
369
|
+
|
|
370
|
+
val cast : Module.t -> t -> Type.t -> t
|
|
371
|
+
(** Module, value, type *)
|
|
372
|
+
end
|
|
373
|
+
|
|
374
|
+
module BrOn : sig
|
|
375
|
+
val make : Module.t -> Op.t -> string -> t -> Type.t -> t
|
|
376
|
+
(** Module, op, label, value, type *)
|
|
377
|
+
end
|
|
378
|
+
|
|
379
|
+
module Struct : sig
|
|
380
|
+
val new_ : Module.t -> t list option -> Heap_type.t -> t
|
|
381
|
+
(** Mdoule, operands, type *)
|
|
382
|
+
|
|
383
|
+
val get : Module.t -> int -> t -> Type.t -> bool -> t
|
|
384
|
+
(** Module, index, struct, type, signed *)
|
|
385
|
+
|
|
386
|
+
val set : Module.t -> int -> t -> t -> t
|
|
387
|
+
(** Module, index, struct, value *)
|
|
388
|
+
end
|
|
389
|
+
|
|
390
|
+
module Array : sig
|
|
391
|
+
val new_ : Module.t -> Heap_type.t -> t -> t -> t
|
|
392
|
+
(** Module, type, size, init *)
|
|
393
|
+
|
|
394
|
+
val new_data : Module.t -> Heap_type.t -> string -> t -> t -> t
|
|
395
|
+
(** Module, type, data name, offset, size *)
|
|
396
|
+
|
|
397
|
+
val new_elem : Module.t -> Heap_type.t -> string -> t -> t -> t
|
|
398
|
+
(** Module, type, seg, offset, size *)
|
|
399
|
+
|
|
400
|
+
val new_fixed : Module.t -> Heap_type.t -> t list -> t
|
|
401
|
+
(** Module, type, values *)
|
|
402
|
+
|
|
403
|
+
val get : Module.t -> t -> t -> Type.t -> bool -> t
|
|
404
|
+
(** Module, array, index, type, signed *)
|
|
405
|
+
|
|
406
|
+
val set : Module.t -> t -> t -> t -> t
|
|
407
|
+
(** Module, array, index, value *)
|
|
408
|
+
|
|
409
|
+
val len : Module.t -> t -> t
|
|
410
|
+
(** Module, array *)
|
|
411
|
+
|
|
412
|
+
val fill : Module.t -> t -> t -> t -> t -> t
|
|
413
|
+
(** Module, array, index, value, offset *)
|
|
414
|
+
|
|
415
|
+
val copy : Module.t -> t -> t -> t -> t -> t -> t
|
|
416
|
+
(** Module, dest, dest index, src, src index, length *)
|
|
417
|
+
|
|
418
|
+
val init_data : Module.t -> string -> t -> t -> t -> t -> t
|
|
419
|
+
(** Module, name, ref, index, offset, size *)
|
|
420
|
+
|
|
421
|
+
val init_elem : Module.t -> string -> t -> t -> t -> t -> t
|
|
422
|
+
(** Module, seg, ref, index, offset, size *)
|
|
351
423
|
end
|
|
352
424
|
|
|
353
425
|
(** Bindings for `try` instruction. *)
|
binaryen-archive/src/heap_type.c
CHANGED
|
@@ -148,3 +148,22 @@ caml_binaryen_type_get_heap_type(value _ty) {
|
|
|
148
148
|
BinaryenHeapType heapTy = BinaryenTypeGetHeapType(ty);
|
|
149
149
|
CAMLreturn(alloc_BinaryenHeapType(heapTy));
|
|
150
150
|
}
|
|
151
|
+
|
|
152
|
+
CAMLprim value caml_binaryen_module_set_type_name(value _module, value _heapType, value _name) {
|
|
153
|
+
CAMLparam3(_module, _heapType, _name);
|
|
154
|
+
BinaryenModuleRef module = BinaryenModuleRef_val(_module);
|
|
155
|
+
BinaryenHeapType heapType = BinaryenHeapType_val(_heapType);
|
|
156
|
+
const char* name = String_val(_name);
|
|
157
|
+
BinaryenModuleSetTypeName(module, heapType, name);
|
|
158
|
+
CAMLreturn(Val_unit);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
CAMLprim value caml_binaryen_module_set_field_name(value _module, value _heapType, value _index, value _name) {
|
|
162
|
+
CAMLparam4(_module, _heapType, _index, _name);
|
|
163
|
+
BinaryenModuleRef module = BinaryenModuleRef_val(_module);
|
|
164
|
+
BinaryenHeapType heapType = BinaryenHeapType_val(_heapType);
|
|
165
|
+
BinaryenIndex index = Int_val(_index);
|
|
166
|
+
const char* name = String_val(_name);
|
|
167
|
+
BinaryenModuleSetFieldName(module, heapType, index, name);
|
|
168
|
+
CAMLreturn(Val_unit);
|
|
169
|
+
}
|
|
@@ -111,3 +111,15 @@ function caml_binaryen_heap_type_is_sub_type(left, right) {
|
|
|
111
111
|
function caml_binaryen_type_get_heap_type(typ) {
|
|
112
112
|
return Binaryen._BinaryenTypeGetHeapType(typ);
|
|
113
113
|
}
|
|
114
|
+
|
|
115
|
+
//Provides: caml_binaryen_module_set_type_name
|
|
116
|
+
//Requires: caml_jsstring_of_string
|
|
117
|
+
function caml_binaryen_module_set_type_name(wasm_mod, heapType, name) {
|
|
118
|
+
wasm_mod.setTypeName(heapType, caml_jsstring_of_string(name));
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
//Provides: caml_binaryen_module_set_field_name
|
|
122
|
+
//Requires: caml_jsstring_of_string
|
|
123
|
+
function caml_binaryen_module_set_field_name(wasm_mod, heapType, index, name) {
|
|
124
|
+
wasm_mod.setFieldName(heapType, index, caml_jsstring_of_string(name));
|
|
125
|
+
}
|
|
@@ -17,4 +17,13 @@ external is_struct : t -> bool = "caml_binaryen_heap_type_is_struct"
|
|
|
17
17
|
external is_array : t -> bool = "caml_binaryen_heap_type_is_array"
|
|
18
18
|
external is_bottom : t -> bool = "caml_binaryen_heap_type_is_bottom"
|
|
19
19
|
external get_bottom : t -> t = "caml_binaryen_heap_type_get_bottom"
|
|
20
|
-
external is_sub_type : t -> bool = "caml_binaryen_heap_type_is_sub_type"
|
|
20
|
+
external is_sub_type : t -> t -> bool = "caml_binaryen_heap_type_is_sub_type"
|
|
21
|
+
|
|
22
|
+
external set_type_name : Module.t -> t -> string -> unit
|
|
23
|
+
= "caml_binaryen_module_set_type_name"
|
|
24
|
+
(** Sets the textual name of a compound `heapType`. Has no effect if the type
|
|
25
|
+
already has a canonical name. *)
|
|
26
|
+
|
|
27
|
+
external set_field_name : Module.t -> t -> int -> string -> unit
|
|
28
|
+
= "caml_binaryen_module_set_field_name"
|
|
29
|
+
(** Sets the field name of a struct `heapType` at index `index`. *)
|
|
@@ -17,4 +17,11 @@ val is_struct : t -> bool
|
|
|
17
17
|
val is_array : t -> bool
|
|
18
18
|
val is_bottom : t -> bool
|
|
19
19
|
val get_bottom : t -> t
|
|
20
|
-
val is_sub_type : t -> bool
|
|
20
|
+
val is_sub_type : t -> t -> bool
|
|
21
|
+
|
|
22
|
+
val set_type_name : Module.t -> t -> string -> unit
|
|
23
|
+
(** Sets the textual name of a compound `heapType`. Has no effect if the type
|
|
24
|
+
already has a canonical name. *)
|
|
25
|
+
|
|
26
|
+
val set_field_name : Module.t -> t -> int -> string -> unit
|
|
27
|
+
(** Sets the field name of a struct `heapType` at index `index`. *)
|
binaryen-archive/src/memory.c
CHANGED
|
@@ -121,7 +121,12 @@ caml_binaryen_get_memory_segment_byte_offset(value _module, value _name) {
|
|
|
121
121
|
CAMLparam2(_module, _name);
|
|
122
122
|
BinaryenModuleRef module = BinaryenModuleRef_val(_module);
|
|
123
123
|
char* name = Safe_String_val(_name);
|
|
124
|
-
|
|
124
|
+
if (BinaryenGetMemorySegmentPassive(module, name)) {
|
|
125
|
+
CAMLreturn(Val_none);
|
|
126
|
+
} else {
|
|
127
|
+
int offset = BinaryenGetMemorySegmentByteOffset(module, name);
|
|
128
|
+
CAMLreturn(caml_alloc_some(Val_int(offset)));
|
|
129
|
+
}
|
|
125
130
|
}
|
|
126
131
|
|
|
127
132
|
CAMLprim value
|
binaryen-archive/src/memory.js
CHANGED
|
@@ -112,10 +112,10 @@ function caml_binaryen_get_num_memory_segments(wasm_mod) {
|
|
|
112
112
|
}
|
|
113
113
|
|
|
114
114
|
//Provides: caml_binaryen_get_memory_segment_byte_offset
|
|
115
|
-
//Requires: caml_jsstring_of_string
|
|
115
|
+
//Requires: caml_jsstring_of_string, to_option
|
|
116
116
|
function caml_binaryen_get_memory_segment_byte_offset(wasm_mod, name) {
|
|
117
117
|
var info = wasm_mod.getMemorySegmentInfo(caml_jsstring_of_string(name));
|
|
118
|
-
return info.offset;
|
|
118
|
+
return to_option(info.offset);
|
|
119
119
|
}
|
|
120
120
|
|
|
121
121
|
//Provides: caml_binaryen_get_memory_segment_passive
|
binaryen-archive/src/memory.ml
CHANGED
|
@@ -71,7 +71,7 @@ let unlimited = -1
|
|
|
71
71
|
external get_num_segments : Module.t -> int
|
|
72
72
|
= "caml_binaryen_get_num_memory_segments"
|
|
73
73
|
|
|
74
|
-
external get_segment_byte_offset : Module.t -> string -> int
|
|
74
|
+
external get_segment_byte_offset : Module.t -> string -> int option
|
|
75
75
|
= "caml_binaryen_get_memory_segment_byte_offset"
|
|
76
76
|
|
|
77
77
|
external get_segment_passive : Module.t -> string -> bool
|
binaryen-archive/src/memory.mli
CHANGED
|
@@ -20,6 +20,6 @@ val is_shared : Module.t -> string -> bool
|
|
|
20
20
|
val is_64 : Module.t -> string -> bool
|
|
21
21
|
val unlimited : int
|
|
22
22
|
val get_num_segments : Module.t -> int
|
|
23
|
-
val get_segment_byte_offset : Module.t -> string -> int
|
|
23
|
+
val get_segment_byte_offset : Module.t -> string -> int option
|
|
24
24
|
val get_segment_passive : Module.t -> string -> bool
|
|
25
25
|
val get_segment_data : Module.t -> string -> bytes
|
binaryen-archive/src/module.js
CHANGED
|
@@ -17,36 +17,24 @@ function caml_binaryen_module_parse(text) {
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
//Provides: caml_binaryen_module_print
|
|
20
|
-
//Requires:
|
|
21
|
-
//Requires: caml_string_of_jsstring
|
|
22
|
-
//Requires: caml_ml_output, caml_ml_string_length
|
|
20
|
+
//Requires: caml_ml_output_str_stdout
|
|
23
21
|
function caml_binaryen_module_print(wasm_mod) {
|
|
24
22
|
var text = wasm_mod.emitText();
|
|
25
|
-
|
|
26
|
-
var s = caml_string_of_jsstring(text);
|
|
27
|
-
caml_ml_output(chanid, s, 0, caml_ml_string_length(s));
|
|
23
|
+
caml_ml_output_str_stdout(text);
|
|
28
24
|
}
|
|
29
25
|
|
|
30
26
|
//Provides: caml_binaryen_module_print_asmjs
|
|
31
|
-
//Requires:
|
|
32
|
-
//Requires: caml_string_of_jsstring
|
|
33
|
-
//Requires: caml_ml_output, caml_ml_string_length
|
|
27
|
+
//Requires: caml_ml_output_str_stdout
|
|
34
28
|
function caml_binaryen_module_print_asmjs(wasm_mod) {
|
|
35
29
|
var asm = wasm_mod.emitAsmjs();
|
|
36
|
-
|
|
37
|
-
var s = caml_string_of_jsstring(asm);
|
|
38
|
-
caml_ml_output(chanid, s, 0, caml_ml_string_length(s));
|
|
30
|
+
caml_ml_output_str_stdout(asm);
|
|
39
31
|
}
|
|
40
32
|
|
|
41
33
|
//Provides: caml_binaryen_module_print_stack_ir
|
|
42
|
-
//Requires:
|
|
43
|
-
//Requires: caml_string_of_jsstring
|
|
44
|
-
//Requires: caml_ml_output, caml_ml_string_length
|
|
34
|
+
//Requires: caml_ml_output_str_stdout
|
|
45
35
|
function caml_binaryen_module_print_stack_ir(wasm_mod) {
|
|
46
36
|
var stackir = wasm_mod.emitStackIR();
|
|
47
|
-
|
|
48
|
-
var s = caml_string_of_jsstring(stackir);
|
|
49
|
-
caml_ml_output(chanid, s, 0, caml_ml_string_length(s));
|
|
37
|
+
caml_ml_output_str_stdout(stackir);
|
|
50
38
|
}
|
|
51
39
|
|
|
52
40
|
//Provides: caml_binaryen_module_validate
|
|
@@ -132,6 +120,5 @@ function caml_binaryen_add_custom_section(wasm_mod, name, contents) {
|
|
|
132
120
|
|
|
133
121
|
//Provides: caml_binaryen_module_update_maps
|
|
134
122
|
function caml_binaryen_module_update_maps(wasm_mod) {
|
|
135
|
-
|
|
136
|
-
return;
|
|
123
|
+
return wasm_mod.updateMaps();
|
|
137
124
|
}
|
binaryen-archive/src/module.ml
CHANGED
|
@@ -98,6 +98,10 @@ module Feature = struct
|
|
|
98
98
|
|
|
99
99
|
let call_indirect_overlong = call_indirect_overlong ()
|
|
100
100
|
|
|
101
|
+
external relaxed_atomics : unit -> t = "caml_binaryen_feature_relaxed_atomics"
|
|
102
|
+
|
|
103
|
+
let relaxed_atomics = relaxed_atomics ()
|
|
104
|
+
|
|
101
105
|
external all : unit -> t = "caml_binaryen_feature_all"
|
|
102
106
|
|
|
103
107
|
let all = all ()
|