Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update to latest binaryen #3

Merged
merged 4 commits into from
Oct 3, 2024
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
56 changes: 28 additions & 28 deletions .depend
Original file line number Diff line number Diff line change
Expand Up @@ -2342,7 +2342,7 @@ asmcomp/asmlink.cmo : \
utils/misc.cmi \
parsing/location.cmi \
utils/load_path.cmi \
wasm/link_wast.cmi \
wasm/link_wat.cmi \
asmcomp/emitaux.cmi \
asmcomp/emit.cmi \
utils/consistbl.cmi \
Expand All @@ -2361,7 +2361,7 @@ asmcomp/asmlink.cmx : \
utils/misc.cmx \
parsing/location.cmx \
utils/load_path.cmx \
wasm/link_wast.cmx \
wasm/link_wat.cmx \
asmcomp/emitaux.cmx \
asmcomp/emit.cmx \
utils/consistbl.cmx \
Expand Down Expand Up @@ -3874,12 +3874,12 @@ wasm/block_repr.cmx : \
wasm/block_repr.cmi
wasm/block_repr.cmi : \
wasm/wmodule.cmo
wasm/emit_wast.cmo : \
wasm/emit_wat.cmo : \
wasm/wtype.cmo \
wasm/wstate.cmo \
wasm/wmodule.cmo \
wasm/wident.cmo \
wasm/wast.cmo \
wasm/wat.cmo \
wasm/wasm_closure_offsets.cmi \
middle_end/variable.cmi \
middle_end/flambda/base_types/var_within_closure.cmi \
Expand All @@ -3905,13 +3905,13 @@ wasm/emit_wast.cmo : \
middle_end/clambda_primitives.cmi \
wasm/block_repr.cmi \
middle_end/flambda/allocated_const.cmi \
wasm/emit_wast.cmi
wasm/emit_wast.cmx : \
wasm/emit_wat.cmi
wasm/emit_wat.cmx : \
wasm/wtype.cmx \
wasm/wstate.cmx \
wasm/wmodule.cmx \
wasm/wident.cmx \
wasm/wast.cmx \
wasm/wat.cmx \
wasm/wasm_closure_offsets.cmx \
middle_end/variable.cmx \
middle_end/flambda/base_types/var_within_closure.cmx \
Expand All @@ -3937,26 +3937,26 @@ wasm/emit_wast.cmx : \
middle_end/clambda_primitives.cmx \
wasm/block_repr.cmx \
middle_end/flambda/allocated_const.cmx \
wasm/emit_wast.cmi
wasm/emit_wast.cmi : \
wasm/wast.cmo \
wasm/emit_wat.cmi
wasm/emit_wat.cmi : \
wasm/wat.cmo \
middle_end/flambda/flambda.cmi
wasm/link_wast.cmo : \
wasm/link_wat.cmo : \
wasm/wstate.cmo \
wasm/wast.cmo \
wasm/wat.cmo \
utils/misc.cmi \
wasm/emit_wast.cmi \
wasm/emit_wat.cmi \
utils/config.cmi \
wasm/link_wast.cmi
wasm/link_wast.cmx : \
wasm/link_wat.cmi
wasm/link_wat.cmx : \
wasm/wstate.cmx \
wasm/wast.cmx \
wasm/wat.cmx \
utils/misc.cmx \
wasm/emit_wast.cmx \
wasm/emit_wat.cmx \
utils/config.cmx \
wasm/link_wast.cmi
wasm/link_wast.cmi : \
wasm/wast.cmo
wasm/link_wat.cmi
wasm/link_wat.cmi : \
wasm/wat.cmo
wasm/wasm_closure_offsets.cmo : \
middle_end/variable.cmi \
middle_end/flambda/base_types/var_within_closure.cmi \
Expand All @@ -3983,12 +3983,12 @@ wasm/wasm_closure_offsets.cmi : \
middle_end/flambda/flambda.cmi \
middle_end/compilation_unit.cmi \
middle_end/flambda/base_types/closure_id.cmi
wasm/wast.cmo : \
wasm/wat.cmo : \
wasm/wtype.cmo \
wasm/wstate.cmo \
wasm/wident.cmo \
wasm/wexpr.cmo
wasm/wast.cmx : \
wasm/wat.cmx : \
wasm/wtype.cmx \
wasm/wstate.cmx \
wasm/wident.cmx \
Expand Down Expand Up @@ -4455,7 +4455,7 @@ middle_end/flambda/effect_analysis.cmx : \
middle_end/flambda/effect_analysis.cmi : \
middle_end/flambda/flambda.cmi
middle_end/flambda/export_info.cmo : \
wasm/wast.cmo \
wasm/wat.cmo \
wasm/wasm_closure_offsets.cmi \
middle_end/variable.cmi \
middle_end/flambda/base_types/var_within_closure.cmi \
Expand All @@ -4469,7 +4469,7 @@ middle_end/flambda/export_info.cmo : \
middle_end/flambda/base_types/closure_id.cmi \
middle_end/flambda/export_info.cmi
middle_end/flambda/export_info.cmx : \
wasm/wast.cmx \
wasm/wat.cmx \
wasm/wasm_closure_offsets.cmx \
middle_end/variable.cmx \
middle_end/flambda/base_types/var_within_closure.cmx \
Expand All @@ -4483,7 +4483,7 @@ middle_end/flambda/export_info.cmx : \
middle_end/flambda/base_types/closure_id.cmx \
middle_end/flambda/export_info.cmi
middle_end/flambda/export_info.cmi : \
wasm/wast.cmo \
wasm/wat.cmo \
wasm/wasm_closure_offsets.cmi \
middle_end/variable.cmi \
middle_end/flambda/base_types/var_within_closure.cmi \
Expand Down Expand Up @@ -4738,7 +4738,7 @@ middle_end/flambda/flambda_middle_end.cmo : \
middle_end/flambda/flambda_iterators.cmi \
middle_end/flambda/flambda_invariants.cmi \
middle_end/flambda/flambda.cmi \
wasm/emit_wast.cmi \
wasm/emit_wat.cmi \
lambda/debuginfo.cmi \
middle_end/compilenv.cmi \
middle_end/flambda/base_types/closure_id.cmi \
Expand Down Expand Up @@ -4774,7 +4774,7 @@ middle_end/flambda/flambda_middle_end.cmx : \
middle_end/flambda/flambda_iterators.cmx \
middle_end/flambda/flambda_invariants.cmx \
middle_end/flambda/flambda.cmx \
wasm/emit_wast.cmx \
wasm/emit_wat.cmx \
lambda/debuginfo.cmx \
middle_end/compilenv.cmx \
middle_end/flambda/base_types/closure_id.cmx \
Expand Down Expand Up @@ -4851,7 +4851,7 @@ middle_end/flambda/flambda_to_clambda.cmx : \
middle_end/flambda/allocated_const.cmx \
middle_end/flambda/flambda_to_clambda.cmi
middle_end/flambda/flambda_to_clambda.cmi : \
wasm/wast.cmo \
wasm/wat.cmo \
middle_end/symbol.cmi \
middle_end/flambda/flambda.cmi \
middle_end/flambda/export_info.cmi \
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ _build
/ocamlopt.opt
/ocamlnat
/_opam
/o*.wast
/o*.wat
/o*.wasm

# specific files and patterns in sub-directories
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ ifeq "$(INSTALL_SOURCE_ARTIFACTS)" "true"
"$(INSTALL_COMPLIBDIR)"
endif
$(INSTALL_DATA) \
wasm/*.wast \
wasm/*.wat \
"$(INSTALL_LIBDIR)"
$(INSTALL_DATA) \
compilerlibs/*.cma \
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ $ opam switch create wasocaml --repos default,wasocaml=git+https://github.com/oc

### Usage

Running the compiler will produce two files: `a.out.wasm` (the Wasm binary) and `a.out.wast` (the Wast text format).
Running the compiler will produce two files: `a.out.wasm` (the Wasm binary) and `a.out.wat` (the Wast text format).

```shell-session
$ /usr/local/bin/ocamlopt file.ml
$ ls
a.out a.out.wasm a.out.wast
a.out a.out.wasm a.out.wat
```

For a complete example using the compiler installed as an opam switch, see [wasocaml-demo].
Expand Down
2 changes: 1 addition & 1 deletion asmcomp/asmlink.ml
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ let link ~ppf_dump objfiles output_name =
| Some w -> Some (ui.ui_name, w))
units_tolink
in
Link_wast.link fl_export ~output:output_name;
Link_wat.link fl_export ~output:output_name;
in
Clflags.ccobjs := !Clflags.ccobjs @ !lib_ccobjs;
Clflags.all_ccopts := !lib_ccopts @ !Clflags.all_ccopts;
Expand Down
6 changes: 3 additions & 3 deletions compilerlibs/Makefile.compilerlibs
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,10 @@ WASM = \
wasm/wident.cmo \
wasm/wexpr.cmo \
wasm/wmodule.cmo \
wasm/wast.cmo \
wasm/wat.cmo \
wasm/block_repr.cmo \
wasm/emit_wast.cmo \
wasm/link_wast.cmo
wasm/emit_wat.cmo \
wasm/link_wat.cmo
WASM_CMI =

COMP = \
Expand Down
6 changes: 3 additions & 3 deletions dune
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,10 @@
wident
wexpr
wmodule
wast
wat
block_repr
emit_wast
link_wast
emit_wat
link_wat
)
)

Expand Down
2 changes: 1 addition & 1 deletion middle_end/flambda/export_info.ml
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ type t = {
invariant_params : Variable.Set.t Variable.Map.t Set_of_closures_id.Map.t;
recursive : Variable.Set.t Set_of_closures_id.Map.t;
wasm_offsets : Wasm_closure_offsets.t;
wasm_contents : Wast.t option;
wasm_contents : Wat.t option;
}

type transient = {
Expand Down
8 changes: 4 additions & 4 deletions middle_end/flambda/export_info.mli
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ type t = private {
indexed by set of closures ID. *)
recursive : Variable.Set.t Set_of_closures_id.Map.t;
wasm_offsets : Wasm_closure_offsets.t;
wasm_contents : Wast.t option;
wasm_contents : Wat.t option;
}

type transient = private {
Expand All @@ -114,7 +114,7 @@ type transient = private {
(** Export information for a compilation unit that exports nothing. *)
val empty : t

val empty_with_wasm : Wast.t option -> t
val empty_with_wasm : Wat.t option -> t

val opaque_transient
: compilation_unit:Compilation_unit.t
Expand All @@ -132,7 +132,7 @@ val create
-> invariant_params:Variable.Set.t Variable.Map.t Set_of_closures_id.Map.t
-> recursive:Variable.Set.t Set_of_closures_id.Map.t
-> wasm_offsets:Wasm_closure_offsets.t
-> wasm_contents:Wast.t option
-> wasm_contents:Wat.t option
-> t

val create_transient
Expand Down Expand Up @@ -165,7 +165,7 @@ val t_of_transient
-> imported_offset_fv:int Var_within_closure.Map.t
-> constant_closures:Closure_id.Set.t
-> wasm_offsets:Wasm_closure_offsets.t
-> wasm_contents:Wast.t option
-> wasm_contents:Wat.t option
-> t

(** Union of export information. Verifies that there are no identifier
Expand Down
4 changes: 2 additions & 2 deletions middle_end/flambda/flambda_middle_end.ml
Original file line number Diff line number Diff line change
Expand Up @@ -230,8 +230,8 @@ let lambda_to_clambda ~backend ~prefixname ~ppf_dump
let wasm_contents =
try
Some (
Profile.record_call "emit_wast" (fun () ->
Emit_wast.emit ~to_file:do_wasm ~output_prefix:prefixname program))
Profile.record_call "emit_wat" (fun () ->
Emit_wat.emit ~to_file:do_wasm ~output_prefix:prefixname program))
with Failure s ->
Format.eprintf "No wasm generated@.%s@." s;
None
Expand Down
2 changes: 1 addition & 1 deletion middle_end/flambda/flambda_to_clambda.mli
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@ type result = {
*)
val convert
: ppf_dump:Format.formatter
-> wasm_contents:Wast.t option
-> wasm_contents:Wat.t option
-> Flambda.program * Export_info.transient
-> result
2 changes: 1 addition & 1 deletion stdlib/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ stdlib__%.cmo:

WASMOPT=~/test/wasm/binaryen/bin/wasm-opt

%.wasm: %.wast
%.wasm: %.wat
$(WASMOPT) \
--enable-reference-types --enable-gc --enable-tail-call --enable-exception-handling \
--enable-multivalue \
Expand Down
4 changes: 2 additions & 2 deletions wasm/block_repr.ml
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ module Block_struct : Block = struct
if size <= 1 then Gen_block else Block { size = size - 1 }
in
Struct { sub = Some sub; fields = (* Tag *)
I8 :: (* size *)
I16 :: fields }
I8 :: (* size *)
I16 :: fields }

let type_decl name size : Decl.t list = [ Decl.Type (name, type_descr size) ]
end
Expand Down
3 changes: 0 additions & 3 deletions wasm/emit_wast.mli

This file was deleted.

Loading
Loading