Skip to content

Commit 4bd7544

Browse files
committed
Undo Import_info.t split
To be redone as separate PR
1 parent dfd683c commit 4bd7544

30 files changed

+159
-107
lines changed

backend/asmlibrarian.ml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,11 @@ let create_archive file_list lib_name =
7474
let cmxs = Array.of_list cmxs in
7575
let cmi_index = Compilation_unit.Name.Tbl.create 42 in
7676
Array.iteri (fun i import ->
77-
Compilation_unit.Name.Tbl.add cmi_index
78-
(Import_info.Intf.name import) i)
77+
Compilation_unit.Name.Tbl.add cmi_index (Import_info.name import) i)
7978
cmis;
8079
let cmx_index = Compilation_unit.Tbl.create 42 in
8180
Array.iteri (fun i import ->
82-
Compilation_unit.Tbl.add cmx_index (Import_info.Impl.cu import) i)
81+
Compilation_unit.Tbl.add cmx_index (Import_info.cu import) i)
8382
cmxs;
8483
let genfns = Cmm_helpers.Generic_fns_tbl.make () in
8584
let mk_bitmap arr ix entries ~find ~get_name =
@@ -98,11 +97,11 @@ let create_archive file_list lib_name =
9897
li_imports_cmi =
9998
mk_bitmap cmis cmi_index unit.ui_imports_cmi
10099
~find:Compilation_unit.Name.Tbl.find
101-
~get_name:Import_info.Intf.name;
100+
~get_name:Import_info.name;
102101
li_imports_cmx =
103102
mk_bitmap cmxs cmx_index unit.ui_imports_cmx
104103
~find:Compilation_unit.Tbl.find
105-
~get_name:Import_info.Impl.cu })
104+
~get_name:Import_info.cu })
106105
descr_list
107106
in
108107
let infos =

