summaryrefslogtreecommitdiff
path: root/bytecomp
diff options
context:
space:
mode:
authorXavier Leroy <xavier.leroy@college-de-france.fr>2023-02-11 14:35:36 +0100
committerXavier Leroy <xavier.leroy@college-de-france.fr>2023-02-26 15:58:40 +0100
commit3f59e2e66fa40fe6a49ce65fc520aef6ea44ea7b (patch)
treef3d8d86ba7a70014949966b3de73f988603f0fec /bytecomp
parentd1d0d85c67cfa2478476a31d43c3f962f38e13b9 (diff)
downloadocaml-3f59e2e66fa40fe6a49ce65fc520aef6ea44ea7b.tar.gz
Use compressed marshaling to write .cmt, .cmti, .cmi, .cmo, .cma files
For .cmi, .cmt and .cmti files, the resulting files are 35-40% the size of the uncompressed files. For .cmo and .cma files, we compress only the debug info; this gives 50% space savings for files with full debug info.
Diffstat (limited to 'bytecomp')
-rw-r--r--bytecomp/bytepackager.ml5
-rw-r--r--bytecomp/emitcode.ml5
2 files changed, 6 insertions, 4 deletions
diff --git a/bytecomp/bytepackager.ml b/bytecomp/bytepackager.ml
index 449d423252..4ff00f2967 100644
--- a/bytecomp/bytepackager.ml
+++ b/bytecomp/bytepackager.ml
@@ -272,8 +272,9 @@ let package_object_files ~ppf_dump files targetfile targetname coercion =
build_global_target ~ppf_dump oc targetname state components coercion in
let pos_debug = pos_out oc in
if !Clflags.debug && state.events <> [] then begin
- output_value oc (List.rev state.events);
- output_value oc (String.Set.elements state.debug_dirs);
+ Marshal.(to_channel oc (List.rev state.events) [Compression]);
+ Marshal.(to_channel oc (String.Set.elements state.debug_dirs)
+ [Compression]);
end;
let force_link =
List.exists (function
diff --git a/bytecomp/emitcode.ml b/bytecomp/emitcode.ml
index 9e70bebd9c..bd3c3f2fb5 100644
--- a/bytecomp/emitcode.ml
+++ b/bytecomp/emitcode.ml
@@ -416,8 +416,9 @@ let to_file outchan unit_name objfile ~required_globals code =
(Filename.dirname (Location.absolute_path objfile))
!debug_dirs;
let p = pos_out outchan in
- output_value outchan !events;
- output_value outchan (String.Set.elements !debug_dirs);
+ Marshal.(to_channel outchan !events [Compression]);
+ Marshal.(to_channel outchan (String.Set.elements !debug_dirs)
+ [Compression]);
(p, pos_out outchan - p)
end else
(0, 0) in