Skip to content

Commit 19d08c7

Browse files
committed
feat!: Upgrade to Binaryen v118
1 parent 8ca1700 commit 19d08c7

File tree

20 files changed

+22
-538
lines changed

20 files changed

+22
-538
lines changed

binaryen.opam

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@ depends: [
1616
"dune" {>= "3.0.0"}
1717
"dune-configurator" {>= "3.0.0"}
1818
"js_of_ocaml-compiler" {>= "6.0.0" < "7.0.0"}
19-
"libbinaryen" {> "117.0.0" < "118.0.0"}
19+
"libbinaryen" {> "118.0.0" < "119.0.0"}
2020
]

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
},
1010
"dependencies": {
1111
"ocaml": ">= 4.13.0 < 5.4.0",
12-
"@grain/libbinaryen": "117.0.0-b",
12+
"@grain/libbinaryen": "118.0.0-b",
1313
"@opam/dune": ">= 3.0.0",
1414
"@opam/dune-configurator": ">= 3.0.0"
1515
},

src/heap_type.c

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -63,27 +63,6 @@ caml_binaryen_heap_type_string(value unit) {
6363
CAMLreturn(alloc_BinaryenHeapType(ty));
6464
}
6565

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-
8766
CAMLprim value
8867
caml_binaryen_heap_type_none(value unit) {
8968
CAMLparam1(unit);

src/heap_type.js

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -46,24 +46,6 @@ function caml_binaryen_heap_type_string() {
4646
return Binaryen._BinaryenHeapTypeString();
4747
}
4848

49-
//Provides: caml_binaryen_heap_type_stringview_wtf8
50-
//Requires: Binaryen
51-
function caml_binaryen_heap_type_stringview_wtf8() {
52-
return Binaryen._BinaryenHeapTypeStringviewWTF8();
53-
}
54-
55-
//Provides: caml_binaryen_heap_type_stringview_wtf16
56-
//Requires: Binaryen
57-
function caml_binaryen_heap_type_stringview_wtf16() {
58-
return Binaryen._BinaryenHeapTypeStringviewWTF16();
59-
}
60-
61-
//Provides: caml_binaryen_heap_type_stringview_iter
62-
//Requires: Binaryen
63-
function caml_binaryen_heap_type_stringview_iter() {
64-
return Binaryen._BinaryenHeapTypeStringviewIter();
65-
}
66-
6749
//Provides: caml_binaryen_heap_type_none
6850
//Requires: Binaryen
6951
function caml_binaryen_heap_type_none() {

src/heap_type.ml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,6 @@ external i31 : unit -> t = "caml_binaryen_heap_type_i31"
88
external struct_ : unit -> t = "caml_binaryen_heap_type_struct"
99
external array : unit -> t = "caml_binaryen_heap_type_array"
1010
external string : unit -> t = "caml_binaryen_heap_type_string"
11-
external stringview_wtf8 : unit -> t = "caml_binaryen_heap_type_stringview_wtf8"
12-
13-
external stringview_wtf16 : unit -> t
14-
= "caml_binaryen_heap_type_stringview_wtf16"
15-
16-
external stringview_iter : unit -> t = "caml_binaryen_heap_type_stringview_iter"
1711
external none : unit -> t = "caml_binaryen_heap_type_none"
1812
external noext : unit -> t = "caml_binaryen_heap_type_noext"
1913
external nofunc : unit -> t = "caml_binaryen_heap_type_nofunc"

src/heap_type.mli

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@ val i31 : unit -> t
88
val struct_ : unit -> t
99
val array : unit -> t
1010
val string : unit -> t
11-
val stringview_wtf8 : unit -> t
12-
val stringview_wtf16 : unit -> t
13-
val stringview_iter : unit -> t
1411
val none : unit -> t
1512
val noext : unit -> t
1613
val nofunc : unit -> t

src/module.c

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,9 @@ caml_binaryen_module_print_asmjs(value module) {
4444
}
4545

4646
CAMLprim value
47-
caml_binaryen_module_print_stack_ir(value module, value _optimize) {
48-
CAMLparam2(module, _optimize);
49-
bool optimize = Bool_val(_optimize);
50-
BinaryenModulePrintStackIR(BinaryenModuleRef_val(module), optimize);
47+
caml_binaryen_module_print_stack_ir(value module) {
48+
CAMLparam1(module);
49+
BinaryenModulePrintStackIR(BinaryenModuleRef_val(module));
5150
CAMLreturn(Val_unit);
5251
}
5352

@@ -127,11 +126,10 @@ caml_binaryen_module_write_text(value _module) {
127126
// There is something weird with this function that causes a bunch of newlines to
128127
// be printed on stdout when calling it. Not sure if that's a bug in Binaryen.
129128
CAMLprim value
130-
caml_binaryen_module_write_stack_ir(value _module, value _optimize) {
131-
CAMLparam2(_module, _optimize);
129+
caml_binaryen_module_write_stack_ir(value _module) {
130+
CAMLparam1(_module);
132131
BinaryenModuleRef module = BinaryenModuleRef_val(_module);
133-
bool optimize = Bool_val(_optimize);
134-
char* result = BinaryenModuleAllocateAndWriteStackIR(module, optimize);
132+
char* result = BinaryenModuleAllocateAndWriteStackIR(module);
135133
CAMLlocal1(text);
136134
text = caml_copy_string(result);
137135
free(result);

src/module.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ function caml_binaryen_module_print_asmjs(wasm_mod) {
4040

4141
//Provides: caml_binaryen_module_print_stack_ir
4242
//Requires: caml_sys_fds
43-
//Requires: caml_string_of_jsstring, caml_js_from_bool
43+
//Requires: caml_string_of_jsstring
4444
//Requires: caml_ml_output, caml_ml_string_length
45-
function caml_binaryen_module_print_stack_ir(wasm_mod, optimize) {
46-
var stackir = wasm_mod.emitStackIR(caml_js_from_bool(optimize));
45+
function caml_binaryen_module_print_stack_ir(wasm_mod) {
46+
var stackir = wasm_mod.emitStackIR();
4747
var chanid = caml_sys_fds[1].chanid; // stdout
4848
var s = caml_string_of_jsstring(stackir);
4949
caml_ml_output(chanid, s, 0, caml_ml_string_length(s));
@@ -96,9 +96,9 @@ function caml_binaryen_module_write_text(wasm_mod) {
9696
}
9797

9898
//Provides: caml_binaryen_module_write_stack_ir
99-
//Requires: caml_string_of_jsstring, caml_js_from_bool
100-
function caml_binaryen_module_write_stack_ir(wasm_mod, optimize) {
101-
var text = wasm_mod.emitStackIR(caml_js_from_bool(optimize));
99+
//Requires: caml_string_of_jsstring
100+
function caml_binaryen_module_write_stack_ir(wasm_mod) {
101+
var text = wasm_mod.emitStackIR();
102102
return caml_string_of_jsstring(text);
103103
}
104104

src/module.ml

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,7 @@ external add_custom_section : t -> string -> string -> unit
9090
external parse : string -> t = "caml_binaryen_module_parse"
9191
external print : t -> unit = "caml_binaryen_module_print"
9292
external print_asmjs : t -> unit = "caml_binaryen_module_print_asmjs"
93-
94-
external print_stack_ir : t -> bool -> unit
95-
= "caml_binaryen_module_print_stack_ir"
96-
93+
external print_stack_ir : t -> unit = "caml_binaryen_module_print_stack_ir"
9794
external validate : t -> int = "caml_binaryen_module_validate"
9895
external optimize : t -> unit = "caml_binaryen_module_optimize"
9996
external get_features : t -> int = "caml_binaryen_module_get_features"
@@ -124,10 +121,7 @@ external write : t -> string option -> bytes * string option
124121
= "caml_binaryen_module_write"
125122

126123
external write_text : t -> string = "caml_binaryen_module_write_text"
127-
128-
external write_stack_ir : t -> bool -> string
129-
= "caml_binaryen_module_write_stack_ir"
130-
124+
external write_stack_ir : t -> string = "caml_binaryen_module_write_stack_ir"
131125
external read : bytes -> t = "caml_binaryen_module_read"
132126
external interpret : t -> unit = "caml_binaryen_module_interpret"
133127

src/module.mli

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ val add_custom_section : t -> string -> string -> unit
2929
val parse : string -> t
3030
val print : t -> unit
3131
val print_asmjs : t -> unit
32-
val print_stack_ir : t -> bool -> unit
32+
val print_stack_ir : t -> unit
3333
val validate : t -> int
3434
val optimize : t -> unit
3535
val get_features : t -> Feature.t list
@@ -38,7 +38,7 @@ val run_passes : t -> Passes.t list -> unit
3838
val auto_drop : t -> unit
3939
val write : t -> string option -> bytes * string option
4040
val write_text : t -> string
41-
val write_stack_ir : t -> bool -> string
41+
val write_stack_ir : t -> string
4242
val read : bytes -> t
4343
val interpret : t -> unit
4444
val add_debug_info_filename : t -> string -> int

0 commit comments

Comments
 (0)