Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion binaryen.opam
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ depends: [
"dune" {>= "3.0.0"}
"dune-configurator" {>= "3.0.0"}
"js_of_ocaml-compiler" {>= "6.0.0" < "7.0.0"}
"libbinaryen" {> "117.0.0" < "118.0.0"}
"libbinaryen" {> "118.0.0" < "119.0.0"}
]
33 changes: 17 additions & 16 deletions esy.lock/index.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 1 addition & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,9 @@
"description": "OCaml bindings for Binaryen.",
"author": "Oscar Spencer <oscar@grain-lang.org>",
"license": "Apache-2.0",
"installConfig": {
"pnp": false
},
"dependencies": {
"ocaml": ">= 4.13.0 < 5.4.0",
"@grain/libbinaryen": "117.0.0-b",
"@grain/libbinaryen": "118.0.0-b",
"@opam/dune": ">= 3.0.0",
"@opam/dune-configurator": ">= 3.0.0"
},
Expand Down
21 changes: 0 additions & 21 deletions src/heap_type.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,27 +63,6 @@ caml_binaryen_heap_type_string(value unit) {
CAMLreturn(alloc_BinaryenHeapType(ty));
}

CAMLprim value
caml_binaryen_heap_type_stringview_wtf8(value unit) {
CAMLparam1(unit);
BinaryenHeapType ty = BinaryenHeapTypeStringviewWTF8();
CAMLreturn(alloc_BinaryenHeapType(ty));
}

CAMLprim value
caml_binaryen_heap_type_stringview_wtf16(value unit) {
CAMLparam1(unit);
BinaryenHeapType ty = BinaryenHeapTypeStringviewWTF16();
CAMLreturn(alloc_BinaryenHeapType(ty));
}

CAMLprim value
caml_binaryen_heap_type_stringview_iter(value unit) {
CAMLparam1(unit);
BinaryenHeapType ty = BinaryenHeapTypeStringviewIter();
CAMLreturn(alloc_BinaryenHeapType(ty));
}

