@grain/binaryen.ml 0.13.0 → 0.15.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.
Files changed (76) hide show
  1. binaryen-archive/CHANGELOG.md +44 -0
  2. binaryen-archive/README.md +16 -0
  3. binaryen-archive/binaryen.opam +4 -6
  4. binaryen-archive/dune +1 -1
  5. binaryen-archive/esy.lock/index.json +87 -173
  6. binaryen-archive/esy.lock/opam/{cmdliner.1.0.4 → cmdliner.1.1.0}/opam +17 -20
  7. binaryen-archive/esy.lock/opam/{ocaml-lsp-server.1.9.1 → ocaml-lsp-server.1.10.3}/opam +4 -4
  8. binaryen-archive/esy.lock/opam/{ocamlbuild.0.14.0 → ocamlbuild.0.14.1}/opam +18 -15
  9. binaryen-archive/esy.lock/opam/ocamlformat.0.20.1/opam +2 -0
  10. binaryen-archive/esy.lock/opam/{ppxlib.0.24.0 → ppxlib.0.25.0}/opam +4 -4
  11. binaryen-archive/esy.lock/opam/stdlib-shims.0.3.0/opam +1 -1
  12. binaryen-archive/esy.lock/opam/uutf.1.0.3/opam +36 -0
  13. binaryen-archive/esy.lock/overrides/opam__s__ocamlbuild_opam__c__0.14.1_opam_override/files/winpatch.patch +11 -0
  14. binaryen-archive/esy.lock/overrides/{opam__s__ocamlbuild_opam__c__0.14.0_opam_override → opam__s__ocamlbuild_opam__c__0.14.1_opam_override}/package.json +5 -3
  15. binaryen-archive/esy.lock/overrides/opam__s__ocamlfind_opam__c__1.9.3_opam_override/files/findlib.patch +14 -0
  16. binaryen-archive/package.json +4 -6
  17. binaryen-archive/src/binaryen_stubs_exports.js +110 -0
  18. binaryen-archive/src/binaryen_stubs_expressions.js +1613 -0
  19. binaryen-archive/src/binaryen_stubs_features.js +105 -0
  20. binaryen-archive/src/binaryen_stubs_functions.js +92 -0
  21. binaryen-archive/src/binaryen_stubs_globals.js +62 -0
  22. binaryen-archive/src/binaryen_stubs_imports.js +86 -0
  23. binaryen-archive/src/binaryen_stubs_literals.js +29 -0
  24. binaryen-archive/src/binaryen_stubs_memory.js +25 -0
  25. binaryen-archive/src/binaryen_stubs_modules.js +121 -0
  26. binaryen-archive/src/binaryen_stubs_ops.js +1895 -0
  27. binaryen-archive/src/binaryen_stubs_settings.js +120 -0
  28. binaryen-archive/src/binaryen_stubs_tables.c +2 -0
  29. binaryen-archive/src/binaryen_stubs_tables.js +84 -0
  30. binaryen-archive/src/binaryen_stubs_types.js +73 -0
  31. binaryen-archive/src/dune +11 -4
  32. binaryen-archive/{virtual → src}/element_segment.mli +0 -0
  33. binaryen-archive/{virtual → src}/export.mli +0 -0
  34. binaryen-archive/{virtual → src}/expression.mli +0 -0
  35. binaryen-archive/{virtual → src}/function.mli +0 -0
  36. binaryen-archive/{virtual → src}/global.mli +0 -0
  37. binaryen-archive/{virtual → src}/import.mli +0 -0
  38. binaryen-archive/src/literal.ml +0 -13
  39. binaryen-archive/src/literal.mli +8 -0
  40. binaryen-archive/src/memory.ml +6 -6
  41. binaryen-archive/{virtual → src}/memory.mli +1 -1
  42. binaryen-archive/src/module.ml +1 -1
  43. binaryen-archive/{virtual → src}/module.mli +1 -1
  44. binaryen-archive/{virtual → src}/op.mli +0 -0
  45. binaryen-archive/src/passes.ml +345 -0
  46. binaryen-archive/src/passes.mli +343 -0
  47. binaryen-archive/{virtual → src}/settings.mli +0 -0
  48. binaryen-archive/{virtual → src}/table.mli +0 -0
  49. binaryen-archive/{virtual → src}/type.mli +0 -0
  50. binaryen-archive/test/dune +2 -22
  51. binaryen-archive/test/test.expected +8 -4
  52. binaryen-archive/test/test.ml +33 -10
  53. binaryen-archive/esy.lock/opam/js_of_ocaml-ppx.3.11.0/opam +0 -44
  54. binaryen-archive/esy.lock/opam/js_of_ocaml.3.11.0/opam +0 -45
  55. binaryen-archive/esy.lock/opam/uchar.0.0.2/opam +0 -36
  56. binaryen-archive/esy.lock/opam/uutf.1.0.2/opam +0 -40
  57. binaryen-archive/esy.lock/overrides/opam__s__ocamlbuild_opam__c__0.14.0_opam_override/files/ocamlbuild-0.14.0.patch +0 -463
  58. binaryen-archive/js/binaryen.es5.js +0 -363
  59. binaryen-archive/js/dune +0 -13
  60. binaryen-archive/js/element_segment.ml +0 -33
  61. binaryen-archive/js/export.ml +0 -57
  62. binaryen-archive/js/expression.ml +0 -1105
  63. binaryen-archive/js/function.ml +0 -60
  64. binaryen-archive/js/global.ml +0 -48
  65. binaryen-archive/js/import.ml +0 -69
  66. binaryen-archive/js/literal.ml +0 -28
  67. binaryen-archive/js/memory.ml +0 -39
  68. binaryen-archive/js/module.ml +0 -116
  69. binaryen-archive/js/op.ml +0 -482
  70. binaryen-archive/js/prelude.js +0 -2
  71. binaryen-archive/js/settings.ml +0 -60
  72. binaryen-archive/js/stubs.c +0 -15
  73. binaryen-archive/js/table.ml +0 -29
  74. binaryen-archive/js/type.ml +0 -21
  75. binaryen-archive/virtual/dune +0 -6
  76. binaryen-archive/virtual/literal.mli +0 -19
@@ -1,5 +1,3 @@
1
- ; Tests for the default_implementation (mirrors 0.2.2 usage)
2
-
3
1
  (test
4
2
  (name test)
5
3
  (modules test)
@@ -9,24 +7,6 @@
9
7
  (action
10
8
  (run %{test})))
11
9
 
12
- ; Tests for binaryen.native implementation
13
-
14
- (rule
15
- (target test_native.ml)
16
- (action
17
- (progn
18
- (copy %{dep:test.ml} %{target})
19
- (copy test.expected test_native.expected))))
20
-
21
- (test
22
- (name test_native)
23
- (modules test_native)
24
- (libraries binaryen binaryen.native)
25
- (ocamlopt_flags
26
- (:include ./config/ocamlopt_flags.sexp))
27
- (action
28
- (run %{test})))
29
-
30
10
  ; Tests for binaryen.js implementation
31
11
 
32
12
  (rule
@@ -43,8 +23,8 @@
43
23
  (modules test_js)
44
24
  (modes
45
25
  (byte js))
46
- (libraries binaryen binaryen.js)
26
+ (libraries binaryen)
47
27
  (action
48
28
  (run node %{dep:test_js.bc.js}))
49
29
  (js_of_ocaml
50
- (flags --no-sourcemap)))
30
+ (flags --no-sourcemap --disable share)))
@@ -13,8 +13,10 @@
13
13
  (type $externref_=>_i32 (func (param externref) (result i32)))
14
14
  (import "future-wasi" "write" (func $write (param externref i32 i32) (result i32)))
15
15
  (global $max_int64 i64 (i64.const 9223372036854775807))
16
+ (global $max_int64_mut (mut i64) (i64.const 9223372036854775807))
16
17
  (global $test_float64_bits f64 (f64.const 1.23))
17
18
  (memory $0 1)
19
+ (data (i32.const 0) "hello")
18
20
  (table $table 1 1 funcref)
19
21
  (elem $elem (i32.const 0) $adder)
20
22
  (export "adder" (func $adder))
@@ -63,6 +65,7 @@
63
65
  (type $externref_=>_i32 (func (param externref) (result i32)))
64
66
  (import "future-wasi" "write" (func $write (param externref i32 i32) (result i32)))
65
67
  (memory $0 1)
68
+ (data (i32.const 0) "hello")
66
69
  (table $table 1 1 funcref)
67
70
  (elem $elem (i32.const 0) $adder)
68
71
  (export "adder" (func $adder))
@@ -98,12 +101,13 @@
98
101
  )
99
102
  )
100
103
  (module
101
- (type $externref_i32_i32_=>_i32 (func (param externref i32 i32) (result i32)))
102
- (type $i32_i32_=>_i32 (func (param i32 i32) (result i32)))
103
- (type $none_=>_none (func))
104
- (type $externref_=>_i32 (func (param externref) (result i32)))
104
+ (type $type$0 (func (param externref i32 i32) (result i32)))
105
+ (type $type$1 (func (param i32 i32) (result i32)))
106
+ (type $type$2 (func))
107
+ (type $type$3 (func (param externref) (result i32)))
105
108
  (import "future-wasi" "write" (func $fimport$0 (param externref i32 i32) (result i32)))
106
109
  (memory $0 1)
110
+ (data (i32.const 0) "hello")
107
111
  (table $0 1 1 funcref)
108
112
  (elem (i32.const 0) $0)
109
113
  (export "adder" (func $0))
@@ -34,15 +34,18 @@ let select =
34
34
 
35
35
  let bin = Expression.Binary.make wasm_mod Op.add_int32 select (y ())
36
36
 
37
+ let if_ =
38
+ Expression.If.make wasm_mod
39
+ (Expression.Const.make wasm_mod (Literal.int32 0l))
40
+ (Expression.Unreachable.make wasm_mod)
41
+ (Expression.Null.make ())
42
+
43
+ let _ = assert (Expression.If.get_if_false if_ = None)
44
+
37
45
  let add =
38
- Expression.Block.make wasm_mod ~return_type:Type.int32 "add"
39
- [
40
- Expression.If.make wasm_mod
41
- (Expression.Const.make wasm_mod (Literal.int32 0l))
42
- (Expression.Unreachable.make wasm_mod)
43
- (Expression.Null.make ());
44
- bin;
45
- ]
46
+ Expression.Block.make wasm_mod ~return_type:Type.int32 "add" [ if_; bin ]
47
+
48
+ let _ = assert (Expression.Block.get_name add = Some "add")
46
49
 
47
50
  (* Create the add function *)
48
51
  let adder = Function.add_function wasm_mod "adder" (params ()) results [||] add
@@ -91,6 +94,10 @@ let _ =
91
94
  Global.add_global wasm_mod "max_int64" Type.int64 false
92
95
  (Expression.Const.make wasm_mod (Literal.int64 Int64.max_int))
93
96
 
97
+ let _ =
98
+ Global.add_global wasm_mod "max_int64_mut" Type.int64 true
99
+ (Expression.Const.make wasm_mod (Literal.int64 Int64.max_int))
100
+
94
101
  let _ =
95
102
  Global.add_global wasm_mod "test_float64_bits" Type.float64 false
96
103
  (Expression.Const.make wasm_mod (Literal.float64_bits 0x3FF3AE147AE147AEL))
@@ -100,7 +107,15 @@ let _ =
100
107
  (Expression.Const.make wasm_mod (Literal.int32 0l))
101
108
 
102
109
  let _ = Function.set_start wasm_mod start
103
- let _ = Memory.set_memory wasm_mod 1 Memory.unlimited "memory" [] false
110
+
111
+ let segment : Binaryen.Memory.segment =
112
+ let data = "hello" in
113
+ let passive = false in
114
+ let offset = Expression.Const.make wasm_mod (Literal.int32 0l) in
115
+ let size = String.length data in
116
+ { data; passive; offset; size }
117
+
118
+ let _ = Memory.set_memory wasm_mod 1 Memory.unlimited "memory" [ segment ] false
104
119
 
105
120
  (* Create an imported "write" function i32 (externref, i32, i32) *)
106
121
  (* Similar to the example here: https://bytecodealliance.org/articles/reference-types-in-wasmtime *)
@@ -139,8 +154,16 @@ let _ = Module.print wasm_mod
139
154
 
140
155
  (* 3. Copy previous module bytes into new module, validate, and print *)
141
156
 
142
- let byts, _ = Module.write wasm_mod None
157
+ let byts, no_sourcemap = Module.write wasm_mod None
158
+ let _ = assert (no_sourcemap = None)
159
+ let _, sourcemap = Module.write wasm_mod (Some "test.wasm.map")
160
+
161
+ let _ =
162
+ assert (
163
+ sourcemap = Some {|{"version":3,"sources":[],"names":[],"mappings":""}|})
164
+
143
165
  let new_mod = Module.read byts
166
+ let _ = Module.run_passes new_mod [ Passes.name_types ]
144
167
 
145
168
  let _ =
146
169
  Module.set_features new_mod
@@ -1,44 +0,0 @@
1
- opam-version: "2.0"
2
- synopsis: "Compiler from OCaml bytecode to JavaScript"
3
- description:
4
- "Js_of_ocaml is a compiler from OCaml bytecode to JavaScript. It makes it possible to run pure OCaml programs in JavaScript environment like browsers and Node.js"
5
- maintainer: ["Ocsigen team <dev@ocsigen.org>"]
6
- authors: ["Ocsigen team <dev@ocsigen.org>"]
7
- license:
8
- "GPL-2.0-or-later AND LGPL-2.1-or-later WITH OCaml-LGPL-linking-exception"
9
- homepage: "https://ocsigen.github.io/js_of_ocaml"
10
- doc: "https://ocsigen.github.io/js_of_ocaml"
11
- bug-reports: "https://github.com/ocsigen/js_of_ocaml/issues"
12
- depends: [
13
- "dune" {>= "2.8"}
14
- "ocaml" {>= "4.04"}
15
- "js_of_ocaml" {= version}
16
- "ppxlib" {>= "0.15.0"}
17
- "num" {with-test}
18
- "ppx_expect" {with-test}
19
- "re" {>= "1.9.0" & with-test}
20
- "odoc" {with-doc}
21
- ]
22
- dev-repo: "git+https://github.com/ocsigen/js_of_ocaml.git"
23
- build: [
24
- ["dune" "subst"] {dev}
25
- [
26
- "dune"
27
- "build"
28
- "-p"
29
- name
30
- "-j"
31
- jobs
32
- "@install"
33
- "@doc" {with-doc}
34
- ]
35
- ]
36
- url {
37
- src:
38
- "https://github.com/ocsigen/js_of_ocaml/releases/download/3.11.0/js_of_ocaml-3.11.0.tbz"
39
- checksum: [
40
- "sha256=158dafe7271ac79157981d1c3f5f177ec78a0099c38f861ae14e7ac06bd29c3a"
41
- "sha512=d83f0988aa1089fa01a0a693d7e6a832018c5a8ce707f44685809769377ef7ef59ce48229b1612966bd9166b610d66ddff8f2606f6c3f09c49f601b74842fde1"
42
- ]
43
- }
44
- x-commit-hash: "4572278dea9cc8a7d44d65b440004a2ec3bce7a7"
@@ -1,45 +0,0 @@
1
- opam-version: "2.0"
2
- synopsis: "Compiler from OCaml bytecode to JavaScript"
3
- description:
4
- "Js_of_ocaml is a compiler from OCaml bytecode to JavaScript. It makes it possible to run pure OCaml programs in JavaScript environment like browsers and Node.js"
5
- maintainer: ["Ocsigen team <dev@ocsigen.org>"]
6
- authors: ["Ocsigen team <dev@ocsigen.org>"]
7
- license:
8
- "GPL-2.0-or-later AND LGPL-2.1-or-later WITH OCaml-LGPL-linking-exception"
9
- homepage: "https://ocsigen.github.io/js_of_ocaml"
10
- doc: "https://ocsigen.github.io/js_of_ocaml"
11
- bug-reports: "https://github.com/ocsigen/js_of_ocaml/issues"
12
- depends: [
13
- "dune" {>= "2.8"}
14
- "ocaml" {>= "4.04"}
15
- "js_of_ocaml-compiler" {= version}
16
- "ppxlib" {>= "0.15"}
17
- "uchar"
18
- "num" {with-test}
19
- "ppx_expect" {with-test}
20
- "re" {>= "1.9.0" & with-test}
21
- "odoc" {with-doc}
22
- ]
23
- dev-repo: "git+https://github.com/ocsigen/js_of_ocaml.git"
24
- build: [
25
- ["dune" "subst"] {dev}
26
- [
27
- "dune"
28
- "build"
29
- "-p"
30
- name
31
- "-j"
32
- jobs
33
- "@install"
34
- "@doc" {with-doc}
35
- ]
36
- ]
37
- url {
38
- src:
39
- "https://github.com/ocsigen/js_of_ocaml/releases/download/3.11.0/js_of_ocaml-3.11.0.tbz"
40
- checksum: [
41
- "sha256=158dafe7271ac79157981d1c3f5f177ec78a0099c38f861ae14e7ac06bd29c3a"
42
- "sha512=d83f0988aa1089fa01a0a693d7e6a832018c5a8ce707f44685809769377ef7ef59ce48229b1612966bd9166b610d66ddff8f2606f6c3f09c49f601b74842fde1"
43
- ]
44
- }
45
- x-commit-hash: "4572278dea9cc8a7d44d65b440004a2ec3bce7a7"
@@ -1,36 +0,0 @@
1
- opam-version: "2.0"
2
- maintainer: "Daniel Bünzli <daniel.buenzl i@erratique.ch>"
3
- authors: ["Daniel Bünzli <daniel.buenzl i@erratique.ch>"]
4
- homepage: "http://ocaml.org"
5
- doc: "https://ocaml.github.io/uchar/"
6
- dev-repo: "git+https://github.com/ocaml/uchar.git"
7
- bug-reports: "https://github.com/ocaml/uchar/issues"
8
- tags: [ "text" "character" "unicode" "compatibility" "org:ocaml.org" ]
9
- license: "typeof OCaml system"
10
- depends: [
11
- "ocaml" {>= "3.12.0"}
12
- "ocamlbuild" {build}
13
- ]
14
- build: [
15
- ["ocaml" "pkg/git.ml"]
16
- [
17
- "ocaml"
18
- "pkg/build.ml"
19
- "native=%{ocaml:native}%"
20
- "native-dynlink=%{ocaml:native-dynlink}%"
21
- ]
22
- ]
23
- synopsis: "Compatibility library for OCaml's Uchar module"
24
- description: """
25
- The `uchar` package provides a compatibility library for the
26
- [`Uchar`][1] module introduced in OCaml 4.03.
27
-
28
- The `uchar` package is distributed under the license of the OCaml
29
- compiler. See [LICENSE](LICENSE) for details.
30
-
31
- [1]: http://caml.inria.fr/pub/docs/manual-ocaml/libref/Uchar.html"""
32
- url {
33
- src:
34
- "https://github.com/ocaml/uchar/releases/download/v0.0.2/uchar-0.0.2.tbz"
35
- checksum: "md5=c9ba2c738d264c420c642f7bb1cf4a36"
36
- }
@@ -1,40 +0,0 @@
1
- opam-version: "2.0"
2
- maintainer: "Daniel Bünzli <daniel.buenzl i@erratique.ch>"
3
- authors: ["Daniel Bünzli <daniel.buenzl i@erratique.ch>"]
4
- homepage: "http://erratique.ch/software/uutf"
5
- doc: "http://erratique.ch/software/uutf/doc/Uutf"
6
- dev-repo: "git+http://erratique.ch/repos/uutf.git"
7
- bug-reports: "https://github.com/dbuenzli/uutf/issues"
8
- tags: [ "unicode" "text" "utf-8" "utf-16" "codec" "org:erratique" ]
9
- license: "ISC"
10
- depends: [
11
- "ocaml" {>= "4.01.0"}
12
- "ocamlfind" {build}
13
- "ocamlbuild" {build}
14
- "topkg" {build}
15
- "uchar"
16
- ]
17
- depopts: ["cmdliner"]
18
- conflicts: ["cmdliner" { < "0.9.6"} ]
19
- build: [[
20
- "ocaml" "pkg/pkg.ml" "build"
21
- "--pinned" "%{pinned}%"
22
- "--with-cmdliner" "%{cmdliner:installed}%" ]]
23
- synopsis: """Non-blocking streaming Unicode codec for OCaml"""
24
- description: """\
25
-
26
- Uutf is a non-blocking streaming codec to decode and encode the UTF-8,
27
- UTF-16, UTF-16LE and UTF-16BE encoding schemes. It can efficiently
28
- work character by character without blocking on IO. Decoders perform
29
- character position tracking and support newline normalization.
30
-
31
- Functions are also provided to fold over the characters of UTF encoded
32
- OCaml string values and to directly encode characters in OCaml
33
- Buffer.t values.
34
-
35
- Uutf has no dependency and is distributed under the ISC license.
36
- """
37
- url {
38
- archive: "http://erratique.ch/software/uutf/releases/uutf-1.0.2.tbz"
39
- checksum: "a7c542405a39630c689a82bd7ef2292c"
40
- }