mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-06 22:41:06 -08:00
* lisp/emacs-lisp/byte-opt.el: Make the build more reproducible
(byte-compile-inline-expand): When inlining code from another file, always inline the byte-code version of the function. (byte-optimize--pcase): Simplify edebug spec.
This commit is contained in:
parent
7a46fa9c75
commit
354ecaf12b
1 changed files with 13 additions and 27 deletions
|
|
@ -268,32 +268,18 @@
|
||||||
;; The byte-code will be really inlined in byte-compile-unfold-bcf.
|
;; The byte-code will be really inlined in byte-compile-unfold-bcf.
|
||||||
`(,fn ,@(cdr form)))
|
`(,fn ,@(cdr form)))
|
||||||
((or `(lambda . ,_) `(closure . ,_))
|
((or `(lambda . ,_) `(closure . ,_))
|
||||||
(if (not (or (eq fn localfn) ;From the same file => same mode.
|
(if (eq fn localfn) ;From the same file => same mode.
|
||||||
(eq (car fn) ;Same mode.
|
(macroexp--unfold-lambda `(,fn ,@(cdr form)))
|
||||||
(if lexical-binding 'closure 'lambda))))
|
;; While byte-compile-unfold-bcf can inline dynbind byte-code into
|
||||||
;; While byte-compile-unfold-bcf can inline dynbind byte-code into
|
;; letbind byte-code (or any other combination for that matter), we
|
||||||
;; letbind byte-code (or any other combination for that matter), we
|
;; can only inline dynbind source into dynbind source or letbind
|
||||||
;; can only inline dynbind source into dynbind source or letbind
|
;; source into letbind source.
|
||||||
;; source into letbind source.
|
;; We can of course byte-compile the inlined function
|
||||||
(progn
|
;; first, and then inline its byte-code. This also has the advantage
|
||||||
;; We can of course byte-compile the inlined function
|
;; that the final code does not depend on the order of compilation
|
||||||
;; first, and then inline its byte-code.
|
;; of ELisp files, making the build more reproducible.
|
||||||
(byte-compile name)
|
(byte-compile name)
|
||||||
`(,(symbol-function name) ,@(cdr form)))
|
`(,(symbol-function name) ,@(cdr form))))
|
||||||
(let ((newfn (if (eq fn localfn)
|
|
||||||
;; If `fn' is from the same file, it has already
|
|
||||||
;; been preprocessed!
|
|
||||||
`(function ,fn)
|
|
||||||
;; Try and process it "in its original environment".
|
|
||||||
(let ((byte-compile-bound-variables nil))
|
|
||||||
(byte-compile-preprocess
|
|
||||||
(byte-compile--reify-function fn))))))
|
|
||||||
(if (eq (car-safe newfn) 'function)
|
|
||||||
(macroexp--unfold-lambda `(,(cadr newfn) ,@(cdr form)))
|
|
||||||
;; This can happen because of macroexp-warn-and-return &co.
|
|
||||||
(byte-compile-warn
|
|
||||||
"Inlining closure %S failed" name)
|
|
||||||
form))))
|
|
||||||
|
|
||||||
(_ ;; Give up on inlining.
|
(_ ;; Give up on inlining.
|
||||||
form))))
|
form))))
|
||||||
|
|
@ -369,7 +355,7 @@ Same format as `byte-optimize--lexvars', with shared structure and contents.")
|
||||||
;; to `(if . (or `(,exp ,then ,else) pcase--dontcare))'.
|
;; to `(if . (or `(,exp ,then ,else) pcase--dontcare))'.
|
||||||
;;
|
;;
|
||||||
;; The resulting macroexpansion is also significantly cleaner/smaller/faster.
|
;; The resulting macroexpansion is also significantly cleaner/smaller/faster.
|
||||||
(declare (indent 1) (debug (form &rest (pcase-PAT body))))
|
(declare (indent 1) (debug pcase))
|
||||||
`(pcase ,exp
|
`(pcase ,exp
|
||||||
. ,(mapcar (lambda (case)
|
. ,(mapcar (lambda (case)
|
||||||
`(,(pcase (car case)
|
`(,(pcase (car case)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue