emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] emacs-24 r117617: * lisp/emacs-lisp/bytecomp.el (byte-comp


From: Stefan Monnier
Subject: [Emacs-diffs] emacs-24 r117617: * lisp/emacs-lisp/bytecomp.el (byte-compile-and-folded): Optimize case where
Date: Wed, 22 Oct 2014 13:38:52 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 117617
revision-id: address@hidden
parent: address@hidden
fixes bug: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=18767
committer: Stefan Monnier <address@hidden>
branch nick: emacs-24
timestamp: Wed 2014-10-22 09:38:47 -0400
message:
  * lisp/emacs-lisp/bytecomp.el (byte-compile-and-folded): Optimize case where
  all args are copyable.
  (=, <, >, <=, >=): Re-enable the optimization.
modified:
  lisp/ChangeLog                 changelog-20091113204419-o5vbwnq5f7feedwu-1432
  lisp/emacs-lisp/bytecomp.el    bytecomp.el-20091113204419-o5vbwnq5f7feedwu-492
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2014-10-21 00:14:07 +0000
+++ b/lisp/ChangeLog    2014-10-22 13:38:47 +0000
@@ -1,3 +1,9 @@
+2014-10-22  Stefan Monnier  <address@hidden>
+
+       * emacs-lisp/bytecomp.el (byte-compile-and-folded): Optimize case where
+       all args are copyable (bug#18767).
+       (=, <, >, <=, >=): Re-enable the optimization.
+
 2014-10-20  Santiago PayĆ  i Miralta  <address@hidden>
 
        * vc/vc-hg.el (vc-hg-log-graph): New var.

=== modified file 'lisp/emacs-lisp/bytecomp.el'
--- a/lisp/emacs-lisp/bytecomp.el       2014-10-20 19:23:50 +0000
+++ b/lisp/emacs-lisp/bytecomp.el       2014-10-22 13:38:47 +0000
@@ -120,7 +120,7 @@
 (require 'backquote)
 (require 'macroexp)
 (require 'cconv)
-(eval-when-compile (require 'cl-lib))
+(require 'cl-lib)
 
 (or (fboundp 'defsubst)
     ;; This really ought to be loaded already!
@@ -3261,11 +3261,11 @@
 (byte-defop-compiler cons              2)
 (byte-defop-compiler aref              2)
 (byte-defop-compiler set               2)
-(byte-defop-compiler (= byte-eqlsign)  2) ;; -and  bug#18767
-(byte-defop-compiler (< byte-lss)      2) ;; -and  bug#18767
-(byte-defop-compiler (> byte-gtr)      2) ;; -and  bug#18767
-(byte-defop-compiler (<= byte-leq)     2) ;; -and  bug#18767
-(byte-defop-compiler (>= byte-geq)     2) ;; -and  bug#18767
+(byte-defop-compiler (= byte-eqlsign)  2-and)
+(byte-defop-compiler (< byte-lss)      2-and)
+(byte-defop-compiler (> byte-gtr)      2-and)
+(byte-defop-compiler (<= byte-leq)     2-and)
+(byte-defop-compiler (>= byte-geq)     2-and)
 (byte-defop-compiler get               2)
 (byte-defop-compiler nth               2)
 (byte-defop-compiler substring         2-3)
@@ -3332,13 +3332,14 @@
 (defun byte-compile-and-folded (form)
   "Compile calls to functions like `<='.
 These implicitly `and' together a bunch of two-arg bytecodes."
-  ;; FIXME: bug#18767 means we can't do it this way!
   (let ((l (length form)))
     (cond
      ((< l 3) (byte-compile-form `(progn ,(nth 1 form) t)))
      ((= l 3) (byte-compile-two-args form))
-     (t (byte-compile-form `(and (,(car form) ,(nth 1 form) ,(nth 2 form))
-                                (,(car form) ,@(nthcdr 2 form))))))))
+     ((cl-every #'macroexp-copyable-p (nthcdr 2 form))
+      (byte-compile-form `(and (,(car form) ,(nth 1 form) ,(nth 2 form))
+                              (,(car form) ,@(nthcdr 2 form)))))
+     (t (byte-compile-normal-call form)))))
 
 (defun byte-compile-three-args (form)
   (if (not (= (length form) 4))


reply via email to

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