diff options
author | Mattias EngdegÄrd <mattiase@acm.org> | 2020-07-27 11:27:00 +0200 |
---|---|---|
committer | Mattias EngdegÄrd <mattiase@acm.org> | 2020-07-28 15:48:38 +0200 |
commit | e5889c704f9351c2cb91d8db2b36af72d9ab4151 (patch) | |
tree | 717b8fadcac2e060719a103d7bff95386382de06 /lisp/emacs-lisp | |
parent | 33ee3266286db00feef2839e172f613c4370fc1b (diff) | |
download | emacs-e5889c704f9351c2cb91d8db2b36af72d9ab4151.tar.gz emacs-e5889c704f9351c2cb91d8db2b36af72d9ab4151.tar.bz2 emacs-e5889c704f9351c2cb91d8db2b36af72d9ab4151.zip |
Simplify and streamline optimizer clauses
* lisp/emacs-lisp/byte-opt.el (byte-optimize-form-code-walker):
Remove clause for 'with-output-to-temp-buffer', since it is a
macro and will have been expanded before reaching this point.
Move clauses for 'lambda' and 'closure' to avoid splitting
a cond jump table.
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r-- | lisp/emacs-lisp/byte-opt.el | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/lisp/emacs-lisp/byte-opt.el b/lisp/emacs-lisp/byte-opt.el index 6f801be5457..48efff911f7 100644 --- a/lisp/emacs-lisp/byte-opt.el +++ b/lisp/emacs-lisp/byte-opt.el @@ -391,13 +391,6 @@ (and (nth 1 form) (not for-effect) form)) - ((eq (car-safe fn) 'lambda) - (let ((newform (byte-compile-unfold-lambda form))) - (if (eq newform form) - ;; Some error occurred, avoid infinite recursion - form - (byte-optimize-form-code-walker newform for-effect)))) - ((eq (car-safe fn) 'closure) form) ((memq fn '(let let*)) ;; recursively enter the optimizer for the bindings and body ;; of a let or let*. This for depth-firstness: forms that @@ -444,13 +437,6 @@ ;; will be optimized away in the lap-optimize pass. (cons fn (byte-optimize-body (cdr form) for-effect))) - ((eq fn 'with-output-to-temp-buffer) - ;; this is just like the above, except for the first argument. - (cons fn - (cons - (byte-optimize-form (nth 1 form) nil) - (byte-optimize-body (cdr (cdr form)) for-effect)))) - ((eq fn 'if) (when (< (length form) 3) (byte-compile-warn "too few arguments for `if'")) @@ -530,6 +516,15 @@ ;; Needed as long as we run byte-optimize-form after cconv. ((eq fn 'internal-make-closure) form) + ((eq (car-safe fn) 'lambda) + (let ((newform (byte-compile-unfold-lambda form))) + (if (eq newform form) + ;; Some error occurred, avoid infinite recursion + form + (byte-optimize-form-code-walker newform for-effect)))) + + ((eq (car-safe fn) 'closure) form) + ((byte-code-function-p fn) (cons fn (mapcar #'byte-optimize-form (cdr form)))) |