@grain/binaryen.ml 0.11.0 → 0.12.1

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 (44) hide show
  1. binaryen-archive/CHANGELOG.md +46 -0
  2. binaryen-archive/README.md +1 -1
  3. binaryen-archive/binaryen.opam +6 -6
  4. binaryen-archive/esy.lock/index.json +325 -310
  5. binaryen-archive/esy.lock/opam/base-bytes.base/opam +9 -0
  6. binaryen-archive/esy.lock/opam/{base.v0.14.2 → base.v0.14.3}/opam +2 -2
  7. binaryen-archive/esy.lock/opam/{dune-build-info.2.9.1 → dune-build-info.2.9.3}/opam +5 -4
  8. binaryen-archive/esy.lock/opam/{dune-configurator.2.9.1 → dune-configurator.2.9.3}/opam +5 -4
  9. binaryen-archive/esy.lock/opam/{dune.2.9.1 → dune.2.9.3}/opam +5 -4
  10. binaryen-archive/esy.lock/opam/either.1.0.0/opam +40 -0
  11. binaryen-archive/esy.lock/opam/{fix.20211231 → fix.20220121}/opam +3 -3
  12. binaryen-archive/esy.lock/opam/menhir.20211128/opam +1 -1
  13. binaryen-archive/esy.lock/opam/{ocaml-lsp-server.1.9.0 → ocaml-lsp-server.1.9.1}/opam +5 -5
  14. binaryen-archive/esy.lock/opam/{ocamlfind.1.9.1 → ocamlfind.1.9.3}/opam +3 -3
  15. binaryen-archive/esy.lock/opam/{ocamlformat.0.18.0 → ocamlformat.0.20.1}/opam +14 -15
  16. binaryen-archive/esy.lock/opam/ocp-indent.1.7.0/opam +57 -0
  17. binaryen-archive/esy.lock/opam/odoc-parser.1.0.0/opam +46 -0
  18. binaryen-archive/esy.lock/opam/{ppxlib.0.22.2 → ppxlib.0.24.0}/opam +9 -6
  19. binaryen-archive/esy.lock/opam/{topkg.1.0.4 → topkg.1.0.5}/opam +3 -3
  20. binaryen-archive/esy.lock/overrides/{opam__s__ocamlfind_opam__c__1.9.1_opam_override/files/findlib-1.9.1.patch → opam__s__ocamlfind_opam__c__1.9.3_opam_override/files/findlib.patch} +0 -0
  21. binaryen-archive/esy.lock/overrides/{opam__s__ocamlfind_opam__c__1.9.1_opam_override → opam__s__ocamlfind_opam__c__1.9.3_opam_override}/package.json +1 -1
  22. binaryen-archive/js/binaryen.es5.js +5 -5
  23. binaryen-archive/js/dune +1 -1
  24. binaryen-archive/js/export.ml +1 -1
  25. binaryen-archive/js/module.ml +6 -1
  26. binaryen-archive/js/postlude.js +2 -2
  27. binaryen-archive/js/prelude.js +11 -0
  28. binaryen-archive/js/table.ml +2 -2
  29. binaryen-archive/package.json +11 -8
  30. binaryen-archive/src/binaryen_stubs_exports.c +2 -2
  31. binaryen-archive/src/binaryen_stubs_modules.c +7 -0
  32. binaryen-archive/src/binaryen_stubs_tables.c +4 -3
  33. binaryen-archive/src/dune +1 -2
  34. binaryen-archive/src/export.ml +2 -2
  35. binaryen-archive/src/module.ml +5 -1
  36. binaryen-archive/src/table.ml +2 -2
  37. binaryen-archive/test/test.expected +5 -5
  38. binaryen-archive/test/test.ml +4 -1
  39. binaryen-archive/virtual/export.mli +1 -1
  40. binaryen-archive/virtual/module.mli +2 -0
  41. binaryen-archive/virtual/table.mli +1 -1
  42. binaryen-archive/esy.lock/opam/ocaml-migrate-parsetree.2.3.0/opam +0 -39
  43. binaryen-archive/esy.lock/opam/odoc.1.5.3/opam +0 -53
  44. binaryen-archive/esy.lock/opam/tyxml.4.5.0/opam +0 -42
