From ec3b90ba3f04e7e9aa1ab7e8ba5d75dca36a6a23 Mon Sep 17 00:00:00 2001 From: zapashcanon Date: Mon, 7 Oct 2024 15:19:05 +0200 Subject: [PATCH] remove register --- wasm/emit_wat.ml | 16 ++++------------ wasm/link_wat.ml | 2 +- wasm/wat.ml | 5 ++--- 3 files changed, 7 insertions(+), 16 deletions(-) diff --git a/wasm/emit_wat.ml b/wasm/emit_wat.ml index 404cd3497..2c8f05bf1 100644 --- a/wasm/emit_wat.ml +++ b/wasm/emit_wat.ml @@ -2387,7 +2387,7 @@ end let output_wat ppf wat = Format.pp_print_string ppf wat -let output_file ~output_prefix ~module_ ~register = +let output_file ~output_prefix ~module_ = let watfile = output_prefix ^ ".wat" in let oc = open_out_bin watfile in let ppf = Format.formatter_of_out_channel oc in @@ -2398,8 +2398,7 @@ let output_file ~output_prefix ~module_ ~register = (* ~exceptionally:(fun () -> Misc.remove_file watfile) *) (fun () -> output_wat ppf module_; - Format.fprintf ppf "@\n"; - output_wat ppf register ) + Format.fprintf ppf "@\n") let run ~output_prefix (flambda : Flambda.program) = State.reset (); @@ -2427,21 +2426,14 @@ let run ~output_prefix (flambda : Flambda.program) = let wasm = Profile.record_call "ToWasm" (fun () -> ToWasm.conv_module (common @ m)) in - let register = - let ln = - Compilation_unit.get_linkage_name (Compilation_unit.get_current_exn ()) - in - Wat.C.register (Linkage_name.to_string ln) - in (* Format.printf "@.%a@." ToWasm.Cst.emit wasm; *) let emit = if Wstate.pp_wat then ToWasm.Cst.pp else ToWasm.Cst.emit in let wasm = Format.asprintf "%a" emit wasm in - let register = Format.asprintf "%a" emit register in - Wat.{ module_ = wasm; register } + Wat.{ module_ = wasm } let emit ~to_file ~output_prefix (flambda : Flambda.program) = let r = run ~output_prefix flambda in if to_file then Profile.record_call "output_wasm" (fun () -> - output_file ~output_prefix ~module_:r.module_ ~register:r.register ); + output_file ~output_prefix ~module_:r.module_ ); r diff --git a/wasm/link_wat.ml b/wasm/link_wat.ml index 61e320f81..e0b936e92 100644 --- a/wasm/link_wat.ml +++ b/wasm/link_wat.ml @@ -20,7 +20,7 @@ let out_file (name, (wat : Wat.t)) = (fun () -> Emit_wat.output_wat ppf wat.module_; Format.fprintf ppf "@\n"; - Emit_wat.output_wat ppf wat.register ); + ); { name; filename } let emit_text = "--emit-text" diff --git a/wasm/wat.ml b/wasm/wat.ml index 0b492cb65..090eecf46 100644 --- a/wasm/wat.ml +++ b/wasm/wat.ml @@ -121,7 +121,6 @@ type printable_expr = string type t = { module_ : string; - register : string; } module C = struct @@ -256,7 +255,8 @@ module C = struct let tuple_make fields = match fields with - | [] -> assert false + | [] -> atom "_____ishouldnotexist" + (* assert false *) | [ field ] -> field | fields -> node "tuple.make" (Atom (List.length fields |> string_of_int) :: fields ) @@ -372,5 +372,4 @@ module C = struct let m = import_tag :: m in nodev "module" m - let register name = node "register" [ String (module_name name) ] end