@grain/binaryen.ml 0.18.0 → 0.19.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 (48) hide show
  1. binaryen-archive/CHANGELOG.md +16 -0
  2. binaryen-archive/binaryen.opam +2 -2
  3. binaryen-archive/esy.lock/index.json +344 -289
  4. binaryen-archive/esy.lock/opam/camlp-streams.5.0.1/opam +59 -0
  5. binaryen-archive/esy.lock/opam/chrome-trace.3.5.0/opam +39 -0
  6. binaryen-archive/esy.lock/opam/{dune-build-info.3.3.1 → dune-build-info.3.5.0}/opam +4 -4
  7. binaryen-archive/esy.lock/opam/{dune-configurator.3.3.1 → dune-configurator.3.5.0}/opam +4 -4
  8. binaryen-archive/esy.lock/opam/{dune-rpc.3.3.1 → dune-rpc.3.5.0}/opam +4 -4
  9. binaryen-archive/esy.lock/opam/{dune.3.3.1 → dune.3.5.0}/opam +4 -4
  10. binaryen-archive/esy.lock/opam/{dyn.3.3.1 → dyn.3.5.0}/opam +4 -4
  11. binaryen-archive/esy.lock/opam/{fiber.3.3.1 → fiber.3.5.0}/opam +4 -4
  12. binaryen-archive/esy.lock/opam/{ocaml-lsp-server.1.12.2 → ocaml-lsp-server.1.14.1}/opam +8 -7
  13. binaryen-archive/esy.lock/opam/{ocaml-version.3.4.0 → ocaml-version.3.5.0}/opam +4 -4
  14. binaryen-archive/esy.lock/opam/{ocamlbuild.0.14.1 → ocamlbuild.0.14.2}/opam +3 -3
  15. binaryen-archive/esy.lock/opam/ocamlfind.1.9.5/files/0001-Fix-bug-when-installing-with-a-system-compiler.patch +26 -0
  16. binaryen-archive/esy.lock/opam/ocamlfind.1.9.5/opam +2 -0
  17. binaryen-archive/esy.lock/opam/{ocamlformat-rpc-lib.0.22.4 → ocamlformat-rpc-lib.0.24.1}/opam +4 -4
  18. binaryen-archive/esy.lock/opam/ocamlformat.0.20.1/opam +1 -1
  19. binaryen-archive/esy.lock/opam/{odoc-parser.1.0.0 → odoc-parser.1.0.1}/opam +6 -5
  20. binaryen-archive/esy.lock/opam/omd.1.3.2/opam +50 -0
  21. binaryen-archive/esy.lock/opam/{ordering.3.3.1 → ordering.3.5.0}/opam +4 -4
  22. binaryen-archive/esy.lock/opam/{ppxlib.0.27.0 → ppxlib.0.28.0}/opam +5 -5
  23. binaryen-archive/esy.lock/opam/{stdune.3.3.1 → stdune.3.5.0}/opam +4 -4
  24. binaryen-archive/esy.lock/opam/uucp.15.0.0/opam +55 -0
  25. binaryen-archive/esy.lock/opam/{uuseg.14.0.0 → uuseg.15.0.0}/opam +39 -25
  26. binaryen-archive/esy.lock/opam/{xdg.3.3.1 → xdg.3.5.0}/opam +4 -4
  27. binaryen-archive/esy.lock/opam/{yojson.2.0.0 → yojson.2.0.2}/opam +5 -5
  28. binaryen-archive/esy.lock/overrides/{opam__s__ocamlbuild_opam__c__0.14.1_opam_override → opam__s__ocamlbuild_opam__c__0.14.2_opam_override}/files/winpatch.patch +0 -0
  29. binaryen-archive/esy.lock/overrides/{opam__s__ocamlbuild_opam__c__0.14.1_opam_override → opam__s__ocamlbuild_opam__c__0.14.2_opam_override}/package.json +0 -0
  30. binaryen-archive/package.json +2 -2
  31. binaryen-archive/src/binaryen_stubs_imports.c +14 -0
  32. binaryen-archive/src/binaryen_stubs_imports.js +14 -0
  33. binaryen-archive/src/binaryen_stubs_memory.c +40 -0
  34. binaryen-archive/src/binaryen_stubs_memory.js +41 -0
  35. binaryen-archive/src/binaryen_stubs_modules.c +20 -0
  36. binaryen-archive/src/binaryen_stubs_modules.js +17 -0
  37. binaryen-archive/src/import.ml +4 -0
  38. binaryen-archive/src/import.mli +2 -0
  39. binaryen-archive/src/memory.ml +10 -0
  40. binaryen-archive/src/memory.mli +10 -0
  41. binaryen-archive/src/module.ml +2 -0
  42. binaryen-archive/src/module.mli +2 -0
  43. binaryen-archive/src/passes.ml +6 -0
  44. binaryen-archive/src/passes.mli +6 -0
  45. binaryen-archive/test/test.expected +36 -0
  46. binaryen-archive/test/test.ml +27 -1
  47. binaryen-archive/esy.lock/opam/omd.1.3.1/opam +0 -39
  48. binaryen-archive/esy.lock/opam/uucp.14.0.0/opam +0 -41
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@grain/binaryen.ml",
3
- "version": "0.18.0",
3
+ "version": "0.19.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": ">= 108.0.0 < 109.0.0",
9
+ "@grain/libbinaryen": ">= 109.0.0 < 110.0.0",
10
10
  "@opam/dune": ">= 2.9.1",
11
11
  "@opam/dune-configurator": ">= 2.9.1"
12
12
  },
@@ -74,6 +74,13 @@ caml_binaryen_function_import_get_module(value _fun) {
74
74
  CAMLreturn(caml_copy_string(BinaryenFunctionImportGetModule(fun)));
75
75
  }
76
76
 
77
+ CAMLprim value
78
+ caml_binaryen_memory_import_get_module(value _module) {
79
+ CAMLparam1(_module);
80
+ BinaryenModuleRef module = BinaryenModuleRef_val(_module);
81
+ CAMLreturn(caml_copy_string(BinaryenMemoryImportGetModule(module)));
82
+ }
83
+
77
84
  CAMLprim value
78
85
  caml_binaryen_global_import_get_module(value _global) {
79
86
  CAMLparam1(_global);
@@ -88,6 +95,13 @@ caml_binaryen_function_import_get_base(value _fun) {
88
95
  CAMLreturn(caml_copy_string(BinaryenFunctionImportGetBase(fun)));
89
96
  }
90
97
 
98
+ CAMLprim value
99
+ caml_binaryen_memory_import_get_base(value _module) {
100
+ CAMLparam1(_module);
101
+ BinaryenModuleRef module = BinaryenModuleRef_val(_module);
102
+ CAMLreturn(caml_copy_string(BinaryenMemoryImportGetBase(module)));
103
+ }
104
+
91
105
  CAMLprim value
92
106
  caml_binaryen_global_import_get_base(value _global) {
93
107
  CAMLparam1(_global);
@@ -100,6 +100,13 @@ function caml_binaryen_function_import_get_module(func) {
100
100
  return caml_string_of_jsstring(func_info.module);
101
101
  }
102
102
 
103
+ //Provides: caml_binaryen_memory_import_get_module
104
+ //Requires: caml_string_of_jsstring
105
+ function caml_binaryen_memory_import_get_module(mod) {
106
+ var memory_info = mod.getMemoryInfo();
107
+ return caml_string_of_jsstring(memory_info.module);
108
+ }
109
+
103
110
  //Provides: caml_binaryen_global_import_get_module
104
111
  //Requires: Binaryen
105
112
  //Requires: caml_string_of_jsstring
@@ -116,6 +123,13 @@ function caml_binaryen_function_import_get_base(func) {
116
123
  return caml_string_of_jsstring(func_info.base);
117
124
  }
118
125
 
126
+ //Provides: caml_binaryen_memory_import_get_base
127
+ //Requires: caml_string_of_jsstring
128
+ function caml_binaryen_memory_import_get_base(mod) {
129
+ var memory_info = mod.getMemoryInfo();
130
+ return caml_string_of_jsstring(memory_info.base);
131
+ }
132
+
119
133
  //Provides: caml_binaryen_global_import_get_base
120
134
  //Requires: Binaryen
121
135
  //Requires: caml_string_of_jsstring
@@ -47,3 +47,43 @@ CAMLprim value
47
47
  caml_binaryen_set_memory__bytecode(value * argv) {
48
48
  return caml_binaryen_set_memory(argv[0], argv[1], argv[2], argv[3], argv[4], argv[5], argv[6], argv[7], argv[8]);
49
49
  }
50
+
51
+ CAMLprim value
52
+ caml_binaryen_has_memory(value _module) {
53
+ CAMLparam1(_module);
54
+ BinaryenModuleRef module = BinaryenModuleRef_val(_module);
55
+ CAMLreturn(Val_bool(BinaryenHasMemory(module)));
56
+ }
57
+
58
+ CAMLprim value
59
+ caml_binaryen_memory_get_initial(value _module) {
60
+ CAMLparam1(_module);
61
+ BinaryenModuleRef module = BinaryenModuleRef_val(_module);
62
+ CAMLreturn(Val_int(BinaryenMemoryGetInitial(module)));
63
+ }
64
+
65
+ CAMLprim value
66
+ caml_binaryen_memory_has_max(value _module) {
67
+ CAMLparam1(_module);
68
+ BinaryenModuleRef module = BinaryenModuleRef_val(_module);
69
+ CAMLreturn(Val_bool(BinaryenMemoryHasMax(module)));
70
+ }
71
+
72
+ CAMLprim value
73
+ caml_binaryen_memory_get_max(value _module) {
74
+ CAMLparam1(_module);
75
+ BinaryenModuleRef module = BinaryenModuleRef_val(_module);
76
+ if (BinaryenMemoryHasMax(module)) {
77
+ CAMLreturn(Val_int(BinaryenMemoryGetMax(module)));
78
+ } else {
79
+ // This ensures that our return is equal to Memory.unlimited
80
+ CAMLreturn(Val_int(-1));
81
+ }
82
+ }
83
+
84
+ CAMLprim value
85
+ caml_binaryen_memory_is_shared(value _module) {
86
+ CAMLparam1(_module);
87
+ BinaryenModuleRef module = BinaryenModuleRef_val(_module);
88
+ CAMLreturn(Val_bool(BinaryenMemoryIsShared(module)));
89
+ }
@@ -25,3 +25,44 @@ function caml_binaryen_set_memory(wasm_mod, initial, maximum, exportName, segmen
25
25
  function caml_binaryen_set_memory__bytecode() {
26
26
  return caml_binaryen_set_memory(arguments[0], arguments[1], arguments[2], arguments[3], arguments[4], arguments[5], arguments[6], arguments[7], arguments[8]);
27
27
  }
28
+
29
+ //Provides: caml_binaryen_has_memory
30
+ //Requires: caml_js_to_bool
31
+ function caml_binaryen_has_memory(mod) {
32
+ return caml_js_to_bool(mod.hasMemory());
33
+ }
34
+
35
+ //Provides: caml_binaryen_memory_get_initial
36
+ function caml_binaryen_memory_get_initial(mod) {
37
+ var memory_info = mod.getMemoryInfo();
38
+ return memory_info.initial;
39
+ }
40
+
41
+ //Provides: caml_binaryen_memory_has_max
42
+ //Requires: caml_js_to_bool
43
+ function caml_binaryen_memory_has_max(mod) {
44
+ var memory_info = mod.getMemoryInfo();
45
+ if (memory_info.max != null) {
46
+ return caml_js_to_bool(true);
47
+ } else {
48
+ return caml_js_to_bool(false);
49
+ }
50
+ }
51
+
52
+ //Provides: caml_binaryen_memory_get_max
53
+ function caml_binaryen_memory_get_max(mod) {
54
+ var memory_info = mod.getMemoryInfo();
55
+ if (memory_info.max != null) {
56
+ return memory_info.max;
57
+ } else {
58
+ // This ensures that our return is equal to Memory.unlimited
59
+ return -1;
60
+ }
61
+ }
62
+
63
+ //Provides: caml_binaryen_memory_is_shared
64
+ //Requires: caml_js_to_bool
65
+ function caml_binaryen_memory_is_shared(mod) {
66
+ var memory_info = mod.getMemoryInfo();
67
+ return caml_js_to_bool(memory_info.shared);
68
+ }
@@ -52,6 +52,13 @@ caml_binaryen_module_print_asmjs(value module) {
52
52
  CAMLreturn(Val_unit);
53
53
  }
54
54
 
55
+ CAMLprim value
56
+ caml_binaryen_module_print_stack_ir(value module) {
57
+ CAMLparam1(module);
58
+ BinaryenModulePrintStackIR(BinaryenModuleRef_val(module));
59
+ CAMLreturn(Val_unit);
60
+ }
61
+
55
62
  CAMLprim value
56
63
  caml_binaryen_module_validate(value module) {
57
64
  CAMLparam1(module);
@@ -125,6 +132,19 @@ caml_binaryen_module_write_text(value _module) {
125
132
  CAMLreturn(text);
126
133
  }
127
134
 
135
+ // There is something weird with this function that causes a bunch of newlines to
136
+ // be printed on stdout when calling it. Not sure if that's a bug in Binaryen.
137
+ CAMLprim value
138
+ caml_binaryen_module_write_stack_ir(value _module) {
139
+ CAMLparam1(_module);
140
+ BinaryenModuleRef module = BinaryenModuleRef_val(_module);
141
+ char* result = BinaryenModuleAllocateAndWriteStackIR(module);
142
+ CAMLlocal1(text);
143
+ text = caml_copy_string(result);
144
+ free(result);
145
+ CAMLreturn(text);
146
+ }
147
+
128
148
  CAMLprim value
129
149
  caml_binaryen_module_read(value _bytes) {
130
150
  CAMLparam1(_bytes);
@@ -36,6 +36,16 @@ function caml_binaryen_module_print_asmjs(wasm_mod) {
36
36
  caml_ml_output(chanid, s, 0, caml_ml_string_length(s));
37
37
  }
38
38
 
39
+ //Provides: caml_binaryen_module_print_stack_ir
40
+ //Requires: caml_string_of_jsstring
41
+ //Requires: caml_ml_output, caml_ml_string_length
42
+ function caml_binaryen_module_print_stack_ir(wasm_mod) {
43
+ var stackir = wasm_mod.emitStackIR()
44
+ var chanid = 1; // stdout
45
+ var s = caml_string_of_jsstring(stackir);
46
+ caml_ml_output(chanid, s, 0, caml_ml_string_length(s));
47
+ }
48
+
39
49
  //Provides: caml_binaryen_module_validate
40
50
  function caml_binaryen_module_validate(wasm_mod) {
41
51
  return wasm_mod.validate();
@@ -82,6 +92,13 @@ function caml_binaryen_module_write_text(wasm_mod) {
82
92
  return caml_string_of_jsstring(text);
83
93
  }
84
94
 
95
+ //Provides: caml_binaryen_module_write_stack_ir
96
+ //Requires: caml_string_of_jsstring
97
+ function caml_binaryen_module_write_stack_ir(wasm_mod) {
98
+ var text = wasm_mod.emitStackIR();
99
+ return caml_string_of_jsstring(text);
100
+ }
101
+
85
102
  //Provides: caml_binaryen_module_read
86
103
  //Requires: Binaryen
87
104
  //Requires: caml_array_of_bytes
@@ -20,11 +20,15 @@ external add_global_import :
20
20
  external function_import_get_module : Function.t -> string
21
21
  = "caml_binaryen_function_import_get_module"
22
22
 
23
+ external memory_import_get_module : Module.t -> string = "caml_binaryen_memory_import_get_module"
24
+
23
25
  external global_import_get_module : Global.t -> string
24
26
  = "caml_binaryen_global_import_get_module"
25
27
 
26
28
  external function_import_get_base : Function.t -> string
27
29
  = "caml_binaryen_function_import_get_base"
28
30
 
31
+ external memory_import_get_base : Module.t -> string = "caml_binaryen_memory_import_get_base"
32
+
29
33
  external global_import_get_base : Global.t -> string
30
34
  = "caml_binaryen_global_import_get_base"
@@ -8,6 +8,8 @@ val add_global_import :
8
8
  Module.t -> string -> string -> string -> Type.t -> bool -> unit
9
9
 
10
10
  val function_import_get_module : Function.t -> string
11
+ val memory_import_get_module : Module.t -> string
11
12
  val global_import_get_module : Global.t -> string
12
13
  val function_import_get_base : Function.t -> string
14
+ val memory_import_get_base : Module.t -> string
13
15
  val global_import_get_base : Global.t -> string
@@ -39,4 +39,14 @@ let set_memory wasm_mod initial maximum export_name (segments : segment list)
39
39
  set_memory wasm_mod initial maximum export_name segment_data segment_passive
40
40
  segment_offsets segment_sizes shared
41
41
 
42
+ external has_memory : Module.t -> bool = "caml_binaryen_has_memory"
43
+
44
+ external get_initial : Module.t -> int = "caml_binaryen_memory_get_initial"
45
+
46
+ external has_max : Module.t -> bool = "caml_binaryen_memory_has_max"
47
+
48
+ external get_max : Module.t -> int = "caml_binaryen_memory_get_max"
49
+
50
+ external is_shared : Module.t -> bool = "caml_binaryen_memory_is_shared"
51
+
42
52
  let unlimited = -1
@@ -4,4 +4,14 @@ and segment_kind = Passive | Active of { offset : Expression.t }
4
4
  val set_memory :
5
5
  Module.t -> int -> int -> string -> segment list -> bool -> unit
6
6
 
7
+ val has_memory : Module.t -> bool
8
+
9
+ val get_initial : Module.t -> int
10
+
11
+ val has_max : Module.t -> bool
12
+
13
+ val get_max : Module.t -> int
14
+
15
+ val is_shared : Module.t -> bool
16
+
7
17
  val unlimited : int
@@ -87,6 +87,7 @@ external add_custom_section : t -> string -> string -> unit
87
87
  external parse : string -> t = "caml_binaryen_module_parse"
88
88
  external print : t -> unit = "caml_binaryen_module_print"
89
89
  external print_asmjs : t -> unit = "caml_binaryen_module_print_asmjs"
90
+ external print_stack_ir : t -> unit = "caml_binaryen_module_print_stack_ir"
90
91
  external validate : t -> int = "caml_binaryen_module_validate"
91
92
  external optimize : t -> unit = "caml_binaryen_module_optimize"
92
93
  external get_features : t -> int = "caml_binaryen_module_get_features"
@@ -117,6 +118,7 @@ external write : t -> string option -> bytes * string option
117
118
  = "caml_binaryen_module_write"
118
119
 
119
120
  external write_text : t -> string = "caml_binaryen_module_write_text"
121
+ external write_stack_ir : t -> string = "caml_binaryen_module_write_stack_ir"
120
122
  external read : bytes -> t = "caml_binaryen_module_read"
121
123
  external interpret : t -> unit = "caml_binaryen_module_interpret"
122
124
 
@@ -28,6 +28,7 @@ val add_custom_section : t -> string -> string -> unit
28
28
  val parse : string -> t
29
29
  val print : t -> unit
30
30
  val print_asmjs : t -> unit
31
+ val print_stack_ir : t -> unit
31
32
  val validate : t -> int
32
33
  val optimize : t -> unit
33
34
  val get_features : t -> Feature.t list
@@ -36,6 +37,7 @@ val run_passes : t -> Passes.t list -> unit
36
37
  val auto_drop : t -> unit
37
38
  val write : t -> string option -> bytes * string option
38
39
  val write_text : t -> string
40
+ val write_stack_ir : t -> string
39
41
  val read : bytes -> t
40
42
  val interpret : t -> unit
41
43
  val add_debug_info_filename : t -> string -> int
@@ -90,6 +90,9 @@ let global_refining = "global-refining"
90
90
  (** globally optimize GC types *)
91
91
  let gto = "gto"
92
92
 
93
+ (** globally optimize struct values *)
94
+ let gsi = "gsi"
95
+
93
96
  (** apply more specific subtypes to type fields where possible *)
94
97
  let type_refining = "type-refining"
95
98
 
@@ -311,6 +314,9 @@ let souperify = "souperify"
311
314
  (** emit Souper IR in text form (single-use nodes only) *)
312
315
  let souperify_single_use = "souperify-single-use"
313
316
 
317
+ (** spill pointers to the C stack (useful for Boehm-style GC) *)
318
+ let spill_pointers = "spill-pointers"
319
+
314
320
  (** stub out unsupported JS operations *)
315
321
  let stub_unsupported_js = "stub-unsupported-js"
316
322
 
@@ -90,6 +90,9 @@ val global_refining : t
90
90
  val gto : t
91
91
  (** globally optimize GC types *)
92
92
 
93
+ val gsi : t
94
+ (** globally optimize struct values *)
95
+
93
96
  val type_refining : t
94
97
  (** apply more specific subtypes to type fields where possible *)
95
98
 
@@ -309,6 +312,9 @@ val souperify : t
309
312
  val souperify_single_use : t
310
313
  (** emit Souper IR in text form (single-use nodes only) *)
311
314
 
315
+ val spill_pointers : t
316
+ (** spill pointers to the C stack (useful for Boehm-style GC) *)
317
+
312
318
  val stub_unsupported_js : t
313
319
  (** stub out unsupported JS operations *)
314
320
 
@@ -143,3 +143,39 @@
143
143
  )
144
144
  )
145
145
  )
146
+ (module
147
+ (type $type$0 (func (param anyref i32 i32) (result i32)))
148
+ (type $type$1 (func (param i32 i32) (result i32)))
149
+ (type $type$2 (func))
150
+ (type $type$3 (func (param anyref) (result i32)))
151
+ (import "future-wasi" "write" (func $fimport$0 (param anyref i32 i32) (result i32)))
152
+ (memory $0 1)
153
+ (data (i32.const 0) "hello")
154
+ (table $0 1 1 funcref)
155
+ (elem (i32.const 0) $0)
156
+ (export "adder" (func $0))
157
+ (export "memory" (memory $0))
158
+ (export "hello" (func $2))
159
+ (start $1)
160
+ (func $0 (param $0 i32) (param $1 i32) (result i32)
161
+ local.get $0
162
+ local.get $1
163
+ i32.load8_s
164
+ i32.const 1
165
+ select
166
+ local.get $1
167
+ i32.add
168
+ )
169
+ (func $1
170
+ i32.const 3
171
+ i32.const 5
172
+ call $0
173
+ drop
174
+ )
175
+ (func $2 (param $0 anyref) (result i32)
176
+ local.get $0
177
+ i32.const 0
178
+ i32.const 1
179
+ call $fimport$0
180
+ )
181
+ )
@@ -19,6 +19,19 @@ let _ = assert (Settings.get_low_memory_unused () == true)
19
19
  let _ = Settings.set_low_memory_unused false
20
20
  let wasm_mod = Module.create ()
21
21
  let _ = Module.set_features wasm_mod [ Module.Feature.all ]
22
+ let import_wasm_mod = Module.create ()
23
+
24
+ let _ =
25
+ Import.add_memory_import import_wasm_mod "internal_name" "external_name"
26
+ "external_base_name" true
27
+
28
+ let _ =
29
+ assert (Import.memory_import_get_module import_wasm_mod = "external_name")
30
+
31
+ let _ =
32
+ assert (Import.memory_import_get_base import_wasm_mod = "external_base_name")
33
+
34
+ let _ = assert (Memory.is_shared import_wasm_mod = true)
22
35
 
23
36
  (* Testing Return.get_value *)
24
37
  let _ =
@@ -137,11 +150,22 @@ let passive_segment : Binaryen.Memory.segment =
137
150
  let size = Bytes.length data in
138
151
  { data; kind; size }
139
152
 
153
+ let _ = assert (Memory.has_memory wasm_mod = false)
154
+
140
155
  let _ =
141
156
  Memory.set_memory wasm_mod 1 Memory.unlimited "memory"
142
157
  [ segment; passive_segment ]
143
158
  false
144
159
 
160
+ let _ = assert (Memory.has_memory wasm_mod = true)
161
+ let _ = assert (Memory.get_initial wasm_mod = 1)
162
+ let _ = assert (Memory.has_max wasm_mod = false)
163
+ let _ = assert (Memory.get_max wasm_mod = Memory.unlimited)
164
+ let max_memory_wasm_mod = Module.create ()
165
+ let _ = Memory.set_memory max_memory_wasm_mod 1 2 "memory" [] false
166
+ let _ = assert (Memory.has_max max_memory_wasm_mod = true)
167
+ let _ = assert (Memory.get_max max_memory_wasm_mod = 2)
168
+
145
169
  (* Create an imported "write" function i32 (anyref, i32, i32) *)
146
170
  (* Similar to the example here: https://bytecodealliance.org/articles/reference-types-in-wasmtime *)
147
171
 
@@ -191,7 +215,7 @@ let new_mod = Module.read byts
191
215
 
192
216
  let _ =
193
217
  Module.run_passes new_mod
194
- [ Passes.name_types; Passes.merge_similar_functions ]
218
+ [ Passes.name_types; Passes.merge_similar_functions; Passes.spill_pointers ]
195
219
 
196
220
  let _ =
197
221
  Module.set_features new_mod
@@ -218,6 +242,8 @@ let _ =
218
242
  let _ = Module.validate new_mod
219
243
  let _ = Module.print new_mod
220
244
 
245
+ let _ = Module.print_stack_ir new_mod
246
+
221
247
  (* Dispose the modules 👋 *)
222
248
 
223
249
  let _ = Module.dispose wasm_mod
@@ -1,39 +0,0 @@
1
- opam-version: "2.0"
2
- maintainer: "Philippe Wang <philippe.wang@gmail.com>"
3
- authors: [ "Philippe Wang <philippe.wang@gmail.com>" ]
4
- license: "ISC"
5
- homepage: "https://github.com/ocaml/omd"
6
- dev-repo: "git+https://github.com/ocaml/omd.git"
7
- bug-reports: "https://github.com/ocaml/omd/issues"
8
- tags: [ "org:ocamllabs" "org:mirage" ]
9
- build: [
10
- ["ocaml" "setup.ml" "-configure" "--prefix" prefix]
11
- ["ocaml" "setup.ml" "-build"]
12
- ["ocaml" "setup.ml" "-configure" "--enable-tests"] {with-test}
13
- ["ocaml" "setup.ml" "-build"] {with-test}
14
- ["ocaml" "setup.ml" "-test"] {with-test}
15
- ]
16
- install: ["ocaml" "setup.ml" "-install"]
17
- remove: [
18
- ["ocaml" "%{etc}%/omd/setup.ml" "-C" "%{etc}%/omd" "-uninstall"]
19
- ]
20
- depends: [
21
- "ocaml" {>= "4.01"}
22
- "base-bigarray"
23
- "base-bytes"
24
- "ocamlbuild" {build}
25
- "ocamlfind" {build & >= "1.5"}
26
- ]
27
- synopsis: "A Markdown frontend in pure OCaml."
28
- description: """
29
- This Markdown library is implemented using only pure OCaml (including
30
- I/O operations provided by the standard OCaml compiler distribution).
31
- OMD is meant to be as faithful as possible to the original Markdown.
32
- Additionally, OMD implements a few Github markdown features, an
33
- extension mechanism, and some other features. Note that the opam
34
- package installs both the OMD library and the command line tool `omd`."""
35
- url {
36
- src:
37
- "https://github.com/Chris00/omd/releases/download/1.3.1/omd-1.3.1.tar.gz"
38
- checksum: "md5=845fc38e86ec0e85721130f2dd044d00"
39
- }
@@ -1,41 +0,0 @@
1
- opam-version: "2.0"
2
- synopsis: """Unicode character properties for OCaml"""
3
- maintainer: ["Daniel Bünzli <daniel.buenzl i@erratique.ch>"]
4
- authors: ["The uucp programmers"]
5
- homepage: "https://erratique.ch/software/uucp"
6
- doc: "https://erratique.ch/software/uucp/doc/"
7
- dev-repo: "git+https://erratique.ch/repos/uucp.git"
8
- bug-reports: "https://github.com/dbuenzli/uucp/issues"
9
- license: ["ISC"]
10
- tags: ["unicode" "text" "character" "org:erratique"]
11
- depends: ["ocaml" {>= "4.03.0"}
12
- "ocamlfind" {build}
13
- "ocamlbuild" {build}
14
- "topkg" {build & >= "1.0.3"}
15
- "uucd" {with-test}
16
- "uunf" {with-test}
17
- "uutf" {with-test}]
18
- depopts: ["uutf"
19
- "uunf"
20
- "cmdliner"]
21
- conflicts: ["uutf" {< "1.0.1"}
22
- "cmdliner" {< "1.0.0"}]
23
- build: [["ocaml" "pkg/pkg.ml" "build" "--dev-pkg" "%{dev}%"
24
- "--with-uutf" "%{uutf:installed}%"
25
- "--with-uunf" "%{uunf:installed}%"
26
- "--with-cmdliner" "%{cmdliner:installed}%" ]]
27
- description: """
28
- Uucp is an OCaml library providing efficient access to a selection of
29
- character properties of the [Unicode character database][1].
30
-
31
- Uucp is independent from any Unicode text data structure and has no
32
- dependencies. It is distributed under the ISC license.
33
-
34
- [1]: http://www.unicode.org/reports/tr44/
35
-
36
- Home page: http://erratique.ch/software/uucp"""
37
- url {
38
- src: "https://erratique.ch/software/uucp/releases/uucp-14.0.0.tbz"
39
- checksum: "sha512=2d0224aed5d5accbb121624898f08598e8c74a2415942f159a54221c0cdac62ed64fc70a039c833e50110cefce77754ada9ac2d58f79a6fc9331135326fe6899"}
40
- post-messages: ["If the build fails with \"ocamlopt.opt got signal and exited\", issue 'ulimit -s unlimited' and retry."
41
- {failure & (arch = "ppc64" | arch = "arm64")}]