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`.
This commit is contained in:
parent
3ffb99f28f
commit
fcade74066
3 changed files with 7 additions and 41 deletions
|
@ -4226,6 +4226,7 @@ LOAD and SELECTOR work as described in `native--compile-async'."
|
|||
(string-match-p re file))
|
||||
native-comp-jit-compilation-deny-list))))
|
||||
|
||||
;;;###autoload
|
||||
(defun native--compile-async (files &optional recursively load selector)
|
||||
;; BEWARE, this function is also called directly from C.
|
||||
"Compile FILES asynchronously.
|
||||
|
|
|
@ -520,27 +520,6 @@ DIRS are relative."
|
|||
xdg-dir)
|
||||
(t emacs-d-dir))))
|
||||
|
||||
(defvar comp--compilable)
|
||||
(defvar comp--delayed-sources)
|
||||
(defun startup--require-comp-safely ()
|
||||
"Require the native compiler avoiding circular dependencies."
|
||||
(when (featurep 'native-compile)
|
||||
;; Require comp with `comp--compilable' set to nil to break
|
||||
;; circularity.
|
||||
(let ((comp--compilable nil))
|
||||
(require 'comp))
|
||||
(native--compile-async comp--delayed-sources nil 'late)
|
||||
(setq comp--delayed-sources nil)))
|
||||
|
||||
(declare-function native--compile-async "comp.el"
|
||||
(files &optional recursively load selector))
|
||||
(defun startup--honor-delayed-native-compilations ()
|
||||
"Honor pending delayed deferred native compilations."
|
||||
(when (and (native-comp-available-p)
|
||||
comp--delayed-sources)
|
||||
(startup--require-comp-safely))
|
||||
(setq comp--compilable t))
|
||||
|
||||
(defvar native-comp-eln-load-path)
|
||||
(defvar native-comp-jit-compilation)
|
||||
(defvar native-comp-enable-subr-trampolines)
|
||||
|
@ -846,8 +825,7 @@ It is the default value of the variable `top-level'."
|
|||
nil)))
|
||||
(setq env (cdr env)))))
|
||||
(when display
|
||||
(setq process-environment (delete display process-environment)))))
|
||||
(startup--honor-delayed-native-compilations))
|
||||
(setq process-environment (delete display process-environment))))))
|
||||
|
||||
;; Precompute the keyboard equivalents in the menu bar items.
|
||||
;; Command-line options supported by tty's:
|
||||
|
|
23
src/comp.c
23
src/comp.c
|
@ -5199,17 +5199,9 @@ maybe_defer_native_compilation (Lisp_Object function_name,
|
|||
|
||||
Fputhash (function_name, definition, Vcomp_deferred_pending_h);
|
||||
|
||||
/* This is so deferred compilation is able to compile comp
|
||||
dependencies breaking circularity. */
|
||||
if (comp__compilable)
|
||||
{
|
||||
/* Startup is done, comp is usable. */
|
||||
CALL0I (startup--require-comp-safely);
|
||||
CALLN (Ffuncall, intern_c_string ("native--compile-async"),
|
||||
src, Qnil, Qlate);
|
||||
}
|
||||
else
|
||||
Vcomp__delayed_sources = Fcons (src, Vcomp__delayed_sources);
|
||||
pending_funcalls
|
||||
= Fcons (list (Qnative__compile_async, src, Qnil, Qlate),
|
||||
pending_funcalls);
|
||||
}
|
||||
|
||||
|
||||
|
@ -5674,13 +5666,6 @@ void
|
|||
syms_of_comp (void)
|
||||
{
|
||||
#ifdef HAVE_NATIVE_COMP
|
||||
DEFVAR_LISP ("comp--delayed-sources", Vcomp__delayed_sources,
|
||||
doc: /* List of sources to be native-compiled when startup is finished.
|
||||
For internal use. */);
|
||||
DEFVAR_BOOL ("comp--compilable", comp__compilable,
|
||||
doc: /* Non-nil when comp.el can be native compiled.
|
||||
For internal use. */);
|
||||
/* Compiler control customizes. */
|
||||
DEFVAR_BOOL ("native-comp-jit-compilation", native_comp_jit_compilation,
|
||||
doc: /* If non-nil, compile loaded .elc files asynchronously.
|
||||
|
||||
|
@ -5798,6 +5783,8 @@ natively-compiled one. */);
|
|||
build_pure_c_string ("eln file inconsistent with current runtime "
|
||||
"configuration, please recompile"));
|
||||
|
||||
DEFSYM (Qnative__compile_async, "native--compile-async");
|
||||
|
||||
defsubr (&Scomp__subr_signature);
|
||||
defsubr (&Scomp_el_to_eln_rel_filename);
|
||||
defsubr (&Scomp_el_to_eln_filename);
|
||||
|
|
Loading…
Add table
Reference in a new issue