# HG changeset patch # User Aidan Kehoe # Date 1284643900 -3600 # Node ID f9ec07abdbf92606e7b25bb29538fccc24e962a4 # Parent 5663ae9a89895c1f42a18d6e3d3bf08f6a5fdc55 Transform safe calls to (= X Y Z) to (and (= X Y) (= Y Z)); same for < > <= >= lisp/ChangeLog addition: 2010-09-16 Aidan Kehoe * cl-macs.el (= < > <= >=): When these functions are handed more than two arguments, and those arguments have no side effects, transform to a series of two argument calls, avoiding funcall in the byte-compiled code. * mule/mule-cmds.el (finish-set-language-environment): Take advantage of this change in a function called 256 times at startup. diff -r 5663ae9a8989 -r f9ec07abdbf9 lisp/ChangeLog --- a/lisp/ChangeLog Thu Sep 16 14:10:44 2010 +0100 +++ b/lisp/ChangeLog Thu Sep 16 14:31:40 2010 +0100 @@ -1,3 +1,13 @@ +2010-09-16 Aidan Kehoe + + * cl-macs.el (= < > <= >=): + When these functions are handed more than two arguments, and those + arguments have no side effects, transform to a series of two + argument calls, avoiding funcall in the byte-compiled code. + * mule/mule-cmds.el (finish-set-language-environment): + Take advantage of this change in a function called 256 times at + startup. + 2010-09-16 Aidan Kehoe * bytecomp.el (byte-compile-function-form, byte-compile-quote) diff -r 5663ae9a8989 -r f9ec07abdbf9 lisp/cl-macs.el --- a/lisp/cl-macs.el Thu Sep 16 14:10:44 2010 +0100 +++ b/lisp/cl-macs.el Thu Sep 16 14:31:40 2010 +0100 @@ -3773,6 +3773,25 @@ (string (cons 'concat (cddr form)))) form)) +(map nil + #'(lambda (function) + ;; There are byte codes for the two-argument versions of these + ;; functions; if the form has more arguments and those arguments + ;; have no side effects, transform to a series of two-argument + ;; calls. + (put function 'cl-compiler-macro + #'(lambda (form &rest arguments) + (if (or (null (nthcdr 3 form)) + (notevery #'cl-safe-expr-p (cdr form))) + form + (cons 'and (mapcon + #'(lambda (rest) + (and (cdr rest) + `((,(car form) ,(pop rest) + ,(car rest))))) + (cdr form))))))) + '(= < > <= >=)) + (mapc #'(lambda (y) (put (car y) 'side-effect-free t) diff -r 5663ae9a8989 -r f9ec07abdbf9 lisp/mule/mule-cmds.el --- a/lisp/mule/mule-cmds.el Thu Sep 16 14:10:44 2010 +0100 +++ b/lisp/mule/mule-cmds.el Thu Sep 16 14:31:40 2010 +0100 @@ -789,8 +789,7 @@ (setq string (format "%c" unicode-error-lookup))) ;; Treat control characters specially: (setq first-char (aref string 0)) - (when (or (and (>= first-char #x00) (<= first-char #x1f)) - (and (>= first-char #x80) (<= first-char #x9f))) + (when (or (<= #x00 first-char #x1f) (<= #x80 first-char #x9f)) (setq string (format "^%c" (+ ?@ (aref string 0)))))) (setq glyph (make-glyph (vector 'string :data string))) (set-glyph-face glyph 'unicode-invalid-sequence-warning-face)