CAMLprim value
caml_binaryen_heap_type_none(value unit) {
CAMLparam1(unit);
Expand Down
18 changes: 0 additions & 18 deletions src/heap_type.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,24 +46,6 @@ function caml_binaryen_heap_type_string() {
return Binaryen._BinaryenHeapTypeString();
}

//Provides: caml_binaryen_heap_type_stringview_wtf8
//Requires: Binaryen
function caml_binaryen_heap_type_stringview_wtf8() {
return Binaryen._BinaryenHeapTypeStringviewWTF8();
}

//Provides: caml_binaryen_heap_type_stringview_wtf16
//Requires: Binaryen
function caml_binaryen_heap_type_stringview_wtf16() {
return Binaryen._BinaryenHeapTypeStringviewWTF16();
}

//Provides: caml_binaryen_heap_type_stringview_iter
//Requires: Binaryen
function caml_binaryen_heap_type_stringview_iter() {
return Binaryen._BinaryenHeapTypeStringviewIter();
}

//Provides: caml_binaryen_heap_type_none
//Requires: Binaryen
function caml_binaryen_heap_type_none() {
Expand Down
6 changes: 0 additions & 6 deletions src/heap_type.ml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,6 @@ external i31 : unit -> t = "caml_binaryen_heap_type_i31"
external struct_ : unit -> t = "caml_binaryen_heap_type_struct"
external array : unit -> t = "caml_binaryen_heap_type_array"
external string : unit -> t = "caml_binaryen_heap_type_string"
external stringview_wtf8 : unit -> t = "caml_binaryen_heap_type_stringview_wtf8"

external stringview_wtf16 : unit -> t
= "caml_binaryen_heap_type_stringview_wtf16"

external stringview_iter : unit -> t = "caml_binaryen_heap_type_stringview_iter"
external none : unit -> t = "caml_binaryen_heap_type_none"
external noext : unit -> t = "caml_binaryen_heap_type_noext"
external nofunc : unit -> t = "caml_binaryen_heap_type_nofunc"
Expand Down
3 changes: 0 additions & 3 deletions src/heap_type.mli
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ val i31 : unit -> t
val struct_ : unit -> t
val array : unit -> t
val string : unit -> t
val stringview_wtf8 : unit -> t
val stringview_wtf16 : unit -> t
val stringview_iter : unit -> t
val none : unit -> t
val noext : unit -> t
val nofunc : unit -> t
Expand Down
14 changes: 6 additions & 8 deletions src/module.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,9 @@ caml_binaryen_module_print_asmjs(value module) {
}

CAMLprim value
caml_binaryen_module_print_stack_ir(value module, value _optimize) {
CAMLparam2(module, _optimize);
bool optimize = Bool_val(_optimize);
BinaryenModulePrintStackIR(BinaryenModuleRef_val(module), optimize);
caml_binaryen_module_print_stack_ir(value module) {
CAMLparam1(module);
BinaryenModulePrintStackIR(BinaryenModuleRef_val(module));
CAMLreturn(Val_unit);
}

Expand Down Expand Up @@ -127,11 +126,10 @@ caml_binaryen_module_write_text(value _module) {
// There is something weird with this function that causes a bunch of newlines to
// be printed on stdout when calling it. Not sure if that's a bug in Binaryen.
CAMLprim value
caml_binaryen_module_write_stack_ir(value _module, value _optimize) {
CAMLparam2(_module, _optimize);
caml_binaryen_module_write_stack_ir(value _module) {
CAMLparam1(_module);
BinaryenModuleRef module = BinaryenModuleRef_val(_module);
bool optimize = Bool_val(_optimize);
char* result = BinaryenModuleAllocateAndWriteStackIR(module, optimize);
char* result = BinaryenModuleAllocateAndWriteStackIR(module);
CAMLlocal1(text);
text = caml_copy_string(result);
free(result);
Expand Down
12 changes: 6 additions & 6 deletions src/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ function caml_binaryen_module_print_asmjs(wasm_mod) {

//Provides: caml_binaryen_module_print_stack_ir
//Requires: caml_sys_fds
//Requires: caml_string_of_jsstring, caml_js_from_bool
//Requires: caml_string_of_jsstring
//Requires: caml_ml_output, caml_ml_string_length
function caml_binaryen_module_print_stack_ir(wasm_mod, optimize) {
var stackir = wasm_mod.emitStackIR(caml_js_from_bool(optimize));
function caml_binaryen_module_print_stack_ir(wasm_mod) {
var stackir = wasm_mod.emitStackIR();
var chanid = caml_sys_fds[1].chanid; // stdout
var s = caml_string_of_jsstring(stackir);
caml_ml_output(chanid, s, 0, caml_ml_string_length(s));
Expand Down Expand Up @@ -96,9 +96,9 @@ function caml_binaryen_module_write_text(wasm_mod) {
}

//Provides: caml_binaryen_module_write_stack_ir
//Requires: caml_string_of_jsstring, caml_js_from_bool
function caml_binaryen_module_write_stack_ir(wasm_mod, optimize) {
var text = wasm_mod.emitStackIR(caml_js_from_bool(optimize));
//Requires: caml_string_of_jsstring
function caml_binaryen_module_write_stack_ir(wasm_mod) {
var text = wasm_mod.emitStackIR();
return caml_string_of_jsstring(text);
}

Expand Down
10 changes: 2 additions & 8 deletions src/module.ml
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,7 @@ external add_custom_section : t -> string -> string -> unit
external parse : string -> t = "caml_binaryen_module_parse"
external print : t -> unit = "caml_binaryen_module_print"
external print_asmjs : t -> unit = "caml_binaryen_module_print_asmjs"

external print_stack_ir : t -> bool -> unit
= "caml_binaryen_module_print_stack_ir"

external print_stack_ir : t -> unit = "caml_binaryen_module_print_stack_ir"
external validate : t -> int = "caml_binaryen_module_validate"
external optimize : t -> unit = "caml_binaryen_module_optimize"
external get_features : t -> int = "caml_binaryen_module_get_features"
Expand Down Expand Up @@ -124,10 +121,7 @@ external write : t -> string option -> bytes * string option
= "caml_binaryen_module_write"

external write_text : t -> string = "caml_binaryen_module_write_text"

external write_stack_ir : t -> bool -> string
= "caml_binaryen_module_write_stack_ir"

external write_stack_ir : t -> string = "caml_binaryen_module_write_stack_ir"
external read : bytes -> t = "caml_binaryen_module_read"
external interpret : t -> unit = "caml_binaryen_module_interpret"

Expand Down
4 changes: 2 additions & 2 deletions src/module.mli
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ val add_custom_section : t -> string -> string -> unit
val parse : string -> t
val print : t -> unit
val print_asmjs : t -> unit
val print_stack_ir : t -> bool -> unit
val print_stack_ir : t -> unit
val validate : t -> int
val optimize : t -> unit
val get_features : t -> Feature.t list
Expand All @@ -38,7 +38,7 @@ val run_passes : t -> Passes.t list -> unit
val auto_drop : t -> unit
val write : t -> string option -> bytes * string option
val write_text : t -> string
val write_stack_ir : t -> bool -> string
val write_stack_ir : t -> string
val read : bytes -> t
val interpret : t -> unit
val add_debug_info_filename : t -> string -> int
Expand Down
Loading