emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 3744720904: Add trampoline AOT compilation target (bug#58318)


From: Andrea Corallo
Subject: master 3744720904: Add trampoline AOT compilation target (bug#58318)
Date: Tue, 11 Oct 2022 15:21:17 -0400 (EDT)

branch: master
commit 37447209042e174f4e95c8d0166418d2aef018ed
Author: Andrea Corallo <andrea.corallo@arm.com>
Commit: Andrea Corallo <andrea.corallo@arm.com>

    Add trampoline AOT compilation target (bug#58318)
    
    * Makefile.in (trampolines): New target.
    * lisp/Makefile.in (trampolines): Likewise.
    * lisp/emacs-lisp/comp.el (comp-compile-all-trampolines): New
    function.
---
 Makefile.in             |  5 +++++
 lisp/Makefile.in        |  6 ++++++
 lisp/emacs-lisp/comp.el | 11 +++++++++++
 3 files changed, 22 insertions(+)

diff --git a/Makefile.in b/Makefile.in
index 741a4c5538..2d617e2294 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -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/).
diff --git a/lisp/Makefile.in b/lisp/Makefile.in
index 256017f6c5..338814fdda 100644
--- a/lisp/Makefile.in
+++ b/lisp/Makefile.in
@@ -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
diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el
index 6656b7e57c..889bffa3f5 100644
--- a/lisp/emacs-lisp/comp.el
+++ b/lisp/emacs-lisp/comp.el
@@ -4204,6 +4204,17 @@ bytecode definition was not changed in the meantime)."
 
 ;;; 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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]