backend/asmlink.ml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ let check_cmi_consistency file_name cmis =
6464
try
6565
Array.iter
6666
(fun import ->
67-
let name = Import_info.Intf.name import in
68-
let crco = Import_info.Intf.crc import in
67+
let name = Import_info.name import in
68+
let crco = Import_info.crc import in
6969
CU.Name.Tbl.replace interfaces name ();
7070
match crco with
7171
None -> ()
@@ -84,8 +84,8 @@ let check_cmx_consistency file_name cmxs =
8484
try
8585
Array.iter
8686
(fun import ->
87-
let name = Import_info.Impl.cu import in
88-
let crco = Import_info.Impl.crc import in
87+
let name = Import_info.cu import in
88+
let crco = Import_info.crc import in
8989
implementations := name :: !implementations;
9090
match crco with
9191
None ->
@@ -131,7 +131,7 @@ let extract_crc_implementations () =
131131
Cmx_consistbl.extract !implementations crc_implementations
132132
|> List.map (fun (cu, crc) ->
133133
let crc = Option.map (fun ((), crc) -> crc) crc in
134-
Import_info.Impl.create cu ~crc)
134+
Import_info.create_normal cu ~crc)
135135

136136
(* Add C objects and options and "custom" info from a library descriptor.
137137
See bytecomp/bytelink.ml for comments on the order of C objects. *)
@@ -167,7 +167,7 @@ let is_required name =
167167
with Not_found -> false
168168

169169
let add_required by import =
170-
let name = Import_info.Impl.cu import in
170+
let name = Import_info.cu import in
171171
try
172172
let rq = Hashtbl.find missing_globals name in
173173
rq := by :: !rq

backend/asmlink.mli

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ val cached_generic_functions : (module Compiler_owee.Unix_intf.S) -> ppf_dump:fo
3030

3131
val reset : unit -> unit
3232
val check_consistency: filepath -> Cmx_format.unit_infos -> Digest.t -> unit
33-
val extract_crc_interfaces: unit -> Import_info.Intf.t list
34-
val extract_crc_implementations: unit -> Import_info.Impl.t list
33+
val extract_crc_interfaces: unit -> Import_info.t list
34+
val extract_crc_implementations: unit -> Import_info.t list
3535

3636
type error =
3737
| File_not_found of filepath

backend/asmpackager.ml

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ let check_units members =
7272
| PM_impl infos ->
7373
List.iter
7474
(fun import ->
75-
let unit = Import_info.Impl.cu import in
75+
let unit = Import_info.cu import in
7676
let name = CU.name unit in
7777
if List.mem name forbidden
7878
then raise(Error(Forward_reference(mb.pm_file, name))))
@@ -188,14 +188,9 @@ let get_approx ui : Clambda.value_approximation =
188188
let build_package_cmx members cmxfile =
189189
let unit_names =
190190
List.map (fun m -> m.pm_name) members in
191-
let filter_cmi lst =
191+
let filter lst =
192192
List.filter (fun import ->
193-
not (List.mem (Import_info.Intf.name import) unit_names)) lst
194-
in
195-
let filter_cmx lst =
196-
List.filter (fun import ->
197-
let name = Compilation_unit.name (Import_info.Impl.cu import) in
198-
not (List.mem name unit_names)) lst in
193+
not (List.mem (Import_info.name import) unit_names)) lst in
199194
let union lst =
200195
List.fold_left
201196
(List.fold_left
@@ -239,11 +234,11 @@ let build_package_cmx members cmxfile =
239234
[ui.ui_unit];
240235
ui_implements_param = None;
241236
ui_imports_cmi =
242-
(Import_info.Intf.create modname (Some ui.ui_unit)
243-
~crc:(Some (Env.crc_of_unit modname))) ::
244-
filter_cmi (Asmlink.extract_crc_interfaces ());
237+
(Import_info.create modname
238+
~crc_with_unit:(Some (ui.ui_unit, Env.crc_of_unit modname))) ::
239+
filter (Asmlink.extract_crc_interfaces ());
245240
ui_imports_cmx =
246-
filter_cmx (Asmlink.extract_crc_implementations());
241+
filter (Asmlink.extract_crc_implementations());
247242
ui_runtime_params = []; (* open modules not supported with packs *)
248243
ui_generic_fns =
249244
{ curry_fun =

file_formats/cmx_format.mli

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,9 @@ type unit_infos =
6262
mutable ui_implements_param: Global.Name.t option;
6363
(* If this is an argument unit, the
6464
parameter it implements *)
65-
mutable ui_imports_cmi: Import_info.Intf.t list;
65+
mutable ui_imports_cmi: Import_info.t list;
6666
(* Interfaces imported *)
67-
mutable ui_imports_cmx: Import_info.Impl.t list;
67+
mutable ui_imports_cmx: Import_info.t list;
6868
(* Infos imported *)
6969
mutable ui_runtime_params: Global.Name.t list;
7070
(* Implementation imports which are
@@ -81,8 +81,8 @@ type unit_infos_raw =
8181
{ uir_unit: Compilation_unit.t;
8282
uir_defines: Compilation_unit.t list;
8383
uir_implements_param: Global.Name.t option;
84-
uir_imports_cmi: Import_info.Intf.t array;
85-
uir_imports_cmx: Import_info.Impl.t array;
84+
uir_imports_cmi: Import_info.t array;
85+
uir_imports_cmx: Import_info.t array;
8686
uir_runtime_params: Global.Name.t array;
8787
uir_generic_fns: generic_fns;
8888
uir_export_info: export_info_raw;

middle_end/compilenv.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ let get_unit_info comp_unit =
220220
(None, None)
221221
end
222222
in
223-
let import = Import_info.Impl.create comp_unit ~crc in
223+
let import = Import_info.create_normal comp_unit ~crc in
224224
current_unit.ui_imports_cmx <- import :: current_unit.ui_imports_cmx;
225225
Infos_table.add global_infos_table name infos;
226226
infos

ocaml/boot/ocamlc

790 Bytes
Binary file not shown.

ocaml/bytecomp/bytelink.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,8 @@ let check_consistency file_name cu =
187187
begin try
188188
Array.iter
189189
(fun import ->
190-
let name = Import_info.Intf.name import in
191-
let crco = Import_info.Intf.crc import in
190+
let name = Import_info.name import in
191+
let crco = Import_info.crc import in
192192
let cuo = Import_info.Intf.impl import in
193193
interfaces := name :: !interfaces;
194194
match crco with

ocaml/bytecomp/bytelink.mli

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ val reset : unit -> unit
2222

2323
val check_consistency: filepath -> Cmo_format.compilation_unit_descr -> unit
2424

25-
val extract_crc_interfaces: unit -> Import_info.Intf.t list
25+
val extract_crc_interfaces: unit -> Import_info.t list
2626

2727
type error =
2828
| File_not_found of filepath

ocaml/bytecomp/bytepackager.ml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ let package_object_files ~ppf_dump files targetfile targetname coercion =
224224
let pos_final = pos_out oc in
225225
let imports =
226226
List.filter
227-
(fun import -> not (List.mem (Import_info.Intf.name import) unit_names))
227+
(fun import -> not (List.mem (Import_info.name import) unit_names))
228228
(Bytelink.extract_crc_interfaces()) in
229229
let for_pack_prefix = CU.Prefix.from_clflags () in
230230
let modname = targetname |> CU.Name.of_string in
@@ -236,8 +236,8 @@ let package_object_files ~ppf_dump files targetfile targetname coercion =
236236
cu_reloc = List.rev !relocs;
237237
cu_imports =
238238
Array.of_list
239-
((Import_info.Intf.create modname (Some cu_name)
240-
~crc:(Some (Env.crc_of_unit modname)))
239+
((Import_info.create modname
240+
~crc_with_unit:(Some (cu_name, Env.crc_of_unit modname)))
241241
:: imports);
242242
cu_runtime_params = [||]; (* Open modules not supported with packs *)
243243
cu_primitives = !primitives;

ocaml/bytecomp/symtable.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ let init_toplevel () =
316316
(* Recover CRC infos for interfaces *)
317317
let crcintfs =
318318
try
319-
(Obj.magic (sect.read_struct "CRCS") : Import_info.Intf.t array)
319+
(Obj.magic (sect.read_struct "CRCS") : Import_info.t array)
320320
with Not_found -> [| |] in
321321
(* Done *)
322322
sect.close_reader();

ocaml/bytecomp/symtable.mli

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ val transl_const: Lambda.structured_constant -> Obj.t
3232

3333
(* Functions for the toplevel *)
3434

35-
val init_toplevel: unit -> Import_info.Intf.t array
35+
val init_toplevel: unit -> Import_info.t array
3636
val update_global_table: unit -> unit
3737
val get_global_value: Ident.t -> Obj.t
3838
val is_global_defined: Ident.t -> bool

ocaml/file_formats/cmi_format.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ module Serialized = Types.Make_wrapped(struct type 'a t = int end)
5959
(* these type abbreviations are not exported;
6060
they are used to provide consistency across
6161
input_value and output_value usage. *)
62-
type crcs = Import_info.Intf.t array (* smaller on disk than using a list *)
62+
type crcs = Import_info.t array (* smaller on disk than using a list *)
6363
type flags = pers_flags list
6464
type header = {
6565
header_name : Compilation_unit.Name.t;

ocaml/file_formats/cmo_format.mli

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ type compilation_unit_descr =
3030
mutable cu_pos: int; (* Absolute position in file *)
3131
cu_codesize: int; (* Size of code block *)
3232
cu_reloc: (reloc_info * int) list; (* Relocation information *)
33-
cu_imports: Import_info.Intf.t array; (* Names and CRC of intfs imported *)
33+
cu_imports: Import_info.t array; (* Names and CRC of intfs imported *)
3434
cu_runtime_params : Global.Name.t array;
3535
(* Parameters and imports which must be
3636
passed as parameters to the module

ocaml/file_formats/cmt_format.ml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ type cmt_infos = {
5757
cmt_loadpath : string list;
5858
cmt_source_digest : Digest.t option;
5959
cmt_initial_env : Env.t;
60-
cmt_imports : Import_info.Intf.t array;
60+
cmt_imports : Import_info.t array;
6161
cmt_interface_digest : Digest.t option;
6262
cmt_use_summaries : bool;
6363
cmt_uid_to_loc : Location.t Shape.Uid.Tbl.t;
@@ -176,8 +176,8 @@ let save_cmt filename modname binary_annots sourcefile initial_env cmi shape =
176176
in
177177
let source_digest = Option.map Digest.file sourcefile in
178178
let compare_imports import1 import2 =
179-
let modname1 = Import_info.Intf.name import1 in
180-
let modname2 = Import_info.Intf.name import2 in
179+
let modname1 = Import_info.name import1 in
180+
let modname2 = Import_info.name import2 in
181181
Compilation_unit.Name.compare modname1 modname2
182182
in
183183
let get_imports () =

ocaml/file_formats/cmt_format.mli

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ type cmt_infos = {
6060
cmt_loadpath : string list;
6161
cmt_source_digest : string option;
6262
cmt_initial_env : Env.t;
63-
cmt_imports : Import_info.Intf.t array;
63+
cmt_imports : Import_info.t array;
6464
cmt_interface_digest : Digest.t option;
6565
cmt_use_summaries : bool;
6666
cmt_uid_to_loc : Location.t Shape.Uid.Tbl.t;

ocaml/file_formats/cmx_format.mli

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ type unit_infos =
4848
mutable ui_implements_param: Global.Name.t option;
4949
(* If this is an argument unit, the
5050
parameter it implements *)
51-
mutable ui_imports_cmi: Import_info.Intf.t array;
51+
mutable ui_imports_cmi: Import_info.t array;
5252
(* Interfaces imported *)
53-
mutable ui_imports_cmx: Import_info.Impl.t array;
53+
mutable ui_imports_cmx: Import_info.t array;
5454
(* Infos imported *)
5555
mutable ui_runtime_params: Global.Name.t list;
5656
(* Implementation imports which are

ocaml/file_formats/cmxs_format.mli

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
type dynunit = {
2323
dynu_name: Compilation_unit.t;
2424
dynu_crc: Digest.t;
25-
dynu_imports_cmi: Import_info.Intf.t array;
26-
dynu_imports_cmx: Import_info.Impl.t array;
25+
dynu_imports_cmi: Import_info.t array;
26+
dynu_imports_cmx: Import_info.t array;
2727
dynu_defines: Compilation_unit.t list;
2828
}
2929

ocaml/middle_end/compilenv.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ let get_unit_info comp_unit =
181181
(None, None)
182182
end
183183
in
184-
let import = Import_info.Impl.create comp_unit ~crc in
184+
let import = Import_info.create_normal comp_unit ~crc in
185185
current_unit.ui_imports_cmx <-
186186
Array.append [| import |] current_unit.ui_imports_cmx;
187187
Infos_table.add global_infos_table name infos;

ocaml/otherlibs/dynlink/dynlink.ml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ module DC = Dynlink_common
2424
module DT = Dynlink_types
2525

2626
let convert_cmi_import import =
27-
let name = Import_info.Intf.name import |> Compilation_unit.Name.to_string in
28-
let crc = Import_info.Intf.crc import in
27+
let name = Import_info.name import |> Compilation_unit.Name.to_string in
28+
let crc = Import_info.crc import in
2929
name, crc
3030

3131
module Bytecode = struct
@@ -91,8 +91,8 @@ module Bytecode = struct
9191

9292
let fold_initial_units ~init ~f =
9393
Array.fold_left (fun acc import ->
94-
let modname = Import_info.Intf.name import in
95-
let crc = Import_info.Intf.crc import in
94+
let modname = Import_info.name import in
95+
let crc = Import_info.crc import in
9696
let id =
9797
Compilation_unit.to_global_ident_for_bytecode
9898
(assume_no_prefix modname)
@@ -237,8 +237,8 @@ module Native = struct
237237
let crc (t : t) = Some t.dynu_crc
238238

239239
let convert_cmx_import import =
240-
let cu = Import_info.Impl.cu import |> Compilation_unit.name_as_string in
241-
let crc = Import_info.Impl.crc import in
240+
let cu = Import_info.cu import |> Compilation_unit.name_as_string in
241+
let crc = Import_info.crc import in
242242
cu, crc
243243

244244
let interface_imports (t : t) =

ocaml/otherlibs/dynlink/extract_crc.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ let digest_interface unit loadpath =
4545
let crc =
4646
match cmi.Cmi_format.cmi_crcs |> Array.to_list with
4747
import :: _ ->
48-
(match Import_info.Intf.crc import with
48+
(match Import_info.crc import with
4949
| Some crc -> crc
5050
| None -> raise Corrupted_interface)
5151
| _ -> raise Corrupted_interface

ocaml/tools/objinfo.ml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,13 @@ let print_name_crc name crco =
6161
(* CR-someday mshinwell: consider moving to [Import_info.print] *)
6262

6363
let print_intf_import import =
64-
let name = Import_info.Intf.name import in
65-
let crco = Import_info.Intf.crc import in
64+
let name = Import_info.name import in
65+
let crco = Import_info.crc import in
6666
print_name_crc name crco
6767

6868
let print_impl_import import =
69-
let unit = Import_info.Impl.cu import in
70-
let crco = Import_info.Impl.crc import in
69+
let unit = Import_info.cu import in
70+
let crco = Import_info.crc import in
7171
print_name_crc (Compilation_unit.name unit) crco
7272

7373
let print_line name =
@@ -292,7 +292,7 @@ let dump_byte ic =
292292
p_list
293293
"Imported units"
294294
print_intf_import
295-
((input_value ic : Import_info.Intf.t array) |> Array.to_list)
295+
((input_value ic : Import_info.t array) |> Array.to_list)
296296
| "DLLS" ->
297297
p_list
298298
"Used DLLs"

ocaml/tools/ocamlcmt.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ let print_info cmt =
8888
let imports =
8989
let imports =
9090
Array.map (fun import ->
91-
Import_info.Intf.name import, Import_info.Intf.crc import)
91+
Import_info.name import, Import_info.crc import)
9292
cmt.cmt_imports
9393
in
9494
Array.sort compare_imports imports;

ocaml/toplevel/expunge.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ let expunge_crcs tbl =
3939
Array.to_list tbl
4040
|> List.filter
4141
(fun import ->
42-
keep (Import_info.Intf.name import |> Compilation_unit.Name.to_string))
42+
keep (Import_info.name import |> Compilation_unit.Name.to_string))
4343
|> Array.of_list
4444

4545
let main () =
@@ -67,7 +67,7 @@ let main () =
6767
let global_map = (input_value ic : Symtable.global_map) in
6868
output_value oc (expunge_map global_map)
6969
| "CRCS" ->
70-
let crcs = (input_value ic : Import_info.Intf.t array) in
70+
let crcs = (input_value ic : Import_info.t array) in
7171
output_value oc (expunge_crcs crcs)
7272
| _ ->
7373
copy_file_chunk ic oc len

ocaml/typing/env.mli

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -449,10 +449,10 @@ val register_parameter_import: Compilation_unit.Name.t -> unit
449449
val crc_of_unit: Compilation_unit.Name.t -> Digest.t
450450

451451
(* Return the set of compilation units imported, with their CRC *)
452-
val imports: unit -> Import_info.Intf.t list
452+
val imports: unit -> Import_info.t list
453453

454454
(* may raise Persistent_env.Consistbl.Inconsistency *)
455-
val import_crcs: source:string -> Import_info.Intf.t array -> unit
455+
val import_crcs: source:string -> Import_info.t array -> unit
456456

457457
(* Return the set of imports represented as parameters, along with the
458458
local variable representing each *)

0 commit comments

Comments
 (0)