binaryen-archive/js/dune CHANGED
@@ -10,4 +10,4 @@
10
10
  (names stubs))
11
11
  (js_of_ocaml
12
12
  (flags --no-sourcemap)
13
- (javascript_files binaryen.es5.js postlude.js)))
13
+ (javascript_files prelude.js binaryen.es5.js postlude.js)))
@@ -51,7 +51,7 @@ let external_memory = meth_call global##.binaryen "_BinaryenExternalMemory" [||]
51
51
 
52
52
  let external_global = meth_call global##.binaryen "_BinaryenExternalGlobal" [||]
53
53
 
54
- let external_event = meth_call global##.binaryen "_BinaryenExternalEvent" [||]
54
+ let external_tag = meth_call global##.binaryen "_BinaryenExternalTag" [||]
55
55
 
56
56
  let export_get_kind export =
57
57
  let export_info =
@@ -74,7 +74,9 @@ let get_features wasm_mod =
74
74
  feature :: split_features (feature lsr 1)
75
75
  | feature -> split_features (feature lsr 1)
76
76
  in
77
- split_features 0x80000000
77
+ (* Support 32-bit OCaml where integers are 31 bits *)
78
+ (* This supports up to 31 Binaryen features *)
79
+ split_features 0x40000000
78
80
 
79
81
  let set_features wasm_mod features =
80
82
  meth_call wasm_mod "setFeatures"
@@ -112,3 +114,6 @@ let add_debug_info_filename wasm_mod filename =
112
114
 
113
115
  let get_debug_info_filename wasm_mod index =
114
116
  meth_call wasm_mod "getDebugInfoFileName" [| inject index |]
117
+
118
+ (* The JS version doesn't expose `update_maps` *)
119
+ let update_maps wasm_mod = ()
@@ -1,2 +1,2 @@
1
- // Attach binaryen to our global
2
- global.binaryen = module.exports;
1
+ // Attach binaryen to globalThis because JSOO wraps in an iife
2
+ globalThis.binaryen = module.exports;
@@ -0,0 +1,11 @@
1
+ if (typeof module === 'undefined') {
2
+ module = {};
3
+ }
4
+
5
+ if (typeof exports === 'undefined') {
6
+ exports = {};
7
+ }
8
+
9
+ if (typeof module.exports === 'undefined') {
10
+ module.exports = exports;
11
+ }
@@ -3,9 +3,9 @@ open Js_of_ocaml.Js.Unsafe
3
3
 
4
4
  type t = int
5
5
 
6
- let add_table wasm_mod name initial maximum =
6
+ let add_table wasm_mod name initial maximum tableType =
7
7
  meth_call wasm_mod "addTable"
8
- [| inject (string name); inject initial; inject maximum |]
8
+ [| inject (string name); inject initial; inject maximum; inject tableType |]
9
9
 
10
10
  let add_active_element_segment wasm_mod table name funcnames offset =
11
11
  meth_call wasm_mod "addActiveElementSegment"
@@ -1,21 +1,24 @@
1
1
  {
2
2
  "name": "@grain/binaryen.ml",
3
- "version": "0.11.0",
3
+ "version": "0.12.1",
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
- "ocaml": ">= 4.12.0 < 4.13.0",
9
- "@grain/libbinaryen": "^101.0.1",
8
+ "ocaml": ">= 4.12.0",
9
+ "@grain/libbinaryen": "^102.0.4",
10
10
  "@opam/dune": "^2.9.1",
11
11
  "@opam/dune-configurator": "^2.9.1",
12
- "@opam/js_of_ocaml": "^3.10.0",
13
- "@opam/js_of_ocaml-ppx": "^3.10.0"
12
+ "@opam/js_of_ocaml": ">= 3.10.0 < 4.0.0",
13
+ "@opam/js_of_ocaml-ppx": ">= 3.10.0 < 4.0.0"
14
14
  },
15
15
  "devDependencies": {
16
- "@opam/js_of_ocaml-compiler": "^3.10.0",
17
- "@opam/ocamlformat": "0.18.0",
18
- "@opam/ocaml-lsp-server": "^1.8.2"
16
+ "@opam/js_of_ocaml-compiler": ">= 3.10.0 < 4.0.0",
17
+ "@opam/ocamlformat": "0.20.1",
18
+ "@opam/ocaml-lsp-server": "^1.9.1"
19
+ },
20
+ "resolutions": {
21
+ "@opam/ocp-indent": "1.7.0"
19
22
  },
20
23
  "esy": {
21
24
  "build": "dune build -p binaryen"
@@ -130,9 +130,9 @@ caml_binaryen_external_global(value _unit) {
130
130
  }
131
131
 
132
132
  CAMLprim value
133
- caml_binaryen_external_event(value _unit) {
133
+ caml_binaryen_external_tag(value _unit) {
134
134
  CAMLparam1(_unit);
135
- CAMLreturn(Val_int(BinaryenExternalEvent()));
135
+ CAMLreturn(Val_int(BinaryenExternalTag()));
136
136
  }
137
137
 
138
138
  CAMLprim value
@@ -172,3 +172,10 @@ caml_binaryen_add_custom_section(value _module, value _name, value _contents) {
172
172
  BinaryenAddCustomSection(module, name, contents, contentsLen);
173
173
  CAMLreturn(Val_unit);
174
174
  }
175
+
176
+ CAMLprim value
177
+ caml_binaryen_module_update_maps(value module) {
178
+ CAMLparam1(module);
179
+ BinaryenModuleUpdateMaps(BinaryenModuleRef_val(module));
180
+ CAMLreturn(Val_unit);
181
+ }
@@ -33,13 +33,14 @@ static value alloc_BinaryenExpressionRef(BinaryenExpressionRef exp)
33
33
  }
34
34
 
35
35
  CAMLprim value
36
- caml_binaryen_add_table(value _module, value _table, value _initial, value _maximum) {
37
- CAMLparam4(_module, _table, _initial, _maximum);
36
+ caml_binaryen_add_table(value _module, value _table, value _initial, value _maximum, value _tableType) {
37
+ CAMLparam5(_module, _table, _initial, _maximum, _tableType);
38
38
  BinaryenModuleRef module = BinaryenModuleRef_val(_module);
39
39
  char* table = Safe_String_val(_table);
40
40
  BinaryenIndex initial = Int_val(_initial);
41
41
  BinaryenIndex maximum = Int_val(_maximum);
42
- CAMLreturn(alloc_BinaryenTableRef(BinaryenAddTable(module, table, initial, maximum)));
42
+ BinaryenType tableType = BinaryenType_val(_tableType);
43
+ CAMLreturn(alloc_BinaryenTableRef(BinaryenAddTable(module, table, initial, maximum, tableType)));
43
44
  }
44
45
 
45
46
  CAMLprim value
binaryen-archive/src/dune CHANGED
@@ -10,5 +10,4 @@
10
10
  binaryen_stubs_imports binaryen_stubs_exports binaryen_stubs_globals
11
11
  binaryen_stubs_tables binaryen_stubs_memory binaryen_stubs_features
12
12
  binaryen_stubs_modules binaryen_stubs_settings ocaml_helpers)
13
- (flags :standard -O2 -Wall -Wextra))
14
- (c_library_flags :standard -lstdc++ -lpthread))
13
+ (flags :standard -O2 -Wall -Wextra)))
@@ -47,8 +47,8 @@ external external_global : unit -> int = "caml_binaryen_external_global"
47
47
 
48
48
  let external_global = external_global ()
49
49
 
50
- external external_event : unit -> int = "caml_binaryen_external_event"
50
+ external external_tag : unit -> int = "caml_binaryen_external_tag"
51
51
 
52
- let external_event = external_event ()
52
+ let external_tag = external_tag ()
53
53
 
54
54
  external export_get_kind : t -> int = "caml_binaryen_export_get_kind"
@@ -85,7 +85,9 @@ let get_features wasm_mod =
85
85
  feature :: split_features (feature lsr 1)
86
86
  | feature -> split_features (feature lsr 1)
87
87
  in
88
- split_features 0x80000000
88
+ (* Support 32-bit OCaml where integers are 31 bits *)
89
+ (* This supports up to 31 Binaryen features *)
90
+ split_features 0x40000000
89
91
 
90
92
  external set_features : t -> int -> unit = "caml_binaryen_module_set_features"
91
93
 
@@ -111,3 +113,5 @@ external add_debug_info_filename : t -> string -> int
111
113
 
112
114
  external get_debug_info_filename : t -> int -> string
113
115
  = "caml_binaryen_module_get_debug_info_filename"
116
+
117
+ external update_maps : t -> unit = "caml_binaryen_module_update_maps"
@@ -1,8 +1,8 @@
1
1
  type t
2
2
 
3
- external add_table : Module.t -> string -> int -> int -> t
3
+ external add_table : Module.t -> string -> int -> int -> Type.t -> t
4
4
  = "caml_binaryen_add_table"
5
- (** Module, name, initial size, maximum size. *)
5
+ (** Module, name, initial size, maximum size, table type *)
6
6
 
7
7
  external add_active_element_segment :
8
8
  Module.t ->
@@ -1,8 +1,8 @@
1
1
  (module
2
2
  (type $i32_i32_=>_i32 (func (param i32 i32) (result i32)))
3
3
  (type $none_=>_none (func))
4
- (type $externref_=>_i32 (func (param externref) (result i32)))
5
4
  (type $externref_i32_i32_=>_i32 (func (param externref i32 i32) (result i32)))
5
+ (type $externref_=>_i32 (func (param externref) (result i32)))
6
6
  (import "future-wasi" "write" (func $write (param externref i32 i32) (result i32)))
7
7
  (global $max_int64 i64 (i64.const 9223372036854775807))
8
8
  (global $test_float64_bits f64 (f64.const 1.23))
@@ -49,10 +49,10 @@
49
49
  )
50
50
  )
51
51
  (module
52
- (type $none_=>_none (func))
53
- (type $externref_=>_i32 (func (param externref) (result i32)))
54
52
  (type $i32_i32_=>_i32 (func (param i32 i32) (result i32)))
53
+ (type $none_=>_none (func))
55
54
  (type $externref_i32_i32_=>_i32 (func (param externref i32 i32) (result i32)))
55
+ (type $externref_=>_i32 (func (param externref) (result i32)))
56
56
  (import "future-wasi" "write" (func $write (param externref i32 i32) (result i32)))
57
57
  (memory $0 1)
58
58
  (table $table 1 1 funcref)
@@ -90,10 +90,10 @@
90
90
  )
91
91
  )
