Better internal-make-closure optimisation
* lisp/emacs-lisp/byte-opt.el (byte-optimize-form-code-walker): Optimise closed-over values in closure creation like any other, which can lead to stack variables being eliminated.
This commit is contained in:
parent
5d3d84066f
commit
6058b4559d
1 changed files with 4 additions and 10 deletions
|
@ -447,16 +447,10 @@ for speeding up processing.")
|
|||
. ,(byte-optimize-body exps for-effect)))
|
||||
|
||||
;; Needed as long as we run byte-optimize-form after cconv.
|
||||
(`(internal-make-closure . ,_)
|
||||
(and (not for-effect)
|
||||
(progn
|
||||
;; Look up free vars and mark them to be kept, so that they
|
||||
;; won't be optimized away.
|
||||
(dolist (var (caddr form))
|
||||
(let ((lexvar (assq var byte-optimize--lexvars)))
|
||||
(when lexvar
|
||||
(setcar (cdr lexvar) t))))
|
||||
form)))
|
||||
(`(internal-make-closure ,vars ,env . ,rest)
|
||||
(if for-effect
|
||||
`(progn ,@(byte-optimize-body env t))
|
||||
`(,fn ,vars ,(mapcar #'byte-optimize-form env) . ,rest)))
|
||||
|
||||
(`((lambda . ,_) . ,_)
|
||||
(let ((newform (macroexp--unfold-lambda form)))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue