diff options
author | Mattias EngdegÄrd <mattiase@acm.org> | 2021-06-10 21:27:16 +0200 |
---|---|---|
committer | Mattias EngdegÄrd <mattiase@acm.org> | 2021-09-06 16:47:13 +0200 |
commit | bba48d6ee5d90f326c70cbe8af19dfe6b00651ba (patch) | |
tree | 4f63312d69c51ddcaecb34799a784c85d97de1ef /lisp/emacs-lisp/bytecomp.el | |
parent | fab1e220dbe38ab7a2f46b673dfc03964e496798 (diff) | |
download | emacs-bba48d6ee5d90f326c70cbe8af19dfe6b00651ba.tar.gz emacs-bba48d6ee5d90f326c70cbe8af19dfe6b00651ba.tar.bz2 emacs-bba48d6ee5d90f326c70cbe8af19dfe6b00651ba.zip |
More robust optimisation of `ignore`
Treat `ignore` as any other function during source-level optimisation,
to avoid having its warning-suppression effects cancelled by repeated
passes. Instead, define a custom code generation function.
* lisp/emacs-lisp/byte-opt.el (byte-optimize-form-code-walker):
Don't treat `ignore' specially here.
(side-effect-free-fns): Don't mark `ignore` as side-effect-free
or error-free (although it is), since that would allow the optimiser
to elide calls.
* lisp/emacs-lisp/bytecomp.el (ignore, byte-compile-ignore):
Define and register a code-gen function.
Diffstat (limited to 'lisp/emacs-lisp/bytecomp.el')
-rw-r--r-- | lisp/emacs-lisp/bytecomp.el | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index 145cdbaa6ed..8ea591b5d0e 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -4207,6 +4207,7 @@ discarding." (byte-defop-compiler-1 funcall) (byte-defop-compiler-1 let) (byte-defop-compiler-1 let* byte-compile-let) +(byte-defop-compiler-1 ignore) (defun byte-compile-progn (form) (byte-compile-body-do-effect (cdr form))) @@ -4222,6 +4223,11 @@ discarding." (if ,discard 'byte-goto-if-nil 'byte-goto-if-nil-else-pop)) ,tag)) +(defun byte-compile-ignore (form) + (dolist (arg (cdr form)) + (byte-compile-form arg t)) + (byte-compile-form nil)) + ;; Return the list of items in CONDITION-PARAM that match PRED-LIST. ;; Only return items that are not in ONLY-IF-NOT-PRESENT. (defun byte-compile-find-bound-condition (condition-param |