92
92
  (module
93
+ (type $externref_i32_i32_=>_i32 (func (param externref i32 i32) (result i32)))
94
+ (type $i32_i32_=>_i32 (func (param i32 i32) (result i32)))
93
95
  (type $none_=>_none (func))
94
96
  (type $externref_=>_i32 (func (param externref) (result i32)))
95
- (type $i32_i32_=>_i32 (func (param i32 i32) (result i32)))
96
- (type $externref_i32_i32_=>_i32 (func (param externref i32 i32) (result i32)))
97
97
  (import "future-wasi" "write" (func $fimport$0 (param externref i32 i32) (result i32)))
98
98
  (memory $0 1)
99
99
  (table $0 1 1 funcref)
@@ -77,7 +77,7 @@ let start =
77
77
 
78
78
  let _ = Export.add_function_export wasm_mod "adder" "adder"
79
79
 
80
- let _ = Table.add_table wasm_mod "table" 1 1
80
+ let _ = Table.add_table wasm_mod "table" 1 1 Type.funcref
81
81
 
82
82
  let _ =
83
83
  Global.add_global wasm_mod "max_int64" Type.int64 false
@@ -116,6 +116,9 @@ let _ =
116
116
 
117
117
  let _ = Export.add_function_export wasm_mod "hello" "hello"
118
118
 
119
+ (* Shouldn't actually do anything since we aren't doing function renames *)
120
+ let _ = Module.update_maps wasm_mod
121
+
119
122
  (* Finally, we print 3 versions of the module to be checked against test.expected *)
120
123
 
121
124
  (* 1. Print the the module as-is *)
@@ -28,6 +28,6 @@ val external_memory : int
28
28
 
29
29
  val external_global : int
30
30
 
31
- val external_event : int
31
+ val external_tag : int
32
32
 
33
33
  val export_get_kind : t -> int
@@ -63,3 +63,5 @@ val interpret : t -> unit
63
63
  val add_debug_info_filename : t -> string -> int
64
64
 
65
65
  val get_debug_info_filename : t -> int -> string
66
+
67
+ val update_maps : t -> unit
@@ -1,6 +1,6 @@
1
1
  type t
2
2
 
3
- val add_table : Module.t -> string -> int -> int -> t
3
+ val add_table : Module.t -> string -> int -> int -> Type.t -> t
4
4
 
5
5
  val add_active_element_segment :
6
6
  Module.t ->
@@ -1,39 +0,0 @@
1
- opam-version: "2.0"
2
- maintainer: "frederic.bour@lakaban.net"
3
- authors: [
4
- "Frédéric Bour <frederic.bour@lakaban.net>"
5
- "Jérémie Dimino <jeremie@dimino.org>"
6
- ]
7
- license: "LGPL-2.1-only WITH OCaml-LGPL-linking-exception"
8
- homepage: "https://github.com/ocaml-ppx/ocaml-migrate-parsetree"
9
- bug-reports: "https://github.com/ocaml-ppx/ocaml-migrate-parsetree/issues"
10
- dev-repo: "git+https://github.com/ocaml-ppx/ocaml-migrate-parsetree.git"
11
- doc: "https://ocaml-ppx.github.io/ocaml-migrate-parsetree/"
12
- tags: [ "syntax" "org:ocamllabs" ]
13
- build: ["dune" "build" "-p" name "-j" jobs]
14
- run-test: ["dune" "runtest" "-p" name "-j" jobs]
15
- depends: [
16
- "dune" {>= "2.3"}
17
- "ocaml" {>= "4.02.3" & < "4.15"}
18
- "cinaps" {with-test & >= "v0.13.0"}
19
- ]
20
- conflicts: [
21
- "base-effects"
22
- ]
23
- synopsis: "Convert OCaml parsetrees between different versions"
24
- description: """
25
- Convert OCaml parsetrees between different versions
26
-
27
- This library converts parsetrees, outcometree and ast mappers between
28
- different OCaml versions. High-level functions help making PPX
29
- rewriters independent of a compiler version.
30
- """
31
- url {
32
- src:
33
- "https://github.com/ocaml-ppx/ocaml-migrate-parsetree/releases/download/v2.3.0/ocaml-migrate-parsetree-2.3.0.tbz"
34
- checksum: [
35
- "sha256=108126b247f190e04c8afd3d72ced0b63ffdf73c3f801f09be5db0cd7280bf0a"
36
- "sha512=cccd766d33e2c70015735e050c2b7cdacf9f046e2874b563ef64b77706f56d004aa9b9df7d5cc201e5f3ba6e3267f95f654e1e3de58891b91f9c28a61988a9ee"
37
- ]
38
- }
39
- x-commit-hash: "7ef6ff49bfd7d6d816be61d3acea460af25d7d99"
@@ -1,53 +0,0 @@
1
- opam-version: "2.0"
2
-
3
- homepage: "http://github.com/ocaml/odoc"
4
- doc: "https://ocaml.github.io/odoc/"
5
- bug-reports: "https://github.com/ocaml/odoc/issues"
6
- license: "ISC"
7
-
8
- authors: [
9
- "Thomas Refis <trefis@janestreet.com>"
10
- "David Sheets <sheets@alum.mit.edu>"
11
- "Leo White <leo@lpw25.net>"
12
- "Anton Bachin <antonbachin@yahoo.com>"
13
- "Jon Ludlam <jon@recoil.org>"
14
- ]
15
- maintainer: "Jon Ludlam <jon@recoil.org>"
16
- dev-repo: "git+https://github.com/ocaml/odoc.git"
17
-
18
- synopsis: "OCaml documentation generator"
19
- description: """
20
- Odoc is a documentation generator for OCaml. It reads doc comments,
21
- delimited with `(** ... *)`, and outputs HTML.
22
- """
23
-
24
- depends: [
25
- "astring"
26
- "cmdliner" {>= "1.0.0"}
27
- "cppo" {build & >= "1.1.0"}
28
- "dune"
29
- "fpath"
30
- "ocaml" {>= "4.02.0" & < "4.14"}
31
- "result"
32
- "tyxml" {>= "4.3.0"}
33
-
34
- "alcotest" {dev & >= "0.8.3" & with-test}
35
- "markup" {dev & >= "1.0.0" & with-test}
36
- "ocamlfind" {dev}
37
- "sexplib" {dev & >= "113.33.00" & with-test}
38
-
39
- "bisect_ppx" {dev & >= "1.3.0"}
40
- ]
41
-
42
- build: [
43
- ["dune" "subst"] {dev}
44
- ["dune" "build" "-p" name "-j" jobs]
45
- ]
46
- url {
47
- src: "https://github.com/ocaml/odoc/releases/download/1.5.3/odoc-1.5.3.tbz"
48
- checksum: [
49
- "sha256=f2b76f811658c4b52cb48ac4ffc2ec37cedd2a805111c7f8ec20f8f36b8bbf45"
50
- "sha512=9e069590e0737c94813d25235b5cfe27feb5a0298a17ff9b9ee446c69827c3a0ea3b7da5d05b278639cd1f0202e0d83356707979edfaa2af73876fc000c23c4d"
51
- ]
52
- }
53
- x-commit-hash: "8de4a36814533b25b461373fe5c0f54db55e5e7c"
@@ -1,42 +0,0 @@
1
- opam-version: "2.0"
2
- synopsis: "A library for building correct HTML and SVG documents"
3
- description:
4
- "TyXML provides a set of convenient combinators that uses the OCaml type system to ensure the validity of the generated documents. TyXML can be used with any representation of HTML and SVG: the textual one, provided directly by this package, or DOM trees (`js_of_ocaml-tyxml`) virtual DOM (`virtual-dom`) and reactive or replicated trees (`eliom`). You can also create your own representation and use it to instantiate a new set of combinators."
5
- maintainer: ["dev@ocsigen.org"]
6
- authors: ["The ocsigen team"]
7
- license: "LGPL-2.1-only WITH OCaml-LGPL-linking-exception"
8
- homepage: "https://github.com/ocsigen/tyxml"
9
- doc: "https://ocsigen.org/tyxml/latest/manual/intro"
10
- bug-reports: "https://github.com/ocsigen/tyxml/issues"
11
- depends: [
12
- "dune" {>= "2.0"}
13
- "ocaml" {>= "4.02"}
14
- "alcotest" {with-test}
15
- "re" {>= "1.5.0"}
16
- "seq"
17
- "uutf" {>= "1.0.0"}
18
- ]
19
- build: [
20
- ["dune" "subst"] {dev}
21
- [
22
- "dune"
23
- "build"
24
- "-p"
25
- name
26
- "-j"
27
- jobs
28
- "@install"
29
- "@runtest" {with-test}
30
- "@doc" {with-doc}
31
- ]
32
- ]
33
- dev-repo: "git+https://github.com/ocsigen/tyxml.git"
34
- x-commit-hash: "ef431a4bceaefb2d9248e79092e6c1a1a9420095"
35
- url {
36
- src:
37
- "https://github.com/ocsigen/tyxml/releases/download/4.5.0/tyxml-4.5.0.tbz"
38
- checksum: [
39
- "sha256=c69accef5df4dd89d38f6aa0baad01e8fda4e9e98bb7dad61bec1452c5716068"
40
- "sha512=772535441b09c393d53c27152e65f404a0a541aa0cea1bda899a8d751ab64d1729237e583618c3ff33d75e3865d53503d1ea413c6bbc8c68c413347efd1709b3"
41
- ]
42
- }