diff options
| author | Andrea Corallo | 2020-09-06 18:17:00 +0200 |
|---|---|---|
| committer | Andrea Corallo | 2020-09-06 18:17:00 +0200 |
| commit | a71f54eff80cb7d7b36326849eea878073963594 (patch) | |
| tree | 4ec2ca769cd2fe752e8a64a8555dbde0d9aaaeee /src/alloc.c | |
| parent | eb8742598874d9bd4c84ff54730527c52d29d7ff (diff) | |
| download | emacs-a71f54eff80cb7d7b36326849eea878073963594.tar.gz emacs-a71f54eff80cb7d7b36326849eea878073963594.zip | |
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.
Diffstat (limited to 'src/alloc.c')
| -rw-r--r-- | src/alloc.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/alloc.c b/src/alloc.c index 6701bf002b7..bde0a16ac15 100644 --- a/src/alloc.c +++ b/src/alloc.c | |||
| @@ -3153,7 +3153,8 @@ cleanup_vector (struct Lisp_Vector *vector) | |||
| 3153 | { | 3153 | { |
| 3154 | struct Lisp_Native_Comp_Unit *cu = | 3154 | struct Lisp_Native_Comp_Unit *cu = |
| 3155 | PSEUDOVEC_STRUCT (vector, Lisp_Native_Comp_Unit); | 3155 | PSEUDOVEC_STRUCT (vector, Lisp_Native_Comp_Unit); |
| 3156 | dispose_comp_unit (cu, true); | 3156 | eassert (cu->handle); |
| 3157 | dynlib_close (cu->handle); | ||
| 3157 | } | 3158 | } |
| 3158 | else if (NATIVE_COMP_FLAG | 3159 | else if (NATIVE_COMP_FLAG |
| 3159 | && PSEUDOVECTOR_TYPEP (&vector->header, PVEC_SUBR)) | 3160 | && PSEUDOVECTOR_TYPEP (&vector->header, PVEC_SUBR)) |