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.
This commit is contained in:
parent
0b58be4941
commit
87c6aa13b3
3 changed files with 18 additions and 0 deletions
|
@ -510,6 +510,11 @@ lost after dumping")))
|
|||
((equal dump-mode "bootstrap") "emacs")
|
||||
((equal dump-mode "pbootstrap") "bootstrap-emacs.pdmp")
|
||||
(t (error "unrecognized dump mode %s" dump-mode)))))
|
||||
(when (and (boundp 'comp-ctxt)
|
||||
(equal dump-mode "pdump"))
|
||||
;; Don't enable this before bootstrap is completed the as the
|
||||
;; compiler infrastructure may not be usable.
|
||||
(setq comp-enable-subr-trampolines t))
|
||||
(message "Dumping under the name %s" output)
|
||||
(condition-case ()
|
||||
(delete-file output)
|
||||
|
|
|
@ -5141,6 +5141,7 @@ native compiled one. */);
|
|||
DEFSYM (Qlate, "late");
|
||||
DEFSYM (Qlambda_fixup, "lambda-fixup");
|
||||
DEFSYM (Qgccjit, "gccjit");
|
||||
DEFSYM (Qcomp_subr_trampoline_install, "comp-subr-trampoline-install")
|
||||
|
||||
/* To be signaled by the compiler. */
|
||||
DEFSYM (Qnative_compiler_error, "native-compiler-error");
|
||||
|
@ -5246,6 +5247,11 @@ 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_BOOL ("comp-enable-subr-trampolines", comp_enable_subr_trampolines,
|
||||
doc: /* When non-nil enable trampoline synthesis
|
||||
triggerd by `fset' making primitives
|
||||
redefinable effectivelly. */);
|
||||
|
||||
DEFVAR_LISP ("comp-installed-trampolines-h", Vcomp_installed_trampolines_h,
|
||||
doc: /* Hash table subr-name -> bool. */);
|
||||
Vcomp_installed_trampolines_h = CALLN (Fmake_hash_table);
|
||||
|
|
|
@ -775,6 +775,13 @@ DEFUN ("fset", Ffset, Sfset, 2, 2, 0,
|
|||
|
||||
eassert (valid_lisp_object_p (definition));
|
||||
|
||||
#ifdef HAVE_NATIVE_COMP
|
||||
if (comp_enable_subr_trampolines
|
||||
&& SUBRP (function)
|
||||
&& !SUBR_NATIVE_COMPILEDP (function))
|
||||
CALLN (Ffuncall, Qcomp_subr_trampoline_install, symbol);
|
||||
#endif
|
||||
|
||||
set_symbol_function (symbol, definition);
|
||||
|
||||
return definition;
|
||||
|
|
Loading…
Add table
Reference in a new issue