summaryrefslogtreecommitdiff
path: root/src/comp.c
diff options
context:
space:
mode:
authorStefan Kangas <stefankangas@gmail.com>2023-02-18 10:45:46 +0100
committerStefan Kangas <stefankangas@gmail.com>2023-02-18 10:45:46 +0100
commit0be5f7ab6368175953c0a5bcbbd485fd9edda2b0 (patch)
tree9794ae60deb1cedca6d4354a8d89619db5a10710 /src/comp.c
parent1298d1db189bf434e54a792d3a6746237881f251 (diff)
parent1769a588300f471a85fe8887864ae33340dececb (diff)
downloademacs-0be5f7ab6368175953c0a5bcbbd485fd9edda2b0.tar.gz
Merge from origin/emacs-29
1769a588300 Fix some uses of 'use-dialog-box' deef41a8259 Fix hi-lock-tests when 'use-dialog-box' is non-nil 5093a534960 Fix regression due to change in face sort order by 'face-... 3e747630999 * lisp/files.el (file-equal-p): Work around Haiku stat bug. 13fd7667f9c ; * src/treesit.c: Improve sectioning. a40b1745d4a (project-vc-backend-markers-alist): Add entry for vc-got 18e96ed7c8a project.el: Extract backend->marker association for a defvar 0a5615669a4 Don't completely clip into visible range in treesit_recor... 5b34fc07085 * lisp/treesit.el (treesit-node-at): Update docstring (bu... 1c7d7623781 ; Minor copyedit of NEWS wrt *-ts-modes 09fad246de8 * lisp/calc/calc.el (calc-mode): Improve docstring. 8aad8d75aa9 ; Improve and update documentation of native compilation d6e4f243720 Merge 'emacs-29' into 'feature/inhibit-native-comp-cleanup' a555abc56d5 Fix order of faces in 'face-list' b44a7ff85dc Allow 'icon-title-format' to have the value t f1f571e72ae Add electric indent for preproc directives 83af806ab7c Rename 'emacs-news-toggle-tag' to 'emacs-news-cycle-tag' 5bc88b3b175 Add menu to news-mode 40f4bc4e0aa ; Avoid installing VC package dependencies multiple times 1c9d81a2b42 Attempt to recognise if a VC package has no Elisp files 2550e8bb0b0 Fix mule-tests under en_US.UTF-8 locale 32795309939 Move block closer above declaration_list rule (bug#61531) b18754bb179 Minor improvements in c-ts-mode and docs 3c6b726a7b4 Add super node as a keyword 1917c51fe68 ; Prevent ERC-induced false positive in JUnit report b16965ef7e6 Delete perplexing paragraph from Gnus manual 43c62a4732d ; Fix typo fdac69b45e6 ; Auto-commit of loaddefs files. 7678b7e46f2 Eglot: check server capability before sending didSave (bu... a3a1ef7bd5e Fix rust-ts-mode type and module highlighting (Bug#61302) 477aa047ee7 rust-ts-mode: Highlight variable reassignments 5206a551c16 Improve backward compatibility of save-restriction accd88d5545 Don't indent template_string contents (bug#61503) d97a3839967 csharp-ts-mode: fontify compiler directives (bug#61512) 420d2cae846 Update to Transient v0.3.7-209-gdab1dfa a3751b5d0c1 ; Raise an error if a VC package checkout is empty 6a32ba8b69c ; Fix the installation of dependencies for VC packages 4eac80fcc39 ; Prepare to update ERC version to 5.5 4f099a72173 ; Remove failing erc-reuse-buffers test ce4a066ed1e * Generate trampolines in a temporary directory if no oth... 4bb27a5ca93 ; Minor docs copyedits 13bcff3da5c Merge branch 'emacs-29' of git.savannah.gnu.org:/srv/git/... 3d572ae0d50 Rename with/without-narrowing to with/without-restriction d806b0e33cf * lisp/repeat.el: Rename internal function and variable (... 1a64f326e0a * Fix previous change 95692f6754c Rename native-comp-deferred-compilation-deny-list 8d8464bd5a9 Rename native-comp-deferred-compilation into native-comp-... 5d0912f1445 Rename comp-enable-subr-trampolines into native-comp-enab... dd8b720ee74 ; * etc/NEWS: Fix typos. 909bd04cf5f ; * lisp/calendar/lunar.el: Add comments. (bug#61460) 10f2aedea9a ; * lisp/progmodes/c-ts-mode.el (c-ts-base-mode): delete ... abfd00e5c02 * lisp/emacs-lisp/comp.el (native-comp-never-optimize-fun... 1795839babc Support `comp-enable-subr-trampolines' as string value 865758130a1 ; * admin/git-bisect-start: Update failing commits b948d0d7efe Merge branch 'scratch/fix-locked-narrowing' b6e2799aa1c * Some more `inhibit-native-compile' clean-up dcb2379a463 Minor improvements to labeled narrowing c0681cd3477 Revert "Add new variable 'inhibit-native-compilation'" 3969a34fa1b Revert "Rename to inhibit-automatic-native-compilation" 4297039bd13 Save and restore the absence of narrowing locks 2956e54b1dd Add an extensive test for labeled (locked) narrowing 79ce185ad13 Update the documentation about labeled (locked) narrowing a6cd4553d48 Rename two long line optimizations variables 0d73e4aa261 Add specific symbols for narrowings d8438e2bb44 Add 'without-narrowing' macro 97314447e60 Make 'narrowing-lock' and 'narrowing-unlock' internal a4aa32bdfff Fix 'save-restriction' for narrowing locks
Diffstat (limited to 'src/comp.c')
-rw-r--r--src/comp.c98
1 files changed, 48 insertions, 50 deletions
diff --git a/src/comp.c b/src/comp.c
index 7d2987605d9..1b55226b0c3 100644
--- a/src/comp.c
+++ b/src/comp.c
@@ -5174,8 +5174,7 @@ maybe_defer_native_compilation (Lisp_Object function_name,
if (!load_gccjit_if_necessary (false))
return;
- if (!native_comp_deferred_compilation
- || !NILP (Vinhibit_automatic_native_compilation)
+ if (!native_comp_jit_compilation
|| noninteractive
|| !NILP (Vpurify_flag)
|| !COMPILEDP (definition)
@@ -5672,28 +5671,18 @@ syms_of_comp (void)
{
#ifdef HAVE_NATIVE_COMP
DEFVAR_LISP ("comp--delayed-sources", Vcomp__delayed_sources,
- doc: /* List of sources to be native-compiled when startup is finished.
+ doc: /* List of sources to be native-compiled when startup is finished.
For internal use. */);
- DEFVAR_BOOL ("comp--compilable",
- comp__compilable,
- doc: /* Non-nil when comp.el can be native compiled.
+ DEFVAR_BOOL ("comp--compilable", comp__compilable,
+ doc: /* Non-nil when comp.el can be native compiled.
For internal use. */);
/* Compiler control customizes. */
- DEFVAR_LISP ("inhibit-automatic-native-compilation",
- Vinhibit_automatic_native_compilation,
- doc: /* If non-nil, inhibit automatic native compilation of loaded .elc files.
+ DEFVAR_BOOL ("native-comp-jit-compilation", native_comp_jit_compilation,
+ doc: /* If non-nil, compile loaded .elc files asynchronously.
-After compilation, each function definition is updated to the native
-compiled one. */);
- Vinhibit_automatic_native_compilation = Qnil;
-
- DEFVAR_BOOL ("native-comp-deferred-compilation",
- native_comp_deferred_compilation,
- doc: /* If non-nil compile loaded .elc files asynchronously.
-
-After compilation, each function definition is updated to the native
-compiled one. */);
- native_comp_deferred_compilation = true;
+After compilation, each function definition is updated to use the
+natively-compiled one. */);
+ native_comp_jit_compilation = true;
DEFSYM (Qnative_comp_speed, "native-comp-speed");
DEFSYM (Qnative_comp_debug, "native-comp-debug");
@@ -5837,74 +5826,83 @@ compiled one. */);
/* FIXME should be initialized but not here... Plus this don't have
to be necessarily exposed to lisp but can easy debug for now. */
DEFVAR_LISP ("comp-subr-list", Vcomp_subr_list,
- doc: /* List of all defined subrs. */);
+ doc: /* List of all defined subrs. */);
DEFVAR_LISP ("comp-abi-hash", Vcomp_abi_hash,
- doc: /* String signing the .eln files ABI. */);
+ doc: /* String signing the .eln files ABI. */);
Vcomp_abi_hash = Qnil;
DEFVAR_LISP ("comp-native-version-dir", Vcomp_native_version_dir,
- doc: /* Directory in use to disambiguate eln compatibility. */);
+ doc: /* Directory in use to disambiguate eln compatibility. */);
Vcomp_native_version_dir = Qnil;
DEFVAR_LISP ("comp-deferred-pending-h", Vcomp_deferred_pending_h,
- doc: /* Hash table symbol-name -> function-value.
+ doc: /* Hash table symbol-name -> function-value.
For internal use. */);
Vcomp_deferred_pending_h = CALLN (Fmake_hash_table, QCtest, Qeq);
DEFVAR_LISP ("comp-eln-to-el-h", Vcomp_eln_to_el_h,
- doc: /* Hash table eln-filename -> el-filename. */);
+ doc: /* Hash table eln-filename -> el-filename. */);
Vcomp_eln_to_el_h = CALLN (Fmake_hash_table, QCtest, Qequal);
DEFVAR_LISP ("native-comp-eln-load-path", Vnative_comp_eln_load_path,
- doc: /* List of eln cache directories.
+ doc: /* List of directories to look for natively-compiled *.eln files.
-If a directory is non absolute it is assumed to be relative to
-`invocation-directory'.
-`comp-native-version-dir' value is used as a sub-folder name inside
-each eln cache directory.
-The last directory of this list is assumed to be the system one. */);
+The *.eln files are actually looked for in a version-specific
+subdirectory of each directory in this list. That subdirectory
+is determined by the value of `comp-native-version-dir'.
+If the name of a directory in this list is not absolute, it is
+assumed to be relative to `invocation-directory'.
+The last directory of this list is assumed to be the one holding
+the system *.eln files, which are the files produced when building
+Emacs. */);
/* Temporary value in use for bootstrap. We can't do better as
`invocation-directory' is still unset, will be fixed up during
dump reload. */
Vnative_comp_eln_load_path = Fcons (build_string ("../native-lisp/"), Qnil);
- DEFVAR_BOOL ("comp-enable-subr-trampolines", comp_enable_subr_trampolines,
- doc: /* If non-nil, enable primitive trampoline synthesis.
-This makes Emacs respect redefinition or advises of primitive functions
-when they are called from Lisp code natively-compiled at `native-comp-speed'
-of 2.
+ DEFVAR_LISP ("native-comp-enable-subr-trampolines",
+ Vnative_comp_enable_subr_trampolines,
+ doc: /* If non-nil, enable generation of trampolines for calling primitives.
+Trampolines are needed so that Emacs respects redefinition or advice of
+primitive functions when they are called from Lisp code natively-compiled
+at `native-comp-speed' of 2.
-By default, this is enabled, and when Emacs sees a redefined or advised
+By default, the value is t, and when Emacs sees a redefined or advised
primitive called from natively-compiled Lisp, it generates a trampoline
for it on-the-fly.
-Disabling this, when a trampoline for a redefined or advised primitive is
-not available from previous compilations, means that such redefinition
-or advise will not have effect on calls from natively-compiled Lisp code.
-That is, calls to primitives without existing trampolines from
-natively-compiled Lisp will behave as if the primitive was called
-directly from C. */);
+If the value is a file name (a string), it specifies the directory in
+which to deposit the generated trampolines, overriding the directories
+in `native-comp-eln-load-path'.
+
+When this variable is nil, generation of trampolines is disabled.
+
+Disabling the generation of trampolines, when a trampoline for a redefined
+or advised primitive is not already available from previous compilations,
+means that such redefinition or advice will not have effect when calling
+primitives from natively-compiled Lisp code. That is, calls to primitives
+without existing trampolines from natively-compiled Lisp will behave as if
+the primitive was called directly from C, and will ignore its redefinition
+and advice. */);
DEFVAR_LISP ("comp-installed-trampolines-h", Vcomp_installed_trampolines_h,
- doc: /* Hash table subr-name -> installed trampoline.
-This is used to prevent double trampoline instantiation but also to
+ doc: /* Hash table subr-name -> installed trampoline.
+This is used to prevent double trampoline instantiation, and also to
protect the trampolines against GC. */);
Vcomp_installed_trampolines_h = CALLN (Fmake_hash_table);
DEFVAR_LISP ("comp-no-native-file-h", V_comp_no_native_file_h,
- doc: /* Files for which no deferred compilation has to be performed.
+ doc: /* Files for which no deferred compilation should be performed.
These files' compilation should not be deferred because the bytecode
version was explicitly requested by the user during load.
For internal use. */);
V_comp_no_native_file_h = CALLN (Fmake_hash_table, QCtest, Qequal);
DEFVAR_BOOL ("comp-file-preloaded-p", comp_file_preloaded_p,
- doc: /* When non-nil assume the file being compiled to
-be preloaded. */);
+ doc: /* When non-nil, assume the file being compiled to be preloaded. */);
DEFVAR_LISP ("comp-loaded-comp-units-h", Vcomp_loaded_comp_units_h,
- doc: /* Hash table recording all loaded compilation units.
-file -> CU. */);
+ doc: /* Hash table recording all loaded compilation units, file -> CU. */);
Vcomp_loaded_comp_units_h =
CALLN (Fmake_hash_table, QCweakness, Qvalue, QCtest, Qequal);