emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

feature/native-comp f1efac1 2/2: * Normalize `comp-eln-load-path' entrie


From: Andrea Corallo
Subject: feature/native-comp f1efac1 2/2: * Normalize `comp-eln-load-path' entries for trampoline comp (bug#43475)
Date: Thu, 14 Jan 2021 16:39:26 -0500 (EST)

branch: feature/native-comp
commit f1efac1f9efbfa15b6434ebef507c00c1277633f
Author: Andrea Corallo <akrl@sdf.org>
Commit: Andrea Corallo <akrl@sdf.org>

    * Normalize `comp-eln-load-path' entries for trampoline comp (bug#43475)
    
        * lisp/emacs-lisp/comp.el (comp-eln-load-path-eff): New function.
        (comp-trampoline-search, comp-trampoline-compile)
        (comp-clean-up-stale-eln): Update to use normalized
        `comp-eln-load-path-eff'.
---
 lisp/emacs-lisp/comp.el | 36 +++++++++++++++++++++---------------
 1 file changed, 21 insertions(+), 15 deletions(-)

diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el
index 156b00e..875f15a 100644
--- a/lisp/emacs-lisp/comp.el
+++ b/lisp/emacs-lisp/comp.el
@@ -3592,6 +3592,15 @@ Prepare every function for final compilation and drive 
the C back-end."
 
 ;; Primitive function advice machinery
 
+(defun comp-eln-load-path-eff ()
+  "Return a list of effective eln load directories.
+Account for `comp-load-path' and `comp-native-version-dir'."
+  (mapcar (lambda (dir)
+            (concat (file-name-as-directory
+                     (expand-file-name dir invocation-directory))
+                    comp-native-version-dir))
+          comp-eln-load-path))
+
 (defun comp-trampoline-filename (subr-name)
   "Given SUBR-NAME return the filename containing the trampoline."
   (concat (comp-c-func-name subr-name "subr--trampoline-" t) ".eln"))
@@ -3616,9 +3625,8 @@ Prepare every function for final compilation and drive 
the C back-end."
 Return the trampoline if found or nil otherwise."
   (cl-loop
    with rel-filename = (comp-trampoline-filename subr-name)
-   for dir in comp-eln-load-path
-   for filename = (expand-file-name rel-filename
-                                    (concat dir comp-native-version-dir))
+   for dir in (comp-eln-load-path-eff)
+   for filename = (expand-file-name rel-filename dir)
    when (file-exists-p filename)
      do (cl-return (native-elisp-load filename))))
 
@@ -3644,8 +3652,7 @@ Return the trampoline if found or nil otherwise."
     (comp--native-compile
      form nil
      (cl-loop
-      for load-dir in comp-eln-load-path
-      for dir = (concat load-dir comp-native-version-dir)
+      for dir in (comp-eln-load-path-eff)
       for f = (expand-file-name
                (comp-trampoline-filename subr-name)
                dir)
@@ -3684,11 +3691,10 @@ sharing the original source filename (including FILE)."
      with filename-hash = (match-string 1 file)
      with regexp = (rx-to-string
                     `(seq "-" ,filename-hash "-" (1+ hex) ".eln" eos))
-     for dir in (butlast comp-eln-load-path) ; Skip last dir.
+     for dir in (butlast (comp-eln-load-path-eff)) ; Skip last dir.
      do (cl-loop
-         with full-dir = (concat dir comp-native-version-dir)
-         for f in (when (file-exists-p full-dir)
-                   (directory-files full-dir t regexp t))
+         for f in (when (file-exists-p dir)
+                   (directory-files dir t regexp t))
          do (comp-delete-or-replace-file f)))))
 
 (defun comp-delete-or-replace-file (oldfile &optional newfile)
@@ -3877,14 +3883,14 @@ load once finished compiling."
          for t0 = (current-time)
          for pass in comp-passes
          unless (memq pass comp-disabled-passes)
-         do
-         (comp-log (format "(%s) Running pass %s:\n"
+           do
+           (comp-log (format "(%s) Running pass %s:\n"
                            function-or-file pass)
                    2)
-         (setf data (funcall pass data))
-         (push (cons pass (float-time (time-since t0))) report)
-         (cl-loop for f in (alist-get pass comp-post-pass-hooks)
-                  do (funcall f data))
+           (setf data (funcall pass data))
+           (push (cons pass (float-time (time-since t0))) report)
+           (cl-loop for f in (alist-get pass comp-post-pass-hooks)
+                    do (funcall f data))
          finally
          (when comp-log-time-report
            (comp-log (format "Done compiling %s" data) 0)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]