emacs-diffs
[Top][All Lists]
Advanced

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

feature/native-comp 5edc7aa 2/2: Fix defsubst effectiveness (bug#44209)


From: Andrea Corallo
Subject: feature/native-comp 5edc7aa 2/2: Fix defsubst effectiveness (bug#44209)
Date: Sun, 25 Oct 2020 19:00:46 -0400 (EDT)

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

    Fix defsubst effectiveness (bug#44209)
    
        * lisp/emacs-lisp/byte-run.el (defsubst): Fix macro definition.
        * test/src/comp-tests.el (comp-test-defsubst): New testcase.
        * test/src/comp-test-funcs.el (comp-test-defsubst-f): New
        function.
---
 lisp/emacs-lisp/byte-run.el | 8 ++++----
 test/src/comp-test-funcs.el | 3 +++
 test/src/comp-tests.el      | 4 ++++
 3 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/lisp/emacs-lisp/byte-run.el b/lisp/emacs-lisp/byte-run.el
index 042a26a..1bc7839 100644
--- a/lisp/emacs-lisp/byte-run.el
+++ b/lisp/emacs-lisp/byte-run.el
@@ -363,13 +363,13 @@ You don't need this.  (See bytecomp.el commentary for 
more details.)
   (or (memq (get name 'byte-optimizer)
            '(nil byte-compile-inline-expand))
       (error "`%s' is a primitive" name))
-  ;; Never native-compile defsubsts as we need the byte
-  ;; definition in `byte-compile-unfold-bcf' to perform the
-  ;; inlining (Bug#42664).
-  (byte-run--set-speed name nil -1)
   `(prog1
        (defun ,name ,arglist ,@body)
      (eval-and-compile
+       ;; Never native-compile defsubsts as we need the byte
+       ;; definition in `byte-compile-unfold-bcf' to perform the
+       ;; inlining (Bug#42664, Bug#43280, Bug#44209).
+       ,(byte-run--set-speed name nil -1)
        (put ',name 'byte-optimizer 'byte-compile-inline-expand))))
 
 (defvar advertised-signature-table (make-hash-table :test 'eq :weakness 'key))
diff --git a/test/src/comp-test-funcs.el b/test/src/comp-test-funcs.el
index 9285ed6..35df46a 100644
--- a/test/src/comp-test-funcs.el
+++ b/test/src/comp-test-funcs.el
@@ -345,6 +345,9 @@
   (declare (speed 2))
   (- x y))
 
+(defsubst comp-test-defsubst-f ()
+  t)
+
 
 ;;;;;;;;;;;;;;;;;;;;
 ;; Tromey's tests ;;
diff --git a/test/src/comp-tests.el b/test/src/comp-tests.el
index b9a0a87..ae96e5d 100644
--- a/test/src/comp-tests.el
+++ b/test/src/comp-tests.el
@@ -426,6 +426,10 @@ 
https://lists.gnu.org/archive/html/bug-gnu-emacs/2020-03/msg00914.html.";
     (should (subr-native-elisp-p f))
     (should (= (funcall f 2) 3))))
 
+(comp-deftest comp-test-defsubst ()
+  ;; Bug#42664, Bug#43280, Bug#44209.
+  (should-not (subr-native-elisp-p (symbol-function #'comp-test-defsubst-f))))
+
 
 ;;;;;;;;;;;;;;;;;;;;;
 ;; Tromey's tests. ;;



reply via email to

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