Skip to content

Remove cmij cache #6192

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 4 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,9 @@ jobs:
- name: Check for changes in lib folder
run: git diff --exit-code lib/js lib/es6

- name: Populate lib/ocaml
run: ./scripts/prebuilt.js

- name: Run tests
if: runner.os != 'Windows'
run: node scripts/ciTest.js -all
Expand All @@ -207,9 +210,7 @@ jobs:
run: node scripts/ciTest.js -mocha -theme -format

- name: Prepare artifact upload
run: |
./scripts/prebuilt.js
node .github/workflows/get_artifact_info.js
run: node .github/workflows/get_artifact_info.js

- name: "Upload artifacts: binaries"
uses: actions/upload-artifact@v3
Expand All @@ -224,15 +225,6 @@ jobs:
name: lib-ocaml
path: lib/ocaml

- name: "Upload artifacts: cmi cache"
if: runner.os == 'Linux'
uses: actions/upload-artifact@v3
with:
name: cmij-cache
path: |
lib/cmi_cache.bin
lib/cmj_cache.bin

package:
needs: build
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ reanalyze:
lib: build node_modules/.bin/semver
node scripts/ninja.js config
node scripts/ninja.js build
./scripts/prebuilt.js

artifacts: lib
./scripts/prebuilt.js
./scripts/makeArtifactList.js

format:
Expand Down
8 changes: 0 additions & 8 deletions jscomp/cmij/cmij_cache.ml

This file was deleted.

8 changes: 0 additions & 8 deletions jscomp/cmij/cmij_cache.mli

This file was deleted.

138 changes: 0 additions & 138 deletions jscomp/cmij/cmij_main.ml

This file was deleted.

6 changes: 0 additions & 6 deletions jscomp/cmij/cmij_main.mli

This file was deleted.

4 changes: 2 additions & 2 deletions jscomp/cmij/dune
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
(:standard -ccopt -static))))

(executables
(names cmij_main cmjdump_main)
(public_names cmij cmjdump)
(names cmjdump_main)
(public_names cmjdump)
(flags
(:standard -w +a-4-9-40-42-69))
(libraries core))
39 changes: 1 addition & 38 deletions jscomp/core/bs_cmi_load.ml
Original file line number Diff line number Diff line change
Expand Up @@ -22,44 +22,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *)

#ifdef RELEASE
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

(*true *)

let cmi_cache_path =
let ( // ) = Filename.concat in
Filename.dirname Sys.executable_name
// Filename.parent_dir_name // "lib" // "cmi_cache.bin"

let load_cmi_cache () =
let channel = open_in_bin cmi_cache_path in
let cache: Cmij_cache.t = Marshal.from_channel channel in
close_in channel;
cache

let cmi_cache = lazy (load_cmi_cache ())

let load_cmi ~unit_name : Env.Persistent_signature.t option =
match Config_util.find_opt (unit_name ^".cmi") with
| Some filename -> Some {filename; cmi = Cmi_format.read_cmi filename}
| None ->
if !Js_config.no_stdlib then None
else
let {Cmij_cache.module_names; module_data} = Lazy.force cmi_cache in
match Ext_string_array.find_sorted module_names unit_name with
| Some index ->
if !Js_config.diagnose then
Format.fprintf Format.err_formatter ">Cmi: %s@." unit_name;
let cmi = Cmij_cache.unmarshal_cmi_data module_data.(index) in
if !Js_config.diagnose then
Format.fprintf Format.err_formatter "<Cmi: %s@." unit_name;
Some {filename = Sys.executable_name ;
cmi }
| None -> None

#else

let load_cmi ~unit_name : Env.Persistent_signature.t option =
match Config_util.find_opt (unit_name ^".cmi") with
| Some filename -> Some {filename; cmi = Cmi_format.read_cmi filename}
| None -> None
#endif
| None -> None
4 changes: 0 additions & 4 deletions jscomp/core/dune
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,3 @@
(flags
(:standard -w +a-4-9-27-30-40-41-42-48-70))
(libraries depends frontend gentype js_parser outcome_printer))

; There exist cyclic dependencies between core and frontend, therefore include frontend files here:

(copy_files# ../cmij/cmij_cache.{ml,mli})
10 changes: 1 addition & 9 deletions jscomp/core/js_cmj_load.ml
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,7 @@ let load_unit_with_file unit_name : Js_cmj_format.cmj_load_info =
(* hacking relying on the convention of pkg/lib/ocaml/xx.cmj*)
Filename.dirname (Filename.dirname (Filename.dirname f));
cmj_table = Js_cmj_format.from_file f}
| None ->
if !Js_config.no_stdlib then Bs_exception.error (Cmj_not_found unit_name)
else
#ifdef RELEASE
Js_cmj_load_builtin_unit.load_builin_unit unit_name
#else
Bs_exception.error (Cmj_not_found unit_name)
#endif

| None -> Bs_exception.error (Cmj_not_found unit_name)

(* we can disable loading from file for troubleshooting
Note in dev mode we still allow loading from file is to
Expand Down
62 changes: 0 additions & 62 deletions jscomp/core/js_cmj_load_builtin_unit.ml

This file was deleted.

2 changes: 1 addition & 1 deletion jscomp/core/res_compmisc.ml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ let init_path () =
let exp_dirs =
List.map (Misc.expand_directory Config.standard_library) dirs
in
Config.load_path := List.rev_append exp_dirs [];
Config.load_path := List.rev_append exp_dirs [Config.standard_library];
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting. Presumably this must have been there a long time ago.
To double check: this should have no effect on pervasives I imagine. Just in case the fact that we build 2 versions of pervasives for uncurried and legacy mode is relevant.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without this, the CMI files (that were formerly loaded from the cache) are not found.

Env.reset_cache ()

(* Return the initial environment in which compilation proceeds. *)
Expand Down
2 changes: 0 additions & 2 deletions lib/.gitignore

This file was deleted.

Loading