Constant-propagate access to captured variables
* lisp/emacs-lisp/byte-opt.el (byte-optimize--substitutable-p): Treat (internal-get-closed-var N) as constants for propagation purposes, because that is effectively what such forms will be compiled to. This allows for the elimination of some lexical variables. * test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-tests--test-cases): Add test case.
This commit is contained in:
parent
36cd4f5d81
commit
8716f21d94
2 changed files with 12 additions and 2 deletions
|
@ -686,6 +686,12 @@ inner loops respectively."
|
|||
(let* ((x 'a))
|
||||
(list x (funcall g) (funcall h)))))))
|
||||
(funcall (funcall f 'b)))
|
||||
|
||||
;; Test constant-propagation of access to captured variables.
|
||||
(let* ((x 2)
|
||||
(f (lambda ()
|
||||
(let ((y x)) (list y 3 y)))))
|
||||
(funcall f))
|
||||
)
|
||||
"List of expressions for cross-testing interpreted and compiled code.")
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue