changeset: 5575:89cb6a66a61f
tag: tip
user: Aidan Kehoe <kehoea(a)parhasard.net>
date: Mon Oct 03 19:39:01 2011 +0100
files: lisp/ChangeLog lisp/bytecomp.el
description:
Force unfolding of (funcall #'(lambda () ...) if optimising, bytecomp.el.
lisp/ChangeLog addition:
2011-10-03 Aidan Kehoe <kehoea(a)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.
diff -r d4f334808463 -r 89cb6a66a61f lisp/ChangeLog
--- 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(a)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(a)parhasard.net>
* bytecomp.el (byte-compile-initial-macro-environment):
diff -r d4f334808463 -r 89cb6a66a61f lisp/bytecomp.el
--- 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)
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-patches