diff options
| author | Andrea Corallo | 2020-10-02 22:36:05 +0200 |
|---|---|---|
| committer | Andrea Corallo | 2020-10-05 21:32:38 +0200 |
| commit | 87c6aa13b30281398688ec8693a0205bb84bc648 (patch) | |
| tree | bcc138d8745d03985ac0008022204070fa36e046 /src | |
| parent | 0b58be4941c92d337eccadabaaba5ef8620c5b52 (diff) | |
| download | emacs-87c6aa13b30281398688ec8693a0205bb84bc648.tar.gz emacs-87c6aa13b30281398688ec8693a0205bb84bc648.zip | |
Make primitive redefinition effective through trampoline synthesis
* lisp/loadup.el (dump-mode): Set `comp-enable-subr-trampolines'
when finished bootstrap.
* src/data.c (Ffset): Call `comp-enable-subr-trampolines' when
redefining a subr.
* src/comp.c (syms_of_comp): Define `comp-subr-trampoline-install'
symbol.
(syms_of_comp): Define `comp-enable-subr-trampolines' variable.
Diffstat (limited to 'src')
| -rw-r--r-- | src/comp.c | 6 | ||||
| -rw-r--r-- | src/data.c | 7 |
2 files changed, 13 insertions, 0 deletions
diff --git a/src/comp.c b/src/comp.c index 5663c9e5624..076236ef80c 100644 --- a/src/comp.c +++ b/src/comp.c | |||
| @@ -5141,6 +5141,7 @@ native compiled one. */); | |||
| 5141 | DEFSYM (Qlate, "late"); | 5141 | DEFSYM (Qlate, "late"); |
| 5142 | DEFSYM (Qlambda_fixup, "lambda-fixup"); | 5142 | DEFSYM (Qlambda_fixup, "lambda-fixup"); |
| 5143 | DEFSYM (Qgccjit, "gccjit"); | 5143 | DEFSYM (Qgccjit, "gccjit"); |
| 5144 | DEFSYM (Qcomp_subr_trampoline_install, "comp-subr-trampoline-install") | ||
| 5144 | 5145 | ||
| 5145 | /* To be signaled by the compiler. */ | 5146 | /* To be signaled by the compiler. */ |
| 5146 | DEFSYM (Qnative_compiler_error, "native-compiler-error"); | 5147 | DEFSYM (Qnative_compiler_error, "native-compiler-error"); |
| @@ -5246,6 +5247,11 @@ The last directory of this list is assumed to be the system one. */); | |||
| 5246 | dump reload. */ | 5247 | dump reload. */ |
| 5247 | Vcomp_eln_load_path = Fcons (build_string ("../native-lisp/"), Qnil); | 5248 | Vcomp_eln_load_path = Fcons (build_string ("../native-lisp/"), Qnil); |
| 5248 | 5249 | ||
| 5250 | DEFVAR_BOOL ("comp-enable-subr-trampolines", comp_enable_subr_trampolines, | ||
| 5251 | doc: /* When non-nil enable trampoline synthesis | ||
| 5252 | triggerd by `fset' making primitives | ||
| 5253 | redefinable effectivelly. */); | ||
| 5254 | |||
| 5249 | DEFVAR_LISP ("comp-installed-trampolines-h", Vcomp_installed_trampolines_h, | 5255 | DEFVAR_LISP ("comp-installed-trampolines-h", Vcomp_installed_trampolines_h, |
| 5250 | doc: /* Hash table subr-name -> bool. */); | 5256 | doc: /* Hash table subr-name -> bool. */); |
| 5251 | Vcomp_installed_trampolines_h = CALLN (Fmake_hash_table); | 5257 | Vcomp_installed_trampolines_h = CALLN (Fmake_hash_table); |
diff --git a/src/data.c b/src/data.c index 8c39c319110..c6629dd5f29 100644 --- a/src/data.c +++ b/src/data.c | |||
| @@ -775,6 +775,13 @@ DEFUN ("fset", Ffset, Sfset, 2, 2, 0, | |||
| 775 | 775 | ||
| 776 | eassert (valid_lisp_object_p (definition)); | 776 | eassert (valid_lisp_object_p (definition)); |
| 777 | 777 | ||
| 778 | #ifdef HAVE_NATIVE_COMP | ||
| 779 | if (comp_enable_subr_trampolines | ||
| 780 | && SUBRP (function) | ||
| 781 | && !SUBR_NATIVE_COMPILEDP (function)) | ||
| 782 | CALLN (Ffuncall, Qcomp_subr_trampoline_install, symbol); | ||
| 783 | #endif | ||
| 784 | |||
| 778 | set_symbol_function (symbol, definition); | 785 | set_symbol_function (symbol, definition); |
| 779 | 786 | ||
| 780 | return definition; | 787 | return definition; |