Revert "Add new variable 'inhibit-native-compilation'"

This reverts commit 5fec9182db.
This commit is contained in:
Andrea Corallo 2023-02-13 10:19:31 +01:00
parent 3969a34fa1
commit c0681cd347
7 changed files with 19 additions and 62 deletions

View file

@ -981,24 +981,6 @@ whether native-compilation is available should use this predicate.
This section documents the variables that control This section documents the variables that control
native-compilation. native-compilation.
@defvar inhibit-native-compilation
If your Emacs has support for native compilation, Emacs will (by
default) compile the Lisp files you're loading in the background, and
then install the native-compiled versions of the functions. If you
wish to disable this, you can set this variable to non-@code{nil}. If
you want to set it permanently, this should probably be done from the
early init file, since setting it in the normal init file is probably
too late.
While setting this variable disables automatic compilation of Lisp
files, the compiler may still be invoked to install @dfn{trampolines}
if any built-in functions are redefined. However, these trampolines
will not get written to your cache directory.
You can also use the @samp{EMACS_INHIBIT_NATIVE_COMPILATION}
environment variable to disable native compilation.
@end defvar
@defopt native-comp-speed @defopt native-comp-speed
This variable specifies the optimization level for native compilation. This variable specifies the optimization level for native compilation.
Its value should be a number between @minus{}1 and 3. Values between Its value should be a number between @minus{}1 and 3. Values between

View file

@ -199,14 +199,6 @@ load time.
** Native Compilation ** Native Compilation
+++ +++
*** New variable 'inhibit-native-compilation'.
If set, Emacs will inhibit native compilation (and won't write
anything to the eln cache automatically). The variable is initialised
from the EMACS_INHIBIT_NATIVE_COMPILATION environment variable on
Emacs startup.
---
*** New command 'native-compile-prune-cache'. *** New command 'native-compile-prune-cache'.
This command deletes old subdirectories of the eln cache (but not the This command deletes old subdirectories of the eln cache (but not the
ones for the current Emacs version). Note that subdirectories of the ones for the current Emacs version). Note that subdirectories of the

View file

@ -3803,25 +3803,22 @@ Return the trampoline if found or nil otherwise."
(lexical-binding t)) (lexical-binding t))
(comp--native-compile (comp--native-compile
form nil form nil
;; If we've disabled nativecomp, don't write the trampolines to (cl-loop
;; the eln cache (but create them). for dir in (if native-compile-target-directory
(and (not inhibit-native-compilation) (list (expand-file-name comp-native-version-dir
(cl-loop native-compile-target-directory))
for dir in (if native-compile-target-directory (comp-eln-load-path-eff))
(list (expand-file-name comp-native-version-dir for f = (expand-file-name
native-compile-target-directory)) (comp-trampoline-filename subr-name)
(comp-eln-load-path-eff)) dir)
for f = (expand-file-name unless (file-exists-p dir)
(comp-trampoline-filename subr-name) do (ignore-errors
dir) (make-directory dir t)
unless (file-exists-p dir) (cl-return f))
do (ignore-errors when (file-writable-p f)
(make-directory dir t) do (cl-return f)
(cl-return f)) finally (error "Cannot find suitable directory for output in \
when (file-writable-p f) `native-comp-eln-load-path'")))))
do (cl-return f)
finally (error "Cannot find suitable directory for output in \
`native-comp-eln-load-path'"))))))
;; Some entry point support code. ;; Some entry point support code.

View file

@ -220,7 +220,7 @@ All commands in `lisp-mode-shared-map' are inherited by this map."
Load the compiled code when finished. Load the compiled code when finished.
Use `emacs-lisp-byte-compile-and-load' in combination with Use `emacs-lisp-byte-compile-and-load' in combination with
`inhibit-native-compilation' set to nil to achieve asynchronous `native-comp-deferred-compilation' set to t to achieve asynchronous
native compilation." native compilation."
(interactive nil emacs-lisp-mode) (interactive nil emacs-lisp-mode)
(emacs-lisp--before-compile-buffer) (emacs-lisp--before-compile-buffer)

View file

@ -542,7 +542,7 @@ DIRS are relative."
(setq comp--compilable t)) (setq comp--compilable t))
(defvar native-comp-eln-load-path) (defvar native-comp-eln-load-path)
(defvar inhibit-native-compilation) (defvar native-comp-deferred-compilation)
(defvar comp-enable-subr-trampolines) (defvar comp-enable-subr-trampolines)
(defvar startup--original-eln-load-path nil (defvar startup--original-eln-load-path nil
@ -579,9 +579,6 @@ the updated value."
It sets `command-line-processed', processes the command-line, It sets `command-line-processed', processes the command-line,
reads the initialization files, etc. reads the initialization files, etc.
It is the default value of the variable `top-level'." It is the default value of the variable `top-level'."
;; Allow disabling automatic .elc->.eln processing.
(setq inhibit-native-compilation (getenv "EMACS_INHIBIT_NATIVE_COMPILATION"))
(if command-line-processed (if command-line-processed
(message internal--top-level-message) (message internal--top-level-message)
(setq command-line-processed t) (setq command-line-processed t)
@ -600,7 +597,7 @@ It is the default value of the variable `top-level'."
;; in this session. This is necessary if libgccjit is not ;; in this session. This is necessary if libgccjit is not
;; available on MS-Windows, but Emacs was built with ;; available on MS-Windows, but Emacs was built with
;; native-compilation support. ;; native-compilation support.
(setq inhibit-native-compilation t (setq native-comp-deferred-compilation nil
comp-enable-subr-trampolines nil)) comp-enable-subr-trampolines nil))
;; Form `native-comp-eln-load-path'. ;; Form `native-comp-eln-load-path'.

View file

@ -1894,9 +1894,6 @@ activations. To prevent runaway recursion, use `max-lisp-eval-depth'
instead; it will indirectly limit the specpdl stack size as well.") instead; it will indirectly limit the specpdl stack size as well.")
(make-obsolete-variable 'max-specpdl-size nil "29.1") (make-obsolete-variable 'max-specpdl-size nil "29.1")
(make-obsolete-variable 'native-comp-deferred-compilation
'inhibit-native-compilation "29.1")
;;;; Alternate names for functions - these are not being phased out. ;;;; Alternate names for functions - these are not being phased out.

View file

@ -5174,7 +5174,6 @@ maybe_defer_native_compilation (Lisp_Object function_name,
return; return;
if (!native_comp_deferred_compilation if (!native_comp_deferred_compilation
|| !NILP (Vinhibit_native_compilation)
|| noninteractive || noninteractive
|| !NILP (Vpurify_flag) || !NILP (Vpurify_flag)
|| !COMPILEDP (definition) || !COMPILEDP (definition)
@ -5678,13 +5677,6 @@ For internal use. */);
doc: /* Non-nil when comp.el can be native compiled. doc: /* Non-nil when comp.el can be native compiled.
For internal use. */); For internal use. */);
/* Compiler control customizes. */ /* Compiler control customizes. */
DEFVAR_LISP ("inhibit-native-compilation", Vinhibit_native_compilation,
doc: /* If non-nil, inhibit automatic native compilation of loaded .elc files.
After compilation, each function definition is updated to the native
compiled one. */);
Vinhibit_native_compilation = Qnil;
DEFVAR_BOOL ("native-comp-deferred-compilation", DEFVAR_BOOL ("native-comp-deferred-compilation",
native_comp_deferred_compilation, native_comp_deferred_compilation,
doc: /* If non-nil compile loaded .elc files asynchronously. doc: /* If non-nil compile loaded .elc files asynchronously.