summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorAndrea Corallo <akrl@sdf.org>2021-11-30 14:18:58 +0100
committerAndrea Corallo <akrl@sdf.org>2021-11-30 15:42:41 +0100
commit9b381a95ef6cd9194d64bfb17fd50bb99fa6cd32 (patch)
tree2beaee9f148cae181ff7948dc9fb9ee12f88b839 /lisp
parent7b235b1ec05c48d70ea44982f04b7b5f4052fa05 (diff)
downloademacs-9b381a95ef6cd9194d64bfb17fd50bb99fa6cd32.tar.gz
emacs-9b381a95ef6cd9194d64bfb17fd50bb99fa6cd32.tar.bz2
emacs-9b381a95ef6cd9194d64bfb17fd50bb99fa6cd32.zip
Improve native compiler startup circular dependecy prevention mechanism
* src/comp.c (maybe_defer_native_compilation): Update to accumulate delayed objects in `comp--delayed-sources'. (syms_of_comp): Add `comp--delayed-sources' and `comp--loadable' vars. * lisp/startup.el (startup--honor-delayed-native-compilations): New function. (normal-top-level): Call it.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/startup.el16
1 files changed, 15 insertions, 1 deletions
diff --git a/lisp/startup.el b/lisp/startup.el
index fc085e6d0ef..d4bb338fc0b 100644
--- a/lisp/startup.el
+++ b/lisp/startup.el
@@ -519,6 +519,19 @@ DIRS are relative."
xdg-dir)
(t emacs-d-dir))))
+(defvar comp--delayed-sources)
+(defvar comp--loadable)
+(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)
+ (require 'comp)
+ (setq comp--loadable t)
+ (native--compile-async comp--delayed-sources nil 'late)
+ (setq comp--delayed-sources nil)))
+
(defvar native-comp-eln-load-path)
(defun normal-top-level ()
"Emacs calls this function when it first starts up.
@@ -785,7 +798,8 @@ It is the default value of the variable `top-level'."
(if (string-match "\\`DISPLAY=" varval)
(setq display varval))))
(when display
- (delete display process-environment)))))
+ (delete display process-environment))))
+ (startup--honor-delayed-native-compilations))
;; Precompute the keyboard equivalents in the menu bar items.
;; Command-line options supported by tty's: