Function: comp--final
comp--final is a byte-compiled function defined in comp.el.gz.
Signature
(comp--final _)
Documentation
Final pass driving the C back-end for code emission.
Source Code
;; Defined in /usr/src/emacs/lisp/emacs-lisp/comp.el.gz
(defun comp--final (_)
"Final pass driving the C back-end for code emission."
(unless comp-dry-run
;; 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 comp-running-batch-compilation comp-async-compilation)
(comp--final1)
;; Call comp--final1 in a child process.
(let* ((output (comp-ctxt-output comp-ctxt))
(print-escape-newlines t)
(print-length nil)
(print-level nil)
(print-quoted t)
(print-gensym t)
(print-circle t)
(print-escape-multibyte t)
(expr `((require 'comp)
(setf native-comp-verbose ,native-comp-verbose
comp-libgccjit-reproducer ,comp-libgccjit-reproducer
comp-ctxt ,comp-ctxt
native-comp-eln-load-path ',native-comp-eln-load-path
native-comp-compiler-options
',native-comp-compiler-options
native-comp-driver-options
',native-comp-driver-options
byte-compile-warnings ',byte-compile-warnings
load-path ',load-path)
,native-comp-async-env-modifier-form
(message "Compiling %s..." ',output)
(comp--final1)))
(temp-file (make-temp-file
(concat "emacs-int-comp-"
(file-name-base output) "-")
nil ".el"))
(default-directory invocation-directory))
(with-temp-file temp-file
(insert ";; -*- coding: utf-8-emacs-unix; lexical-binding: t -*-\n")
(mapc (lambda (e)
(insert (prin1-to-string e)))
expr))
(with-temp-buffer
(unwind-protect
(if (zerop
(call-process (expand-file-name invocation-name
invocation-directory)
nil t t "-no-comp-spawn" "-Q" "--batch" "-l"
temp-file))
(progn
(delete-file temp-file)
output)
(signal 'native-compiler-error (list (buffer-string))))
(comp-log-to-buffer (buffer-string))))))))