@grain/binaryen.ml 0.9.1 → 0.11.2
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 → binaryen-archive-v0.11.2}/.gitattributes +0 -0
- {binaryen-archive → binaryen-archive-v0.11.2}/.gitignore +1 -0
- {binaryen-archive → binaryen-archive-v0.11.2}/.gitmodules +0 -0
- {binaryen-archive → binaryen-archive-v0.11.2}/CHANGELOG.md +73 -0
- {binaryen-archive → binaryen-archive-v0.11.2}/LICENSE +0 -0
- {binaryen-archive → binaryen-archive-v0.11.2}/README.md +27 -3
- {binaryen-archive → binaryen-archive-v0.11.2}/binaryen.opam +8 -8
- {binaryen-archive → binaryen-archive-v0.11.2}/dune +0 -0
- {binaryen-archive → binaryen-archive-v0.11.2}/dune-project +0 -0
- {binaryen-archive → binaryen-archive-v0.11.2}/dune-workspace +0 -0
- {binaryen-archive → binaryen-archive-v0.11.2}/esy.lock/.gitattributes +0 -0
- {binaryen-archive → binaryen-archive-v0.11.2}/esy.lock/.gitignore +0 -0
- binaryen-archive-v0.11.2/esy.lock/index.json +1365 -0
- {binaryen-archive → binaryen-archive-v0.11.2}/esy.lock/opam/astring.0.8.5/opam +0 -0
- {binaryen-archive → binaryen-archive-v0.11.2}/esy.lock/opam/base-threads.base/opam +0 -0
- {binaryen-archive → binaryen-archive-v0.11.2}/esy.lock/opam/base-unix.base/opam +0 -0
- {binaryen-archive/esy.lock/opam/base.v0.14.1 → binaryen-archive-v0.11.2/esy.lock/opam/base.v0.14.2}/opam +4 -4
- {binaryen-archive → binaryen-archive-v0.11.2}/esy.lock/opam/biniou.1.2.1/opam +1 -1
- {binaryen-archive → binaryen-archive-v0.11.2}/esy.lock/opam/cmdliner.1.0.4/opam +0 -0
- {binaryen-archive/esy.lock/opam/cppo.1.6.7 → binaryen-archive-v0.11.2/esy.lock/opam/cppo.1.6.8}/opam +4 -6
- {binaryen-archive/esy.lock/opam/csexp.1.4.0 → binaryen-archive-v0.11.2/esy.lock/opam/csexp.1.5.1}/opam +11 -9
- {binaryen-archive/esy.lock/opam/dune-build-info.2.8.2 → binaryen-archive-v0.11.2/esy.lock/opam/dune-build-info.2.9.1}/opam +5 -5
- {binaryen-archive/esy.lock/opam/dune-configurator.2.8.2 → binaryen-archive-v0.11.2/esy.lock/opam/dune-configurator.2.9.1}/opam +5 -5
- {binaryen-archive/esy.lock/opam/dune.2.8.2 → binaryen-archive-v0.11.2/esy.lock/opam/dune.2.9.1}/opam +4 -4
- {binaryen-archive → binaryen-archive-v0.11.2}/esy.lock/opam/easy-format.1.3.2/opam +1 -1
- {binaryen-archive/esy.lock/opam/fix.20201120 → binaryen-archive-v0.11.2/esy.lock/opam/fix.20211231}/opam +7 -5
- {binaryen-archive → binaryen-archive-v0.11.2}/esy.lock/opam/fpath.0.7.3/opam +0 -0
- binaryen-archive-v0.11.2/esy.lock/opam/js_of_ocaml-compiler.3.11.0/opam +54 -0
- binaryen-archive-v0.11.2/esy.lock/opam/js_of_ocaml-ppx.3.11.0/opam +44 -0
- binaryen-archive-v0.11.2/esy.lock/opam/js_of_ocaml.3.11.0/opam +45 -0
- {binaryen-archive/esy.lock/opam/menhir.20201216 → binaryen-archive-v0.11.2/esy.lock/opam/menhir.20211128}/opam +8 -6
- {binaryen-archive/esy.lock/opam/menhirLib.20201216 → binaryen-archive-v0.11.2/esy.lock/opam/menhirLib.20211128}/opam +8 -6
- {binaryen-archive/esy.lock/opam/menhirSdk.20201216 → binaryen-archive-v0.11.2/esy.lock/opam/menhirSdk.20211128}/opam +8 -6
- binaryen-archive-v0.11.2/esy.lock/opam/ocaml-compiler-libs.v0.12.4/opam +39 -0
- {binaryen-archive/esy.lock/opam/ocaml-lsp-server.1.4.0 → binaryen-archive-v0.11.2/esy.lock/opam/ocaml-lsp-server.1.9.0}/opam +15 -12
- {binaryen-archive/esy.lock/opam/ocaml-migrate-parsetree.2.1.0 → binaryen-archive-v0.11.2/esy.lock/opam/ocaml-migrate-parsetree.2.3.0}/opam +13 -10
- binaryen-archive-v0.11.2/esy.lock/opam/ocaml-version.3.4.0/opam +49 -0
- {binaryen-archive → binaryen-archive-v0.11.2}/esy.lock/opam/ocamlbuild.0.14.0/opam +1 -1
- {binaryen-archive/esy.lock/opam/ocamlfind.1.8.1 → binaryen-archive-v0.11.2/esy.lock/opam/ocamlfind.1.9.1}/opam +19 -39
- binaryen-archive-v0.11.2/esy.lock/opam/ocamlformat-rpc-lib.0.19.0/opam +40 -0
- binaryen-archive-v0.11.2/esy.lock/opam/ocamlformat.0.18.0/opam +56 -0
- {binaryen-archive/esy.lock/opam/odoc.1.5.2 → binaryen-archive-v0.11.2/esy.lock/opam/odoc.1.5.3}/opam +12 -12
- binaryen-archive-v0.11.2/esy.lock/opam/pp.1.1.2/opam +58 -0
- {binaryen-archive → binaryen-archive-v0.11.2}/esy.lock/opam/ppx_derivers.1.2.1/opam +1 -1
- {binaryen-archive → binaryen-archive-v0.11.2}/esy.lock/opam/ppx_yojson_conv_lib.v0.14.0/opam +2 -2
- {binaryen-archive/esy.lock/opam/ppxlib.0.21.0 → binaryen-archive-v0.11.2/esy.lock/opam/ppxlib.0.22.2}/opam +40 -32
- {binaryen-archive/esy.lock/opam/re.1.9.0 → binaryen-archive-v0.11.2/esy.lock/opam/re.1.10.3}/opam +8 -4
- {binaryen-archive → binaryen-archive-v0.11.2}/esy.lock/opam/result.1.5/opam +2 -2
- {binaryen-archive → binaryen-archive-v0.11.2}/esy.lock/opam/seq.base/files/META.seq +0 -0
- {binaryen-archive → binaryen-archive-v0.11.2}/esy.lock/opam/seq.base/files/seq.install +0 -0
- {binaryen-archive → binaryen-archive-v0.11.2}/esy.lock/opam/seq.base/opam +0 -0
- {binaryen-archive → binaryen-archive-v0.11.2}/esy.lock/opam/sexplib0.v0.14.0/opam +2 -2
- binaryen-archive-v0.11.2/esy.lock/opam/spawn.v0.15.0/opam +56 -0
- {binaryen-archive → binaryen-archive-v0.11.2}/esy.lock/opam/stdio.v0.14.0/opam +2 -2
- {binaryen-archive → binaryen-archive-v0.11.2}/esy.lock/opam/stdlib-shims.0.3.0/opam +0 -0
- {binaryen-archive/esy.lock/opam/topkg.1.0.3 → binaryen-archive-v0.11.2/esy.lock/opam/topkg.1.0.4}/opam +18 -22
- binaryen-archive-v0.11.2/esy.lock/opam/tyxml.4.5.0/opam +42 -0
- {binaryen-archive → binaryen-archive-v0.11.2}/esy.lock/opam/uchar.0.0.2/opam +0 -0
- binaryen-archive-v0.11.2/esy.lock/opam/uucp.14.0.0/opam +41 -0
- {binaryen-archive/esy.lock/opam/uuseg.13.0.0 → binaryen-archive-v0.11.2/esy.lock/opam/uuseg.14.0.0}/opam +22 -28
- {binaryen-archive → binaryen-archive-v0.11.2}/esy.lock/opam/uutf.1.0.2/opam +0 -0
- {binaryen-archive → binaryen-archive-v0.11.2}/esy.lock/opam/yojson.1.7.0/opam +1 -1
- {binaryen-archive → binaryen-archive-v0.11.2}/esy.lock/overrides/opam__s__ocamlbuild_opam__c__0.14.0_opam_override/files/ocamlbuild-0.14.0.patch +0 -0
- {binaryen-archive → binaryen-archive-v0.11.2}/esy.lock/overrides/opam__s__ocamlbuild_opam__c__0.14.0_opam_override/package.json +0 -0
- binaryen-archive/esy.lock/overrides/opam__s__ocamlfind_opam__c__1.8.1_opam_override/files/findlib-1.8.1.patch → binaryen-archive-v0.11.2/esy.lock/overrides/opam__s__ocamlfind_opam__c__1.9.1_opam_override/files/findlib-1.9.1.patch +0 -0
- {binaryen-archive/esy.lock/overrides/opam__s__ocamlfind_opam__c__1.8.1_opam_override → binaryen-archive-v0.11.2/esy.lock/overrides/opam__s__ocamlfind_opam__c__1.9.1_opam_override}/package.json +1 -1
- binaryen-archive-v0.11.2/js/binaryen.es5.js +5 -0
- {binaryen-archive → binaryen-archive-v0.11.2}/js/dune +1 -6
- binaryen-archive-v0.11.2/js/element_segment.ml +33 -0
- binaryen-archive-v0.11.2/js/export.ml +60 -0
- binaryen-archive-v0.11.2/js/expression.ml +944 -0
- binaryen-archive-v0.11.2/js/function.ml +60 -0
- binaryen-archive-v0.11.2/js/global.ml +48 -0
- {binaryen-archive → binaryen-archive-v0.11.2}/js/import.ml +24 -0
- {binaryen-archive → binaryen-archive-v0.11.2}/js/literal.ml +0 -0
- {binaryen-archive → binaryen-archive-v0.11.2}/js/memory.ml +0 -0
- {binaryen-archive → binaryen-archive-v0.11.2}/js/module.ml +42 -46
- {binaryen-archive → binaryen-archive-v0.11.2}/js/op.ml +9 -78
- binaryen-archive-v0.11.2/js/postlude.js +2 -0
- binaryen-archive-v0.11.2/js/prelude.js +11 -0
- binaryen-archive-v0.11.2/js/settings.ml +60 -0
- {binaryen-archive → binaryen-archive-v0.11.2}/js/stubs.c +0 -0
- binaryen-archive-v0.11.2/js/table.ml +29 -0
- {binaryen-archive → binaryen-archive-v0.11.2}/js/type.ml +3 -0
- binaryen-archive-v0.11.2/package.json +37 -0
- {binaryen-archive → binaryen-archive-v0.11.2}/src/binaryen_stubs_exports.c +78 -0
- binaryen-archive-v0.11.2/src/binaryen_stubs_expressions.c +1710 -0
- {binaryen-archive → binaryen-archive-v0.11.2}/src/binaryen_stubs_features.c +7 -0
- {binaryen-archive → binaryen-archive-v0.11.2}/src/binaryen_stubs_functions.c +78 -0
- binaryen-archive-v0.11.2/src/binaryen_stubs_globals.c +109 -0
- {binaryen-archive → binaryen-archive-v0.11.2}/src/binaryen_stubs_imports.c +29 -0
- {binaryen-archive → binaryen-archive-v0.11.2}/src/binaryen_stubs_literals.c +0 -0
- {binaryen-archive → binaryen-archive-v0.11.2}/src/binaryen_stubs_memory.c +1 -1
- {binaryen-archive → binaryen-archive-v0.11.2}/src/binaryen_stubs_modules.c +0 -122
- {binaryen-archive → binaryen-archive-v0.11.2}/src/binaryen_stubs_ops.c +19 -173
- binaryen-archive-v0.11.2/src/binaryen_stubs_settings.c +145 -0
- binaryen-archive-v0.11.2/src/binaryen_stubs_tables.c +145 -0
- {binaryen-archive → binaryen-archive-v0.11.2}/src/binaryen_stubs_types.c +18 -0
- binaryen-archive-v0.11.2/src/dune +14 -0
- binaryen-archive-v0.11.2/src/element_segment.ml +13 -0
- binaryen-archive-v0.11.2/src/export.ml +54 -0
- binaryen-archive-v0.11.2/src/expression.ml +844 -0
- {binaryen-archive → binaryen-archive-v0.11.2}/src/function.ml +18 -0
- binaryen-archive-v0.11.2/src/global.ml +24 -0
- {binaryen-archive → binaryen-archive-v0.11.2}/src/import.ml +12 -0
- {binaryen-archive → binaryen-archive-v0.11.2}/src/literal.ml +0 -0
- {binaryen-archive → binaryen-archive-v0.11.2}/src/memory.ml +0 -0
- binaryen-archive-v0.11.2/src/module.ml +115 -0
- {binaryen-archive → binaryen-archive-v0.11.2}/src/ocaml_helpers.c +0 -8
- {binaryen-archive → binaryen-archive-v0.11.2}/src/ocaml_helpers.h +2 -3
- {binaryen-archive → binaryen-archive-v0.11.2}/src/op.ml +18 -131
- binaryen-archive-v0.11.2/src/settings.ml +45 -0
- binaryen-archive-v0.11.2/src/table.ml +26 -0
- {binaryen-archive → binaryen-archive-v0.11.2}/src/type.ml +2 -0
- binaryen-archive-v0.11.2/test/config/dune +8 -0
- binaryen-archive-v0.11.2/test/config/ocamlopt_flags.ml +16 -0
- {binaryen-archive → binaryen-archive-v0.11.2}/test/dune +4 -0
- {binaryen-archive → binaryen-archive-v0.11.2}/test/test.expected +38 -5
- binaryen-archive-v0.11.2/test/test.ml +147 -0
- binaryen-archive-v0.11.2/virtual/dune +6 -0
- binaryen-archive-v0.11.2/virtual/element_segment.mli +11 -0
- binaryen-archive-v0.11.2/virtual/export.mli +33 -0
- binaryen-archive-v0.11.2/virtual/expression.mli +423 -0
- {binaryen-archive → binaryen-archive-v0.11.2}/virtual/function.mli +16 -0
- binaryen-archive-v0.11.2/virtual/global.mli +19 -0
- {binaryen-archive → binaryen-archive-v0.11.2}/virtual/import.mli +8 -0
- {binaryen-archive → binaryen-archive-v0.11.2}/virtual/literal.mli +0 -0
- {binaryen-archive → binaryen-archive-v0.11.2}/virtual/memory.mli +0 -0
- binaryen-archive-v0.11.2/virtual/module.mli +65 -0
- {binaryen-archive → binaryen-archive-v0.11.2}/virtual/op.mli +9 -53
- binaryen-archive-v0.11.2/virtual/settings.mli +35 -0
- binaryen-archive-v0.11.2/virtual/table.mli +19 -0
- {binaryen-archive → binaryen-archive-v0.11.2}/virtual/type.mli +2 -0
- binaryen-archive/esy.lock/index.json +0 -1288
- binaryen-archive/esy.lock/opam/conf-m4.1/opam +0 -22
- binaryen-archive/esy.lock/opam/dot-merlin-reader.4.1/opam +0 -30
- binaryen-archive/esy.lock/opam/js_of_ocaml-compiler.3.9.1/opam +0 -40
- binaryen-archive/esy.lock/opam/js_of_ocaml-ppx.3.9.0/opam +0 -30
- binaryen-archive/esy.lock/opam/js_of_ocaml.3.9.0/opam +0 -31
- binaryen-archive/esy.lock/opam/ocaml-compiler-libs.v0.12.3/opam +0 -29
- binaryen-archive/esy.lock/opam/ocamlfind.1.8.1/files/ocaml-stub +0 -4
- binaryen-archive/esy.lock/opam/ocamlfind.1.8.1/files/ocamlfind.install +0 -6
- binaryen-archive/esy.lock/opam/ocamlformat.0.15.1/opam +0 -41
- binaryen-archive/esy.lock/opam/tyxml.4.4.0/opam +0 -47
- binaryen-archive/esy.lock/opam/uucp.13.0.0/opam +0 -44
- binaryen-archive/esy.lock/overrides/opam__s__conf_m4_opam__c__1_opam_override/package.json +0 -6
- binaryen-archive/js/export.ml +0 -23
- binaryen-archive/js/expression.ml +0 -185
- binaryen-archive/js/features.ml +0 -27
- binaryen-archive/js/function.ml +0 -29
- binaryen-archive/js/function_table.ml +0 -13
- binaryen-archive/js/global.ml +0 -19
- binaryen-archive/js/postlude.js +0 -2
- binaryen-archive/js/table.ml +0 -12
- binaryen-archive/package.json +0 -43
- binaryen-archive/src/binaryen_stubs_expressions.c +0 -410
- binaryen-archive/src/binaryen_stubs_function_tables.c +0 -25
- binaryen-archive/src/binaryen_stubs_globals.c +0 -46
- binaryen-archive/src/binaryen_stubs_tables.c +0 -31
- binaryen-archive/src/config/dune +0 -8
- binaryen-archive/src/config/library_flags.ml +0 -16
- binaryen-archive/src/dune +0 -53
- binaryen-archive/src/export.ml +0 -21
- binaryen-archive/src/expression.ml +0 -115
- binaryen-archive/src/features.ml +0 -49
- binaryen-archive/src/function_table.ml +0 -6
- binaryen-archive/src/global.ml +0 -10
- binaryen-archive/src/module.ml +0 -89
- binaryen-archive/src/table.ml +0 -4
- binaryen-archive/test/test.ml +0 -83
- binaryen-archive/vendor/binaryen-c.h +0 -2647
- binaryen-archive/vendor/js/index.es5.js +0 -5
- binaryen-archive/vendor/linux/libbinaryen.a +0 -0
- binaryen-archive/vendor/linux/libbinaryen.so +0 -0
- binaryen-archive/vendor/macosx/libbinaryen.a +0 -0
- binaryen-archive/vendor/macosx/libbinaryen.dylib +0 -0
- binaryen-archive/vendor/mingw64/libbinaryen.a +0 -0
- binaryen-archive/vendor/mingw64/libbinaryen.dll +0 -0
- binaryen-archive/vendor/wasm-delegations.h +0 -85
- binaryen-archive/virtual/dune +0 -6
- binaryen-archive/virtual/export.mli +0 -11
- binaryen-archive/virtual/expression.mli +0 -68
- binaryen-archive/virtual/features.mli +0 -23
- binaryen-archive/virtual/function_table.mli +0 -4
- binaryen-archive/virtual/global.mli +0 -7
- binaryen-archive/virtual/module.mli +0 -67
- binaryen-archive/virtual/table.mli +0 -2
binaryen-archive/package.json
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@grain/binaryen.ml",
|
|
3
|
-
"version": "0.9.1",
|
|
4
|
-
"description": "OCaml bindings for Binaryen.",
|
|
5
|
-
"author": "Oscar Spencer <oscar@grain-lang.org>",
|
|
6
|
-
"license": "Apache-2.0",
|
|
7
|
-
"dependencies": {
|
|
8
|
-
"ocaml": ">= 4.9.0 < 4.12.0",
|
|
9
|
-
"@opam/dune": "^2.7.1",
|
|
10
|
-
"@opam/dune-configurator": "^2.7.1",
|
|
11
|
-
"@opam/js_of_ocaml": "^3.6.0",
|
|
12
|
-
"@opam/js_of_ocaml-ppx": "^3.6.0"
|
|
13
|
-
},
|
|
14
|
-
"devDependencies": {
|
|
15
|
-
"@opam/js_of_ocaml-compiler": "^3.6.0",
|
|
16
|
-
"@opam/ocamlformat": "^0.15.0",
|
|
17
|
-
"@opam/ocaml-lsp-server": "^1.1.0"
|
|
18
|
-
},
|
|
19
|
-
"esy": {
|
|
20
|
-
"build": "dune build -p binaryen",
|
|
21
|
-
"buildEnv": {
|
|
22
|
-
"DUNE_BUILD_DIR": "#{self.target_dir}",
|
|
23
|
-
"PATH": "#{os == 'windows' ? '/usr/x86_64-w64-mingw32/sys-root/mingw/bin' : '' : $PATH }"
|
|
24
|
-
},
|
|
25
|
-
"exportedEnv": {
|
|
26
|
-
"PATH": {
|
|
27
|
-
"val": "#{os == 'windows' ? '/usr/x86_64-w64-mingw32/sys-root/mingw/bin' : '' : $PATH }",
|
|
28
|
-
"scope": "global"
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
},
|
|
32
|
-
"scripts": {
|
|
33
|
-
"test": "esy b dune runtest",
|
|
34
|
-
"format": "dune build @fmt --auto-promote"
|
|
35
|
-
},
|
|
36
|
-
"installConfig": {
|
|
37
|
-
"pnp": false
|
|
38
|
-
},
|
|
39
|
-
"keywords": [
|
|
40
|
-
"binaryen",
|
|
41
|
-
"ocaml"
|
|
42
|
-
]
|
|
43
|
-
}
|
|
@@ -1,410 +0,0 @@
|
|
|
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
|
-
|
|
10
|
-
/* Allocating an OCaml custom block to hold the given BinaryenExpressionRef */
|
|
11
|
-
static value alloc_BinaryenExpressionRef(BinaryenExpressionRef exp)
|
|
12
|
-
{
|
|
13
|
-
value v = caml_alloc_custom(&binaryen_ops, sizeof(BinaryenExpressionRef), 0, 1);
|
|
14
|
-
BinaryenExpressionRef_val(v) = exp;
|
|
15
|
-
return v;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
CAMLprim value
|
|
19
|
-
caml_binaryen_null_expression(value unit) {
|
|
20
|
-
CAMLparam1(unit);
|
|
21
|
-
CAMLreturn(alloc_BinaryenExpressionRef(NULL));
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
CAMLprim value
|
|
25
|
-
caml_binaryen_block(value _module, value _name, value _children, value _ty) {
|
|
26
|
-
CAMLparam4(_module, _name, _children, _ty);
|
|
27
|
-
BinaryenModuleRef module = BinaryenModuleRef_val(_module);
|
|
28
|
-
char* name = Safe_String_val(_name);
|
|
29
|
-
_children = array_of_list(_children);
|
|
30
|
-
int childLen = array_length(_children);
|
|
31
|
-
BinaryenExpressionRef children[childLen];
|
|
32
|
-
for (int i = 0; i < childLen; i++) {
|
|
33
|
-
children[i] = BinaryenExpressionRef_val(Field(_children, i));
|
|
34
|
-
}
|
|
35
|
-
BinaryenType ty = BinaryenType_val(_ty);
|
|
36
|
-
BinaryenExpressionRef block = BinaryenBlock(module, name, children, childLen, ty);
|
|
37
|
-
CAMLreturn(alloc_BinaryenExpressionRef(block));
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
CAMLprim value
|
|
41
|
-
caml_binaryen_if(value _module, value _cond, value _tru, value _fals) {
|
|
42
|
-
CAMLparam4(_module, _cond, _tru, _fals);
|
|
43
|
-
BinaryenModuleRef module = BinaryenModuleRef_val(_module);
|
|
44
|
-
BinaryenExpressionRef cond = BinaryenExpressionRef_val(_cond);
|
|
45
|
-
BinaryenExpressionRef tru = BinaryenExpressionRef_val(_tru);
|
|
46
|
-
BinaryenExpressionRef fals = BinaryenExpressionRef_val(_fals);
|
|
47
|
-
BinaryenExpressionRef exp = BinaryenIf(module, cond, tru, fals);
|
|
48
|
-
CAMLreturn(alloc_BinaryenExpressionRef(exp));
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
CAMLprim value
|
|
52
|
-
caml_binaryen_loop(value _module, value _name, value _body) {
|
|
53
|
-
CAMLparam3(_module, _name, _body);
|
|
54
|
-
BinaryenModuleRef module = BinaryenModuleRef_val(_module);
|
|
55
|
-
char* name = Safe_String_val(_name);
|
|
56
|
-
BinaryenExpressionRef body = BinaryenExpressionRef_val(_body);
|
|
57
|
-
BinaryenExpressionRef exp = BinaryenLoop(module, name, body);
|
|
58
|
-
CAMLreturn(alloc_BinaryenExpressionRef(exp));
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
CAMLprim value
|
|
62
|
-
caml_binaryen_break(value _module, value _name, value _cond, value _res) {
|
|
63
|
-
CAMLparam4(_module, _name, _cond, _res);
|
|
64
|
-
BinaryenModuleRef module = BinaryenModuleRef_val(_module);
|
|
65
|
-
char* name = Safe_String_val(_name);
|
|
66
|
-
BinaryenExpressionRef cond = BinaryenExpressionRef_val(_cond);
|
|
67
|
-
BinaryenExpressionRef res = BinaryenExpressionRef_val(_res);
|
|
68
|
-
BinaryenExpressionRef exp = BinaryenBreak(module, name, cond, res);
|
|
69
|
-
CAMLreturn(alloc_BinaryenExpressionRef(exp));
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
CAMLprim value
|
|
73
|
-
caml_binaryen_switch(value _module, value _names, value _defaultName, value _cond, value _val) {
|
|
74
|
-
CAMLparam5(_module, _names, _defaultName, _cond, _val);
|
|
75
|
-
BinaryenModuleRef module = BinaryenModuleRef_val(_module);
|
|
76
|
-
_names = array_of_list(_names);
|
|
77
|
-
int namesLen = array_length(_names);
|
|
78
|
-
const char* names[namesLen];
|
|
79
|
-
for (int i = 0; i < namesLen; i++) {
|
|
80
|
-
names[i] = Safe_String_val(Field(_names, i));
|
|
81
|
-
}
|
|
82
|
-
char* defaultName = Safe_String_val(_defaultName);
|
|
83
|
-
BinaryenExpressionRef cond = BinaryenExpressionRef_val(_cond);
|
|
84
|
-
BinaryenExpressionRef val = BinaryenExpressionRef_val(_val);
|
|
85
|
-
BinaryenExpressionRef exp = BinaryenSwitch(module, names, namesLen, defaultName, cond, val);
|
|
86
|
-
CAMLreturn(alloc_BinaryenExpressionRef(exp));
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
CAMLprim value
|
|
90
|
-
caml_binaryen_call(value _module, value _name, value _params, value _retty) {
|
|
91
|
-
CAMLparam4(_module, _name, _params, _retty);
|
|
92
|
-
BinaryenModuleRef module = BinaryenModuleRef_val(_module);
|
|
93
|
-
char* name = Safe_String_val(_name);
|
|
94
|
-
_params = array_of_list(_params);
|
|
95
|
-
int paramsLen = array_length(_params);
|
|
96
|
-
BinaryenExpressionRef params[paramsLen];
|
|
97
|
-
for (int i = 0; i < paramsLen; i++) {
|
|
98
|
-
params[i] = BinaryenExpressionRef_val(Field(_params, i));
|
|
99
|
-
}
|
|
100
|
-
BinaryenType retty = BinaryenType_val(_retty);
|
|
101
|
-
BinaryenExpressionRef exp = BinaryenCall(module, name, params, paramsLen, retty);
|
|
102
|
-
CAMLreturn(alloc_BinaryenExpressionRef(exp));
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
CAMLprim value
|
|
106
|
-
caml_binaryen_call_indirect(value _module, value _table, value _target, value _params, value _paramsty, value _retty) {
|
|
107
|
-
CAMLparam5(_module, _table, _target, _params, _paramsty);
|
|
108
|
-
CAMLxparam1(_retty);
|
|
109
|
-
BinaryenModuleRef module = BinaryenModuleRef_val(_module);
|
|
110
|
-
char* table = Safe_String_val(_table);
|
|
111
|
-
BinaryenExpressionRef target = BinaryenExpressionRef_val(_target);
|
|
112
|
-
_params = array_of_list(_params);
|
|
113
|
-
int paramsLen = array_length(_params);
|
|
114
|
-
BinaryenExpressionRef params[paramsLen];
|
|
115
|
-
for (int i = 0; i < paramsLen; i++) {
|
|
116
|
-
params[i] = BinaryenExpressionRef_val(Field(_params, i));
|
|
117
|
-
}
|
|
118
|
-
BinaryenType paramsty = BinaryenType_val(_paramsty);
|
|
119
|
-
BinaryenType retty = BinaryenType_val(_retty);
|
|
120
|
-
BinaryenExpressionRef exp = BinaryenCallIndirect(module, table, target, params, paramsLen, paramsty, retty);
|
|
121
|
-
CAMLreturn(alloc_BinaryenExpressionRef(exp));
|
|
122
|
-
}
|
|
123
|
-
CAMLprim value
|
|
124
|
-
caml_binaryen_call_indirect__bytecode(value * argv) {
|
|
125
|
-
return caml_binaryen_call_indirect(argv[0], argv[1], argv[2], argv[3], argv[4], argv[5]);
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
CAMLprim value
|
|
129
|
-
caml_binaryen_return_call(value _module, value _name, value _params, value _retty) {
|
|
130
|
-
CAMLparam4(_module, _name, _params, _retty);
|
|
131
|
-
BinaryenModuleRef module = BinaryenModuleRef_val(_module);
|
|
132
|
-
char* name = Safe_String_val(_name);
|
|
133
|
-
_params = array_of_list(_params);
|
|
134
|
-
int paramsLen = array_length(_params);
|
|
135
|
-
BinaryenExpressionRef params[paramsLen];
|
|
136
|
-
for (int i = 0; i < paramsLen; i++) {
|
|
137
|
-
params[i] = BinaryenExpressionRef_val(Field(_params, i));
|
|
138
|
-
}
|
|
139
|
-
BinaryenType retty = BinaryenType_val(_retty);
|
|
140
|
-
BinaryenExpressionRef exp = BinaryenReturnCall(module, name, params, paramsLen, retty);
|
|
141
|
-
CAMLreturn(alloc_BinaryenExpressionRef(exp));
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
CAMLprim value
|
|
145
|
-
caml_binaryen_return_call_indirect(value _module, value _table, value _target, value _params, value _paramsty, value _retty) {
|
|
146
|
-
CAMLparam5(_module, _table, _target, _params, _paramsty);
|
|
147
|
-
CAMLxparam1(_retty);
|
|
148
|
-
BinaryenModuleRef module = BinaryenModuleRef_val(_module);
|
|
149
|
-
char* table = Safe_String_val(_table);
|
|
150
|
-
BinaryenExpressionRef target = BinaryenExpressionRef_val(_target);
|
|
151
|
-
_params = array_of_list(_params);
|
|
152
|
-
int paramsLen = array_length(_params);
|
|
153
|
-
BinaryenExpressionRef params[paramsLen];
|
|
154
|
-
for (int i = 0; i < paramsLen; i++) {
|
|
155
|
-
params[i] = BinaryenExpressionRef_val(Field(_params, i));
|
|
156
|
-
}
|
|
157
|
-
BinaryenType paramsty = BinaryenType_val(_paramsty);
|
|
158
|
-
BinaryenType retty = BinaryenType_val(_retty);
|
|
159
|
-
BinaryenExpressionRef exp = BinaryenReturnCallIndirect(module, table, target, params, paramsLen, paramsty, retty);
|
|
160
|
-
CAMLreturn(alloc_BinaryenExpressionRef(exp));
|
|
161
|
-
}
|
|
162
|
-
CAMLprim value
|
|
163
|
-
caml_binaryen_return_call_indirect__bytecode(value * argv) {
|
|
164
|
-
return caml_binaryen_return_call_indirect(argv[0], argv[1], argv[2], argv[3], argv[4], argv[5]);
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
CAMLprim value
|
|
168
|
-
caml_binaryen_local_get(value _module, value _slot, value _ty) {
|
|
169
|
-
CAMLparam3(_module, _slot, _ty);
|
|
170
|
-
BinaryenModuleRef module = BinaryenModuleRef_val(_module);
|
|
171
|
-
int slot = Int_val(_slot);
|
|
172
|
-
BinaryenType ty = BinaryenType_val(_ty);
|
|
173
|
-
BinaryenExpressionRef exp = BinaryenLocalGet(module, slot, ty);
|
|
174
|
-
CAMLreturn(alloc_BinaryenExpressionRef(exp));
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
CAMLprim value
|
|
178
|
-
caml_binaryen_local_set(value _module, value _slot, value _val) {
|
|
179
|
-
CAMLparam3(_module, _slot, _val);
|
|
180
|
-
BinaryenModuleRef module = BinaryenModuleRef_val(_module);
|
|
181
|
-
int slot = Int_val(_slot);
|
|
182
|
-
BinaryenExpressionRef val = BinaryenExpressionRef_val(_val);
|
|
183
|
-
BinaryenExpressionRef exp = BinaryenLocalSet(module, slot, val);
|
|
184
|
-
CAMLreturn(alloc_BinaryenExpressionRef(exp));
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
CAMLprim value
|
|
188
|
-
caml_binaryen_local_tee(value _module, value _slot, value _val, value _ty) {
|
|
189
|
-
CAMLparam4(_module, _slot, _val, _ty);
|
|
190
|
-
BinaryenModuleRef module = BinaryenModuleRef_val(_module);
|
|
191
|
-
int slot = Int_val(_slot);
|
|
192
|
-
BinaryenExpressionRef val = BinaryenExpressionRef_val(_val);
|
|
193
|
-
BinaryenType ty = BinaryenType_val(_ty);
|
|
194
|
-
BinaryenExpressionRef exp = BinaryenLocalTee(module, slot, val, ty);
|
|
195
|
-
CAMLreturn(alloc_BinaryenExpressionRef(exp));
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
CAMLprim value
|
|
199
|
-
caml_binaryen_global_get(value _module, value _name, value _ty) {
|
|
200
|
-
CAMLparam3(_module, _name, _ty);
|
|
201
|
-
BinaryenModuleRef module = BinaryenModuleRef_val(_module);
|
|
202
|
-
char* name = Safe_String_val(_name);
|
|
203
|
-
BinaryenType ty = BinaryenType_val(_ty);
|
|
204
|
-
BinaryenExpressionRef exp = BinaryenGlobalGet(module, name, ty);
|
|
205
|
-
CAMLreturn(alloc_BinaryenExpressionRef(exp));
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
CAMLprim value
|
|
209
|
-
caml_binaryen_global_set(value _module, value _name, value _val) {
|
|
210
|
-
CAMLparam3(_module, _name, _val);
|
|
211
|
-
BinaryenModuleRef module = BinaryenModuleRef_val(_module);
|
|
212
|
-
char* name = Safe_String_val(_name);
|
|
213
|
-
BinaryenExpressionRef val = BinaryenExpressionRef_val(_val);
|
|
214
|
-
BinaryenExpressionRef exp = BinaryenGlobalSet(module, name, val);
|
|
215
|
-
CAMLreturn(alloc_BinaryenExpressionRef(exp));
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
CAMLprim value
|
|
219
|
-
caml_binaryen_load(value _module, value _bytes, value _signed_, value _offset, value _align, value _ty, value _ptr) {
|
|
220
|
-
CAMLparam5(_module, _bytes, _signed_, _offset, _align);
|
|
221
|
-
CAMLxparam2(_ty, _ptr);
|
|
222
|
-
BinaryenModuleRef module = BinaryenModuleRef_val(_module);
|
|
223
|
-
int bytes = Int_val(_bytes);
|
|
224
|
-
int8_t signed_ = Bool_val(_signed_);
|
|
225
|
-
int offset = Int_val(_offset);
|
|
226
|
-
int align = Int_val(_align);
|
|
227
|
-
BinaryenType ty = BinaryenType_val(_ty);
|
|
228
|
-
BinaryenExpressionRef ptr = BinaryenExpressionRef_val(_ptr);
|
|
229
|
-
BinaryenExpressionRef exp = BinaryenLoad(module, bytes, signed_, offset, align, ty, ptr);
|
|
230
|
-
CAMLreturn(alloc_BinaryenExpressionRef(exp));
|
|
231
|
-
}
|
|
232
|
-
CAMLprim value
|
|
233
|
-
caml_binaryen_load__bytecode(value * argv) {
|
|
234
|
-
return caml_binaryen_load(argv[0], argv[1], argv[2], argv[3], argv[4], argv[5], argv[6]);
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
CAMLprim value
|
|
238
|
-
caml_binaryen_store(value _module, value _bytes, value _offset, value _align, value _ptr, value _val, value _ty) {
|
|
239
|
-
CAMLparam5(_module, _bytes, _offset, _align, _ptr);
|
|
240
|
-
CAMLxparam2(_val, _ty);
|
|
241
|
-
BinaryenModuleRef module = BinaryenModuleRef_val(_module);
|
|
242
|
-
int bytes = Int_val(_bytes);
|
|
243
|
-
int offset = Int_val(_offset);
|
|
244
|
-
int align = Int_val(_align);
|
|
245
|
-
BinaryenExpressionRef ptr = BinaryenExpressionRef_val(_ptr);
|
|
246
|
-
BinaryenExpressionRef val = BinaryenExpressionRef_val(_val);
|
|
247
|
-
BinaryenType ty = BinaryenType_val(_ty);
|
|
248
|
-
BinaryenExpressionRef exp = BinaryenStore(module, bytes, offset, align, ptr, val, ty);
|
|
249
|
-
CAMLreturn(alloc_BinaryenExpressionRef(exp));
|
|
250
|
-
}
|
|
251
|
-
CAMLprim value
|
|
252
|
-
caml_binaryen_store__bytecode(value * argv) {
|
|
253
|
-
return caml_binaryen_store(argv[0], argv[1], argv[2], argv[3], argv[4], argv[5], argv[6]);
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
CAMLprim value
|
|
257
|
-
caml_binaryen_const(value _module, value _lit) {
|
|
258
|
-
CAMLparam2(_module, _lit);
|
|
259
|
-
BinaryenModuleRef module = BinaryenModuleRef_val(_module);
|
|
260
|
-
struct BinaryenLiteral lit = BinaryenLiteral_val(_lit);
|
|
261
|
-
BinaryenExpressionRef exp = BinaryenConst(module, lit);
|
|
262
|
-
CAMLreturn(alloc_BinaryenExpressionRef(exp));
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
CAMLprim value
|
|
266
|
-
caml_binaryen_unary(value _module, value _op, value _p) {
|
|
267
|
-
CAMLparam3(_module, _op, _p);
|
|
268
|
-
BinaryenModuleRef module = BinaryenModuleRef_val(_module);
|
|
269
|
-
BinaryenOp op = BinaryenOp_val(_op);
|
|
270
|
-
BinaryenExpressionRef p = BinaryenExpressionRef_val(_p);
|
|
271
|
-
BinaryenExpressionRef exp = BinaryenUnary(module, op, p);
|
|
272
|
-
CAMLreturn(alloc_BinaryenExpressionRef(exp));
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
CAMLprim value
|
|
276
|
-
caml_binaryen_binary(value _module, value _op, value _p1, value _p2) {
|
|
277
|
-
CAMLparam4(_module, _op, _p1, _p2);
|
|
278
|
-
BinaryenModuleRef module = BinaryenModuleRef_val(_module);
|
|
279
|
-
BinaryenOp op = BinaryenOp_val(_op);
|
|
280
|
-
BinaryenExpressionRef p1 = BinaryenExpressionRef_val(_p1);
|
|
281
|
-
BinaryenExpressionRef p2 = BinaryenExpressionRef_val(_p2);
|
|
282
|
-
BinaryenExpressionRef exp = BinaryenBinary(module, op, p1, p2);
|
|
283
|
-
CAMLreturn(alloc_BinaryenExpressionRef(exp));
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
CAMLprim value
|
|
287
|
-
caml_binaryen_select(value _module, value _cond, value _tru, value _fals, value _ty) {
|
|
288
|
-
CAMLparam5(_module, _cond, _tru, _fals, _ty);
|
|
289
|
-
BinaryenModuleRef module = BinaryenModuleRef_val(_module);
|
|
290
|
-
BinaryenExpressionRef cond = BinaryenExpressionRef_val(_cond);
|
|
291
|
-
BinaryenExpressionRef tru = BinaryenExpressionRef_val(_tru);
|
|
292
|
-
BinaryenExpressionRef fals = BinaryenExpressionRef_val(_fals);
|
|
293
|
-
BinaryenType ty = BinaryenType_val(_ty);
|
|
294
|
-
BinaryenExpressionRef exp = BinaryenSelect(module, cond, tru, fals, ty);
|
|
295
|
-
CAMLreturn(alloc_BinaryenExpressionRef(exp));
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
CAMLprim value
|
|
299
|
-
caml_binaryen_drop(value _module, value _p1) {
|
|
300
|
-
CAMLparam2(_module, _p1);
|
|
301
|
-
BinaryenModuleRef module = BinaryenModuleRef_val(_module);
|
|
302
|
-
BinaryenExpressionRef p1 = BinaryenExpressionRef_val(_p1);
|
|
303
|
-
BinaryenExpressionRef exp = BinaryenDrop(module, p1);
|
|
304
|
-
CAMLreturn(alloc_BinaryenExpressionRef(exp));
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
CAMLprim value
|
|
308
|
-
caml_binaryen_return(value _module, value _p1) {
|
|
309
|
-
CAMLparam2(_module, _p1);
|
|
310
|
-
BinaryenModuleRef module = BinaryenModuleRef_val(_module);
|
|
311
|
-
BinaryenExpressionRef p1 = BinaryenExpressionRef_val(_p1);
|
|
312
|
-
BinaryenExpressionRef exp = BinaryenReturn(module, p1);
|
|
313
|
-
CAMLreturn(alloc_BinaryenExpressionRef(exp));
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
CAMLprim value
|
|
317
|
-
caml_binaryen_memory_size(value _module) {
|
|
318
|
-
CAMLparam1(_module);
|
|
319
|
-
BinaryenModuleRef module = BinaryenModuleRef_val(_module);
|
|
320
|
-
BinaryenExpressionRef exp = BinaryenMemorySize(module);
|
|
321
|
-
CAMLreturn(alloc_BinaryenExpressionRef(exp));
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
CAMLprim value
|
|
325
|
-
caml_binaryen_memory_grow(value _module, value _p1) {
|
|
326
|
-
CAMLparam2(_module, _p1);
|
|
327
|
-
BinaryenModuleRef module = BinaryenModuleRef_val(_module);
|
|
328
|
-
BinaryenExpressionRef p1 = BinaryenExpressionRef_val(_p1);
|
|
329
|
-
BinaryenExpressionRef exp = BinaryenMemoryGrow(module, p1);
|
|
330
|
-
CAMLreturn(alloc_BinaryenExpressionRef(exp));
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
CAMLprim value
|
|
334
|
-
caml_binaryen_nop(value _module) {
|
|
335
|
-
CAMLparam1(_module);
|
|
336
|
-
BinaryenModuleRef module = BinaryenModuleRef_val(_module);
|
|
337
|
-
BinaryenExpressionRef exp = BinaryenNop(module);
|
|
338
|
-
CAMLreturn(alloc_BinaryenExpressionRef(exp));
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
CAMLprim value
|
|
342
|
-
caml_binaryen_unreachable(value _module) {
|
|
343
|
-
CAMLparam1(_module);
|
|
344
|
-
BinaryenModuleRef module = BinaryenModuleRef_val(_module);
|
|
345
|
-
BinaryenExpressionRef exp = BinaryenUnreachable(module);
|
|
346
|
-
CAMLreturn(alloc_BinaryenExpressionRef(exp));
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
CAMLprim value
|
|
350
|
-
caml_binaryen_memory_copy(value _module, value _dest, value _source, value _size) {
|
|
351
|
-
CAMLparam4(_module, _dest, _source, _size);
|
|
352
|
-
BinaryenModuleRef module = BinaryenModuleRef_val(_module);
|
|
353
|
-
BinaryenExpressionRef dest = BinaryenExpressionRef_val(_dest);
|
|
354
|
-
BinaryenExpressionRef source = BinaryenExpressionRef_val(_source);
|
|
355
|
-
BinaryenExpressionRef size = BinaryenExpressionRef_val(_size);
|
|
356
|
-
BinaryenExpressionRef exp = BinaryenMemoryCopy(module, dest, source, size);
|
|
357
|
-
CAMLreturn(alloc_BinaryenExpressionRef(exp));
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
CAMLprim value
|
|
361
|
-
caml_binaryen_memory_fill(value _module, value _dest, value _val, value _size) {
|
|
362
|
-
CAMLparam4(_module, _dest, _val, _size);
|
|
363
|
-
BinaryenModuleRef module = BinaryenModuleRef_val(_module);
|
|
364
|
-
BinaryenExpressionRef dest = BinaryenExpressionRef_val(_dest);
|
|
365
|
-
BinaryenExpressionRef val = BinaryenExpressionRef_val(_val);
|
|
366
|
-
BinaryenExpressionRef size = BinaryenExpressionRef_val(_size);
|
|
367
|
-
BinaryenExpressionRef exp = BinaryenMemoryFill(module, dest, val, size);
|
|
368
|
-
CAMLreturn(alloc_BinaryenExpressionRef(exp));
|
|
369
|
-
}
|
|
370
|
-
|
|
371
|
-
CAMLprim value
|
|
372
|
-
caml_binaryen_tuple_make(value _module, value _operands) {
|
|
373
|
-
CAMLparam2(_module, _operands);
|
|
374
|
-
BinaryenModuleRef module = BinaryenModuleRef_val(_module);
|
|
375
|
-
_operands = array_of_list(_operands);
|
|
376
|
-
int operandsLen = array_length(_operands);
|
|
377
|
-
BinaryenExpressionRef operands[operandsLen];
|
|
378
|
-
for (int i = 0; i < operandsLen; i++) {
|
|
379
|
-
operands[i] = BinaryenExpressionRef_val(Field(_operands, i));
|
|
380
|
-
}
|
|
381
|
-
BinaryenExpressionRef exp = BinaryenTupleMake(module, operands, operandsLen);
|
|
382
|
-
CAMLreturn(alloc_BinaryenExpressionRef(exp));
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
CAMLprim value
|
|
386
|
-
caml_binaryen_tuple_extract(value _module, value _tuple, value _index) {
|
|
387
|
-
CAMLparam3(_module, _tuple, _index);
|
|
388
|
-
BinaryenModuleRef module = BinaryenModuleRef_val(_module);
|
|
389
|
-
BinaryenExpressionRef tuple = BinaryenExpressionRef_val(_tuple);
|
|
390
|
-
int index = Int_val(_index);
|
|
391
|
-
BinaryenExpressionRef exp = BinaryenTupleExtract(module, tuple, index);
|
|
392
|
-
CAMLreturn(alloc_BinaryenExpressionRef(exp));
|
|
393
|
-
}
|
|
394
|
-
|
|
395
|
-
CAMLprim value
|
|
396
|
-
caml_binaryen_pop(value _module, value _ty) {
|
|
397
|
-
CAMLparam2(_module, _ty);
|
|
398
|
-
BinaryenModuleRef module = BinaryenModuleRef_val(_module);
|
|
399
|
-
BinaryenType ty = BinaryenType_val(_ty);
|
|
400
|
-
BinaryenExpressionRef exp = BinaryenPop(module, ty);
|
|
401
|
-
CAMLreturn(alloc_BinaryenExpressionRef(exp));
|
|
402
|
-
}
|
|
403
|
-
|
|
404
|
-
CAMLprim value
|
|
405
|
-
caml_binaryen_expression_print(value _exp) {
|
|
406
|
-
CAMLparam1(_exp);
|
|
407
|
-
BinaryenExpressionRef exp = BinaryenExpressionRef_val(_exp);
|
|
408
|
-
BinaryenExpressionPrint(exp);
|
|
409
|
-
CAMLreturn(Val_unit);
|
|
410
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
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
|
-
|
|
10
|
-
CAMLprim value
|
|
11
|
-
caml_binaryen_set_function_table(value _module, value _initial, value _maximum, value _funcnames, value _offset) {
|
|
12
|
-
CAMLparam5(_module, _initial, _maximum, _funcnames, _offset);
|
|
13
|
-
BinaryenModuleRef module = BinaryenModuleRef_val(_module);
|
|
14
|
-
BinaryenIndex initial = Int_val(_initial);
|
|
15
|
-
BinaryenIndex maximum = Int_val(_maximum);
|
|
16
|
-
_funcnames = array_of_list(_funcnames);
|
|
17
|
-
int funcnamesLen = array_length(_funcnames);
|
|
18
|
-
const char* funcnames[funcnamesLen];
|
|
19
|
-
for (int i = 0; i < funcnamesLen; i++) {
|
|
20
|
-
funcnames[i] = Safe_String_val(Field(_funcnames, i));
|
|
21
|
-
}
|
|
22
|
-
BinaryenExpressionRef offset = BinaryenExpressionRef_val(_offset);
|
|
23
|
-
BinaryenSetFunctionTable(module, initial, maximum, funcnames, funcnamesLen, offset);
|
|
24
|
-
CAMLreturn(Val_unit);
|
|
25
|
-
}
|
|
@@ -1,46 +0,0 @@
|
|
|
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
|
-
|
|
10
|
-
/* Allocating an OCaml custom block to hold the given BinaryenGlobalRef */
|
|
11
|
-
static value alloc_BinaryenGlobalRef(BinaryenGlobalRef exp)
|
|
12
|
-
{
|
|
13
|
-
value v = caml_alloc_custom(&binaryen_ops, sizeof(BinaryenGlobalRef), 0, 1);
|
|
14
|
-
BinaryenGlobalRef_val(v) = exp;
|
|
15
|
-
return v;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
CAMLprim value
|
|
19
|
-
caml_binaryen_add_global(value _module, value _name, value _ty, value _mutable_, value _init) {
|
|
20
|
-
CAMLparam5(_module, _name, _ty, _mutable_, _init);
|
|
21
|
-
BinaryenModuleRef module = BinaryenModuleRef_val(_module);
|
|
22
|
-
char* name = Safe_String_val(_name);
|
|
23
|
-
BinaryenType ty = BinaryenType_val(_ty);
|
|
24
|
-
int8_t mutable_ = Bool_val(_mutable_);
|
|
25
|
-
BinaryenExpressionRef init = BinaryenExpressionRef_val(_init);
|
|
26
|
-
BinaryenGlobalRef glob = BinaryenAddGlobal(module, name, ty, mutable_, init);
|
|
27
|
-
CAMLreturn(alloc_BinaryenGlobalRef(glob));
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
CAMLprim value
|
|
31
|
-
caml_binaryen_get_global(value _module, value _name) {
|
|
32
|
-
CAMLparam2(_module, _name);
|
|
33
|
-
BinaryenModuleRef module = BinaryenModuleRef_val(_module);
|
|
34
|
-
char* name = Safe_String_val(_name);
|
|
35
|
-
BinaryenGlobalRef glob = BinaryenGetGlobal(module, name);
|
|
36
|
-
CAMLreturn(alloc_BinaryenGlobalRef(glob));
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
CAMLprim value
|
|
40
|
-
caml_binaryen_remove_global(value _module, value _name) {
|
|
41
|
-
CAMLparam2(_module, _name);
|
|
42
|
-
BinaryenModuleRef module = BinaryenModuleRef_val(_module);
|
|
43
|
-
char* name = Safe_String_val(_name);
|
|
44
|
-
BinaryenRemoveGlobal(module, name);
|
|
45
|
-
CAMLreturn(Val_unit);
|
|
46
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
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
|
-
|
|
10
|
-
CAMLprim value
|
|
11
|
-
caml_binaryen_add_table(value _module, value _name, value _initial, value _maximum, value _funcnames, value _offset) {
|
|
12
|
-
CAMLparam5(_module, _name, _initial, _maximum, _funcnames);
|
|
13
|
-
CAMLxparam1(_offset);
|
|
14
|
-
BinaryenModuleRef module = BinaryenModuleRef_val(_module);
|
|
15
|
-
char* name = Safe_String_val(_name);
|
|
16
|
-
BinaryenIndex initial = Int_val(_initial);
|
|
17
|
-
BinaryenIndex maximum = Int_val(_maximum);
|
|
18
|
-
_funcnames = array_of_list(_funcnames);
|
|
19
|
-
int funcnamesLen = array_length(_funcnames);
|
|
20
|
-
const char* funcnames[funcnamesLen];
|
|
21
|
-
for (int i = 0; i < funcnamesLen; i++) {
|
|
22
|
-
funcnames[i] = Safe_String_val(Field(_funcnames, i));
|
|
23
|
-
}
|
|
24
|
-
BinaryenExpressionRef offset = BinaryenExpressionRef_val(_offset);
|
|
25
|
-
BinaryenAddTable(module, name, initial, maximum, funcnames, funcnamesLen, offset);
|
|
26
|
-
CAMLreturn(Val_unit);
|
|
27
|
-
}
|
|
28
|
-
CAMLprim value
|
|
29
|
-
caml_binaryen_add_table__bytecode(value * argv) {
|
|
30
|
-
return caml_binaryen_add_table(argv[0], argv[1], argv[2], argv[3], argv[4], argv[5]);
|
|
31
|
-
}
|
binaryen-archive/src/config/dune
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
module C = Configurator.V1
|
|
2
|
-
|
|
3
|
-
let () =
|
|
4
|
-
C.main ~name:"library_flags" (fun c ->
|
|
5
|
-
let default = [] in
|
|
6
|
-
|
|
7
|
-
let library_flags =
|
|
8
|
-
match C.ocaml_config_var c "system" with
|
|
9
|
-
| Some "macosx" ->
|
|
10
|
-
(* These flags preserve the original C error behavior *)
|
|
11
|
-
[ "-cclib"; "-Wl,-keep_dwarf_unwind" ]
|
|
12
|
-
| Some _ -> default
|
|
13
|
-
| None -> default
|
|
14
|
-
in
|
|
15
|
-
|
|
16
|
-
C.Flags.write_sexp "library_flags.sexp" library_flags)
|
binaryen-archive/src/dune
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
(library
|
|
2
|
-
(name binaryen_native)
|
|
3
|
-
(public_name binaryen.native)
|
|
4
|
-
(implements binaryen)
|
|
5
|
-
(foreign_stubs
|
|
6
|
-
(language c)
|
|
7
|
-
(names binaryen_stubs_types binaryen_stubs_ops binaryen_stubs_literals
|
|
8
|
-
binaryen_stubs_expressions binaryen_stubs_functions
|
|
9
|
-
binaryen_stubs_imports binaryen_stubs_exports binaryen_stubs_globals
|
|
10
|
-
binaryen_stubs_function_tables binaryen_stubs_tables
|
|
11
|
-
binaryen_stubs_memory binaryen_stubs_features binaryen_stubs_modules
|
|
12
|
-
ocaml_helpers)
|
|
13
|
-
(flags -O2 -Wall -Wextra))
|
|
14
|
-
(foreign_archives binaryen)
|
|
15
|
-
(library_flags
|
|
16
|
-
(:include ./config/library_flags.sexp))
|
|
17
|
-
(c_library_flags -lstdc++ -lpthread))
|
|
18
|
-
|
|
19
|
-
(rule
|
|
20
|
-
(target binaryen-c.h)
|
|
21
|
-
(action
|
|
22
|
-
(copy ../vendor/binaryen-c.h binaryen-c.h)))
|
|
23
|
-
|
|
24
|
-
(rule
|
|
25
|
-
(target wasm-delegations.h)
|
|
26
|
-
(action
|
|
27
|
-
(copy ../vendor/wasm-delegations.h wasm-delegations.h)))
|
|
28
|
-
|
|
29
|
-
(rule
|
|
30
|
-
(target libbinaryen.a)
|
|
31
|
-
(action
|
|
32
|
-
(copy ../vendor/%{system}/libbinaryen.a libbinaryen.a)))
|
|
33
|
-
|
|
34
|
-
(rule
|
|
35
|
-
(target dllbinaryen.so)
|
|
36
|
-
(enabled_if
|
|
37
|
-
(= %{system} macosx))
|
|
38
|
-
(action
|
|
39
|
-
(copy ../vendor/%{system}/libbinaryen.dylib dllbinaryen.so)))
|
|
40
|
-
|
|
41
|
-
(rule
|
|
42
|
-
(target dllbinaryen.so)
|
|
43
|
-
(enabled_if
|
|
44
|
-
(= %{system} linux))
|
|
45
|
-
(action
|
|
46
|
-
(copy ../vendor/%{system}/libbinaryen.so dllbinaryen.so)))
|
|
47
|
-
|
|
48
|
-
(rule
|
|
49
|
-
(target dllbinaryen.dll)
|
|
50
|
-
(enabled_if
|
|
51
|
-
(= %{system} mingw64))
|
|
52
|
-
(action
|
|
53
|
-
(copy ../vendor/%{system}/libbinaryen.dll dllbinaryen.dll)))
|
binaryen-archive/src/export.ml
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
type t
|
|
2
|
-
|
|
3
|
-
external add_function_export : Module.t -> string -> string -> t
|
|
4
|
-
= "caml_binaryen_add_function_export"
|
|
5
|
-
(** Module, internal name, external name. *)
|
|
6
|
-
|
|
7
|
-
external add_table_export : Module.t -> string -> string -> t
|
|
8
|
-
= "caml_binaryen_add_table_export"
|
|
9
|
-
(** Module, internal name, external name. *)
|
|
10
|
-
|
|
11
|
-
external add_memory_export : Module.t -> string -> string -> t
|
|
12
|
-
= "caml_binaryen_add_memory_export"
|
|
13
|
-
(** Module, internal name, external name. *)
|
|
14
|
-
|
|
15
|
-
external add_global_export : Module.t -> string -> string -> t
|
|
16
|
-
= "caml_binaryen_add_global_export"
|
|
17
|
-
(** Module, internal name, external name. *)
|
|
18
|
-
|
|
19
|
-
external remove_export : Module.t -> string -> unit
|
|
20
|
-
= "caml_binaryen_remove_export"
|
|
21
|
-
(** Module, external name. *)
|