summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp
diff options
context:
space:
mode:
authorAndrea Corallo <akrl@sdf.org>2020-12-07 12:22:48 +0100
committerAndrea Corallo <akrl@sdf.org>2020-12-07 16:43:01 +0100
commitbe907b0ba82c2a65e0468d50653cae8a7cf5f16b (patch)
tree80610d66042b2bd782d9decdab45281dd3243668 /lisp/emacs-lisp
parent715a1ca1744f9a5918376bf7662c81302f0b20c0 (diff)
downloademacs-be907b0ba82c2a65e0468d50653cae8a7cf5f16b.tar.gz
emacs-be907b0ba82c2a65e0468d50653cae8a7cf5f16b.tar.bz2
emacs-be907b0ba82c2a65e0468d50653cae8a7cf5f16b.zip
* Spawn a sub-process for running GCC also in batch mode (bug#45056)
* lisp/emacs-lisp/comp.el (comp-async-compilation): New variable. (comp-final): Always run the C side of the compilation as a sub-process unless during bootstrap or async compilation. (comp-run-async-workers): Set `comp-async-compilation'.
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r--lisp/emacs-lisp/comp.el10
1 files changed, 9 insertions, 1 deletions
diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el
index 13f9beb5f96..339fff7aa17 100644
--- a/lisp/emacs-lisp/comp.el
+++ b/lisp/emacs-lisp/comp.el
@@ -2805,11 +2805,18 @@ Prepare every function for final compilation and drive the C back-end."
(and (comp--release-ctxt)
compile-result))))
+(defvar comp-async-compilation nil
+ "Non-nil while executing an asyncronous native compilation.")
+
(defun comp-final (_)
"Final pass driving the C back-end for code emission."
(maphash #'comp-ret-type-spec (comp-ctxt-funcs-h comp-ctxt))
(unless comp-dry-run
- (if noninteractive
+ ;; Always run the C side of the compilation as a sub-process
+ ;; unless during bootstrap or async compilation (bug#45056). GCC
+ ;; leaks memory but also interfere with the ability of Emacs to
+ ;; detect when a sub-process completes (TODO understand why).
+ (if (or byte-native-for-bootstrap comp-async-compilation)
(comp-final1)
;; Call comp-final1 in a child process.
(let* ((output (comp-ctxt-output comp-ctxt))
@@ -3073,6 +3080,7 @@ display a message."
(setf comp-speed ,comp-speed
comp-debug ,comp-debug
comp-verbose ,comp-verbose
+ comp-async-compilation t
comp-eln-load-path ',comp-eln-load-path
comp-native-driver-options
',comp-native-driver-options