emacs-diffs
[Top][All Lists]
Advanced

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

master 10083e788f: In early bootstrap, use byte-compiled compiler to nat


From: Alan Mackenzie
Subject: master 10083e788f: In early bootstrap, use byte-compiled compiler to native compile first files
Date: Thu, 20 Jan 2022 13:41:31 -0500 (EST)

branch: master
commit 10083e788f7349fa363d100687dc3d94bea88f57
Author: Alan Mackenzie <acm@muc.de>
Commit: Alan Mackenzie <acm@muc.de>

    In early bootstrap, use byte-compiled compiler to native compile first files
    
    This speeds up a make bootstrap by around 15%.
    
    * lisp/Makefile.in (BYTE_COMPILE_FLAGS): set a value specific to 
compile-first
    which doesn't contain the setting of Emacs variable load-prefer-newer.
    Add a new make hunk which byte-compiles (rather then native compiles) when 
the
    environment variable ANCIENT is "yes".  Set the date of the .elc files built
    to 1971-01-01 to cause a second compilation of them later.
    
    * src/Makefile.in: Add an extra invocation of directory lisp's MAKE with
    target compile-first and the flag environment variable ANCIENT set to yes.
    
    * src/verbose.mk.in: When ANCIENT is yes, output ELC, not ELC+ELN for
    AM_V_ELC.
---
 lisp/Makefile.in  | 16 ++++++++++++++++
 src/Makefile.in   |  3 +++
 src/verbose.mk.in | 11 ++++++++---
 3 files changed, 27 insertions(+), 3 deletions(-)

diff --git a/lisp/Makefile.in b/lisp/Makefile.in
index 3a72034463..308407a8bf 100644
--- a/lisp/Makefile.in
+++ b/lisp/Makefile.in
@@ -77,6 +77,8 @@ AUTOGENEL = ${loaddefs} ${srcdir}/cus-load.el 
${srcdir}/finder-inf.el \
 # Set load-prefer-newer for the benefit of the non-bootstrappers.
 BYTE_COMPILE_FLAGS = \
   --eval '(setq load-prefer-newer t)' $(BYTE_COMPILE_EXTRA_FLAGS)
+# ... but we must prefer .elc files for those in the early bootstrap.
+compile-first: BYTE_COMPILE_FLAGS = $(BYTE_COMPILE_EXTRA_FLAGS)
 
 # Files to compile before others during a bootstrap.  This is done to
 # speed up the bootstrap process.  They're ordered by size, so we use
@@ -303,9 +305,23 @@ endif
 # An old-fashioned suffix rule, which, according to the GNU Make manual,
 # cannot have prerequisites.
 ifeq ($(HAVE_NATIVE_COMP),yes)
+ifeq ($(ANCIENT),yes)
+# The first compilation of compile-first, using an interpreted compiler:
+# The resulting .elc files get given a date of 1971-01-01 so that their
+# date stamp is earlier than the source files, causing these to be compiled
+# into native code at the second recursive invocation of this $(MAKE),
+# using these .elc's.  This is faster than just compiling the native code
+# directly using the interpreted compile-first files.  (Note: 1970-01-01
+# fails on some systems.)
+.el.elc:
+       $(AM_V_ELC)$(emacs) $(BYTE_COMPILE_FLAGS) \
+       -l comp -f batch-byte-compile $<
+       touch -t 197101010000 $@
+else
 .el.elc:
        $(AM_V_ELC)$(emacs) $(BYTE_COMPILE_FLAGS) \
        -l comp -f batch-byte+native-compile $<
+endif
 else
 .el.elc:
        $(AM_V_ELC)$(emacs) $(BYTE_COMPILE_FLAGS) -f batch-byte-compile $<
diff --git a/src/Makefile.in b/src/Makefile.in
index 0b465b8cd6..706beb453b 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -914,6 +914,9 @@ $(bootstrap_pdmp): bootstrap-emacs$(EXEEXT)
        $(RUN_TEMACS) --batch $(BUILD_DETAILS) -l loadup --temacs=pbootstrap \
                --bin-dest $(BIN_DESTDIR) --eln-dest $(ELN_DESTDIR)
        @: Compile some files earlier to speed up further compilation.
+       @: First, byte compile these files, ....
+       ANCIENT=yes $(MAKE) -C ../lisp compile-first EMACS="$(bootstrap_exe)"
+       @: .... then use their .elcs in native compiling these and other files.
        $(MAKE) -C ../lisp compile-first EMACS="$(bootstrap_exe)"
 endif
 
diff --git a/src/verbose.mk.in b/src/verbose.mk.in
index e3f5678303..01076df946 100644
--- a/src/verbose.mk.in
+++ b/src/verbose.mk.in
@@ -40,12 +40,17 @@ AM_V_CXX     = @$(info $   CXX      $@)
 AM_V_CCLD    = @$(info $   CCLD     $@)
 AM_V_CXXLD   = @$(info $   CXXLD    $@)
 ifeq ($(HAVE_NATIVE_COMP),yes)
-ifeq ($(NATIVE_DISABLED),1)
+ifneq ($(NATIVE_DISABLED),1)
+ifneq ($(ANCIENT),yes)
+AM_V_ELC     = @$(info $   ELC+ELN  $@)
+AM_V_ELN     = @$(info $   ELN      $@)
+else
 AM_V_ELC     = @$(info $   ELC      $@)
 AM_V_ELN =
+endif
 else
-AM_V_ELC     = @$(info $   ELC+ELN  $@)
-AM_V_ELN     = @$(info $   ELN      $@)
+AM_V_ELC     = @$(info $   ELC      $@)
+AM_V_ELN =
 endif
 else
 AM_V_ELC     = @$(info $   ELC      $@)



reply via email to

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