* Don't install unnecessary trampolines (bug#69573) (don't merge)
authorAndrea Corallo <acorallo@gnu.org>
Tue, 26 Mar 2024 07:20:54 +0000 (08:20 +0100)
committerAndrea Corallo <acorallo@gnu.org>
Tue, 26 Mar 2024 07:32:37 +0000 (08:32 +0100)
* lisp/emacs-lisp/comp.el (comp-subr-trampoline-install):
Check that subr-name actually matches the target subr.

lisp/emacs-lisp/comp.el

index 6b65a375ea02312f7c1b358464de5e792f039ff2..a3c6bb594696bd5afbbfa61c629f0e0330eddb22 100644 (file)
@@ -714,13 +714,15 @@ This are essential for the trampoline machinery to work properly.")
   (when (memq subr-name comp-warn-primitives)
     (warn "Redefining `%s' might break native compilation of trampolines."
           subr-name))
-  (unless (or (null native-comp-enable-subr-trampolines)
-              (memq subr-name native-comp-never-optimize-functions)
-              (gethash subr-name comp-installed-trampolines-h))
-    (cl-assert (subr-primitive-p (symbol-function subr-name)))
-    (when-let ((trampoline (or (comp-trampoline-search subr-name)
-                               (comp-trampoline-compile subr-name))))
-        (comp--install-trampoline subr-name trampoline))))
+  (let ((subr (symbol-function subr-name)))
+    (unless (or (not (string= subr-name (subr-name subr))) ;; (bug#69573)
+                (null native-comp-enable-subr-trampolines)
+                (memq subr-name native-comp-never-optimize-functions)
+                (gethash subr-name comp-installed-trampolines-h))
+      (cl-assert (subr-primitive-p subr))
+      (when-let ((trampoline (or (comp-trampoline-search subr-name)
+                                 (comp-trampoline-compile subr-name))))
+        (comp--install-trampoline subr-name trampoline)))))
 
 \f
 (cl-defstruct (comp-vec (:copier nil))