@grain/binaryen.ml 0.20.0 → 0.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- binaryen-archive/CHANGELOG.md +42 -0
- binaryen-archive/binaryen.opam +3 -3
- binaryen-archive/esy.lock/index.json +491 -426
- binaryen-archive/esy.lock/opam/{base.v0.15.1 → base.v0.16.1}/opam +7 -4
- binaryen-archive/esy.lock/opam/{chrome-trace.3.6.1 → chrome-trace.3.9.0}/opam +4 -4
- binaryen-archive/esy.lock/opam/{cmdliner.1.1.1 → cmdliner.1.2.0}/opam +2 -2
- binaryen-archive/esy.lock/opam/{csexp.1.5.1 → csexp.1.5.2}/opam +7 -9
- binaryen-archive/esy.lock/opam/{dune-build-info.3.6.1 → dune-build-info.3.9.0}/opam +4 -4
- binaryen-archive/esy.lock/opam/{dune-configurator.3.6.1 → dune-configurator.3.9.0}/opam +4 -4
- binaryen-archive/esy.lock/opam/{dune-rpc.3.6.1 → dune-rpc.3.9.0}/opam +4 -4
- binaryen-archive/esy.lock/opam/{dune.3.6.1 → dune.3.9.0}/opam +5 -5
- binaryen-archive/esy.lock/opam/{dyn.3.6.1 → dyn.3.9.0}/opam +4 -4
- binaryen-archive/esy.lock/opam/fiber.3.7.0/opam +39 -0
- binaryen-archive/esy.lock/opam/{fix.20220121 → fix.20230505}/opam +3 -3
- binaryen-archive/esy.lock/opam/gen.1.1/opam +31 -0
- binaryen-archive/esy.lock/opam/{js_of_ocaml-compiler.4.1.0 → js_of_ocaml-compiler.5.3.0}/opam +10 -10
- binaryen-archive/esy.lock/opam/{menhir.20220210 → menhir.20230608}/opam +4 -4
- binaryen-archive/esy.lock/opam/{menhirLib.20220210 → menhirLib.20230608}/opam +4 -4
- binaryen-archive/esy.lock/opam/{menhirSdk.20220210 → menhirSdk.20230608}/opam +4 -4
- binaryen-archive/esy.lock/opam/{ocamlbuild.0.14.2 → ocamlbuild.0.14.2+win}/opam +13 -14
- binaryen-archive/esy.lock/opam/ocamlfind.1.9.6/files/0001-Harden-test-for-OCaml-5.patch +12 -0
- binaryen-archive/esy.lock/opam/{ocamlfind.1.9.5 → ocamlfind.1.9.6}/opam +8 -7
- binaryen-archive/esy.lock/opam/{ocamlformat-rpc-lib.0.24.1 → ocamlformat-rpc-lib.0.25.1}/opam +4 -4
- binaryen-archive/esy.lock/opam/ocamlformat.0.24.1/opam +1 -1
- binaryen-archive/esy.lock/opam/{ordering.3.6.1 → ordering.3.9.0}/opam +4 -4
- binaryen-archive/esy.lock/opam/{ppx_yojson_conv_lib.v0.15.0 → ppx_yojson_conv_lib.v0.16.0}/opam +3 -3
- binaryen-archive/esy.lock/opam/{ppxlib.0.28.0 → ppxlib.0.29.1}/opam +5 -5
- binaryen-archive/esy.lock/opam/sedlex.3.2/opam +48 -0
- binaryen-archive/esy.lock/opam/{sexplib0.v0.15.1 → sexplib0.v0.16.0}/opam +3 -3
- binaryen-archive/esy.lock/opam/{stdio.v0.15.0 → stdio.v0.16.0}/opam +4 -4
- binaryen-archive/esy.lock/opam/{stdune.3.6.1 → stdune.3.9.0}/opam +4 -4
- binaryen-archive/esy.lock/opam/{topkg.1.0.6 → topkg.1.0.7}/opam +2 -2
- binaryen-archive/esy.lock/opam/{xdg.3.6.1 → xdg.3.9.0}/opam +4 -4
- binaryen-archive/esy.lock/opam/{yojson.2.0.2 → yojson.2.1.0}/opam +33 -23
- binaryen-archive/esy.lock/overrides/opam__s__ocamlbuild_opam__c__0.14.2+win_opam_override/files/ocamlbuild-0.14.2.patch +0 -0
- binaryen-archive/esy.lock/overrides/opam__s__ocamlfind_opam__c__1.9.6_opam_override/files/findlib.patch +11 -0
- binaryen-archive/package.json +3 -3
- binaryen-archive/src/array_type.c +29 -0
- binaryen-archive/src/array_type.js +17 -0
- binaryen-archive/src/array_type.ml +8 -0
- binaryen-archive/src/array_type.mli +3 -0
- binaryen-archive/src/dune +38 -32
- binaryen-archive/src/{binaryen_stubs_exports.c → export.c} +0 -8
- binaryen-archive/src/{binaryen_stubs_expressions.c → expression.c} +0 -9
- binaryen-archive/src/{binaryen_stubs_expressions.js → expression.js} +18 -8
- binaryen-archive/src/{binaryen_stubs_functions.c → function.c} +0 -24
- binaryen-archive/src/{binaryen_stubs_globals.c → global.c} +0 -25
- binaryen-archive/src/heap_type.c +171 -0
- binaryen-archive/src/heap_type.js +131 -0
- binaryen-archive/src/heap_type.ml +11 -0
- binaryen-archive/src/heap_type.mli +11 -0
- binaryen-archive/src/{binaryen_stubs_literals.c → literal.c} +0 -9
- binaryen-archive/src/{binaryen_stubs_memory.c → memory.c} +15 -5
- binaryen-archive/src/{binaryen_stubs_memory.js → memory.js} +11 -1
- binaryen-archive/src/memory.ml +6 -3
- binaryen-archive/src/memory.mli +10 -1
- binaryen-archive/src/{binaryen_stubs_modules.c → module.c} +0 -9
- binaryen-archive/src/module.ml +4 -5
- binaryen-archive/src/module.mli +1 -1
- binaryen-archive/src/{binaryen_stubs_features.c → module_feature.c} +6 -6
- binaryen-archive/src/{binaryen_stubs_features.js → module_feature.js} +6 -6
- binaryen-archive/src/ocaml_helpers.c +87 -0
- binaryen-archive/src/ocaml_helpers.h +33 -0
- binaryen-archive/src/{binaryen_stubs_ops.c → op.c} +582 -325
- binaryen-archive/src/op.js +2123 -0
- binaryen-archive/src/op.ml +385 -344
- binaryen-archive/src/op.mli +38 -0
- binaryen-archive/src/passes.ml +38 -2
- binaryen-archive/src/passes.mli +38 -2
- binaryen-archive/src/signature_type.c +23 -0
- binaryen-archive/src/signature_type.js +11 -0
- binaryen-archive/src/signature_type.ml +5 -0
- binaryen-archive/src/signature_type.mli +2 -0
- binaryen-archive/src/struct_type.c +39 -0
- binaryen-archive/src/struct_type.js +23 -0
- binaryen-archive/src/struct_type.ml +11 -0
- binaryen-archive/src/struct_type.mli +4 -0
- binaryen-archive/src/{binaryen_stubs_tables.c → table.c} +0 -25
- binaryen-archive/src/{binaryen_stubs_types.c → type.c} +28 -10
- binaryen-archive/src/{binaryen_stubs_types.js → type.js} +28 -0
- binaryen-archive/src/type.ml +16 -0
- binaryen-archive/src/type.mli +4 -0
- binaryen-archive/test/test.expected +5 -5
- binaryen-archive/test/test.ml +20 -5
- binaryen-archive/esy.lock/opam/fiber.3.6.1/opam +0 -41
- binaryen-archive/esy.lock/opam/ocamlfind.1.9.5/files/0001-Fix-bug-when-installing-with-a-system-compiler.patch +0 -26
- binaryen-archive/esy.lock/overrides/opam__s__ocamlfind_opam__c__1.9.5_opam_override/files/findlib.patch +0 -485
- binaryen-archive/src/binaryen_stubs_heap_types.c +0 -95
- binaryen-archive/src/binaryen_stubs_heap_types.js +0 -65
- binaryen-archive/src/binaryen_stubs_ops.js +0 -1895
- /binaryen-archive/esy.lock/overrides/{opam__s__ocamlbuild_opam__c__0.14.2_opam_override → opam__s__ocamlbuild_opam__c__0.14.2+win_opam_override}/files/winpatch.patch +0 -0
- /binaryen-archive/esy.lock/overrides/{opam__s__ocamlbuild_opam__c__0.14.2_opam_override → opam__s__ocamlbuild_opam__c__0.14.2+win_opam_override}/package.json +0 -0
- /binaryen-archive/esy.lock/overrides/{opam__s__ocamlfind_opam__c__1.9.5_opam_override → opam__s__ocamlfind_opam__c__1.9.6_opam_override}/package.json +0 -0
- /binaryen-archive/src/{binaryen_stubs_exports.js → export.js} +0 -0
- /binaryen-archive/src/{binaryen_stubs_functions.js → function.js} +0 -0
- /binaryen-archive/src/{binaryen_stubs_globals.js → global.js} +0 -0
- /binaryen-archive/src/{binaryen_stubs_imports.c → import.c} +0 -0
- /binaryen-archive/src/{binaryen_stubs_imports.js → import.js} +0 -0
- /binaryen-archive/src/{binaryen_stubs_literals.js → literal.js} +0 -0
- /binaryen-archive/src/{binaryen_stubs_modules.js → module.js} +0 -0
- /binaryen-archive/src/{binaryen_stubs_packed_types.c → packed_type.c} +0 -0
- /binaryen-archive/src/{binaryen_stubs_packed_types.js → packed_type.js} +0 -0
- /binaryen-archive/src/{binaryen_stubs_settings.c → settings.c} +0 -0
- /binaryen-archive/src/{binaryen_stubs_settings.js → settings.js} +0 -0
- /binaryen-archive/src/{binaryen_stubs_tables.js → table.js} +0 -0
- /binaryen-archive/src/{binaryen_stubs_type_system.c → type_system.c} +0 -0
- /binaryen-archive/src/{binaryen_stubs_type_system.js → type_system.js} +0 -0
|
@@ -10,8 +10,8 @@ build: [
|
|
|
10
10
|
["dune" "build" "-p" name "-j" jobs]
|
|
11
11
|
]
|
|
12
12
|
depends: [
|
|
13
|
-
"ocaml" {>= "4.
|
|
14
|
-
"base" {>= "v0.
|
|
13
|
+
"ocaml" {>= "4.14.0"}
|
|
14
|
+
"base" {>= "v0.16" & < "v0.17"}
|
|
15
15
|
"dune" {>= "2.0.0"}
|
|
16
16
|
]
|
|
17
17
|
synopsis: "Standard IO library for OCaml"
|
|
@@ -22,6 +22,6 @@ It re-exports the input/output functions of the OCaml standard
|
|
|
22
22
|
libraries using a more consistent API.
|
|
23
23
|
"
|
|
24
24
|
url {
|
|
25
|
-
src: "https://ocaml.janestreet.com/ocaml-core/v0.
|
|
26
|
-
checksum: "sha256=
|
|
25
|
+
src: "https://ocaml.janestreet.com/ocaml-core/v0.16/files/stdio-v0.16.0.tar.gz"
|
|
26
|
+
checksum: "sha256=61f0b75950614ac5378c6ec0d822cce6463402d919d5810b736fc46522b3a73e"
|
|
27
27
|
}
|
|
@@ -35,10 +35,10 @@ build: [
|
|
|
35
35
|
]
|
|
36
36
|
]
|
|
37
37
|
url {
|
|
38
|
-
src: "https://github.com/ocaml/dune/releases/download/3.
|
|
38
|
+
src: "https://github.com/ocaml/dune/releases/download/3.9.0/dune-3.9.0.tbz"
|
|
39
39
|
checksum: [
|
|
40
|
-
"sha256=
|
|
41
|
-
"sha512=
|
|
40
|
+
"sha256=c4825a9de454aedf450c2db25ac353033e31d326a9d1b4b7a2cd7260639bd544"
|
|
41
|
+
"sha512=55d83bfee7c741cb5b74187674f9ef992ddf0b149f8d22a0a392c4c8ddf1075e9192eebd81cf36c115331cd96e10824100c6c338835d26c25e965e68ed94673d"
|
|
42
42
|
]
|
|
43
43
|
}
|
|
44
|
-
x-commit-hash: "
|
|
44
|
+
x-commit-hash: "891fa5a7d72655634378425d51a1cf703ff93336"
|
|
@@ -41,7 +41,7 @@ depends: [
|
|
|
41
41
|
build: ["ocaml" "pkg/pkg.ml" "build" "--pkg-name" name "--dev-pkg" "%{dev}%"]
|
|
42
42
|
dev-repo: "git+https://erratique.ch/repos/topkg.git"
|
|
43
43
|
url {
|
|
44
|
-
src: "https://erratique.ch/software/topkg/releases/topkg-1.0.
|
|
44
|
+
src: "https://erratique.ch/software/topkg/releases/topkg-1.0.7.tbz"
|
|
45
45
|
checksum:
|
|
46
|
-
"sha512=
|
|
46
|
+
"sha512=09e59f1759bf4db8471f02d0aefd8db602b44932a291c05c312b1423796e7a15d1598d3c62a0cec7f083eff8e410fac09363533dc4bd2120914bb9664efea535"
|
|
47
47
|
}
|
|
@@ -30,10 +30,10 @@ build: [
|
|
|
30
30
|
]
|
|
31
31
|
]
|
|
32
32
|
url {
|
|
33
|
-
src: "https://github.com/ocaml/dune/releases/download/3.
|
|
33
|
+
src: "https://github.com/ocaml/dune/releases/download/3.9.0/dune-3.9.0.tbz"
|
|
34
34
|
checksum: [
|
|
35
|
-
"sha256=
|
|
36
|
-
"sha512=
|
|
35
|
+
"sha256=c4825a9de454aedf450c2db25ac353033e31d326a9d1b4b7a2cd7260639bd544"
|
|
36
|
+
"sha512=55d83bfee7c741cb5b74187674f9ef992ddf0b149f8d22a0a392c4c8ddf1075e9192eebd81cf36c115331cd96e10824100c6c338835d26c25e965e68ed94673d"
|
|
37
37
|
]
|
|
38
38
|
}
|
|
39
|
-
x-commit-hash: "
|
|
39
|
+
x-commit-hash: "891fa5a7d72655634378425d51a1cf703ff93336"
|
|
@@ -1,38 +1,48 @@
|
|
|
1
1
|
opam-version: "2.0"
|
|
2
|
-
|
|
2
|
+
synopsis:
|
|
3
|
+
"Yojson is an optimized parsing and printing library for the JSON format"
|
|
4
|
+
description: """
|
|
5
|
+
Yojson is an optimized parsing and printing library for the JSON format.
|
|
6
|
+
|
|
7
|
+
ydump is a pretty-printing command-line program provided with the
|
|
8
|
+
yojson package."""
|
|
9
|
+
maintainer: [
|
|
10
|
+
"paul-elliot@tarides.com" "nathan@tarides.com" "marek@tarides.com"
|
|
11
|
+
]
|
|
3
12
|
authors: ["Martin Jambon"]
|
|
13
|
+
license: "BSD-3-Clause"
|
|
4
14
|
homepage: "https://github.com/ocaml-community/yojson"
|
|
15
|
+
doc: "https://ocaml-community.github.io/yojson"
|
|
5
16
|
bug-reports: "https://github.com/ocaml-community/yojson/issues"
|
|
6
|
-
dev-repo: "git+https://github.com/ocaml-community/yojson.git"
|
|
7
|
-
doc: "https://ocaml-community.github.io/yojson/"
|
|
8
|
-
license: "BSD-3-Clause"
|
|
9
|
-
build: [
|
|
10
|
-
["dune" "subst"] {dev}
|
|
11
|
-
["dune" "build" "-p" name "-j" jobs]
|
|
12
|
-
["dune" "runtest" "-p" name "-j" jobs] {with-test}
|
|
13
|
-
["dune" "build" "@doc" "-p" name "-j" jobs] {with-doc}
|
|
14
|
-
]
|
|
15
17
|
depends: [
|
|
18
|
+
"dune" {>= "2.7"}
|
|
16
19
|
"ocaml" {>= "4.02.3"}
|
|
17
|
-
"dune" {>= "2.0"}
|
|
18
20
|
"cppo" {build}
|
|
19
21
|
"alcotest" {with-test & >= "0.8.5"}
|
|
20
|
-
"odoc" {with-doc}
|
|
21
22
|
"seq" {>= "0.2.2"}
|
|
23
|
+
"odoc" {with-doc}
|
|
22
24
|
]
|
|
23
|
-
|
|
24
|
-
"
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
25
|
+
build: [
|
|
26
|
+
["dune" "subst"] {dev}
|
|
27
|
+
[
|
|
28
|
+
"dune"
|
|
29
|
+
"build"
|
|
30
|
+
"-p"
|
|
31
|
+
name
|
|
32
|
+
"-j"
|
|
33
|
+
jobs
|
|
34
|
+
"@install"
|
|
35
|
+
"@runtest" {with-test}
|
|
36
|
+
"@doc" {with-doc}
|
|
37
|
+
]
|
|
38
|
+
]
|
|
39
|
+
dev-repo: "git+https://github.com/ocaml-community/yojson.git"
|
|
30
40
|
url {
|
|
31
41
|
src:
|
|
32
|
-
"https://github.com/ocaml-community/yojson/releases/download/2.0
|
|
42
|
+
"https://github.com/ocaml-community/yojson/releases/download/2.1.0/yojson-2.1.0.tbz"
|
|
33
43
|
checksum: [
|
|
34
|
-
"sha256=
|
|
35
|
-
"sha512=
|
|
44
|
+
"sha256=9fcb1ff2db58ab259f9228796b0ada4794eae97177b1833371380c4e4f90b15d"
|
|
45
|
+
"sha512=31ab8580e0e4e8a05459fbec2fb9424a3df4cf5aef6df21fc577dbe3d32e81103a632c6a511c4dcf1f51819e88b38d2ce7d6888545bc3f359e69e070f8d2e69c"
|
|
36
46
|
]
|
|
37
47
|
}
|
|
38
|
-
x-commit-hash: "
|
|
48
|
+
x-commit-hash: "42fa0887cb870bdbd1751d98cd23f99d6b29751d"
|
|
File without changes
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
--- ./Makefile
|
|
2
|
+
+++ ./Makefile
|
|
3
|
+
@@ -55,7 +55,7 @@
|
|
4
|
+
export USE_CYGPATH; \
|
|
5
|
+
cat findlib.conf.in | \
|
|
6
|
+
$(SH) tools/patch '@SITELIB@' '$(OCAML_SITELIB)' | \
|
|
7
|
+
- $(SH) tools/patch '@FINDLIB_PATH@' '$(FINDLIB_PATH)' -p >findlib.conf
|
|
8
|
+
+ $(SH) tools/patch '@FINDLIB_PATH@' '$(FINDLIB_PATH)' >findlib.conf
|
|
9
|
+
if ./tools/cmd_from_same_dir ocamlc; then \
|
|
10
|
+
echo 'ocamlc="ocamlc.opt"' >>findlib.conf; \
|
|
11
|
+
fi
|
binaryen-archive/package.json
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@grain/binaryen.ml",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.21.0",
|
|
4
4
|
"description": "OCaml bindings for Binaryen.",
|
|
5
5
|
"author": "Oscar Spencer <oscar@grain-lang.org>",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"dependencies": {
|
|
8
8
|
"ocaml": ">= 4.12.0",
|
|
9
|
-
"@grain/libbinaryen": ">=
|
|
9
|
+
"@grain/libbinaryen": ">= 111.0.0 < 112.0.0",
|
|
10
10
|
"@opam/dune": ">= 3.0.0",
|
|
11
11
|
"@opam/dune-configurator": ">= 3.0.0"
|
|
12
12
|
},
|
|
13
13
|
"devDependencies": {
|
|
14
|
-
"@opam/js_of_ocaml-compiler": ">= 4.1.0 <
|
|
14
|
+
"@opam/js_of_ocaml-compiler": ">= 4.1.0 < 6.0.0",
|
|
15
15
|
"@opam/ocamlformat": "0.24.1",
|
|
16
16
|
"@opam/ocaml-lsp-server": ">= 1.9.1 < 1.13.0"
|
|
17
17
|
},
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
#define CAML_NAME_SPACE
|
|
2
|
+
#include <caml/mlvalues.h>
|
|
3
|
+
#include <caml/fail.h>
|
|
4
|
+
#include <caml/memory.h>
|
|
5
|
+
|
|
6
|
+
#include "binaryen-c.h"
|
|
7
|
+
#include "ocaml_helpers.h"
|
|
8
|
+
|
|
9
|
+
CAMLprim value
|
|
10
|
+
caml_binaryen_array_type_get_element_type(value _heapType) {
|
|
11
|
+
CAMLparam1(_heapType);
|
|
12
|
+
BinaryenHeapType heapType = BinaryenHeapType_val(_heapType);
|
|
13
|
+
BinaryenType ty = BinaryenArrayTypeGetElementType(heapType);
|
|
14
|
+
CAMLreturn(alloc_BinaryenType(ty));
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
CAMLprim value
|
|
18
|
+
caml_binaryen_array_type_get_element_packed_type(value _heapType) {
|
|
19
|
+
CAMLparam1(_heapType);
|
|
20
|
+
BinaryenHeapType heapType = BinaryenHeapType_val(_heapType);
|
|
21
|
+
CAMLreturn(Val_int(BinaryenArrayTypeGetElementPackedType(heapType)));
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
CAMLprim value
|
|
25
|
+
caml_binaryen_array_type_is_element_mutable(value _heapType) {
|
|
26
|
+
CAMLparam1(_heapType);
|
|
27
|
+
BinaryenHeapType heapType = BinaryenHeapType_val(_heapType);
|
|
28
|
+
CAMLreturn(Val_bool(BinaryenArrayTypeIsElementMutable(heapType)));
|
|
29
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
//Provides: caml_binaryen_array_type_get_element_type
|
|
2
|
+
//Requires: Binaryen
|
|
3
|
+
function caml_binaryen_array_type_get_element_type(heapType) {
|
|
4
|
+
return Binaryen._BinaryenArrayTypeGetElementType(heapType);
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
//Provides: caml_binaryen_array_type_get_element_packed_type
|
|
8
|
+
//Requires: Binaryen
|
|
9
|
+
function caml_binaryen_array_type_get_element_packed_type(heapType) {
|
|
10
|
+
return Binaryen._BinaryenArrayTypeGetElementPackedType(heapType);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
//Provides: caml_binaryen_array_type_is_element_mutable
|
|
14
|
+
//Requires: Binaryen
|
|
15
|
+
function caml_binaryen_array_type_is_element_mutable(heapType) {
|
|
16
|
+
return Binaryen._BinaryenArrayTypeIsElementMutable(heapType);
|
|
17
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
external get_element_type : Heap_type.t -> Type.t
|
|
2
|
+
= "caml_binaryen_array_type_get_element_type"
|
|
3
|
+
|
|
4
|
+
external get_element_packed_type : Heap_type.t -> Packed_type.t
|
|
5
|
+
= "caml_binaryen_array_type_get_element_packed_type"
|
|
6
|
+
|
|
7
|
+
external is_element_mutable : Heap_type.t -> bool
|
|
8
|
+
= "caml_binaryen_array_type_is_element_mutable"
|
binaryen-archive/src/dune
CHANGED
|
@@ -5,39 +5,45 @@
|
|
|
5
5
|
(foreign_stubs
|
|
6
6
|
(language c)
|
|
7
7
|
(names
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
8
|
+
array_type
|
|
9
|
+
type
|
|
10
|
+
op
|
|
11
|
+
literal
|
|
12
|
+
expression
|
|
13
|
+
function
|
|
14
|
+
import
|
|
15
|
+
export
|
|
16
|
+
global
|
|
17
|
+
table
|
|
18
|
+
memory
|
|
19
|
+
module_feature
|
|
20
|
+
module
|
|
21
|
+
settings
|
|
22
|
+
packed_type
|
|
23
|
+
heap_type
|
|
24
|
+
signature_type
|
|
25
|
+
struct_type
|
|
26
|
+
type_system
|
|
24
27
|
ocaml_helpers)
|
|
25
28
|
(flags :standard -O2 -Wall -Wextra))
|
|
26
29
|
(js_of_ocaml
|
|
27
30
|
(javascript_files
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
31
|
+
array_type.js
|
|
32
|
+
type.js
|
|
33
|
+
op.js
|
|
34
|
+
literal.js
|
|
35
|
+
expression.js
|
|
36
|
+
function.js
|
|
37
|
+
import.js
|
|
38
|
+
export.js
|
|
39
|
+
global.js
|
|
40
|
+
table.js
|
|
41
|
+
memory.js
|
|
42
|
+
module_feature.js
|
|
43
|
+
module.js
|
|
44
|
+
settings.js
|
|
45
|
+
packed_type.js
|
|
46
|
+
heap_type.js
|
|
47
|
+
signature_type.js
|
|
48
|
+
struct_type.js
|
|
49
|
+
type_system.js)))
|
|
@@ -8,14 +8,6 @@
|
|
|
8
8
|
#include "ocaml_helpers.h"
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
/* Allocating an OCaml custom block to hold the given BinaryenExportRef */
|
|
12
|
-
static value alloc_BinaryenExportRef(BinaryenExportRef exp)
|
|
13
|
-
{
|
|
14
|
-
value v = caml_alloc_custom(&binaryen_ops, sizeof(BinaryenExportRef), 0, 1);
|
|
15
|
-
BinaryenExportRef_val(v) = exp;
|
|
16
|
-
return v;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
11
|
CAMLprim value
|
|
20
12
|
caml_binaryen_add_function_export(value _module, value _internalName, value _externalName) {
|
|
21
13
|
CAMLparam3(_module, _internalName, _externalName);
|
|
@@ -7,15 +7,6 @@
|
|
|
7
7
|
#include "binaryen-c.h"
|
|
8
8
|
#include "ocaml_helpers.h"
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
/* Allocating an OCaml custom block to hold the given BinaryenExpressionRef */
|
|
12
|
-
static value alloc_BinaryenExpressionRef(BinaryenExpressionRef exp)
|
|
13
|
-
{
|
|
14
|
-
value v = caml_alloc_custom(&binaryen_ops, sizeof(BinaryenExpressionRef), 0, 1);
|
|
15
|
-
BinaryenExpressionRef_val(v) = exp;
|
|
16
|
-
return v;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
10
|
CAMLprim value
|
|
20
11
|
caml_binaryen_expression_get_id(value _expr) {
|
|
21
12
|
CAMLparam1(_expr);
|
|
@@ -189,11 +189,12 @@ function caml_binaryen_load(
|
|
|
189
189
|
|
|
190
190
|
switch (typ) {
|
|
191
191
|
case Binaryen.i32: {
|
|
192
|
-
if
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
192
|
+
// Using four bytes doesn't matter if it is signed or unsigned
|
|
193
|
+
if (bytes === 4) {
|
|
194
|
+
return wasm_mod.i32.load(offset, align, ptr, name);
|
|
195
|
+
}
|
|
196
196
|
|
|
197
|
+
if (signed) {
|
|
197
198
|
if (bytes === 1) {
|
|
198
199
|
return wasm_mod.i32.load8_s(offset, align, ptr, name);
|
|
199
200
|
}
|
|
@@ -210,13 +211,16 @@ function caml_binaryen_load(
|
|
|
210
211
|
return wasm_mod.i32.load16_u(offset, align, ptr, name);
|
|
211
212
|
}
|
|
212
213
|
}
|
|
214
|
+
|
|
215
|
+
break;
|
|
213
216
|
}
|
|
214
217
|
case Binaryen.i64: {
|
|
215
|
-
if
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
218
|
+
// Using eight bytes doesn't matter if it is signed or unsigned
|
|
219
|
+
if (bytes === 8) {
|
|
220
|
+
return wasm_mod.i64.load(offset, align, ptr, name);
|
|
221
|
+
}
|
|
219
222
|
|
|
223
|
+
if (signed) {
|
|
220
224
|
if (bytes === 1) {
|
|
221
225
|
return wasm_mod.i64.load8_s(offset, align, ptr, name);
|
|
222
226
|
}
|
|
@@ -241,6 +245,8 @@ function caml_binaryen_load(
|
|
|
241
245
|
return wasm_mod.i64.load32_u(offset, align, ptr, name);
|
|
242
246
|
}
|
|
243
247
|
}
|
|
248
|
+
|
|
249
|
+
break;
|
|
244
250
|
}
|
|
245
251
|
case Binaryen.f32: {
|
|
246
252
|
return wasm_mod.f32.load(offset, align, ptr, name);
|
|
@@ -300,6 +306,8 @@ function caml_binaryen_store(
|
|
|
300
306
|
if (bytes === 2) {
|
|
301
307
|
return wasm_mod.i32.store16(offset, align, ptr, value, name);
|
|
302
308
|
}
|
|
309
|
+
|
|
310
|
+
break;
|
|
303
311
|
}
|
|
304
312
|
case Binaryen.i64: {
|
|
305
313
|
if (bytes === 8) {
|
|
@@ -317,6 +325,8 @@ function caml_binaryen_store(
|
|
|
317
325
|
if (bytes === 4) {
|
|
318
326
|
return wasm_mod.i64.store32(offset, align, ptr, value, name);
|
|
319
327
|
}
|
|
328
|
+
|
|
329
|
+
break;
|
|
320
330
|
}
|
|
321
331
|
case Binaryen.f32: {
|
|
322
332
|
return wasm_mod.f32.store(offset, align, ptr, value, name);
|
|
@@ -8,30 +8,6 @@
|
|
|
8
8
|
#include "ocaml_helpers.h"
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
/* Allocating an OCaml custom block to hold the given BinaryenFunctionRef */
|
|
12
|
-
static value alloc_BinaryenFunctionRef(BinaryenFunctionRef fun)
|
|
13
|
-
{
|
|
14
|
-
value v = caml_alloc_custom(&binaryen_ops, sizeof(BinaryenFunctionRef), 0, 1);
|
|
15
|
-
BinaryenFunctionRef_val(v) = fun;
|
|
16
|
-
return v;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
/* Allocating an OCaml custom block to hold the given BinaryenExpressionRef */
|
|
20
|
-
static value alloc_BinaryenExpressionRef(BinaryenExpressionRef exp)
|
|
21
|
-
{
|
|
22
|
-
value v = caml_alloc_custom(&binaryen_ops, sizeof(BinaryenExpressionRef), 0, 1);
|
|
23
|
-
BinaryenExpressionRef_val(v) = exp;
|
|
24
|
-
return v;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
/* Allocating an OCaml custom block to hold the given BinaryenType */
|
|
28
|
-
static value alloc_BinaryenType(BinaryenType typ)
|
|
29
|
-
{
|
|
30
|
-
value v = caml_alloc_custom(&binaryen_ops, sizeof(BinaryenType), 0, 1);
|
|
31
|
-
BinaryenType_val(v) = typ;
|
|
32
|
-
return v;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
11
|
CAMLprim value
|
|
36
12
|
caml_binaryen_add_function(value _module, value _name, value _params, value _results, value _locals, value _body) {
|
|
37
13
|
CAMLparam5(_module, _name, _params, _results, _locals);
|
|
@@ -7,31 +7,6 @@
|
|
|
7
7
|
#include "binaryen-c.h"
|
|
8
8
|
#include "ocaml_helpers.h"
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
/* Allocating an OCaml custom block to hold the given BinaryenGlobalRef */
|
|
12
|
-
static value alloc_BinaryenGlobalRef(BinaryenGlobalRef exp)
|
|
13
|
-
{
|
|
14
|
-
value v = caml_alloc_custom(&binaryen_ops, sizeof(BinaryenGlobalRef), 0, 1);
|
|
15
|
-
BinaryenGlobalRef_val(v) = exp;
|
|
16
|
-
return v;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
/* Allocating an OCaml custom block to hold the given BinaryenType */
|
|
20
|
-
static value alloc_BinaryenType(BinaryenType typ)
|
|
21
|
-
{
|
|
22
|
-
value v = caml_alloc_custom(&binaryen_ops, sizeof(BinaryenType), 0, 1);
|
|
23
|
-
BinaryenType_val(v) = typ;
|
|
24
|
-
return v;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
/* Allocating an OCaml custom block to hold the given BinaryenExpressionRef */
|
|
28
|
-
static value alloc_BinaryenExpressionRef(BinaryenExpressionRef exp)
|
|
29
|
-
{
|
|
30
|
-
value v = caml_alloc_custom(&binaryen_ops, sizeof(BinaryenExpressionRef), 0, 1);
|
|
31
|
-
BinaryenExpressionRef_val(v) = exp;
|
|
32
|
-
return v;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
10
|
CAMLprim value
|
|
36
11
|
caml_binaryen_add_global(value _module, value _name, value _ty, value _mutable_, value _init) {
|
|
37
12
|
CAMLparam5(_module, _name, _ty, _mutable_, _init);
|
|
@@ -0,0 +1,171 @@
|
|
|
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_heap_type_ext(value unit) {
|
|
12
|
+
CAMLparam1(unit);
|
|
13
|
+
BinaryenHeapType ty = BinaryenHeapTypeExt();
|
|
14
|
+
CAMLreturn(alloc_BinaryenHeapType(ty));
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
CAMLprim value
|
|
18
|
+
caml_binaryen_heap_type_func(value unit) {
|
|
19
|
+
CAMLparam1(unit);
|
|
20
|
+
BinaryenHeapType ty = BinaryenHeapTypeFunc();
|
|
21
|
+
CAMLreturn(alloc_BinaryenHeapType(ty));
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
CAMLprim value
|
|
25
|
+
caml_binaryen_heap_type_any(value unit) {
|
|
26
|
+
CAMLparam1(unit);
|
|
27
|
+
BinaryenHeapType ty = BinaryenHeapTypeAny();
|
|
28
|
+
CAMLreturn(alloc_BinaryenHeapType(ty));
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
CAMLprim value
|
|
32
|
+
caml_binaryen_heap_type_eq(value unit) {
|
|
33
|
+
CAMLparam1(unit);
|
|
34
|
+
BinaryenHeapType ty = BinaryenHeapTypeEq();
|
|
35
|
+
CAMLreturn(alloc_BinaryenHeapType(ty));
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
CAMLprim value
|
|
39
|
+
caml_binaryen_heap_type_i31(value unit) {
|
|
40
|
+
CAMLparam1(unit);
|
|
41
|
+
BinaryenHeapType ty = BinaryenHeapTypeI31();
|
|
42
|
+
CAMLreturn(alloc_BinaryenHeapType(ty));
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
CAMLprim value
|
|
46
|
+
caml_binaryen_heap_type_data(value unit) {
|
|
47
|
+
CAMLparam1(unit);
|
|
48
|
+
BinaryenHeapType ty = BinaryenHeapTypeData();
|
|
49
|
+
CAMLreturn(alloc_BinaryenHeapType(ty));
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
CAMLprim value
|
|
53
|
+
caml_binaryen_heap_type_array(value unit) {
|
|
54
|
+
CAMLparam1(unit);
|
|
55
|
+
BinaryenHeapType ty = BinaryenHeapTypeArray();
|
|
56
|
+
CAMLreturn(alloc_BinaryenHeapType(ty));
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
CAMLprim value
|
|
60
|
+
caml_binaryen_heap_type_string(value unit) {
|
|
61
|
+
CAMLparam1(unit);
|
|
62
|
+
BinaryenHeapType ty = BinaryenHeapTypeString();
|
|
63
|
+
CAMLreturn(alloc_BinaryenHeapType(ty));
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
CAMLprim value
|
|
67
|
+
caml_binaryen_heap_type_stringview_wtf8(value unit) {
|
|
68
|
+
CAMLparam1(unit);
|
|
69
|
+
BinaryenHeapType ty = BinaryenHeapTypeStringviewWTF8();
|
|
70
|
+
CAMLreturn(alloc_BinaryenHeapType(ty));
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
CAMLprim value
|
|
74
|
+
caml_binaryen_heap_type_stringview_wtf16(value unit) {
|
|
75
|
+
CAMLparam1(unit);
|
|
76
|
+
BinaryenHeapType ty = BinaryenHeapTypeStringviewWTF16();
|
|
77
|
+
CAMLreturn(alloc_BinaryenHeapType(ty));
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
CAMLprim value
|
|
81
|
+
caml_binaryen_heap_type_stringview_iter(value unit) {
|
|
82
|
+
CAMLparam1(unit);
|
|
83
|
+
BinaryenHeapType ty = BinaryenHeapTypeStringviewIter();
|
|
84
|
+
CAMLreturn(alloc_BinaryenHeapType(ty));
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
CAMLprim value
|
|
88
|
+
caml_binaryen_heap_type_none(value unit) {
|
|
89
|
+
CAMLparam1(unit);
|
|
90
|
+
BinaryenHeapType ty = BinaryenHeapTypeNone();
|
|
91
|
+
CAMLreturn(alloc_BinaryenHeapType(ty));
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
CAMLprim value
|
|
95
|
+
caml_binaryen_heap_type_noext(value unit) {
|
|
96
|
+
CAMLparam1(unit);
|
|
97
|
+
BinaryenHeapType ty = BinaryenHeapTypeNoext();
|
|
98
|
+
CAMLreturn(alloc_BinaryenHeapType(ty));
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
CAMLprim value
|
|
102
|
+
caml_binaryen_heap_type_nofunc(value unit) {
|
|
103
|
+
CAMLparam1(unit);
|
|
104
|
+
BinaryenHeapType ty = BinaryenHeapTypeNofunc();
|
|
105
|
+
CAMLreturn(alloc_BinaryenHeapType(ty));
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
CAMLprim value
|
|
109
|
+
caml_binaryen_heap_type_is_basic(value _ty) {
|
|
110
|
+
CAMLparam1(_ty);
|
|
111
|
+
BinaryenHeapType ty = BinaryenHeapType_val(_ty);
|
|
112
|
+
bool result = BinaryenHeapTypeIsBasic(ty);
|
|
113
|
+
CAMLreturn(Val_bool(result));
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
CAMLprim value
|
|
117
|
+
caml_binaryen_heap_type_is_signature(value _ty) {
|
|
118
|
+
CAMLparam1(_ty);
|
|
119
|
+
BinaryenHeapType ty = BinaryenHeapType_val(_ty);
|
|
120
|
+
bool result = BinaryenHeapTypeIsSignature(ty);
|
|
121
|
+
CAMLreturn(Val_bool(result));
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
CAMLprim value
|
|
125
|
+
caml_binaryen_heap_type_is_struct(value _ty) {
|
|
126
|
+
CAMLparam1(_ty);
|
|
127
|
+
BinaryenHeapType ty = BinaryenHeapType_val(_ty);
|
|
128
|
+
bool result = BinaryenHeapTypeIsStruct(ty);
|
|
129
|
+
CAMLreturn(Val_bool(result));
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
CAMLprim value
|
|
133
|
+
caml_binaryen_heap_type_is_array(value _ty) {
|
|
134
|
+
CAMLparam1(_ty);
|
|
135
|
+
BinaryenHeapType ty = BinaryenHeapType_val(_ty);
|
|
136
|
+
bool result = BinaryenHeapTypeIsArray(ty);
|
|
137
|
+
CAMLreturn(Val_bool(result));
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
CAMLprim value
|
|
141
|
+
caml_binaryen_heap_type_is_bottom(value _ty) {
|
|
142
|
+
CAMLparam1(_ty);
|
|
143
|
+
BinaryenHeapType ty = BinaryenHeapType_val(_ty);
|
|
144
|
+
bool result = BinaryenHeapTypeIsBottom(ty);
|
|
145
|
+
CAMLreturn(Val_bool(result));
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
CAMLprim value
|
|
149
|
+
caml_binaryen_heap_type_get_bottom(value _ty) {
|
|
150
|
+
CAMLparam1(_ty);
|
|
151
|
+
BinaryenHeapType ty = BinaryenHeapType_val(_ty);
|
|
152
|
+
BinaryenHeapType heapTy = BinaryenHeapTypeGetBottom(ty);
|
|
153
|
+
CAMLreturn(alloc_BinaryenHeapType(heapTy));
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
CAMLprim value
|
|
157
|
+
caml_binaryen_heap_type_is_sub_type(value _left, value _right) {
|
|
158
|
+
CAMLparam2(_left, _right);
|
|
159
|
+
BinaryenHeapType left = BinaryenHeapType_val(_left);
|
|
160
|
+
BinaryenHeapType right = BinaryenHeapType_val(_right);
|
|
161
|
+
bool result = BinaryenHeapTypeIsSubType(left, right);
|
|
162
|
+
CAMLreturn(Val_bool(result));
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
CAMLprim value
|
|
166
|
+
caml_binaryen_type_get_heap_type(value _ty) {
|
|
167
|
+
CAMLparam1(_ty);
|
|
168
|
+
BinaryenType ty = BinaryenType_val(_ty);
|
|
169
|
+
BinaryenHeapType heapTy = BinaryenTypeGetHeapType(ty);
|
|
170
|
+
CAMLreturn(alloc_BinaryenHeapType(heapTy));
|
|
171
|
+
}
|