Mercurial > hg > xemacs-beta
changeset 5575:89cb6a66a61f
Force unfolding of (funcall #'(lambda () ...) if optimising, bytecomp.el.
lisp/ChangeLog addition:
2011-10-03 Aidan Kehoe <kehoea@parhasard.net>
* bytecomp.el (byte-compile-funcall):
Sometimes the optimizer shirks its responsibility and doesn't
unfold a lambda when it should. Do this here, if optimization is
turned on; this makes inlining labels more consistent and
trustworthy.
author | Aidan Kehoe <kehoea@parhasard.net> |
---|---|
date | Mon, 03 Oct 2011 19:39:01 +0100 |
parents | d4f334808463 |
children | 071b810ceb18 |
files | lisp/ChangeLog lisp/bytecomp.el |
diffstat | 2 files changed, 21 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/ChangeLog Sun Oct 02 15:32:16 2011 +0100 +++ b/lisp/ChangeLog Mon Oct 03 19:39:01 2011 +0100 @@ -1,3 +1,11 @@ +2011-10-03 Aidan Kehoe <kehoea@parhasard.net> + + * bytecomp.el (byte-compile-funcall): + Sometimes the optimizer shirks its responsibility and doesn't + unfold a lambda when it should. Do this here, if optimization is + turned on; this makes inlining labels more consistent and + trustworthy. + 2011-10-02 Aidan Kehoe <kehoea@parhasard.net> * bytecomp.el (byte-compile-initial-macro-environment):
--- a/lisp/bytecomp.el Sun Oct 02 15:32:16 2011 +0100 +++ b/lisp/bytecomp.el Mon Oct 03 19:39:01 2011 +0100 @@ -4157,8 +4157,19 @@ (byte-compile-constp (second form))) (byte-compile-callargs-warn (cons (cl-const-expr-val (second form)) (nthcdr 2 form)))) - (mapc 'byte-compile-form (cdr form)) - (byte-compile-out 'byte-call (length (cdr (cdr form))))) + (if (and byte-optimize + (eq 'function (car-safe (cadr form))) + (eq 'lambda (car-safe (cadadr form))) + (or + (not (eq (setq form (cons (cadadr form) (cddr form))) + (setq form (byte-compile-unfold-lambda form)))) + (prog1 nil (setq form `(funcall #',(car form) ,@(cdr form)))))) + ;; Sometimes the optimizer fails to unfold well-formed calls of the + ;; form (funcall #'(lambda ...)); since we need it to do this for + ;; (declare (inline ...)) to work properly with labels, force that here. + (byte-compile-form form) + (mapc 'byte-compile-form (cdr form)) + (byte-compile-out 'byte-call (length (cdr (cdr form)))))) (defun byte-compile-let (form)