GNU bug report logs - #57627
29.0.50; [native-compilation] cl-loaddefs.el recompiled on startup

Previous Next

Package: emacs;

Reported by: German Pacenza <germanp82 <at> hotmail.com>

Date: Tue, 6 Sep 2022 14:55:04 UTC

Severity: normal

Tags: moreinfo

Found in version 29.0.50

Fixed in version 29.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: germanp82 <at> hotmail.com, 57627 <at> debbugs.gnu.org, Eli Zaretskii <eliz <at> gnu.org>, Andrea Corallo <akrl <at> sdf.org>
Subject: bug#57627: 29.0.50; [native-compilation] cl-loaddefs.el recompiled on startup
Date: Sun, 16 Oct 2022 10:21:47 +0200
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:

> Re-reading this discussion what I see is two different options, neither
> of which is significantly better than the other.
> So the motivation to change is not very high.

True.

So I've now implemented Stefan's suggestion (i.e., just putting a
puthash into the .elc file if the file-local variable says so), and it
seems to work fine.

Andrea, does this look OK to you?

diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
index 74ba8984f2..1dc5442716 100644
--- a/lisp/emacs-lisp/bytecomp.el
+++ b/lisp/emacs-lisp/bytecomp.el
@@ -2323,9 +2323,15 @@ byte-compile-from-buffer
        (setq case-fold-search nil))
      (displaying-byte-compile-warnings
       (with-current-buffer inbuffer
-	(and byte-compile-current-file
-	     (byte-compile-insert-header byte-compile-current-file
-                                         byte-compile--outbuffer))
+	(when byte-compile-current-file
+	  (byte-compile-insert-header byte-compile-current-file
+                                      byte-compile--outbuffer)
+          ;; Instruct native-comp to ignore this file.
+          (when (bound-and-true-p no-native-compile)
+            (with-current-buffer byte-compile--outbuffer
+              (insert
+               "(when (boundp 'native-comp--no-native-compile)
+  (puthash load-file-name t native-comp--no-native-compile))\n\n"))))
 	(goto-char (point-min))
 	;; Should we always do this?  When calling multiple files, it
 	;; would be useful to delay this warning until all have been
diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el
index 889bffa3f5..3c64f472a0 100644
--- a/lisp/emacs-lisp/comp.el
+++ b/lisp/emacs-lisp/comp.el
@@ -4119,6 +4119,8 @@ native-compile-async-skip-p
 LOAD and SELECTOR work as described in `native--compile-async'."
   ;; Make sure we are not already compiling `file' (bug#40838).
   (or (gethash file comp-async-compilations)
+      (gethash (file-name-with-extension file "elc")
+               native-comp--no-native-compile)
       (cond
        ((null selector) nil)
        ((functionp selector) (not (funcall selector file)))
diff --git a/lisp/loadup.el b/lisp/loadup.el
index c01c827a75..95bfbc502e 100644
--- a/lisp/loadup.el
+++ b/lisp/loadup.el
@@ -501,7 +501,10 @@
                                          bin-dest-dir)
                      ;; Relative filename from the built uninstalled binary.
                      (file-relative-name file invocation-directory)))))
-	       comp-loaded-comp-units-h))))
+	       comp-loaded-comp-units-h)))
+  ;; Set up the mechanism to allow inhibiting native-comp via
+  ;; file-local variables.
+  (defvar native-comp--no-native-compile (make-hash-table :test #'equal)))
 
 (when (hash-table-p purify-flag)
   (let ((strings 0)




This bug report was last modified 222 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.