]> git.eshelyaron.com Git - emacs.git/commitdiff
Add trampoline AOT compilation target (bug#58318)
authorAndrea Corallo <andrea.corallo@arm.com>
Tue, 11 Oct 2022 19:17:55 +0000 (21:17 +0200)
committerAndrea Corallo <andrea.corallo@arm.com>
Tue, 11 Oct 2022 19:19:21 +0000 (21:19 +0200)
* Makefile.in (trampolines): New target.
* lisp/Makefile.in (trampolines): Likewise.
* lisp/emacs-lisp/comp.el (comp-compile-all-trampolines): New
function.

Makefile.in
lisp/Makefile.in
lisp/emacs-lisp/comp.el

index 741a4c5538ac06f7453d2990e55b52708853c131..2d617e2294dd6b567574e11f63d4a8fedd06a2dc 100644 (file)
@@ -530,6 +530,11 @@ lisp: src
 lib lib-src lisp nt: Makefile
        $(MAKE) -C $@ all
 
+trampolines: src lisp
+ifeq ($(HAVE_NATIVE_COMP),yes)
+       $(MAKE) -C lisp trampolines
+endif
+
 # Pass an unexpanded $srcdir to src's Makefile, which then
 # expands it using its own value of srcdir (which points to the
 # source directory of src/).
index 256017f6c5bdbfc568f72f54e632d5805e60613d..338814fdda23d1f954140898705c6427efd71031 100644 (file)
@@ -430,6 +430,12 @@ compile-always:
        find $(lisp) -name '*.elc' $(FIND_DELETE)
        $(MAKE) compile
 
+.PHONY: trampolines
+trampolines: compile
+ifeq ($(HAVE_NATIVE_COMP),yes)
+       $(emacs) -l comp -f comp-compile-all-trampolines
+endif
+
 .PHONY: backup-compiled-files compile-after-backup
 
 # Backup compiled Lisp files in elc.tar.gz.  If that file already
index 6656b7e57c1245528a0c4fe87fe8b7977fd0e02e..889bffa3f5c27b1aaf9ee382296e7ae0563c2ba2 100644 (file)
@@ -4204,6 +4204,17 @@ bytecode definition was not changed in the meantime)."
 \f
 ;;; Compiler entry points.
 
+(defun comp-compile-all-trampolines ()
+  "Pre-compile AOT all trampolines."
+  (let ((comp-running-batch-compilation t)
+        ;; We want to target only the 'native-lisp' directory.
+        (native-compile-target-directory
+         (car (last native-comp-eln-load-path))))
+    (mapatoms (lambda (f)
+                (when (subr-primitive-p (symbol-function f))
+                  (message "Compiling trampoline for: %s" f)
+                  (comp-trampoline-compile f))))))
+
 ;;;###autoload
 (defun comp-lookup-eln (filename)
   "Given a Lisp source FILENAME return the corresponding .eln file if found.