diff options
| author | Andrea Corallo | 2022-10-11 21:17:55 +0200 |
|---|---|---|
| committer | Andrea Corallo | 2022-10-11 21:19:21 +0200 |
| commit | 37447209042e174f4e95c8d0166418d2aef018ed (patch) | |
| tree | 19d01aa53747137f14bb59337ef89339db0cd46f | |
| parent | 61b6da5acef2d550022c664e628346539ba1852f (diff) | |
| download | emacs-37447209042e174f4e95c8d0166418d2aef018ed.tar.gz emacs-37447209042e174f4e95c8d0166418d2aef018ed.zip | |
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.
| -rw-r--r-- | Makefile.in | 5 | ||||
| -rw-r--r-- | lisp/Makefile.in | 6 | ||||
| -rw-r--r-- | lisp/emacs-lisp/comp.el | 11 |
3 files changed, 22 insertions, 0 deletions
diff --git a/Makefile.in b/Makefile.in index 741a4c5538a..2d617e2294d 100644 --- a/Makefile.in +++ b/Makefile.in | |||
| @@ -530,6 +530,11 @@ lisp: src | |||
| 530 | lib lib-src lisp nt: Makefile | 530 | lib lib-src lisp nt: Makefile |
| 531 | $(MAKE) -C $@ all | 531 | $(MAKE) -C $@ all |
| 532 | 532 | ||
| 533 | trampolines: src lisp | ||
| 534 | ifeq ($(HAVE_NATIVE_COMP),yes) | ||
| 535 | $(MAKE) -C lisp trampolines | ||
| 536 | endif | ||
| 537 | |||
| 533 | # Pass an unexpanded $srcdir to src's Makefile, which then | 538 | # Pass an unexpanded $srcdir to src's Makefile, which then |
| 534 | # expands it using its own value of srcdir (which points to the | 539 | # expands it using its own value of srcdir (which points to the |
| 535 | # source directory of src/). | 540 | # source directory of src/). |
diff --git a/lisp/Makefile.in b/lisp/Makefile.in index 256017f6c5b..338814fdda2 100644 --- a/lisp/Makefile.in +++ b/lisp/Makefile.in | |||
| @@ -430,6 +430,12 @@ compile-always: | |||
| 430 | find $(lisp) -name '*.elc' $(FIND_DELETE) | 430 | find $(lisp) -name '*.elc' $(FIND_DELETE) |
| 431 | $(MAKE) compile | 431 | $(MAKE) compile |
| 432 | 432 | ||
| 433 | .PHONY: trampolines | ||
| 434 | trampolines: compile | ||
| 435 | ifeq ($(HAVE_NATIVE_COMP),yes) | ||
| 436 | $(emacs) -l comp -f comp-compile-all-trampolines | ||
| 437 | endif | ||
| 438 | |||
| 433 | .PHONY: backup-compiled-files compile-after-backup | 439 | .PHONY: backup-compiled-files compile-after-backup |
| 434 | 440 | ||
| 435 | # Backup compiled Lisp files in elc.tar.gz. If that file already | 441 | # 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 6656b7e57c1..889bffa3f5c 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)." | |||
| 4204 | 4204 | ||
| 4205 | ;;; Compiler entry points. | 4205 | ;;; Compiler entry points. |
| 4206 | 4206 | ||
| 4207 | (defun comp-compile-all-trampolines () | ||
| 4208 | "Pre-compile AOT all trampolines." | ||
| 4209 | (let ((comp-running-batch-compilation t) | ||
| 4210 | ;; We want to target only the 'native-lisp' directory. | ||
| 4211 | (native-compile-target-directory | ||
| 4212 | (car (last native-comp-eln-load-path)))) | ||
| 4213 | (mapatoms (lambda (f) | ||
| 4214 | (when (subr-primitive-p (symbol-function f)) | ||
| 4215 | (message "Compiling trampoline for: %s" f) | ||
| 4216 | (comp-trampoline-compile f)))))) | ||
| 4217 | |||
| 4207 | ;;;###autoload | 4218 | ;;;###autoload |
| 4208 | (defun comp-lookup-eln (filename) | 4219 | (defun comp-lookup-eln (filename) |
| 4209 | "Given a Lisp source FILENAME return the corresponding .eln file if found. | 4220 | "Given a Lisp source FILENAME return the corresponding .eln file if found. |