aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndrea Corallo2020-09-06 18:19:00 +0200
committerAndrea Corallo2020-09-06 18:19:00 +0200
commit3df471e1f4723cc0d860b31f5153ee8e47503e34 (patch)
tree7ce71b98a615413e25f6cedf6294de09a37dd534 /src
parenta71f54eff80cb7d7b36326849eea878073963594 (diff)
downloademacs-3df471e1f4723cc0d860b31f5153ee8e47503e34.tar.gz
emacs-3df471e1f4723cc0d860b31f5153ee8e47503e34.zip
* src/comp.c (Fnative_elisp_load): Make recompilation always effective.
When loading a file if in this session there was ever a file loaded with that name rename it before loading it to make sure we always get a new handle from the standard library.
Diffstat (limited to 'src')
-rw-r--r--src/comp.c31
1 files changed, 23 insertions, 8 deletions
diff --git a/src/comp.c b/src/comp.c
index 68a0ead69ae..ddecacd74e7 100644
--- a/src/comp.c
+++ b/src/comp.c
@@ -4916,20 +4916,35 @@ DEFUN ("comp--late-register-subr", Fcomp__late_register_subr,
4916 4916
4917/* Load related routines. */ 4917/* Load related routines. */
4918DEFUN ("native-elisp-load", Fnative_elisp_load, Snative_elisp_load, 1, 2, 0, 4918DEFUN ("native-elisp-load", Fnative_elisp_load, Snative_elisp_load, 1, 2, 0,
4919 doc: /* Load native elisp code FILE. 4919 doc: /* Load native elisp code FILENAME.
4920 LATE_LOAD has to be non nil when loading for deferred 4920 LATE_LOAD has to be non nil when loading for deferred
4921 compilation. */) 4921 compilation. */)
4922 (Lisp_Object file, Lisp_Object late_load) 4922 (Lisp_Object filename, Lisp_Object late_load)
4923{ 4923{
4924 CHECK_STRING (file); 4924 CHECK_STRING (filename);
4925 if (NILP (Ffile_exists_p (file))) 4925 if (NILP (Ffile_exists_p (filename)))
4926 xsignal2 (Qnative_lisp_load_failed, build_string ("file does not exists"), 4926 xsignal2 (Qnative_lisp_load_failed, build_string ("file does not exists"),
4927 file); 4927 filename);
4928 struct Lisp_Native_Comp_Unit *comp_u = allocate_native_comp_unit (); 4928 struct Lisp_Native_Comp_Unit *comp_u = allocate_native_comp_unit ();
4929 comp_u->handle = dynlib_open (SSDATA (file)); 4929 if (!NILP (Fgethash (filename, all_loaded_comp_units_h, Qnil)))
4930 {
4931 /* If in this session there was ever a file loaded with this
4932 name rename before loading it to make sure we always get a
4933 new handle! */
4934 Lisp_Object tmp_filename =
4935 Fmake_temp_file_internal (filename, make_fixnum (0),
4936 build_string (".eln"), Qnil);
4937 Frename_file (filename, tmp_filename, Qnil);
4938 comp_u->handle = dynlib_open (SSDATA (tmp_filename));
4939 Frename_file (tmp_filename, filename, Qnil);
4940 }
4941 else
4942 comp_u->handle = dynlib_open (SSDATA (filename));
4943
4930 if (!comp_u->handle) 4944 if (!comp_u->handle)
4931 xsignal2 (Qnative_lisp_load_failed, file, build_string (dynlib_error ())); 4945 xsignal2 (Qnative_lisp_load_failed, filename,
4932 comp_u->file = file; 4946 build_string (dynlib_error ()));
4947 comp_u->file = filename;
4933 comp_u->data_vec = Qnil; 4948 comp_u->data_vec = Qnil;
4934 comp_u->lambda_gc_guard_h = CALLN (Fmake_hash_table, QCtest, Qeq); 4949 comp_u->lambda_gc_guard_h = CALLN (Fmake_hash_table, QCtest, Qeq);
4935 comp_u->lambda_c_name_idx_h = CALLN (Fmake_hash_table, QCtest, Qequal); 4950 comp_u->lambda_c_name_idx_h = CALLN (Fmake_hash_table, QCtest, Qequal);