@grain/binaryen.ml 0.21.0 → 0.23.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 (44) hide show
  1. binaryen-archive/CHANGELOG.md +59 -0
  2. binaryen-archive/binaryen.opam +2 -2
  3. binaryen-archive/esy.lock/index.json +261 -258
  4. binaryen-archive/esy.lock/opam/{base.v0.16.1 → base.v0.16.3}/opam +3 -3
  5. binaryen-archive/esy.lock/opam/{chrome-trace.3.9.0 → chrome-trace.3.10.0}/opam +5 -4
  6. binaryen-archive/esy.lock/opam/{dune-build-info.3.9.0 → dune-build-info.3.10.0}/opam +5 -4
  7. binaryen-archive/esy.lock/opam/{dune-configurator.3.9.0 → dune-configurator.3.10.0}/opam +5 -4
  8. binaryen-archive/esy.lock/opam/{dune-rpc.3.9.0 → dune-rpc.3.10.0}/opam +5 -4
  9. binaryen-archive/esy.lock/opam/{dune.3.9.0 → dune.3.10.0}/opam +5 -4
  10. binaryen-archive/esy.lock/opam/{dyn.3.9.0 → dyn.3.10.0}/opam +5 -4
  11. binaryen-archive/esy.lock/opam/{js_of_ocaml-compiler.5.3.0 → js_of_ocaml-compiler.5.4.0}/opam +5 -5
  12. binaryen-archive/esy.lock/opam/{ocamlformat-rpc-lib.0.25.1 → ocamlformat-rpc-lib.0.26.1}/opam +16 -6
  13. binaryen-archive/esy.lock/opam/{ordering.3.9.0 → ordering.3.10.0}/opam +5 -4
  14. binaryen-archive/esy.lock/opam/{pp.1.1.2 → pp.1.2.0}/opam +7 -6
  15. binaryen-archive/esy.lock/opam/{re.1.10.4 → re.1.11.0}/opam +5 -5
  16. binaryen-archive/esy.lock/opam/{stdune.3.9.0 → stdune.3.10.0}/opam +5 -4
  17. binaryen-archive/esy.lock/opam/{uucp.15.0.0 → uucp.15.1.0}/opam +10 -14
  18. binaryen-archive/esy.lock/opam/{uuseg.15.0.0 → uuseg.15.1.0}/opam +9 -11
  19. binaryen-archive/esy.lock/opam/{xdg.3.9.0 → xdg.3.10.0}/opam +5 -4
  20. binaryen-archive/package.json +2 -2
  21. binaryen-archive/src/dune +1 -3
  22. binaryen-archive/src/expression.c +42 -24
  23. binaryen-archive/src/expression.js +35 -16
  24. binaryen-archive/src/expression.ml +39 -11
  25. binaryen-archive/src/expression.mli +10 -2
  26. binaryen-archive/src/heap_type.c +2 -2
  27. binaryen-archive/src/heap_type.js +3 -3
  28. binaryen-archive/src/heap_type.ml +1 -1
  29. binaryen-archive/src/heap_type.mli +1 -1
  30. binaryen-archive/src/op.c +116 -95
  31. binaryen-archive/src/op.js +102 -84
  32. binaryen-archive/src/op.ml +152 -35
  33. binaryen-archive/src/op.mli +48 -45
  34. binaryen-archive/src/passes.ml +17 -1
  35. binaryen-archive/src/passes.mli +15 -0
  36. binaryen-archive/src/type.c +2 -2
  37. binaryen-archive/src/type.js +3 -3
  38. binaryen-archive/src/type.ml +2 -2
  39. binaryen-archive/src/type.mli +1 -1
  40. binaryen-archive/test/test.expected +26 -26
  41. binaryen-archive/src/type_system.c +0 -40
  42. binaryen-archive/src/type_system.js +0 -29
  43. binaryen-archive/src/type_system.ml +0 -7
  44. binaryen-archive/src/type_system.mli +0 -7
@@ -15,6 +15,9 @@ val dae : t
15
15
  val dae_optimizing : t
16
16
  (** removes arguments to calls in an lto-like manner, and optimizes where we removed *)
17
17
 
18
+ val abstract_type_refining : t
19
+ (** refine and merge abstract (never-created) types *)
20
+
18
21
  val coalesce_locals : t
