]> git.eshelyaron.com Git - emacs.git/commit
Rework eln deletion strategy for new eln-cache folder structure
authorAndrea Corallo <akrl@sdf.org>
Sun, 6 Sep 2020 16:17:00 +0000 (18:17 +0200)
committerAndrea Corallo <akrl@sdf.org>
Sun, 6 Sep 2020 16:17:00 +0000 (18:17 +0200)
commita71f54eff80cb7d7b36326849eea878073963594
tree4ec2ca769cd2fe752e8a64a8555dbde0d9aaaeee
parenteb8742598874d9bd4c84ff54730527c52d29d7ff
Rework eln deletion strategy for new eln-cache folder structure

When recompiling remove the corresponding stale elns found in the
`comp-eln-load-path'.

When removing a package remove the corresponding elns too.

On Windows both of these are performed only when possible, when it's
not the file is renamed as .eln.old and a last attempt to remove this
is performed closing the Emacs session.  When a file being deleted was
loaded by multiple Emacs sessions the last one being closed should
delete it.

* lisp/emacs-lisp/comp.el (comp-clean-up-stale-eln): New function.
(comp-delete-or-replace-file): Rename from
`comp--replace-output-file' and update so it can be used for
replacing or deleting shared libs safetly.

* lisp/emacs-lisp/package.el (package--delete-directory): When
native compiled just call `comp-clean-up-stale-eln' for each
eln file we want to clean-up.

* src/alloc.c (cleanup_vector): Call directly the dynlib_close.

* src/comp.c (syms_of_comp): Update for comp_u->cfile removal.
Make 'all_loaded_comp_units_h' key-value weak as now the key will
be the filename.
(load_comp_unit): Register the compilation unit only when the load
is fully completed.
(register_native_comp_unit): Make the key of
all_loaded_comp_units_h the load filename.
(eln_load_path_final_clean_up): New function.
(dispose_comp_unit)
(finish_delayed_disposal_of_comp_units)
(dispose_all_remaining_comp_units)
(clean_package_user_dir_of_old_comp_units): Remove.
(Fcomp__compile_ctxt_to_file): Update for
`comp--replace-output-file' -> `comp-delete-or-replace-file'
rename.

* src/comp.h (dispose_comp_unit)
(finish_delayed_disposal_of_comp_units)
(dispose_all_remaining_comp_units)
(clean_package_user_dir_of_old_comp_units): Remove.
(eln_load_path_final_clean_up): Add.
(struct Lisp_Native_Comp_Unit): Remove cfile field.

* src/emacs.c (Fkill_emacs): Call 'eln_load_path_final_clean_up'.

* src/pdumper.c (dump_do_dump_relocation): Do not set comp_u->cfile.
lisp/emacs-lisp/comp.el
lisp/emacs-lisp/package.el
src/alloc.c
src/comp.c
src/comp.h
src/emacs.c
src/pdumper.c