diff options
| author | Stefan Monnier | 2014-10-22 09:38:47 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2014-10-22 09:38:47 -0400 |
| commit | be603ee9b653b14f62bb1bbcc6bded35e76f3ee7 (patch) | |
| tree | e1e6ec218a93b275bc5c2d8ca41fb0c46658c1b1 | |
| parent | bdc9a8b5acdffe0acd6360b1cade8ff732df3e76 (diff) | |
| download | emacs-be603ee9b653b14f62bb1bbcc6bded35e76f3ee7.tar.gz emacs-be603ee9b653b14f62bb1bbcc6bded35e76f3ee7.zip | |
* lisp/emacs-lisp/bytecomp.el (byte-compile-and-folded): Optimize case where
all args are copyable.
(=, <, >, <=, >=): Re-enable the optimization.
Fixes: debbugs:18767
| -rw-r--r-- | lisp/ChangeLog | 6 | ||||
| -rw-r--r-- | lisp/emacs-lisp/bytecomp.el | 19 |
2 files changed, 16 insertions, 9 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index a23b2fc4012..d1f8fdcdd58 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2014-10-22 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 2 | |||
| 3 | * emacs-lisp/bytecomp.el (byte-compile-and-folded): Optimize case where | ||
| 4 | all args are copyable (bug#18767). | ||
| 5 | (=, <, >, <=, >=): Re-enable the optimization. | ||
| 6 | |||
| 1 | 2014-10-20 Santiago PayĆ i Miralta <santiagopim@gmail.com> | 7 | 2014-10-20 Santiago PayĆ i Miralta <santiagopim@gmail.com> |
| 2 | 8 | ||
| 3 | * vc/vc-hg.el (vc-hg-log-graph): New var. | 9 | * vc/vc-hg.el (vc-hg-log-graph): New var. |
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index 69c4e0f1628..6ab0efff86b 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el | |||
| @@ -120,7 +120,7 @@ | |||
| 120 | (require 'backquote) | 120 | (require 'backquote) |
| 121 | (require 'macroexp) | 121 | (require 'macroexp) |
| 122 | (require 'cconv) | 122 | (require 'cconv) |
| 123 | (eval-when-compile (require 'cl-lib)) | 123 | (require 'cl-lib) |
| 124 | 124 | ||
| 125 | (or (fboundp 'defsubst) | 125 | (or (fboundp 'defsubst) |
| 126 | ;; This really ought to be loaded already! | 126 | ;; This really ought to be loaded already! |
| @@ -3261,11 +3261,11 @@ If it is nil, then the handler is \"byte-compile-SYMBOL.\"" | |||
| 3261 | (byte-defop-compiler cons 2) | 3261 | (byte-defop-compiler cons 2) |
| 3262 | (byte-defop-compiler aref 2) | 3262 | (byte-defop-compiler aref 2) |
| 3263 | (byte-defop-compiler set 2) | 3263 | (byte-defop-compiler set 2) |
| 3264 | (byte-defop-compiler (= byte-eqlsign) 2) ;; -and bug#18767 | 3264 | (byte-defop-compiler (= byte-eqlsign) 2-and) |
| 3265 | (byte-defop-compiler (< byte-lss) 2) ;; -and bug#18767 | 3265 | (byte-defop-compiler (< byte-lss) 2-and) |
| 3266 | (byte-defop-compiler (> byte-gtr) 2) ;; -and bug#18767 | 3266 | (byte-defop-compiler (> byte-gtr) 2-and) |
| 3267 | (byte-defop-compiler (<= byte-leq) 2) ;; -and bug#18767 | 3267 | (byte-defop-compiler (<= byte-leq) 2-and) |
| 3268 | (byte-defop-compiler (>= byte-geq) 2) ;; -and bug#18767 | 3268 | (byte-defop-compiler (>= byte-geq) 2-and) |
| 3269 | (byte-defop-compiler get 2) | 3269 | (byte-defop-compiler get 2) |
| 3270 | (byte-defop-compiler nth 2) | 3270 | (byte-defop-compiler nth 2) |
| 3271 | (byte-defop-compiler substring 2-3) | 3271 | (byte-defop-compiler substring 2-3) |
| @@ -3332,13 +3332,14 @@ If it is nil, then the handler is \"byte-compile-SYMBOL.\"" | |||
| 3332 | (defun byte-compile-and-folded (form) | 3332 | (defun byte-compile-and-folded (form) |
| 3333 | "Compile calls to functions like `<='. | 3333 | "Compile calls to functions like `<='. |
| 3334 | These implicitly `and' together a bunch of two-arg bytecodes." | 3334 | These implicitly `and' together a bunch of two-arg bytecodes." |
| 3335 | ;; FIXME: bug#18767 means we can't do it this way! | ||
| 3336 | (let ((l (length form))) | 3335 | (let ((l (length form))) |
| 3337 | (cond | 3336 | (cond |
| 3338 | ((< l 3) (byte-compile-form `(progn ,(nth 1 form) t))) | 3337 | ((< l 3) (byte-compile-form `(progn ,(nth 1 form) t))) |
| 3339 | ((= l 3) (byte-compile-two-args form)) | 3338 | ((= l 3) (byte-compile-two-args form)) |
| 3340 | (t (byte-compile-form `(and (,(car form) ,(nth 1 form) ,(nth 2 form)) | 3339 | ((cl-every #'macroexp-copyable-p (nthcdr 2 form)) |
| 3341 | (,(car form) ,@(nthcdr 2 form)))))))) | 3340 | (byte-compile-form `(and (,(car form) ,(nth 1 form) ,(nth 2 form)) |
| 3341 | (,(car form) ,@(nthcdr 2 form))))) | ||
| 3342 | (t (byte-compile-normal-call form))))) | ||
| 3342 | 3343 | ||
| 3343 | (defun byte-compile-three-args (form) | 3344 | (defun byte-compile-three-args (form) |
| 3344 | (if (not (= (length form) 4)) | 3345 | (if (not (= (length form) 4)) |