Skip to content

Commit 13728cb

Browse files
committed
continue shrinking cmj size
1 parent bdf3d62 commit 13728cb

File tree

10 files changed

+1179
-1136
lines changed

10 files changed

+1179
-1136
lines changed

jscomp/core/js_cmj_format.mli

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ type keyed_cmj_value = {
7070
persistent_closed_lambda : Lam.t option
7171
}
7272

73-
type t = private {
73+
type t = {
7474
values : keyed_cmj_value array ;
7575
pure : bool;
7676
package_spec : Js_packages_info.t ;

jscomp/core/js_cmj_load.ml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@ then
4242
if Js_config.get_diagnose () then
4343
Format.fprintf Format.err_formatter ">Cmj: %s@." unit_name;
4444
let cmj_table : Js_cmj_format.t =
45-
Marshal.from_string Builtin_cmj_datasets.module_data.(i) 0 in
45+
let values, pure = Marshal.from_string Builtin_cmj_datasets.module_data.(i) 0 in
46+
{values; pure; package_spec = Js_packages_info.runtime_package_specs;js_file_kind = Little_js}
47+
in
4648
if Js_config.get_diagnose () then
4749
Format.fprintf Format.err_formatter "<Cmj: %s@." unit_name;
4850
{package_path =

jscomp/core/js_packages_info.ml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,13 @@ type t =
7676
module_systems: package_info list
7777
}
7878

79+
let runtime_package_specs : t = {
80+
name = Pkg_runtime;
81+
module_systems =[
82+
{module_system = Es6; path = "lib/es6"};
83+
{module_system = NodeJS; path = "lib/js"};
84+
]
85+
}
7986
let same_package_by_name (x : t) (y : t) = x.name = y.name
8087

8188
let is_runtime_package (x : t) =

jscomp/core/js_packages_info.mli

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ type package_info = {
4545

4646
type t
4747

48+
val runtime_package_specs : t
4849
val is_runtime_package:
4950
t ->
5051
bool

jscomp/main/builtin_cmj_datasets.ml

Lines changed: 281 additions & 281 deletions
Large diffs are not rendered by default.

jscomp/main/cmij_main.ml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,13 @@ let from_cmj (files : string list) (output_file : string) : unit =
5757
let abs =
5858
Ext_list.map files (fun file ->
5959
let module_name = (cmp file) in
60+
let content : Js_cmj_format.t = Js_cmj_format.from_file file in
61+
assert (content.js_file_kind = Little_js);
62+
assert (content.package_spec = Js_packages_info.runtime_package_specs);
63+
(* prerr_endline (Ext_obj.dump content.package_spec); *)
6064
let c =
61-
(let content = Ext_io.load_file file in
62-
String.sub content Ext_cmj_magic.header_length (String.length content - Ext_cmj_magic.header_length)
63-
) in
65+
Marshal.to_string (content.values, content.pure) []
66+
in
6467
Printf.sprintf {|%S (* %d *)|} module_name
6568
(String.length c),
6669
Printf.sprintf {|(* %s *)%S|} module_name c

lib/4.06.1/unstable/js_compiler.ml

Lines changed: 293 additions & 283 deletions
Large diffs are not rendered by default.

lib/4.06.1/unstable/js_refmt_compiler.ml

Lines changed: 293 additions & 283 deletions
Large diffs are not rendered by default.

lib/4.06.1/whole_compiler.ml

Lines changed: 293 additions & 283 deletions
Large diffs are not rendered by default.

scripts/ninja.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1649,7 +1649,7 @@ build ./bin/bspack.exe: link stubs/stubs.cmxa ext/ext.cmxa ./common/common.cmxa
16491649
flags = -I ./bin -w -40-30
16501650
build ./bin/cmjdump.exe: link ./stubs/stubs.cmxa ext/ext.cmxa common/common.cmxa syntax/syntax.cmxa depends/depends.cmxa core/core.cmxa main/cmjdump_main.cmx
16511651
libs = ocamlcommon.cmxa
1652-
build ./bin/cmij.exe: link ./stubs/stubs.cmxa ext/ext.cmxa main/cmij_main.cmx
1652+
build ./bin/cmij.exe: link ./stubs/stubs.cmxa ext/ext.cmxa common/common.cmxa syntax/syntax.cmxa depends/depends.cmxa core/core.cmxa main/cmij_main.cmx
16531653
libs = ocamlcommon.cmxa
16541654
16551655
rule bspack

0 commit comments

Comments
 (0)