diff options
| author | Stefan Monnier | 2023-07-13 20:11:55 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2023-07-13 20:13:32 -0400 |
| commit | fcade74066d82625e367c561a34971f52cf46a61 (patch) | |
| tree | c496c261380a248d39bcc74a144aba38bd94e47e /src/comp.c | |
| parent | 3ffb99f28f29cd98094f359ea316468572535aa0 (diff) | |
| download | emacs-fcade74066d82625e367c561a34971f52cf46a61.tar.gz emacs-fcade74066d82625e367c561a34971f52cf46a61.zip | |
src/comp.c: Use `pending_funcalls` to fix bug#64494
Make sure `comp.el` is never loaded synchronously by simply
delaying all calls to `native--compile-async` via `pending_funcalls`.
* lisp/startup.el (comp--compilable, comp--delayed-sources): Don't declare.
(startup--require-comp-safely)
(startup--honor-delayed-native-compilations): Delete functions.
(normal-top-level): Don't call `startup--honor-delayed-native-compilations`.
* src/comp.c (maybe_defer_native_compilation): Use `pending_funcalls`.
(syms_of_comp): Delete `Vcomp__delayed_sources` and `comp__compilable`.
Define `Qnative__compile_async`.
Diffstat (limited to 'src/comp.c')
| -rw-r--r-- | src/comp.c | 23 |
1 files changed, 5 insertions, 18 deletions
diff --git a/src/comp.c b/src/comp.c index 013ac6358c1..3c63cad18c7 100644 --- a/src/comp.c +++ b/src/comp.c | |||
| @@ -5199,17 +5199,9 @@ maybe_defer_native_compilation (Lisp_Object function_name, | |||
| 5199 | 5199 | ||
| 5200 | Fputhash (function_name, definition, Vcomp_deferred_pending_h); | 5200 | Fputhash (function_name, definition, Vcomp_deferred_pending_h); |
| 5201 | 5201 | ||
| 5202 | /* This is so deferred compilation is able to compile comp | 5202 | pending_funcalls |
| 5203 | dependencies breaking circularity. */ | 5203 | = Fcons (list (Qnative__compile_async, src, Qnil, Qlate), |
| 5204 | if (comp__compilable) | 5204 | pending_funcalls); |
| 5205 | { | ||
| 5206 | /* Startup is done, comp is usable. */ | ||
| 5207 | CALL0I (startup--require-comp-safely); | ||
| 5208 | CALLN (Ffuncall, intern_c_string ("native--compile-async"), | ||
| 5209 | src, Qnil, Qlate); | ||
| 5210 | } | ||
| 5211 | else | ||
| 5212 | Vcomp__delayed_sources = Fcons (src, Vcomp__delayed_sources); | ||
| 5213 | } | 5205 | } |
| 5214 | 5206 | ||
| 5215 | 5207 | ||
| @@ -5674,13 +5666,6 @@ void | |||
| 5674 | syms_of_comp (void) | 5666 | syms_of_comp (void) |
| 5675 | { | 5667 | { |
| 5676 | #ifdef HAVE_NATIVE_COMP | 5668 | #ifdef HAVE_NATIVE_COMP |
| 5677 | DEFVAR_LISP ("comp--delayed-sources", Vcomp__delayed_sources, | ||
| 5678 | doc: /* List of sources to be native-compiled when startup is finished. | ||
| 5679 | For internal use. */); | ||
| 5680 | DEFVAR_BOOL ("comp--compilable", comp__compilable, | ||
| 5681 | doc: /* Non-nil when comp.el can be native compiled. | ||
| 5682 | For internal use. */); | ||
| 5683 | /* Compiler control customizes. */ | ||
| 5684 | DEFVAR_BOOL ("native-comp-jit-compilation", native_comp_jit_compilation, | 5669 | DEFVAR_BOOL ("native-comp-jit-compilation", native_comp_jit_compilation, |
| 5685 | doc: /* If non-nil, compile loaded .elc files asynchronously. | 5670 | doc: /* If non-nil, compile loaded .elc files asynchronously. |
| 5686 | 5671 | ||
| @@ -5798,6 +5783,8 @@ natively-compiled one. */); | |||
| 5798 | build_pure_c_string ("eln file inconsistent with current runtime " | 5783 | build_pure_c_string ("eln file inconsistent with current runtime " |
| 5799 | "configuration, please recompile")); | 5784 | "configuration, please recompile")); |
| 5800 | 5785 | ||
| 5786 | DEFSYM (Qnative__compile_async, "native--compile-async"); | ||
| 5787 | |||
| 5801 | defsubr (&Scomp__subr_signature); | 5788 | defsubr (&Scomp__subr_signature); |
| 5802 | defsubr (&Scomp_el_to_eln_rel_filename); | 5789 | defsubr (&Scomp_el_to_eln_rel_filename); |
| 5803 | defsubr (&Scomp_el_to_eln_filename); | 5790 | defsubr (&Scomp_el_to_eln_filename); |