mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-06 06:20:55 -08:00
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
|
|
@ -342,8 +342,12 @@ for speeding up processing.")
|
|||
(numberp expr)
|
||||
(stringp expr)
|
||||
(and (consp expr)
|
||||
(memq (car expr) '(quote function))
|
||||
(symbolp (cadr expr)))
|
||||
(or (and (memq (car expr) '(quote function))
|
||||
(symbolp (cadr expr)))
|
||||
;; (internal-get-closed-var N) can be considered constant for
|
||||
;; const-prop purposes.
|
||||
(and (eq (car expr) 'internal-get-closed-var)
|
||||
(integerp (cadr expr)))))
|
||||
(keywordp expr)))
|
||||
|
||||
(defmacro byte-optimize--pcase (exp &rest cases)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue