all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Lars Ingebrigtsen <larsi@gnus.org>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: germanp82@hotmail.com, 57627@debbugs.gnu.org,
	Eli Zaretskii <eliz@gnu.org>, Andrea Corallo <akrl@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	[thread overview]
Message-ID: <87k0502n6s.fsf@gnus.org> (raw)
In-Reply-To: <jwvmt9xkw7a.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Sat, 15 Oct 2022 10:19:57 -0400")

Stefan Monnier <monnier@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)





  reply	other threads:[~2022-10-16  8:21 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-06 11:38 bug#57627: 29.0.50; [native-compilation] cl-loaddefs.el recompiled on startup German Pacenza
2022-09-06 15:02 ` Lars Ingebrigtsen
2022-09-06 15:46   ` German Pacenza
2022-09-06 15:51     ` Lars Ingebrigtsen
2022-09-06 16:33       ` Andrea Corallo
2022-09-06 16:41         ` Eli Zaretskii
2022-09-06 19:23           ` Andrea Corallo
2022-09-06 20:40             ` Lars Ingebrigtsen
2022-09-07  2:33               ` Eli Zaretskii
2022-09-07 12:47                 ` Lars Ingebrigtsen
2022-09-07 13:01                   ` German Pacenza
2022-09-07 13:06                     ` Lars Ingebrigtsen
2022-09-07 13:41                       ` Lars Ingebrigtsen
2022-09-07 13:08                   ` Eli Zaretskii
2022-09-07 13:10                     ` Lars Ingebrigtsen
2022-09-07 18:06               ` Andrea Corallo
2022-09-08 11:57                 ` Lars Ingebrigtsen
2022-09-09 12:57                   ` Andrea Corallo
2022-09-09 17:09                     ` Lars Ingebrigtsen
2022-09-09 19:03                       ` Andrea Corallo
2022-09-10  4:33                         ` Lars Ingebrigtsen
2022-09-10  4:38                           ` Lars Ingebrigtsen
2022-10-14 10:53                           ` Lars Ingebrigtsen
2022-10-14 19:00                             ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-10-15 10:13                               ` Lars Ingebrigtsen
2022-10-15 14:19                                 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-10-16  8:21                                   ` Lars Ingebrigtsen [this message]
2022-10-17  7:47                                     ` Andrea Corallo
2022-10-17  8:49                                       ` Lars Ingebrigtsen
2022-10-17  8:52                                         ` Andrea Corallo
2022-10-17  9:06                                         ` Eli Zaretskii
2022-10-17  9:13                                           ` Lars Ingebrigtsen
2022-10-17 11:59                                     ` Arash Esbati
2022-10-17 12:01                                       ` Lars Ingebrigtsen
2022-10-17 12:09                                         ` Arash Esbati
2022-10-17 12:21                                           ` Lars Ingebrigtsen
2022-10-17 12:31                                             ` Lars Ingebrigtsen
2022-10-17 12:53                                               ` Arash Esbati
2022-10-17 12:59                                               ` German Pacenza

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87k0502n6s.fsf@gnus.org \
    --to=larsi@gnus.org \
    --cc=57627@debbugs.gnu.org \
    --cc=akrl@sdf.org \
    --cc=eliz@gnu.org \
    --cc=germanp82@hotmail.com \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.