comparison lisp/byte-optimize.el @ 380:8626e4521993 r21-2-5

Import from CVS: tag r21-2-5
author cvs
date Mon, 13 Aug 2007 11:07:10 +0200
parents cc15677e0335
children 74fd4e045ea6
comparison
equal deleted inserted replaced
379:76b7d63099ad 380:8626e4521993
1 ;;; byte-opt.el --- the optimization passes of the emacs-lisp byte compiler. 1 ;;; byte-optimize.el --- the optimization passes of the emacs-lisp byte compiler.
2 2
3 ;;; Copyright (c) 1991, 1994 Free Software Foundation, Inc. 3 ;;; Copyright (c) 1991, 1994 Free Software Foundation, Inc.
4 4
5 ;; Author: Jamie Zawinski <jwz@netscape.com> 5 ;; Author: Jamie Zawinski <jwz@netscape.com>
6 ;; Hallvard Furuseth <hbf@ulrik.uio.no> 6 ;; Hallvard Furuseth <hbf@ulrik.uio.no>
37 ;; to get it there. 37 ;; to get it there.
38 ;; 38 ;;
39 39
40 ;; TO DO: 40 ;; TO DO:
41 ;; 41 ;;
42 ;; (apply '(lambda (x &rest y) ...) 1 (foo)) 42 ;; (apply #'(lambda (x &rest y) ...) 1 (foo))
43 ;; 43 ;;
44 ;; maintain a list of functions known not to access any global variables 44 ;; maintain a list of functions known not to access any global variables
45 ;; (actually, give them a 'dynamically-safe property) and then 45 ;; (actually, give them a 'dynamically-safe property) and then
46 ;; (let ( v1 v2 ... vM vN ) <...dynamically-safe...> ) ==> 46 ;; (let ( v1 v2 ... vM vN ) <...dynamically-safe...> ) ==>
47 ;; (let ( v1 v2 ... vM ) vN <...dynamically-safe...> ) 47 ;; (let ( v1 v2 ... vM ) vN <...dynamically-safe...> )
147 ;; Since this would be a file-local optimization, there would be no way to 147 ;; Since this would be a file-local optimization, there would be no way to
148 ;; modify the interpreter to obey this (unless the loader was hacked 148 ;; modify the interpreter to obey this (unless the loader was hacked
149 ;; in some grody way, but that's a really bad idea.) 149 ;; in some grody way, but that's a really bad idea.)
150 ;; 150 ;;
151 ;; HA! RMS removed the following paragraph from his version of 151 ;; HA! RMS removed the following paragraph from his version of
152 ;; byte-opt.el. 152 ;; byte-optimize.el.
153 ;; 153 ;;
154 ;; Really the Right Thing is to make lexical scope the default across 154 ;; Really the Right Thing is to make lexical scope the default across
155 ;; the board, in the interpreter and compiler, and just FIX all of 155 ;; the board, in the interpreter and compiler, and just FIX all of
156 ;; the code that relies on dynamic scope of non-defvarred variables. 156 ;; the code that relies on dynamic scope of non-defvarred variables.
157 157
158 ;; Other things to consider: 158 ;; Other things to consider:
159 159
160 ;; Associative math should recognize subcalls to identical function: 160 ;; Associative math should recognize subcalls to identical function:
161 ;;(disassemble (lambda (x) (+ (+ (foo) 1) (+ (bar) 2)))) 161 ;;(disassemble #'(lambda (x) (+ (+ (foo) 1) (+ (bar) 2))))
162 ;; This should generate the same as (1+ x) and (1- x) 162 ;; This should generate the same as (1+ x) and (1- x)
163 163
164 ;;(disassemble (lambda (x) (cons (+ x 1) (- x 1)))) 164 ;;(disassemble #'(lambda (x) (cons (+ x 1) (- x 1))))
165 ;; An awful lot of functions always return a non-nil value. If they're 165 ;; An awful lot of functions always return a non-nil value. If they're
166 ;; error free also they may act as true-constants. 166 ;; error free also they may act as true-constants.
167 167
168 ;;(disassemble (lambda (x) (and (point) (foo)))) 168 ;;(disassemble #'(lambda (x) (and (point) (foo))))
169 ;; When 169 ;; When
170 ;; - all but one arguments to a function are constant 170 ;; - all but one arguments to a function are constant
171 ;; - the non-constant argument is an if-expression (cond-expression?) 171 ;; - the non-constant argument is an if-expression (cond-expression?)
172 ;; then the outer function can be distributed. If the guarding 172 ;; then the outer function can be distributed. If the guarding
173 ;; condition is side-effect-free [assignment-free] then the other 173 ;; condition is side-effect-free [assignment-free] then the other
174 ;; arguments may be any expressions. Since, however, the code size 174 ;; arguments may be any expressions. Since, however, the code size
175 ;; can increase this way they should be "simple". Compare: 175 ;; can increase this way they should be "simple". Compare:
176 176
177 ;;(disassemble (lambda (x) (eq (if (point) 'a 'b) 'c))) 177 ;;(disassemble #'(lambda (x) (eq (if (point) 'a 'b) 'c)))
178 ;;(disassemble (lambda (x) (if (point) (eq 'a 'c) (eq 'b 'c)))) 178 ;;(disassemble #'(lambda (x) (if (point) (eq 'a 'c) (eq 'b 'c))))
179 179
180 ;; (car (cons A B)) -> (progn B A) 180 ;; (car (cons A B)) -> (progn B A)
181 ;;(disassemble (lambda (x) (car (cons (foo) 42)))) 181 ;;(disassemble #'(lambda (x) (car (cons (foo) 42))))
182 182
183 ;; (cdr (cons A B)) -> (progn A B) 183 ;; (cdr (cons A B)) -> (progn A B)
184 ;;(disassemble (lambda (x) (cdr (cons 42 (foo))))) 184 ;;(disassemble #'(lambda (x) (cdr (cons 42 (foo)))))
185 185
186 ;; (car (list A B ...)) -> (progn B ... A) 186 ;; (car (list A B ...)) -> (progn B ... A)
187 ;;(disassemble (lambda (x) (car (list (foo) 42 (bar))))) 187 ;;(disassemble #'(lambda (x) (car (list (foo) 42 (bar)))))
188 188
189 ;; (cdr (list A B ...)) -> (progn A (list B ...)) 189 ;; (cdr (list A B ...)) -> (progn A (list B ...))
190 ;;(disassemble (lambda (x) (cdr (list 42 (foo) (bar))))) 190 ;;(disassemble #'(lambda (x) (cdr (list 42 (foo) (bar)))))
191 191
192 192
193 ;;; Code: 193 ;;; Code:
194 194
195 (require 'byte-compile "bytecomp") 195 (require 'byte-compile "bytecomp")
197 (defun byte-compile-log-lap-1 (format &rest args) 197 (defun byte-compile-log-lap-1 (format &rest args)
198 (if (aref byte-code-vector 0) 198 (if (aref byte-code-vector 0)
199 (error "The old version of the disassembler is loaded. Reload new-bytecomp as well.")) 199 (error "The old version of the disassembler is loaded. Reload new-bytecomp as well."))
200 (byte-compile-log-1 200 (byte-compile-log-1
201 (apply 'format format 201 (apply 'format format
202 (let (c a) 202 (let (c a)
203 (mapcar '(lambda (arg) 203 (mapcar
204 (if (not (consp arg)) 204 #'(lambda (arg)
205 (if (and (symbolp arg) 205 (if (not (consp arg))
206 (string-match "^byte-" (symbol-name arg))) 206 (if (and (symbolp arg)
207 (intern (substring (symbol-name arg) 5)) 207 (string-match "^byte-" (symbol-name arg)))
208 arg) 208 (intern (substring (symbol-name arg) 5))
209 (if (integerp (setq c (car arg))) 209 arg)
210 (error "non-symbolic byte-op %s" c)) 210 (if (integerp (setq c (car arg)))
211 (if (eq c 'TAG) 211 (error "non-symbolic byte-op %s" c))
212 (setq c arg) 212 (if (eq c 'TAG)
213 (setq a (cond ((memq c byte-goto-ops) 213 (setq c arg)
214 (car (cdr (cdr arg)))) 214 (setq a (cond ((memq c byte-goto-ops)
215 ((memq c byte-constref-ops) 215 (car (cdr (cdr arg))))
216 (car (cdr arg))) 216 ((memq c byte-constref-ops)
217 (t (cdr arg)))) 217 (car (cdr arg)))
218 (setq c (symbol-name c)) 218 (t (cdr arg))))
219 (if (string-match "^byte-." c) 219 (setq c (symbol-name c))
220 (setq c (intern (substring c 5))))) 220 (if (string-match "^byte-." c)
221 (if (eq c 'constant) (setq c 'const)) 221 (setq c (intern (substring c 5)))))
222 (if (and (eq (cdr arg) 0) 222 (if (eq c 'constant) (setq c 'const))
223 (not (memq c '(unbind call const)))) 223 (if (and (eq (cdr arg) 0)
224 c 224 (not (memq c '(unbind call const))))
225 (format "(%s %s)" c a)))) 225 c
226 args))))) 226 (format "(%s %s)" c a))))
227 args)))))
227 228
228 (defmacro byte-compile-log-lap (format-string &rest args) 229 (defmacro byte-compile-log-lap (format-string &rest args)
229 (list 'and 230 (list 'and
230 '(memq byte-optimize-log '(t byte)) 231 '(memq byte-optimize-log '(t byte))
231 (cons 'byte-compile-log-lap-1 232 (cons 'byte-compile-log-lap-1
236 237
237 (put 'inline 'byte-optimizer 'byte-optimize-inline-handler) 238 (put 'inline 'byte-optimizer 'byte-optimize-inline-handler)
238 239
239 (defun byte-optimize-inline-handler (form) 240 (defun byte-optimize-inline-handler (form)
240 "byte-optimize-handler for the `inline' special-form." 241 "byte-optimize-handler for the `inline' special-form."
241 (cons 'progn 242 (cons
242 (mapcar 243 'progn
243 '(lambda (sexp) 244 (mapcar
244 (let ((fn (car-safe sexp))) 245 #'(lambda (sexp)
245 (if (and (symbolp fn) 246 (let ((fn (car-safe sexp)))
246 (or (cdr (assq fn byte-compile-function-environment)) 247 (if (and (symbolp fn)
247 (and (fboundp fn) 248 (or (cdr (assq fn byte-compile-function-environment))
248 (not (or (cdr (assq fn byte-compile-macro-environment)) 249 (and (fboundp fn)
249 (and (consp (setq fn (symbol-function fn))) 250 (not (or (cdr (assq fn byte-compile-macro-environment))
250 (eq (car fn) 'macro)) 251 (and (consp (setq fn (symbol-function fn)))
251 (subrp fn)))))) 252 (eq (car fn) 'macro))
252 (byte-compile-inline-expand sexp) 253 (subrp fn))))))
253 sexp))) 254 (byte-compile-inline-expand sexp)
254 (cdr form)))) 255 sexp)))
256 (cdr form))))
255 257
256 258
257 ;; Splice the given lap code into the current instruction stream. 259 ;; Splice the given lap code into the current instruction stream.
258 ;; If it has any labels in it, you're responsible for making sure there 260 ;; If it has any labels in it, you're responsible for making sure there
259 ;; are no collisions, and that byte-compile-tag-number is reasonable 261 ;; are no collisions, and that byte-compile-tag-number is reasonable
390 ;; recursively enter the optimizer for the bindings and body 392 ;; recursively enter the optimizer for the bindings and body
391 ;; of a let or let*. This for depth-firstness: forms that 393 ;; of a let or let*. This for depth-firstness: forms that
392 ;; are more deeply nested are optimized first. 394 ;; are more deeply nested are optimized first.
393 (cons fn 395 (cons fn
394 (cons 396 (cons
395 (mapcar '(lambda (binding) 397 (mapcar
396 (if (symbolp binding) 398 #'(lambda (binding)
397 binding 399 (if (symbolp binding)
398 (if (cdr (cdr binding)) 400 binding
399 (byte-compile-warn "malformed let binding: %s" 401 (if (cdr (cdr binding))
400 (prin1-to-string binding))) 402 (byte-compile-warn "malformed let binding: %s"
401 (list (car binding) 403 (prin1-to-string binding)))
402 (byte-optimize-form (nth 1 binding) nil)))) 404 (list (car binding)
403 (nth 1 form)) 405 (byte-optimize-form (nth 1 binding) nil))))
406 (nth 1 form))
404 (byte-optimize-body (cdr (cdr form)) for-effect)))) 407 (byte-optimize-body (cdr (cdr form)) for-effect))))
405 ((eq fn 'cond) 408 ((eq fn 'cond)
406 (cons fn 409 (cons fn
407 (mapcar '(lambda (clause) 410 (mapcar
408 (if (consp clause) 411 #'(lambda (clause)
409 (cons 412 (if (consp clause)
410 (byte-optimize-form (car clause) nil) 413 (cons
411 (byte-optimize-body (cdr clause) for-effect)) 414 (byte-optimize-form (car clause) nil)
412 (byte-compile-warn "malformed cond form: %s" 415 (byte-optimize-body (cdr clause) for-effect))
413 (prin1-to-string clause)) 416 (byte-compile-warn "malformed cond form: %s"
414 clause)) 417 (prin1-to-string clause))
415 (cdr form)))) 418 clause))
419 (cdr form))))
416 ((eq fn 'progn) 420 ((eq fn 'progn)
417 ;; as an extra added bonus, this simplifies (progn <x>) --> <x> 421 ;; as an extra added bonus, this simplifies (progn <x>) --> <x>
418 (if (cdr (cdr form)) 422 (if (cdr (cdr form))
419 (progn 423 (progn
420 (setq tmp (byte-optimize-body (cdr form) for-effect)) 424 (setq tmp (byte-optimize-body (cdr form) for-effect))
540 "The source-level pass of the optimizer." 544 "The source-level pass of the optimizer."
541 ;; 545 ;;
542 ;; First, optimize all sub-forms of this one. 546 ;; First, optimize all sub-forms of this one.
543 (setq form (byte-optimize-form-code-walker form for-effect)) 547 (setq form (byte-optimize-form-code-walker form for-effect))
544 ;; 548 ;;
545 ;; after optimizing all subforms, optimize this form until it doesn't 549 ;; After optimizing all subforms, optimize this form until it doesn't
546 ;; optimize any further. This means that some forms will be passed through 550 ;; optimize any further. This means that some forms will be passed through
547 ;; the optimizer many times, but that's necessary to make the for-effect 551 ;; the optimizer many times, but that's necessary to make the for-effect
548 ;; processing do as much as possible. 552 ;; processing do as much as possible.
549 ;; 553 ;;
550 (let (opt new) 554 (let (opt new)
562 new) 566 new)
563 form))) 567 form)))
564 568
565 569
566 (defun byte-optimize-body (forms all-for-effect) 570 (defun byte-optimize-body (forms all-for-effect)
567 ;; optimize the cdr of a progn or implicit progn; all forms is a list of 571 ;; Optimize the cdr of a progn or implicit progn; `forms' is a list of
568 ;; forms, all but the last of which are optimized with the assumption that 572 ;; forms, all but the last of which are optimized with the assumption that
569 ;; they are being called for effect. the last is for-effect as well if 573 ;; they are being called for effect. The last is for-effect as well if
570 ;; all-for-effect is true. returns a new list of forms. 574 ;; all-for-effect is true. Returns a new list of forms.
571 (let ((rest forms) 575 (let ((rest forms)
572 (result nil) 576 (result nil)
573 fe new) 577 fe new)
574 (while rest 578 (while rest
575 (setq fe (or all-for-effect (cdr rest))) 579 (setq fe (or all-for-effect (cdr rest)))
590 ;;; It is now safe to optimize code such that it introduces new bindings. 594 ;;; It is now safe to optimize code such that it introduces new bindings.
591 595
592 ;; I'd like this to be a defsubst, but let's not be self-referential... 596 ;; I'd like this to be a defsubst, but let's not be self-referential...
593 (defmacro byte-compile-trueconstp (form) 597 (defmacro byte-compile-trueconstp (form)
594 ;; Returns non-nil if FORM is a non-nil constant. 598 ;; Returns non-nil if FORM is a non-nil constant.
595 (` (cond ((consp (, form)) (eq (car (, form)) 'quote)) 599 `(cond ((consp ,form) (eq (car ,form) 'quote))
596 ((not (symbolp (, form)))) 600 ((not (symbolp ,form)))
597 ((eq (, form) t))))) 601 ((eq ,form t))
602 ((keywordp ,form))))
598 603
599 ;; If the function is being called with constant numeric args, 604 ;; If the function is being called with constant numeric args,
600 ;; evaluate as much as possible at compile-time. This optimizer 605 ;; evaluate as much as possible at compile-time. This optimizer
601 ;; assumes that the function is associative, like + or *. 606 ;; assumes that the function is associative, like + or *.
602 (defun byte-optimize-associative-math (form) 607 (defun byte-optimize-associative-math (form)
897 (put 'cdr-safe 'byte-optimizer 'byte-optimize-predicate) 902 (put 'cdr-safe 'byte-optimizer 'byte-optimize-predicate)
898 903
899 904
900 ;; I'm not convinced that this is necessary. Doesn't the optimizer loop 905 ;; I'm not convinced that this is necessary. Doesn't the optimizer loop
901 ;; take care of this? - Jamie 906 ;; take care of this? - Jamie
902 ;; I think this may some times be necessary to reduce ie (quote 5) to 5, 907 ;; I think this may some times be necessary to reduce eg. (quote 5) to 5,
903 ;; so arithmetic optimizers recognize the numeric constant. - Hallvard 908 ;; so arithmetic optimizers recognize the numeric constant. - Hallvard
904 (put 'quote 'byte-optimizer 'byte-optimize-quote) 909 (put 'quote 'byte-optimizer 'byte-optimize-quote)
905 (defun byte-optimize-quote (form) 910 (defun byte-optimize-quote (form)
906 (if (or (consp (nth 1 form)) 911 (if (or (consp (nth 1 form))
907 (and (symbolp (nth 1 form)) 912 (and (symbolp (nth 1 form))
1050 (or (if (or (null last) 1055 (or (if (or (null last)
1051 (eq (car-safe last) 'quote)) 1056 (eq (car-safe last) 'quote))
1052 (if (listp (nth 1 last)) 1057 (if (listp (nth 1 last))
1053 (let ((butlast (nreverse (cdr (reverse (cdr (cdr form))))))) 1058 (let ((butlast (nreverse (cdr (reverse (cdr (cdr form)))))))
1054 (nconc (list 'funcall fn) butlast 1059 (nconc (list 'funcall fn) butlast
1055 (mapcar '(lambda (x) (list 'quote x)) (nth 1 last)))) 1060 (mapcar #'(lambda (x) (list 'quote x)) (nth 1 last))))
1056 (byte-compile-warn 1061 (byte-compile-warn
1057 "last arg to apply can't be a literal atom: %s" 1062 "last arg to apply can't be a literal atom: %s"
1058 (prin1-to-string last)) 1063 (prin1-to-string last))
1059 nil)) 1064 nil))
1060 form))) 1065 form)))
1120 elt exp expt fboundp featurep 1125 elt exp expt fboundp featurep
1121 file-directory-p file-exists-p file-locked-p file-name-absolute-p 1126 file-directory-p file-exists-p file-locked-p file-name-absolute-p
1122 file-newer-than-file-p file-readable-p file-symlink-p file-writable-p 1127 file-newer-than-file-p file-readable-p file-symlink-p file-writable-p
1123 float floor format 1128 float floor format
1124 get get-buffer get-buffer-window getenv get-file-buffer 1129 get get-buffer get-buffer-window getenv get-file-buffer
1130 ;; hash-table functions
1131 make-hash-table copy-hash-table
1132 gethash
1133 hash-table-count
1134 hash-table-rehash-size
1135 hash-table-rehash-threshold
1136 hash-table-size
1137 hash-table-test
1138 hash-table-type
1139 ;;
1125 int-to-string 1140 int-to-string
1126 length log log10 logand logb logior lognot logxor lsh 1141 length log log10 logand logb logior lognot logxor lsh
1127 marker-buffer max member memq min mod 1142 marker-buffer max member memq min mod
1128 next-window nth nthcdr number-to-string 1143 next-window nth nthcdr number-to-string
1129 parse-colon-path previous-window 1144 parse-colon-path previous-window
1132 string-to-int string-to-number substring symbol-plist 1147 string-to-int string-to-number substring symbol-plist
1133 tan upcase user-variable-p vconcat 1148 tan upcase user-variable-p vconcat
1134 ;; XEmacs change: window-edges -> window-pixel-edges 1149 ;; XEmacs change: window-edges -> window-pixel-edges
1135 window-buffer window-dedicated-p window-pixel-edges window-height 1150 window-buffer window-dedicated-p window-pixel-edges window-height
1136 window-hscroll window-minibuffer-p window-width 1151 window-hscroll window-minibuffer-p window-width
1137 zerop)) 1152 zerop
1153 ;; functions defined by cl
1154 oddp evenp plusp minusp
1155 abs expt signum last butlast ldiff
1156 pairlis gcd lcm
1157 isqrt floor* ceiling* truncate* round* mod* rem* subseq
1158 list-length get* getf
1159 ))
1138 (side-effect-and-error-free-fns 1160 (side-effect-and-error-free-fns
1139 '(arrayp atom 1161 '(arrayp atom
1140 bobp bolp buffer-end buffer-list buffer-size buffer-string bufferp 1162 bobp bolp buffer-end buffer-list buffer-size buffer-string bufferp
1141 car-safe case-table-p cdr-safe char-or-string-p char-table-p 1163 car-safe case-table-p cdr-safe char-or-string-p char-table-p
1142 characterp commandp cons 1164 characterp commandp cons
1145 ;; XEmacs: extent functions, frame-live-p, various other stuff 1167 ;; XEmacs: extent functions, frame-live-p, various other stuff
1146 devicep device-live-p 1168 devicep device-live-p
1147 dot dot-marker eobp eolp eq eql equal eventp extentp 1169 dot dot-marker eobp eolp eq eql equal eventp extentp
1148 extent-live-p floatp framep frame-live-p 1170 extent-live-p floatp framep frame-live-p
1149 get-largest-window get-lru-window 1171 get-largest-window get-lru-window
1172 hash-table-p
1150 identity ignore integerp integer-or-marker-p interactive-p 1173 identity ignore integerp integer-or-marker-p interactive-p
1151 invocation-directory invocation-name 1174 invocation-directory invocation-name
1152 ;; keymapp may autoload in XEmacs, so not on this list! 1175 ;; keymapp may autoload in XEmacs, so not on this list!
1153 list listp 1176 list listp
1154 make-marker mark mark-marker markerp memory-limit minibuffer-window 1177 make-marker mark mark-marker markerp memory-limit minibuffer-window
1159 range-table-p 1182 range-table-p
1160 selected-window sequencep stringp subrp symbolp syntax-table-p 1183 selected-window sequencep stringp subrp symbolp syntax-table-p
1161 user-full-name user-login-name user-original-login-name 1184 user-full-name user-login-name user-original-login-name
1162 user-real-login-name user-real-uid user-uid 1185 user-real-login-name user-real-uid user-uid
1163 vector vectorp 1186 vector vectorp
1164 window-configuration-p window-live-p windowp))) 1187 window-configuration-p window-live-p windowp
1165 (while side-effect-free-fns 1188 ;; Functions defined by cl
1166 (put (car side-effect-free-fns) 'side-effect-free t) 1189 eql floatp-safe list* subst acons equalp random-state-p
1167 (setq side-effect-free-fns (cdr side-effect-free-fns))) 1190 copy-tree sublis
1168 (while side-effect-and-error-free-fns 1191 )))
1169 (put (car side-effect-and-error-free-fns) 'side-effect-free 'error-free) 1192 (dolist (fn side-effect-free-fns)
1170 (setq side-effect-and-error-free-fns (cdr side-effect-and-error-free-fns))) 1193 (put fn 'side-effect-free t))
1171 nil) 1194 (dolist (fn side-effect-and-error-free-fns)
1195 (put fn 'side-effect-free 'error-free)))
1172 1196
1173 1197
1174 (defun byte-compile-splice-in-already-compiled-code (form) 1198 (defun byte-compile-splice-in-already-compiled-code (form)
1175 ;; form is (byte-code "..." [...] n) 1199 ;; form is (byte-code "..." [...] n)
1176 (if (not (memq byte-optimize '(t lap))) 1200 (if (not (memq byte-optimize '(t lap)))
1324 (if (null (car (cdr (car lap)))) 1348 (if (null (car (cdr (car lap))))
1325 (setq lap (cdr lap))) 1349 (setq lap (cdr lap)))
1326 (if endtag 1350 (if endtag
1327 (setq lap (cons (cons nil endtag) lap))) 1351 (setq lap (cons (cons nil endtag) lap)))
1328 ;; remove addrs, lap = ( [ (op . arg) | (TAG tagno) ]* ) 1352 ;; remove addrs, lap = ( [ (op . arg) | (TAG tagno) ]* )
1329 (mapcar (function (lambda (elt) 1353 (mapcar #'(lambda (elt) (if (numberp elt) elt (cdr elt)))
1330 (if (numberp elt)
1331 elt
1332 (cdr elt))))
1333 (nreverse lap)))) 1354 (nreverse lap))))
1334 1355
1335 1356
1336 ;;; peephole optimizer 1357 ;;; peephole optimizer
1337 1358
1951 (eval-when-compile 1972 (eval-when-compile
1952 (or (compiled-function-p (symbol-function 'byte-optimize-form)) 1973 (or (compiled-function-p (symbol-function 'byte-optimize-form))
1953 (assq 'byte-code (symbol-function 'byte-optimize-form)) 1974 (assq 'byte-code (symbol-function 'byte-optimize-form))
1954 (let ((byte-optimize nil) 1975 (let ((byte-optimize nil)
1955 (byte-compile-warnings nil)) 1976 (byte-compile-warnings nil))
1956 (mapcar '(lambda (x) 1977 (mapcar
1957 (or noninteractive (message "compiling %s..." x)) 1978 #'(lambda (x)
1958 (byte-compile x) 1979 (or noninteractive (message "compiling %s..." x))
1959 (or noninteractive (message "compiling %s...done" x))) 1980 (byte-compile x)
1960 '(byte-optimize-form 1981 (or noninteractive (message "compiling %s...done" x)))
1961 byte-optimize-body 1982 '(byte-optimize-form
1962 byte-optimize-predicate 1983 byte-optimize-body
1963 byte-optimize-binary-predicate 1984 byte-optimize-predicate
1964 ;; Inserted some more than necessary, to speed it up. 1985 byte-optimize-binary-predicate
1965 byte-optimize-form-code-walker 1986 ;; Inserted some more than necessary, to speed it up.
1966 byte-optimize-lapcode)))) 1987 byte-optimize-form-code-walker
1988 byte-optimize-lapcode))))
1967 nil) 1989 nil)
1968 1990
1969 ;;; byte-optimize.el ends here 1991 ;;; byte-optimize.el ends here