19
22
  (** reduce # of locals by coalescing *)
20
23
 
@@ -198,6 +201,9 @@ val monomorphize_always : t
198
201
  val multi_memory_lowering : t
199
202
  (** combines multiple memories into a single memory *)
200
203
 
204
+ val multi_memory_lowering_with_bounds_checks : t
205
+ (** combines multiple memories into a single memory, trapping if the read or write is larger than the length of the memory's data *)
206
+
201
207
  val nm : t
202
208
  (** name list *)
203
209
 
@@ -285,6 +291,9 @@ val remove_unused_nonfunction_module_elements : t
285
291
  val remove_unused_names : t
286
292
  (** removes names from locations that are never branched to *)
287
293
 
294
+ val remove_unused_types : t
295
+ (** remove unused private GC types *)
296
+
288
297
  val reorder_functions : t
289
298
  (** sorts functions by access frequency *)
290
299
 
@@ -384,6 +393,12 @@ val trap_mode_clamp : t
384
393
  val trap_mode_js : t
385
394
  (** replace trapping operations with js semantics *)
386
395
 
396
+ val type_merging : t
397
+ (** merge types to their supertypes where possible *)
398
+
399
+ val type_ssa : t
400
+ (** create new nominal types to help other optimizations *)
401
+
387
402
  val untee : t
388
403
  (** removes local.tees, replacing them with sets and gets *)
389
404
 
@@ -77,9 +77,9 @@ caml_binaryen_type_i31ref(value unit) {
77
77
  }
78
78
 
79
79
  CAMLprim value
80
- caml_binaryen_type_dataref(value unit) {
80
+ caml_binaryen_type_structref(value unit) {
81
81
  CAMLparam1(unit);
82
- BinaryenType ty = BinaryenTypeDataref();
82
+ BinaryenType ty = BinaryenTypeStructref();
83
83
  CAMLreturn(alloc_BinaryenType(ty));
84
84
  }
85
85
 
@@ -58,10 +58,10 @@ function caml_binaryen_type_i31ref() {
58
58
  return Binaryen.i31ref;
59
59
  }
60
60
 
61
- //Provides: caml_binaryen_type_dataref
61
+ //Provides: caml_binaryen_type_structref
62
62
  //Requires: Binaryen
63
- function caml_binaryen_type_dataref() {
64
- return Binaryen.dataref;
63
+ function caml_binaryen_type_structref() {
64
+ return Binaryen.structref;
65
65
  }
66
66
 
67
67
  //Provides: caml_binaryen_type_arrayref
@@ -40,9 +40,9 @@ external i31ref : unit -> t = "caml_binaryen_type_i31ref"
40
40
 
41
41
  let i31ref = i31ref ()
42
42
 
43
- external dataref : unit -> t = "caml_binaryen_type_dataref"
43
+ external structref : unit -> t = "caml_binaryen_type_structref"
44
44
 
45
- let dataref = dataref ()
45
+ let structref = structref ()
46
46
 
47
47
  external arrayref : unit -> t = "caml_binaryen_type_arrayref"
48
48
 
@@ -10,7 +10,7 @@ val funcref : t
10
10
  val anyref : t
11
11
  val eqref : t
12
12
  val i31ref : t
13
- val dataref : t
13
+ val structref : t
14
14
  val arrayref : t
15
15
  val stringref : t
16
16
  val stringview_wtf8 : t
@@ -16,15 +16,15 @@
16
16
  (global $max_int64_mut (mut i64) (i64.const 9223372036854775807))
17
17
  (global $test_float64_bits f64 (f64.const 1.23))
18
18
  (memory $0 1)
19
- (data (i32.const 0) "hello")
20
- (data "world")
19
+ (data $0 (i32.const 0) "hello")
20
+ (data $1 "world")
21
21
  (table $table 1 1 funcref)
22
22
  (elem $elem (i32.const 0) $adder)
23
23
  (export "adder" (func $adder))
24
24
  (export "memory" (memory $0))
25
25
  (export "hello" (func $hello))
26
26
  (start $start)
27
- (func $adder (param $0 i32) (param $1 i32) (result i32)
27
+ (func $adder (type $i32_i32_=>_i32) (param $0 i32) (param $1 i32) (result i32)
28
28
  (block $add (result i32)
29
29
  (if
30
30
  (i32.const 0)
@@ -42,9 +42,9 @@
42
42
  )
43
43
  )
44
44
  )
45
- (func $start
45
+ (func $start (type $none_=>_none)
46
46
  (block $start
47
- (memory.init 1
47
+ (memory.init $1
48
48
  (i32.const 2048)
49
49
  (i32.const 0)
50
50
  (i32.const 5)
@@ -58,7 +58,7 @@
58
58
  )
59
59
  )
60
60
  )
61
- (func $hello (param $0 anyref) (result i32)
61
+ (func $hello (type $anyref_=>_i32) (param $0 anyref) (result i32)
62
62
  (call $write
63
63
  (local.get $0)
64
64
  (i32.const 0)
@@ -73,15 +73,15 @@
73
73
  (type $anyref_=>_i32 (func (param anyref) (result i32)))
74
74
  (import "future-wasi" "write" (func $write (param anyref i32 i32) (result i32)))
75
75
  (memory $0 1)
76
- (data (i32.const 0) "hello")
77
- (data "world")
76
+ (data $0 (i32.const 0) "hello")
77
+ (data $1 "world")
78
78
  (table $table 1 1 funcref)
79
79
  (elem $elem (i32.const 0) $adder)
80
80
  (export "adder" (func $adder))
81
81
  (export "memory" (memory $0))
82
82
  (export "hello" (func $hello))
83
83
  (start $start)
84
- (func $adder (; has Stack IR ;) (param $0 i32) (param $1 i32) (result i32)
84
+ (func $adder (type $i32_i32_=>_i32) (; has Stack IR ;) (param $0 i32) (param $1 i32) (result i32)
85
85
  (i32.add
86
86
  (select
87
87
  (local.get $0)
@@ -93,8 +93,8 @@
93
93
  (local.get $1)
94
94
  )
95
95
  )
96
- (func $start (; has Stack IR ;)
97
- (memory.init 1
96
+ (func $start (type $none_=>_none) (; has Stack IR ;)
97
+ (memory.init $1
98
98
  (i32.const 2048)
99
99
  (i32.const 0)
100
100
  (i32.const 5)
@@ -106,7 +106,7 @@
106
106
  )
107
107
  )
108
108
  )
109
- (func $hello (; has Stack IR ;) (param $0 anyref) (result i32)
109
+ (func $hello (type $anyref_=>_i32) (; has Stack IR ;) (param $0 anyref) (result i32)
110
110
  (call $write
111
111
  (local.get $0)
112
112
  (i32.const 0)
@@ -121,15 +121,15 @@
121
121
  (type $type$3 (func (param anyref) (result i32)))
122
122
  (import "future-wasi" "write" (func $fimport$0 (param anyref i32 i32) (result i32)))
123
123
  (memory $0 1)
124
- (data (i32.const 0) "hello")
125
- (data "world")
124
+ (data $0 (i32.const 0) "hello")
125
+ (data $1 "world")
126
126
  (table $0 1 1 funcref)
127
- (elem (i32.const 0) $0)
127
+ (elem $0 (i32.const 0) $0)
128
128
  (export "adder" (func $0))
129
129
  (export "memory" (memory $0))
130
130
  (export "hello" (func $2))
131
131
  (start $1)
132
- (func $0 (param $0 i32) (param $1 i32) (result i32)
132
+ (func $0 (type $type$1) (param $0 i32) (param $1 i32) (result i32)
133
133
  (i32.add
134
134
  (select
135
135
  (local.get $0)
@@ -141,8 +141,8 @@
141
141
  (local.get $1)
142
142
  )
143
143
  )
144
- (func $1
145
- (memory.init 1
144
+ (func $1 (type $type$2)
145
+ (memory.init $1
146
146
  (i32.const 2048)
147
147
  (i32.const 0)
148
148
  (i32.const 5)
@@ -154,7 +154,7 @@
154
154
  )
155
155
  )
156
156
  )
157
- (func $2 (param $0 anyref) (result i32)
157
+ (func $2 (type $type$3) (param $0 anyref) (result i32)
158
158
  (call $fimport$0
159
159
  (local.get $0)
160
160
  (i32.const 0)
@@ -169,15 +169,15 @@
169
169
  (type $type$3 (func (param anyref) (result i32)))
170
170
  (import "future-wasi" "write" (func $fimport$0 (param anyref i32 i32) (result i32)))
171
171
  (memory $0 1)
172
- (data (i32.const 0) "hello")
173
- (data "world")
172
+ (data $0 (i32.const 0) "hello")
173
+ (data $1 "world")
174
174
  (table $0 1 1 funcref)
175
- (elem (i32.const 0) $0)
175
+ (elem $0 (i32.const 0) $0)
176
176
  (export "adder" (func $0))
177
177
  (export "memory" (memory $0))
178
178
  (export "hello" (func $2))
179
179
  (start $1)
180
- (func $0 (param $0 i32) (param $1 i32) (result i32)
180
+ (func $0 (type $type$1) (param $0 i32) (param $1 i32) (result i32)
181
181
  local.get $0
182
182
  local.get $1
183
183
  i32.load $0
@@ -186,17 +186,17 @@
186
186
  local.get $1
187
187
  i32.add
188
188
  )
189
- (func $1
189
+ (func $1 (type $type$2)
190
190
  i32.const 2048
191
191
  i32.const 0
192
192
  i32.const 5
193
- memory.init $0 1
193
+ memory.init $0 $1
194
194
  i32.const 3
195
195
  i32.const 5
196
196
  call $0
197
197
  drop
198
198
  )
199
- (func $2 (param $0 anyref) (result i32)
199
+ (func $2 (type $type$3) (param $0 anyref) (result i32)
200
200
  local.get $0
201
201
  i32.const 0
202
202
  i32.const 1
@@ -1,40 +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_type_system_equirecursive(value unit) {
12
- CAMLparam1(unit);
13
- CAMLreturn(Val_int(BinaryenTypeSystemEquirecursive()));
14
- }
15
-
16
- CAMLprim value
17
- caml_binaryen_type_system_nominal(value unit) {
18
- CAMLparam1(unit);
19
- CAMLreturn(Val_int(BinaryenTypeSystemNominal()));
20
- }
21
-
22
- CAMLprim value
23
- caml_binaryen_type_system_isorecursive(value unit) {
24
- CAMLparam1(unit);
25
- CAMLreturn(Val_int(BinaryenTypeSystemIsorecursive()));
26
- }
27
-
28
- CAMLprim value
29
- caml_binaryen_get_type_system(value unit) {
30
- CAMLparam1(unit);
31
- CAMLreturn(Val_int(BinaryenGetTypeSystem()));
32
- }
33
-
34
- CAMLprim value
35
- caml_binaryen_set_type_system(value _typeSystem) {
36
- CAMLparam1(_typeSystem);
37
- BinaryenTypeSystem typeSystem = Int_val(_typeSystem);
38
- BinaryenSetTypeSystem(typeSystem);
39
- CAMLreturn(Val_unit);
40
- }
@@ -1,29 +0,0 @@
1
- //Provides: caml_binaryen_type_system_equirecursive
2
- //Requires: Binaryen
3
- function caml_binaryen_type_system_equirecursive() {
4
- return Binaryen._BinaryenTypeSystemEquirecursive();
5
- }
6
-
7
- //Provides: caml_binaryen_type_system_nominal
8
- //Requires: Binaryen
9
- function caml_binaryen_type_system_nominal() {
10
- return Binaryen._BinaryenTypeSystemNominal();
11
- }
12
-
13
- //Provides: caml_binaryen_type_system_isorecursive
14
- //Requires: Binaryen
15
- function caml_binaryen_type_system_isorecursive() {
16
- return Binaryen._BinaryenTypeSystemIsorecursive();
17
- }
18
-
19
- //Provides: caml_binaryen_get_type_system
20
- //Requires: Binaryen
21
- function caml_binaryen_get_type_system() {
22
- return Binaryen._BinaryenGetTypeSystem();
23
- }
24
-
25
- //Provides: caml_binaryen_set_type_system
26
- //Requires: Binaryen
27
- function caml_binaryen_set_type_system(typeSystem) {
28
- Binaryen._BinaryenSetTypeSystem(typeSystem);
29
- }
@@ -1,7 +0,0 @@
1
- type t = int
2
-
3
- external equirecursive : unit -> t = "caml_binaryen_type_system_equirecursive"
4
- external nominal : unit -> t = "caml_binaryen_type_system_nominal"
5
- external isorecursive : unit -> t = "caml_binaryen_type_system_isorecursive"
6
- external get_type_system : unit -> t = "caml_binaryen_get_type_system"
7
- external set_type_system : t -> unit = "caml_binaryen_set_type_system"
@@ -1,7 +0,0 @@
1
- type t
2
-
3
- val equirecursive : unit -> t
4
- val nominal : unit -> t
5
- val isorecursive : unit -> t
6
- val get_type_system : unit -> t
7
- val set_type_system : t -> unit