changeset: 5577:0b6e7ae1e78f
tag: tip
user: Aidan Kehoe <kehoea(a)parhasard.net>
date: Tue Oct 04 09:02:14 2011 +0100
files: lisp/ChangeLog lisp/bytecomp.el
description:
Update a comment with a better understanding of the optimizer, bytecomp.el
lisp/ChangeLog addition:
2011-10-04 Aidan Kehoe <kehoea(a)parhasard.net>
* bytecomp.el (byte-compile-funcall):
Correct a comment here, explaining why the optimizer doesn't
expand (funcall #'(lambda ...)) in some contexts with inline
labels, and why it's reasonable to do it here.
diff -r 071b810ceb18 -r 0b6e7ae1e78f lisp/ChangeLog
--- a/lisp/ChangeLog Mon Oct 03 20:16:14 2011 +0100
+++ b/lisp/ChangeLog Tue Oct 04 09:02:14 2011 +0100
@@ -1,3 +1,10 @@
+2011-10-04 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ * bytecomp.el (byte-compile-funcall):
+ Correct a comment here, explaining why the optimizer doesn't
+ expand (funcall #'(lambda ...)) in some contexts with inline
+ labels, and why it's reasonable to do it here.
+
2011-10-03 Aidan Kehoe <kehoea(a)parhasard.net>
* simple.el (handle-pre-motion-command-current-command-is-motion):
diff -r 071b810ceb18 -r 0b6e7ae1e78f lisp/bytecomp.el
--- a/lisp/bytecomp.el Mon Oct 03 20:16:14 2011 +0100
+++ b/lisp/bytecomp.el Tue Oct 04 09:02:14 2011 +0100
@@ -4164,9 +4164,23 @@
(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.
+ ;; The byte-compile part of the #'labels implementation, above,
+ ;; happens after macroexpansion and after the source optimizer has
+ ;; done its thing. When labels are to be made inline we can have code
+ ;; that looks like (funcall #'(lambda ...) ...), when the code that
+ ;; the optimizer saw looked like (funcall #<compiled-function ...>
+ ;; ...).
+ ;;
+ ;; So, the optimizer doesn't have the opportunity to transform the
+ ;; former to (let (...) ...), and it's reasonable to do that here (since
+ ;; the labels implementation doesn't change other code that would need
+ ;; running through the optimizer; the lambda itself has already been
+ ;; through the optimizer).
+ ;;
+ ;; Equally reasonable, and conceptually a bit clearer, would be to do
+ ;; the transformation to (funcall #'(lambda ...) ...) in the
+ ;; byte-optimizer, breaking most of the #'sublis calls out of the
+ ;; byte-compile method.
(byte-compile-form form)
(mapc 'byte-compile-form (cdr form))
(byte-compile-out 'byte-call (length (cdr (cdr form))))))
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-patches