[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
feature/native-comp 94736c4 09/11: Do not install a subr trampoline twic
From: |
Andrea Corallo |
Subject: |
feature/native-comp 94736c4 09/11: Do not install a subr trampoline twice |
Date: |
Thu, 24 Sep 2020 04:13:19 -0400 (EDT) |
branch: feature/native-comp
commit 94736c413ff728833f260acf125ff3a572e270d6
Author: Andrea Corallo <akrl@sdf.org>
Commit: Andrea Corallo <akrl@sdf.org>
Do not install a subr trampoline twice
* src/comp.c (syms_of_comp): Define and initialize
'Vcomp_installed_trampolines_h'.
(Fcomp__install_trampoline): Fill 'Vcomp_installed_trampolines_h'
* lisp/emacs-lisp/comp.el (comp--subr-safe-advice): Make use of
`comp-installed-trampolines-h' to guard against installing a
trampoline twice.
---
lisp/emacs-lisp/comp.el | 3 ++-
src/comp.c | 5 +++++
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el
index e33d58c..8b8b111 100644
--- a/lisp/emacs-lisp/comp.el
+++ b/lisp/emacs-lisp/comp.el
@@ -2601,7 +2601,8 @@ Return the its filename if found or nil otherwise."
;;;###autoload
(defun comp--subr-safe-advice (subr-name)
"Make SUBR-NAME effectively advice-able when called from native code."
- (unless (memq subr-name comp-never-optimize-functions)
+ (unless (or (memq subr-name comp-never-optimize-functions)
+ (gethash subr-name comp-installed-trampolines-h))
(let ((trampoline-sym (comp-trampoline-sym subr-name)))
(cl-assert (subr-primitive-p (symbol-function subr-name)))
(load (or (comp-search-trampoline subr-name)
diff --git a/src/comp.c b/src/comp.c
index db6aee9..15782cc 100644
--- a/src/comp.c
+++ b/src/comp.c
@@ -4126,6 +4126,7 @@ DEFUN ("comp--install-trampoline",
Fcomp__install_trampoline,
if (EQ (subr, orig_subr))
{
freloc.link_table[i] = XSUBR (trampoline)->function.a0;
+ Fputhash (subr_name, Qt, Vcomp_installed_trampolines_h);
return Qt;
}
i++;
@@ -5257,6 +5258,10 @@ The last directory of this list is assumed to be the
system one. */);
dump reload. */
Vcomp_eln_load_path = Fcons (build_string ("../native-lisp/"), Qnil);
+ DEFVAR_LISP ("comp-installed-trampolines-h", Vcomp_installed_trampolines_h,
+ doc: /* Hash table subr-name -> bool. */);
+ Vcomp_installed_trampolines_h = CALLN (Fmake_hash_table);
+
#endif /* #ifdef HAVE_NATIVE_COMP */
defsubr (&Snative_comp_available_p);
- feature/native-comp updated (4a50f54 -> e5b052d), Andrea Corallo, 2020/09/24
- feature/native-comp 63c65b4 01/11: * lisp/emacs-lisp/comp.el (native-compile): Add OUTPUT parameter., Andrea Corallo, 2020/09/24
- feature/native-comp 2ab0966 03/11: Make CHECK_SUBR public, Andrea Corallo, 2020/09/24
- feature/native-comp 3ec1b93 05/11: * Add `comp--subr-safe-advice' entry point, Andrea Corallo, 2020/09/24
- feature/native-comp 2f78ac3 04/11: * Add `comp--install-trampoline' machinery, Andrea Corallo, 2020/09/24
- feature/native-comp 0cc1804 07/11: Add a test for primitive advicing effectiveness, Andrea Corallo, 2020/09/24
- feature/native-comp b94a0a9 08/11: * lisp/emacs-lisp/comp.el (comp-never-optimize-functions): Clean-up., Andrea Corallo, 2020/09/24
- feature/native-comp 9d4fd66 02/11: * lisp/emacs-lisp/comp.el (comp-final): Log when interactively invoked., Andrea Corallo, 2020/09/24
- feature/native-comp 6d83902 10/11: * lisp/emacs-lisp/comp.el (comp-body-eff): Improve style., Andrea Corallo, 2020/09/24
- feature/native-comp 94736c4 09/11: Do not install a subr trampoline twice,
Andrea Corallo <=
- feature/native-comp e5b052d 11/11: Rename comp--subr-safe-advice -> comp-subr-safe-advice, Andrea Corallo, 2020/09/24
- feature/native-comp db354ff 06/11: Call `comp--subr-safe-advice' from the advice machinery, Andrea Corallo, 2020/09/24