@@ -43,9 +43,9 @@ let update_sourcemap ~sourcemap_root ~sourcemap_don't_inline_content sourcemap_f
4343 else
4444 Some
4545 (List. map source_map.sources ~f: (fun file ->
46- if String. equal file Wa_source_map . blackbox_filename
46+ if String. equal file Wasm_source_map . blackbox_filename
4747 then
48- Some (Source_map.Source_content. create Wa_source_map . blackbox_contents)
48+ Some (Source_map.Source_content. create Wasm_source_map . blackbox_contents)
4949 else if Sys. file_exists file && not (Sys. is_directory file)
5050 then Some (Source_map.Source_content. create (Fs. read_file file))
5151 else None ))
@@ -56,8 +56,8 @@ let update_sourcemap ~sourcemap_root ~sourcemap_don't_inline_content sourcemap_f
5656 ; sourceroot =
5757 (if Option. is_some sourcemap_root then sourcemap_root else source_map.sourceroot)
5858 ; ignore_list =
59- (if List. mem Wa_source_map . blackbox_filename ~set: source_map.sources
60- then [ Wa_source_map . blackbox_filename ]
59+ (if List. mem Wasm_source_map . blackbox_filename ~set: source_map.sources
60+ then [ Wasm_source_map . blackbox_filename ]
6161 else [] )
6262 }
6363 in
@@ -100,7 +100,7 @@ let link_and_optimize
100100 then Some (Filename. temp_file " wasm-merged" " .wasm.map" )
101101 else None )
102102 @@ fun opt_temp_sourcemap ->
103- Wa_binaryen . link
103+ Binaryen . link
104104 ~runtime_files: (runtime_file :: runtime_wasm_files)
105105 ~input_files: wat_files
106106 ~opt_output_sourcemap: opt_temp_sourcemap
@@ -112,14 +112,14 @@ let link_and_optimize
112112 (if enable_source_maps then Some (Filename. temp_file " wasm-dce" " .wasm.map" ) else None )
113113 @@ fun opt_temp_sourcemap' ->
114114 let primitives =
115- Wa_binaryen . dead_code_elimination
115+ Binaryen . dead_code_elimination
116116 ~dependencies: Wa_runtime. dependencies
117117 ~opt_input_sourcemap: opt_temp_sourcemap
118118 ~opt_output_sourcemap: opt_temp_sourcemap'
119119 ~input_file: temp_file
120120 ~output_file: temp_file'
121121 in
122- Wa_binaryen . optimize
122+ Binaryen . optimize
123123 ~profile
124124 ~opt_input_sourcemap: opt_temp_sourcemap'
125125 ~opt_output_sourcemap: opt_sourcemap
@@ -136,12 +136,12 @@ let link_runtime ~profile runtime_wasm_files output_file =
136136 Fs. write_file ~name: runtime_file ~contents: Wa_runtime. wasm_runtime;
137137 Fs. with_intermediate_file (Filename. temp_file " wasm-merged" " .wasm" )
138138 @@ fun temp_file ->
139- Wa_binaryen . link
139+ Binaryen . link
140140 ~opt_output_sourcemap: None
141141 ~runtime_files: (runtime_file :: runtime_wasm_files)
142142 ~input_files: []
143143 ~output_file: temp_file;
144- Wa_binaryen . optimize
144+ Binaryen . optimize
145145 ~profile
146146 ~opt_input_sourcemap: None
147147 ~opt_output_sourcemap: None
@@ -160,10 +160,10 @@ let generate_prelude ~out_file =
160160 let Driver. { program; variable_uses; in_cps; deadcode_sentinal; _ } =
161161 Driver. optimize ~profile code
162162 in
163- let context = Wa_generate . start () in
163+ let context = Generate . start () in
164164 let debug = Parse_bytecode.Debug. create ~include_cmis: false false in
165165 let _ =
166- Wa_generate . f
166+ Generate . f
167167 ~context
168168 ~unit_name: (Some " prelude" )
169169 ~live_vars: variable_uses
@@ -172,7 +172,7 @@ let generate_prelude ~out_file =
172172 ~debug
173173 program
174174 in
175- Wa_generate . output ch ~context ;
175+ Generate . output ch ~context ;
176176 uinfo.provides
177177
178178let build_prelude z =
@@ -181,7 +181,7 @@ let build_prelude z =
181181 Fs. with_intermediate_file (Filename. temp_file " prelude_file" " .wasm" )
182182 @@ fun tmp_prelude_file ->
183183 let predefined_exceptions = generate_prelude ~out_file: prelude_file in
184- Wa_binaryen . optimize
184+ Binaryen . optimize
185185 ~profile: (Driver. profile 1 )
186186 ~input_file: prelude_file
187187 ~output_file: tmp_prelude_file
@@ -214,7 +214,7 @@ let build_js_runtime ~primitives ?runtime_arguments () =
214214 | Javascript. Expression_statement e , N -> e
215215 | _ -> assert false
216216 in
217- let prelude = Wa_link . output_js always_required_js in
217+ let prelude = Link . output_js always_required_js in
218218 let init_fun =
219219 match Parse_js. parse (Parse_js.Lexer. of_string Wa_runtime. js_runtime) with
220220 | [ (Expression_statement f, _) ] -> f
@@ -230,7 +230,7 @@ let build_js_runtime ~primitives ?runtime_arguments () =
230230 in
231231 [ Javascript. Expression_statement js, Javascript. N ]
232232 in
233- Wa_link . output_js js
233+ Link . output_js js
234234 in
235235 prelude ^ launcher
236236
@@ -241,13 +241,13 @@ let add_source_map sourcemap_don't_inline_content z opt_source_map_file =
241241 if not sourcemap_don't_inline_content
242242 then
243243 let sm = Source_map. of_file file in
244- Wa_source_map . iter_sources sm (fun i j file ->
244+ Wasm_source_map . iter_sources sm (fun i j file ->
245245 if Sys. file_exists file && not (Sys. is_directory file)
246246 then
247247 let sm = Fs. read_file file in
248248 Zip. add_entry
249249 z
250- ~name: (Wa_link . source_name i j file)
250+ ~name: (Link . source_name i j file)
251251 ~contents: (Yojson.Basic. to_string (`String sm))))
252252 opt_source_map_file
253253
@@ -266,7 +266,7 @@ let run
266266 } =
267267 Config. set_target `Wasm ;
268268 Jsoo_cmdline.Arg. eval common;
269- Wa_generate . init () ;
269+ Generate . init () ;
270270 let output_file = fst output_file in
271271 if debug_mem () then Debug. start_profiling output_file;
272272 List. iter params ~f: (fun (s , v ) -> Config.Param. set s v);
@@ -322,10 +322,10 @@ let run
322322 let Driver. { program; variable_uses; in_cps; deadcode_sentinal; _ } =
323323 Driver. optimize ~profile code
324324 in
325- let context = Wa_generate . start () in
325+ let context = Generate . start () in
326326 let debug = one.debug in
327327 let toplevel_name, generated_js =
328- Wa_generate . f
328+ Generate . f
329329 ~context
330330 ~unit_name
331331 ~live_vars: variable_uses
@@ -334,8 +334,8 @@ let run
334334 ~debug
335335 program
336336 in
337- if standalone then Wa_generate . add_start_function ~context toplevel_name;
338- Wa_generate . output ch ~context ;
337+ if standalone then Generate . add_start_function ~context toplevel_name;
338+ Generate . output ch ~context ;
339339 if times () then Format. eprintf " compilation: %a@." Timer. print t;
340340 generated_js
341341 in
@@ -348,8 +348,8 @@ let run
348348 link_runtime ~profile runtime_wasm_files tmp_wasm_file;
349349 let primitives =
350350 tmp_wasm_file
351- |> (fun file -> Wa_link .Wasm_binary. read_imports ~file )
352- |> List. filter_map ~f: (fun { Wa_link .Wasm_binary. module_; name; _ } ->
351+ |> (fun file -> Link .Wasm_binary. read_imports ~file )
352+ |> List. filter_map ~f: (fun { Link .Wasm_binary. module_; name; _ } ->
353353 if String. equal module_ " js" then Some name else None )
354354 |> StringSet. of_list
355355 in
@@ -358,7 +358,7 @@ let run
358358 Zip. add_file z ~name: " runtime.wasm" ~file: tmp_wasm_file;
359359 Zip. add_entry z ~name: " runtime.js" ~contents: js_runtime;
360360 let predefined_exceptions = build_prelude z in
361- Wa_link . add_info
361+ Link . add_info
362362 z
363363 ~predefined_exceptions
364364 ~build_info: (Build_info. create `Runtime )
@@ -399,13 +399,13 @@ let run
399399 let strings, fragments =
400400 output_gen wat_file (output code ~unit_name: (Some unit_name))
401401 in
402- Wa_binaryen . optimize
402+ Binaryen . optimize
403403 ~profile
404404 ~opt_input_sourcemap: None
405405 ~opt_output_sourcemap: opt_tmp_map_file
406406 ~input_file: wat_file
407407 ~output_file: tmp_wasm_file;
408- { Wa_link . unit_name; unit_info; strings; fragments }
408+ { Link . unit_name; unit_info; strings; fragments }
409409 in
410410 cont unit_data unit_name tmp_wasm_file opt_tmp_map_file
411411 in
@@ -425,7 +425,7 @@ let run
425425 Fs. gen_file (Filename. chop_extension output_file ^ " .wat" )
426426 @@ fun wat_file ->
427427 let dir = Filename. chop_extension output_file ^ " .assets" in
428- Wa_link . gen_dir dir
428+ Link . gen_dir dir
429429 @@ fun tmp_dir ->
430430 Sys. mkdir tmp_dir 0o777 ;
431431 let opt_sourcemap =
@@ -455,21 +455,21 @@ let run
455455 if enable_source_maps
456456 then (
457457 Sys. rename (Filename. concat tmp_dir " code.wasm.map" ) (tmp_wasm_file' ^ " .map" );
458- Wa_link .Wasm_binary. append_source_map_section
458+ Link .Wasm_binary. append_source_map_section
459459 ~file: tmp_wasm_file'
460460 ~url: (wasm_name ^ " .wasm.map" ));
461461 let js_runtime =
462462 let missing_primitives =
463- let l = Wa_link .Wasm_binary. read_imports ~file: tmp_wasm_file' in
463+ let l = Link .Wasm_binary. read_imports ~file: tmp_wasm_file' in
464464 List. filter_map
465- ~f: (fun { Wa_link .Wasm_binary. module_; name; _ } ->
465+ ~f: (fun { Link .Wasm_binary. module_; name; _ } ->
466466 if String. equal module_ " env" then Some name else None )
467467 l
468468 in
469469 build_js_runtime
470470 ~primitives
471471 ~runtime_arguments:
472- (Wa_link . build_runtime_arguments
472+ (Link . build_runtime_arguments
473473 ~missing_primitives
474474 ~wasm_dir: dir
475475 ~link_spec: [ wasm_name, None ]
@@ -492,7 +492,7 @@ let run
492492 unit_data)
493493 in
494494 let unit_data = [ compile_cmo' z cmo ] in
495- Wa_link . add_info z ~build_info: (Build_info. create `Cmo ) ~unit_data () ;
495+ Link . add_info z ~build_info: (Build_info. create `Cmo ) ~unit_data () ;
496496 Zip. close_out z
497497 | `Cma cma ->
498498 Fs. gen_file output_file
@@ -515,10 +515,10 @@ let run
515515 else None )
516516 @@ fun opt_output_sourcemap_file ->
517517 let l = List. rev l in
518- Wa_wasm_link . f
518+ Wasm_link . f
519519 (List. map
520520 ~f: (fun (_ , _ , file , opt_source_map ) ->
521- { Wa_wasm_link . module_name = " OCaml"
521+ { Wasm_link . module_name = " OCaml"
522522 ; file
523523 ; code = None
524524 ; opt_source_map = Option. map ~f: (fun f -> `File f) opt_source_map
@@ -531,7 +531,7 @@ let run
531531 List. map ~f: (fun (unit_data , _ , _ , _ ) -> unit_data) l)
532532 []
533533 in
534- Wa_link . add_info z ~build_info: (Build_info. create `Cma ) ~unit_data () ;
534+ Link . add_info z ~build_info: (Build_info. create `Cma ) ~unit_data () ;
535535 Zip. close_out z);
536536 close_ic () );
537537 Debug. stop_profiling ()
0 commit comments