Make `comp-enable-subr-trampolines' effective for advices (bug#45854)

* src/comp.c: Copyright update.
	(syms_of_comp): Update `comp-enable-subr-trampolines' doc.
	* lisp/emacs-lisp/comp.el (comp-subr-trampoline-install): Check
	for `comp-enable-subr-trampolines'.
This commit is contained in:
Andrea Corallo 2021-01-17 16:50:16 +01:00
parent 88100bed0a
commit 883d937320
2 changed files with 5 additions and 4 deletions

View file

@ -3668,7 +3668,8 @@ Return the trampoline if found or nil otherwise."
;;;###autoload
(defun comp-subr-trampoline-install (subr-name)
"Make SUBR-NAME effectively advice-able when called from native code."
(unless (or (memq subr-name comp-never-optimize-functions)
(unless (or (null comp-enable-subr-trampolines)
(memq subr-name comp-never-optimize-functions)
(gethash subr-name comp-installed-trampolines-h))
(cl-assert (subr-primitive-p (symbol-function subr-name)))
(comp--install-trampoline

View file

@ -1,5 +1,5 @@
/* Compile elisp into native code.
Copyright (C) 2019-2020 Free Software Foundation, Inc.
Copyright (C) 2019-2021 Free Software Foundation, Inc.
Author: Andrea Corallo <akrl@sdf.org>
@ -5269,8 +5269,8 @@ The last directory of this list is assumed to be the system one. */);
Vcomp_eln_load_path = Fcons (build_string ("../native-lisp/"), Qnil);
DEFVAR_BOOL ("comp-enable-subr-trampolines", comp_enable_subr_trampolines,
doc: /* If non-nil, enable trampoline synthesis triggered by `fset'.
This makes primitives redefinable effectively. */);
doc: /* If non-nil enable primitive trampoline synthesis.
This makes primitive functions redefinable or advisable effectively. */);
DEFVAR_LISP ("comp-installed-trampolines-h", Vcomp_installed_trampolines_h,
doc: /* Hash table subr-name -> installed trampoline.