Update handling of advices during preload
* lisp/emacs-lisp/comp-common.el (native-comp-never-optimize-functions): Remove macroexpand and rename-buffer from default value. * lisp/emacs-lisp/comp.el (comp-call-optim-form-call): Document call optimization for advised primitives. * lisp/emacs-lisp/nadvice.el (advice-add): Remove references to TODOs that were completed already earlier. * lisp/loadup.el: Disallow advices during preload. (Bug#67005)
This commit is contained in:
parent
f5e4524708
commit
e670412a3e
4 changed files with 21 additions and 7 deletions
|
@ -49,11 +49,10 @@ This is intended for debugging the compiler itself.
|
|||
:version "28.1")
|
||||
|
||||
(defcustom native-comp-never-optimize-functions
|
||||
'(eval
|
||||
;; The following two are mandatory for Emacs to be working
|
||||
;; correctly (see comment in `advice--add-function'). DO NOT
|
||||
;; REMOVE.
|
||||
macroexpand rename-buffer)
|
||||
;; We used to list those functions here that were advised during
|
||||
;; preload, but we now prefer to disallow preload advices in
|
||||
;; loadup.el (bug#67005).
|
||||
'(eval)
|
||||
"Primitive functions to exclude from trampoline optimization.
|
||||
|
||||
Primitive functions included in this list will not be called
|
||||
|
|
|
@ -2789,6 +2789,14 @@ FUNCTION can be a function-name or byte compiled function."
|
|||
(symbol-function callee)
|
||||
(cl-assert (byte-code-function-p callee))
|
||||
callee))
|
||||
;; Below call to `subrp' returns nil on an advised
|
||||
;; primitive F, so that we do not optimize calls to F
|
||||
;; with the funcall trampoline removal below. But if F
|
||||
;; is advised while we compile its call, it is very
|
||||
;; likely to be advised also when that call is executed.
|
||||
;; And in that case an "unoptimized" call to F is
|
||||
;; actually cheaper since it avoids the call to the
|
||||
;; intermediate native trampoline (bug#67005).
|
||||
(subrp (subrp f))
|
||||
(comp-func-callee (comp-func-in-unit callee)))
|
||||
(cond
|
||||
|
|
|
@ -509,8 +509,6 @@ HOW can be one of:
|
|||
<<>>"
|
||||
;; TODO:
|
||||
;; - record the advice location, to display in describe-function.
|
||||
;; - change all defadvice in lisp/**/*.el.
|
||||
;; - obsolete advice.el.
|
||||
(let* ((f (symbol-function symbol))
|
||||
(nf (advice--normalize symbol f)))
|
||||
(unless (eq f nf) (fset symbol nf))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue