diff --git a/driver/compenv.ml b/driver/compenv.ml index 7056ebad3f..1b6fb58b3e 100644 --- a/driver/compenv.ml +++ b/driver/compenv.ml @@ -241,15 +241,6 @@ let parse_warnings error v = let read_one_param ppf position name v = let set name options s = setter ppf (fun b -> b) name options s in let clear name options s = setter ppf (fun b -> not b) name options s in -<<<<<<< HEAD - let handled = - match !extra_params with - | Some h -> h ppf position name v - | None -> false - in - if not handled then -||||||| merged common ancestors -======= let compat name s = let error_if_unset = function | true -> true @@ -260,7 +251,12 @@ let read_one_param ppf position name v = in setter ppf error_if_unset name [ ref true ] s in ->>>>>>> ocaml/5.1 + let handled = + match !extra_params with + | Some h -> h ppf position name v + | None -> false + in + if not handled then match name with | "g" -> set "g" [ Clflags.debug ] v | "bin-annot" -> set "bin-annot" [ Clflags.binary_annotations ] v @@ -504,14 +500,10 @@ let read_one_param ppf position name v = end | "dump-into-file" -> Clflags.dump_into_file := true | "dump-dir" -> Clflags.dump_dir := Some v -<<<<<<< HEAD | "extension" -> Language_extension.enable_of_string_exn v | "disable-all-extensions" -> if check_bool ppf name v then Language_extension.disallow_extensions () -||||||| merged common ancestors -======= ->>>>>>> ocaml/5.1 | _ -> if !warnings_for_discarded_params && diff --git a/driver/compmisc.ml b/driver/compmisc.ml index 6eb7513882..f15c7fb9d5 100644 --- a/driver/compmisc.ml +++ b/driver/compmisc.ml @@ -38,15 +38,6 @@ let init_path ?(auto_include=auto_include) ?(dir="") () = !Compenv.first_include_dirs in let exp_dirs = -<<<<<<< HEAD - List.map (Misc.expand_directory Config.standard_library) dirs in - Load_path.init (dir :: List.rev_append exp_dirs (Clflags.std_include_dir ())); - Env.reset_cache ~preserve_persistent_env:false -||||||| merged common ancestors - List.map (Misc.expand_directory Config.standard_library) dirs in - Load_path.init (dir :: List.rev_append exp_dirs (Clflags.std_include_dir ())); - Env.reset_cache () -======= List.map (Misc.expand_directory Config.standard_library) dirs in let dirs = @@ -54,8 +45,7 @@ let init_path ?(auto_include=auto_include) ?(dir="") () = @ List.rev_append exp_dirs (Clflags.std_include_dir ()) in Load_path.init ~auto_include dirs; - Env.reset_cache () ->>>>>>> ocaml/5.1 + Env.reset_cache ~preserve_persistent_env:false (* Return the initial environment in which compilation proceeds. *) @@ -105,13 +95,7 @@ let rec make_directory dir = Sys.mkdir dir 0o777 end -<<<<<<< HEAD let with_ppf_dump ?stdout ~file_prefix f = -||||||| merged common ancestors -let with_ppf_dump ~file_prefix f = -======= -let with_ppf_dump ~file_prefix f = ->>>>>>> ocaml/5.1 let with_ch ch = let ppf = Format.formatter_of_out_channel ch in ppf, @@ -121,26 +105,12 @@ let with_ppf_dump ~file_prefix f = in let ppf_dump, finally = match !Clflags.dump_dir, !Clflags.dump_into_file with -<<<<<<< HEAD | None, false -> let formatter = if Option.is_some stdout then Format.std_formatter else Format.err_formatter in formatter, ignore -||||||| merged common ancestors - if not !Clflags.dump_into_file - then Format.err_formatter, ignore - else - let ch = open_out (file_prefix ^ ".dump") in - let ppf = Format.formatter_of_out_channel ch in - ppf, - (fun () -> - Format.pp_print_flush ppf (); - close_out ch) -======= - | None, false -> Format.err_formatter, ignore ->>>>>>> ocaml/5.1 | None, true -> with_ch (open_out (file_prefix ^ ".dump")) | Some d, _ -> let () = make_directory Filename.(dirname @@ concat d @@ file_prefix) in diff --git a/driver/compmisc.mli b/driver/compmisc.mli index 8150dd216b..2f8559126e 100644 --- a/driver/compmisc.mli +++ b/driver/compmisc.mli @@ -21,16 +21,10 @@ val initial_env : unit -> Env.t val set_from_env : 'a option ref -> 'a Clflags.env_reader -> unit val read_clflags_from_env : unit -> unit -<<<<<<< HEAD val with_ppf_dump : ?stdout:unit -> file_prefix:string -> (Format.formatter -> 'a) -> 'a -||||||| merged common ancestors -val with_ppf_dump : file_prefix:string -> (Format.formatter -> 'a) -> 'a -======= -val with_ppf_dump : file_prefix:string -> (Format.formatter -> 'a) -> 'a val auto_include : Load_path.auto_include_callback (** [auto_include find_in_dir fn] is a callback function to be passed to {!Load_path.init} and automatically adds [-I +lib] to the load path after displaying an alert. *) ->>>>>>> ocaml/5.1 diff --git a/driver/main_args.ml b/driver/main_args.ml index 48ad7d0afa..34c5500577 100644 --- a/driver/main_args.ml +++ b/driver/main_args.ml @@ -39,6 +39,7 @@ let mk_annot f = let mk_binannot f = "-bin-annot", Arg.Unit f, " Save typedtree in .cmt" +;; let mk_binannot_cms f = "-bin-annot-cms", Arg.Unit f, " Save shapes in .cms" @@ -171,15 +172,8 @@ let mk_inline_toplevel f = let mk_inlining_report f = "-inlining-report", Arg.Unit f, " Emit `..inlining' file(s) (one per \ -<<<<<<< HEAD round) showing the inliner's decisions (Flambda 1 and 2)" ;; -||||||| merged common ancestors - round) showing the inliner's decisions" -;; -======= - round) showing the inliner's decisions" ->>>>>>> ocaml/5.1 let mk_dump_pass f = "-dump-pass", Arg.String f, @@ -212,15 +206,8 @@ let mk_inline_max_unroll f = let mk_classic_inlining f = "-Oclassic", Arg.Unit f, " Make inlining decisions at function definition \ time rather than at the call site (replicates previous behaviour of the \ -<<<<<<< HEAD compiler). Implies -linscan (and causes -nolinscan to be ignored)." ;; -||||||| merged common ancestors - compiler)" -;; -======= - compiler)" ->>>>>>> ocaml/5.1 let mk_inline_cost arg descr default f = Printf.sprintf "-inline-%s-cost" arg, @@ -287,6 +274,7 @@ let mk_keep_locs f = let mk_no_keep_locs f = "-no-keep-locs", Arg.Unit f, " Do not keep locations in .cmi files" +;; let mk_probes f = if Config.probes then @@ -495,7 +483,8 @@ let mk_thread f = " (deprecated) same as -I +threads" let mk_dtimings f = - "-dtimings", Arg.Unit f, " Print timings information for each pass" + "-dtimings", Arg.Unit f, " Print timings information for each pass"; +;; let mk_dtimings_precision f = "-dtimings-precision", Arg.Int f, @@ -524,18 +513,8 @@ let mk_unboxed_types f = let mk_no_unboxed_types f = "-no-unboxed-types", Arg.Unit f, " unannotated unboxable types will not be unboxed (default)" -<<<<<<< HEAD -;; -||||||| merged common ancestors -;; - -let mk_force_tmc f = - "-force-tmc", Arg.Unit f, " Rewrite all possible TMC calls" ;; -======= ->>>>>>> ocaml/5.1 - let mk_unsafe f = "-unsafe", Arg.Unit f, " Do not compile bounds checking on array and string access" @@ -651,10 +630,7 @@ let mk_use_prims f = let mk_dump_into_file f = "-dump-into-file", Arg.Unit f, " dump output like -dlambda into .dump" - -let mk_dump_dir f = - "-dump-dir", Arg.String f, - " dump output like -dlambda into /.dump" +;; let mk_extension f = let available_extensions = @@ -707,9 +683,7 @@ let mk_dparsetree f = let mk_dtypedtree f = "-dtypedtree", Arg.Unit f, " (undocumented)" - -let mk_dshape f = - "-dshape", Arg.Unit f, " (undocumented)" +;; let mk_dshape f = "-dshape", Arg.Unit f, " (undocumented)" @@ -743,54 +717,22 @@ let mk_dclambda f = "-dclambda", Arg.Unit f, " (undocumented)" let mk_dflambda f = -<<<<<<< HEAD "-dflambda", Arg.Unit f, " Print Flambda (1 or 2) terms on exit from Flambda" ;; -||||||| merged common ancestors - "-dflambda", Arg.Unit f, " Print Flambda terms" -;; -======= - "-dflambda", Arg.Unit f, " Print Flambda terms" ->>>>>>> ocaml/5.1 let mk_drawflambda f = -<<<<<<< HEAD "-drawflambda", Arg.Unit f, " Print Flambda terms after closure conversion\n\ \ (for Flambda 2, after [Lambda_to_flambda])" ;; -||||||| merged common ancestors - "-drawflambda", Arg.Unit f, " Print Flambda terms after closure conversion" -;; -======= - "-drawflambda", Arg.Unit f, " Print Flambda terms after closure conversion" ->>>>>>> ocaml/5.1 let mk_dflambda_invariants f = -<<<<<<< HEAD "-dflambda-invariants", Arg.Unit f, " Check Flambda (1 and 2) invariants" ;; -||||||| merged common ancestors - "-dflambda-invariants", Arg.Unit f, " Check Flambda invariants \ - around each pass" -;; -======= - "-dflambda-invariants", Arg.Unit f, " Check Flambda invariants \ - around each pass" ->>>>>>> ocaml/5.1 let mk_dflambda_no_invariants f = -<<<<<<< HEAD "-dflambda-no-invariants", Arg.Unit f, " Do not check Flambda (1 and 2) \ invariants" ;; -||||||| merged common ancestors - "-dflambda-no-invariants", Arg.Unit f, " Do not Check Flambda invariants \ - around each pass" -;; -======= - "-dflambda-no-invariants", Arg.Unit f, " Do not Check Flambda invariants \ - around each pass" ->>>>>>> ocaml/5.1 let mk_dflambda_let f = "-dflambda-let", Arg.Int f, " Print when the given Flambda 1 [Let] \ @@ -858,6 +800,10 @@ let mk_debug_ocaml f = "-debug-ocaml", Arg.Unit f, " Debugging output for the compiler\n\ (internal use only)" +let mk_debug_ocaml f = + "-debug-ocaml", Arg.Unit f, " Debugging output for the compiler\n\ + (internal use only)" + let mk_opaque f = "-opaque", Arg.Unit f, " Does not generate cross-module optimization information\n\ @@ -933,14 +879,9 @@ module type Common_options = sig val _no_strict_formats : unit -> unit val _unboxed_types : unit -> unit val _no_unboxed_types : unit -> unit -<<<<<<< HEAD val _unsafe_string : unit -> unit val _verbose_types : unit -> unit val _no_verbose_types : unit -> unit -||||||| merged common ancestors - val _unsafe_string : unit -> unit -======= ->>>>>>> ocaml/5.1 val _version : unit -> unit val _vnum : unit -> unit val _w : string -> unit @@ -1286,11 +1227,7 @@ struct mk_dprofile F._dprofile; mk_dump_into_file F._dump_into_file; mk_dump_dir F._dump_dir; -<<<<<<< HEAD mk_debug_ocaml F._debug_ocaml; -||||||| merged common ancestors -======= ->>>>>>> ocaml/5.1 mk_args F._args; mk_args0 F._args0; @@ -1339,15 +1276,9 @@ struct mk_unboxed_types F._unboxed_types; mk_no_unboxed_types F._no_unboxed_types; mk_unsafe F._unsafe; -<<<<<<< HEAD mk_unsafe_string F._unsafe_string; mk_verbose_types F._verbose_types; mk_no_verbose_types F._no_verbose_types; -||||||| merged common ancestors - mk_unsafe_string F._unsafe_string; -======= - mk_unsafe_string; ->>>>>>> ocaml/5.1 mk_version F._version; mk__version F._version; mk_no_version F._no_version; @@ -1805,13 +1736,8 @@ module Default = struct let _strict_formats = set strict_formats let _strict_sequence = set strict_sequence let _unboxed_types = set unboxed_types -<<<<<<< HEAD let _unsafe_string = set unsafe_string let _verbose_types = set verbose_types -||||||| merged common ancestors - let _unsafe_string = set unsafe_string -======= ->>>>>>> ocaml/5.1 let _w s = Warnings.parse_options false s |> Option.iter Location.(prerr_alert none) let _debug_ocaml = set debug_ocaml @@ -1959,13 +1885,7 @@ module Default = struct let _dtimings_precision n = timings_precision := n let _dump_into_file = set dump_into_file let _dump_dir s = dump_dir := Some s -<<<<<<< HEAD let _for_pack s = for_package := (Some (String.capitalize_ascii s)) -||||||| merged common ancestors - let _for_pack s = for_package := (Some s) -======= - let _for_pack s = for_package := (Some s) ->>>>>>> ocaml/5.1 let _g = set debug let _no_g = clear debug let _i = set print_types diff --git a/driver/main_args.mli b/driver/main_args.mli index 814e15431f..00bc732a71 100644 --- a/driver/main_args.mli +++ b/driver/main_args.mli @@ -48,14 +48,9 @@ module type Common_options = sig val _no_strict_formats : unit -> unit val _unboxed_types : unit -> unit val _no_unboxed_types : unit -> unit -<<<<<<< HEAD val _unsafe_string : unit -> unit val _verbose_types : unit -> unit val _no_verbose_types : unit -> unit -||||||| merged common ancestors - val _unsafe_string : unit -> unit -======= ->>>>>>> ocaml/5.1 val _version : unit -> unit val _vnum : unit -> unit val _w : string -> unit @@ -252,15 +247,9 @@ module type Optcomp_options = sig val _afl_inst_ratio : int -> unit val _function_sections : unit -> unit val _save_ir_after : string -> unit -<<<<<<< HEAD val _probes : unit -> unit val _no_probes : unit -> unit end;; -||||||| merged common ancestors -end;; -======= -end ->>>>>>> ocaml/5.1 module type Opttop_options = sig include Toplevel_options diff --git a/driver/maindriver.ml b/driver/maindriver.ml index 0db9320329..a3bd6de7fa 100644 --- a/driver/maindriver.ml +++ b/driver/maindriver.ml @@ -112,16 +112,13 @@ let main argv ppf = n | exception Continue | () -> -<<<<<<< HEAD - Compmisc.with_ppf_dump ~stdout:() ~file_prefix:"profile" - (fun ppf -> Profile.print ppf !Clflags.profile_columns ~timings_precision:!Clflags.timings_precision); -||||||| merged common ancestors - Profile.print Format.std_formatter !Clflags.profile_columns; -======= Compmisc.with_ppf_dump ~file_prefix:"profile" (fun ppf -> Profile.print ppf !Clflags.profile_columns); ->>>>>>> ocaml/5.1 0 | exception x -> - Location.report_exception ppf x; - 2 + Location.report_exception ppf x; + 2 + | () -> + Compmisc.with_ppf_dump ~stdout:() ~file_prefix:"profile" + (fun ppf -> Profile.print ppf !Clflags.profile_columns ~timings_precision:!Clflags.timings_precision); + 0 diff --git a/driver/optcompile.ml b/driver/optcompile.ml index 02323a1104..0b84868778 100644 --- a/driver/optcompile.ml +++ b/driver/optcompile.ml @@ -32,100 +32,11 @@ let interface ~source_file ~output_prefix = (** Native compilation backend for .ml files. *) -<<<<<<< HEAD let compile i ~backend ~middle_end ~transl_style Typedtree.{structure; coercion; _} = -||||||| merged common ancestors -let flambda i backend Typedtree.{structure; coercion; _} = - if !Clflags.classic_inlining then begin - Clflags.default_simplify_rounds := 1; - Clflags.use_inlining_arguments_set Clflags.classic_arguments; - Clflags.unbox_free_vars_of_closures := false; - Clflags.unbox_specialised_args := false - end; -======= -let flambda i backend Typedtree.{structure; coercion; _} = - if !Clflags.classic_inlining then begin - Clflags.default_simplify_rounds := 1; - Clflags.use_inlining_arguments_set Clflags.classic_arguments; - Clflags.unbox_free_vars_of_closures := false; - Clflags.unbox_specialised_args := false - end; - ->>>>>>> ocaml/5.1 (structure, coercion) |> Profile.(record transl) -<<<<<<< HEAD (Translmod.transl_implementation i.module_name ~style:transl_style) -||||||| merged common ancestors - (Translmod.transl_implementation_flambda i.module_name) - |> Profile.(record generate) - (fun {Lambda.module_ident; main_module_block_size; - required_globals; code } -> - ((module_ident, main_module_block_size), code) - |>> print_if i.ppf_dump Clflags.dump_rawlambda Printlambda.lambda - |>> Simplif.simplify_lambda - |>> print_if i.ppf_dump Clflags.dump_lambda Printlambda.lambda - |> (fun ((module_ident, main_module_block_size), code) -> - let program : Lambda.program = - { Lambda. - module_ident; - main_module_block_size; - required_globals; - code; - } - in - Asmgen.compile_implementation - ~backend - ~prefixname:i.output_prefix - ~middle_end:Flambda_middle_end.lambda_to_clambda - ~ppf_dump:i.ppf_dump - program); - Compilenv.save_unit_info (cmx i)) - -let clambda i backend Typedtree.{structure; coercion; _} = - Clflags.use_inlining_arguments_set Clflags.classic_arguments; - (structure, coercion) - |> Profile.(record transl) - (Translmod.transl_store_implementation i.module_name) -======= - (Translmod.transl_implementation_flambda i.module_name) - |> Profile.(record generate) - (fun {Lambda.module_ident; main_module_block_size; - required_globals; code } -> - let () = - let (module_ident, main_module_block_size), code = - ((module_ident, main_module_block_size), code) - |>> print_if i.ppf_dump Clflags.dump_rawlambda Printlambda.lambda - |>> Simplif.simplify_lambda - |>> print_if i.ppf_dump Clflags.dump_lambda Printlambda.lambda - in - - if Clflags.(should_stop_after Compiler_pass.Lambda) then () else ( - let program : Lambda.program = - { Lambda. - module_ident; - main_module_block_size; - required_globals; - code; - } - in - Asmgen.compile_implementation - ~backend - ~prefixname:i.output_prefix - ~middle_end:Flambda_middle_end.lambda_to_clambda - ~ppf_dump:i.ppf_dump - program) - in - Compilenv.save_unit_info (cmx i)) - - -let clambda i backend Typedtree.{structure; coercion; _} = - Clflags.use_inlining_arguments_set Clflags.classic_arguments; - (structure, coercion) - |> Profile.(record transl) - (Translmod.transl_store_implementation i.module_name) ->>>>>>> ocaml/5.1 |> print_if i.ppf_dump Clflags.dump_rawlambda Printlambda.program |> Profile.(record generate) (fun program -> @@ -137,21 +48,9 @@ let clambda i backend Typedtree.{structure; coercion; _} = Asmgen.compile_implementation ~backend ~prefixname:i.output_prefix -<<<<<<< HEAD ~middle_end ~ppf_dump:i.ppf_dump; Compilenv.save_unit_info (cmx i)) -||||||| merged common ancestors - ~middle_end:Closure_middle_end.lambda_to_clambda - ~ppf_dump:i.ppf_dump; - Compilenv.save_unit_info (cmx i)) -======= - ~middle_end:Closure_middle_end.lambda_to_clambda - ~ppf_dump:i.ppf_dump - lambda; - Compilenv.save_unit_info (cmx i))) - ->>>>>>> ocaml/5.1 let flambda i backend typed = compile i typed ~backend ~transl_style:Plain_block diff --git a/driver/optmaindriver.ml b/driver/optmaindriver.ml index 04522ce31b..9a0f8f4723 100644 --- a/driver/optmaindriver.ml +++ b/driver/optmaindriver.ml @@ -72,14 +72,8 @@ let main argv ppf = | None -> Compenv.fatal "Please specify at most one of -pack, -a, -shared, -c, \ -output-obj"; -<<<<<<< HEAD - | Some ((P.Parsing | P.Typing | P.Scheduling + | Some ((P.Parsing | P.Typing | P.Lambda | P.Scheduling | P.Simplify_cfg | P.Emit | P.Selection) as p) -> -||||||| merged common ancestors - | Some ((P.Parsing | P.Typing | P.Scheduling | P.Emit) as p) -> -======= - | Some ((P.Parsing | P.Typing | P.Lambda | P.Scheduling | P.Emit) as p) -> ->>>>>>> ocaml/5.1 assert (P.is_compilation_pass p); Printf.ksprintf Compenv.fatal "Options -i and -stop-after (%s) \ @@ -140,14 +134,7 @@ let main argv ppf = Location.report_exception ppf x; 2 | () -> -<<<<<<< HEAD Compmisc.with_ppf_dump ~stdout:() ~file_prefix:"profile" - (fun ppf -> Profile.print ppf !Clflags.profile_columns ~timings_precision:!Clflags.timings_precision); -||||||| merged common ancestors - Profile.print Format.std_formatter !Clflags.profile_columns; - 0 -======= - Compmisc.with_ppf_dump ~file_prefix:"profile" - (fun ppf -> Profile.print ppf !Clflags.profile_columns); ->>>>>>> ocaml/5.1 + (fun ppf -> Profile.print ppf !Clflags.profile_columns + ~timings_precision:!Clflags.timings_precision); 0