Andrea Corallo
ab4273056e
Comp fix calls to redefined primtives with op-bytecode (bug#61917)
...
* test/src/comp-tests.el (61917-1): New test.
* src/comp.c (syms_of_comp): New variable.
* lisp/loadup.el: Store primitive arities before dumping.
* lisp/emacs-lisp/comp.el (comp--func-arity): New function.
(comp-emit-set-call-subr): Make use of `comp--func-arity'.
2023-03-29 22:25:04 +02:00
Andrea Corallo
a8c9283e17
Revert "Comp fix calls to redefined primtives with op-bytecode (bug#61917)"
...
This reverts commit 263d6c3853
.
These patch series caused a number of regression and more analysis is
required.
2023-03-28 15:47:54 +02:00
Andrea Corallo
8b66d8abd0
Revert "* lisp/emacs-lisp/comp.el (comp-emit-set-call-subr): Improve..."
...
This reverts commit 4a7a0c9a9f
.
These patch series caused a number of regression and more analysis is
required.
2023-03-28 15:47:47 +02:00
Andrea Corallo
4a7a0c9a9f
* lisp/emacs-lisp/comp.el (comp-emit-set-call-subr): Improve 263d6c3853
2023-03-21 12:10:31 +01:00
Andrea Corallo
263d6c3853
Comp fix calls to redefined primtives with op-bytecode (bug#61917)
...
* lisp/emacs-lisp/comp.el (comp-emit-set-call-subr): Fix compilation
of calls to redefined primtives with dedicated op-bytecode.
* test/src/comp-tests.el (61917-1): New test.
2023-03-20 19:01:26 +01:00
Andrea Corallo
8a2a554192
* Make sure `default-directory' exists before spawning processes (bug#62004)
...
* lisp/emacs-lisp/comp.el (comp-final, comp-run-async-workers): Bind
`default-directory' to `invocation-directory'.
2023-03-08 21:16:12 +01:00
Andrea Corallo
4a7e657389
* lisp/emacs-lisp/comp.el (comp-prettyformat-insn): Fix (bug#61917)
2023-03-06 17:23:15 +01:00
Eli Zaretskii
2258ed01f4
; Minor fix of last change
...
* lisp/emacs-lisp/comp.el (comp-subr-trampoline-install): Fix
wording. (Bug#61880)
2023-03-05 12:24:39 +02:00
Andrea Corallo
9c18af0cfa
* Warn when certain primitives are redefined (bug#61880)
...
* lisp/emacs-lisp/comp.el (comp-warn-primitives): New constant.
(comp-subr-trampoline-install): Warn when a sensitive primitive is
being redefined.
2023-03-05 11:06:37 +01:00
Andrea Corallo
68df9e5953
* lisp/emacs-lisp/comp.el (comp--trampoline-abs-filename): Improve 5d0b45cd67
2023-02-21 16:39:39 +01:00
Andrea Corallo
5d0b45cd67
Make the native compiler always use `make-temp-file' for temporary files
...
* src/comp.c (CALL4I): Define macro.
(Fcomp__compile_ctxt_to_file): Use `make-temp-file' instead of
`make-temp-file-internal'.
* lisp/emacs-lisp/comp.el (comp--trampoline-abs-filename): Likewise.
2023-02-20 21:16:04 +01:00
Andrea Corallo
c15bc91e1b
* Fix `native-comp-enable-subr-trampolines' semantic
...
* lisp/emacs-lisp/comp.el (comp--trampoline-abs-filename): Interpret
`native-comp-enable-subr-trampolines' relative to
`invocation-directory'.
2023-02-18 22:44:05 +01:00
Eli Zaretskii
8aad8d75aa
; Improve and update documentation of native compilation
...
* src/comp.c (syms_of_comp) <native-comp-enable-subr-trampolines>
<native-comp-eln-load-path>: Doc fixes.
* lisp/emacs-lisp/comp.el (native-comp-never-optimize-functions):
Doc fix.
* doc/lispref/compile.texi (Native-Compilation Variables):
Document 'native-comp-jit-compilation' and
'native-comp-enable-subr-trampolines'.
2023-02-17 16:15:51 +02:00
Andrea Corallo
ce4a066ed1
* Generate trampolines in a temporary directory if no other option is viable
...
* lisp/emacs-lisp/comp.el (comp--trampoline-abs-filename): Use
temporary file if no other option is viable.
2023-02-14 12:27:58 +01:00
Andrea Corallo
95692f6754
Rename native-comp-deferred-compilation-deny-list
...
* lisp/emacs-lisp/comp.el (native-comp-jit-compilation-deny-list)
(native-compile-async-skip-p): Rename
native-comp-deferred-compilation-deny-list into
native-comp-jit-compilation-deny-list.
(native-comp-deferred-compilation-deny-list): Mark it obsolete.
2023-02-13 17:06:13 +01:00
Andrea Corallo
5d0912f144
Rename comp-enable-subr-trampolines into native-comp-enable-subr-trampolines
...
* src/data.c (Ffset): Rename comp-enable-subr-trampolines into
native-comp-enable-subr-trampolines.
* src/comp.c (syms_of_comp): Likewise.
* lisp/subr.el (comp-enable-subr-trampolines): Make
comp-enable-subr-trampolines obsolete.
* lisp/startup.el (native-comp-enable-subr-trampolines)
(normal-top-level): Rename comp-enable-subr-trampolines into
native-comp-enable-subr-trampolines.
* lisp/loadup.el (dump-mode): Likewise.
* lisp/emacs-lisp/comp.el (comp-subr-trampoline-install)
(comp--trampoline-abs-filename): Likewise.
2023-02-13 17:02:38 +01:00
Andrea Corallo
abfd00e5c0
* lisp/emacs-lisp/comp.el (native-comp-never-optimize-functions): Improve doc
2023-02-13 12:49:05 +01:00
Andrea Corallo
1795839bab
Support `comp-enable-subr-trampolines' as string value
...
* src/comp.c (syms_of_comp): Update `comp-enable-subr-trampolines'.
* lisp/emacs-lisp/comp.el (native-comp-never-optimize-functions)
(comp--trampoline-abs-filename): Support
`comp-enable-subr-trampolines' string value.
* src/data.c (Ffset): Use Vcomp_enable_subr_trampolines now.
2023-02-13 12:48:09 +01:00
Andrea Corallo
b6e2799aa1
* Some more `inhibit-native-compile' clean-up
...
* lisp/emacs-lisp/generate-lisp-file.el (generate-lisp-file-trailer):
Use `native-comp-deferred-compilation'.
2023-02-13 11:44:28 +01:00
Andrea Corallo
c0681cd347
Revert "Add new variable 'inhibit-native-compilation'"
...
This reverts commit 5fec9182db
.
2023-02-13 10:19:31 +01:00
Andrea Corallo
3969a34fa1
Revert "Rename to inhibit-automatic-native-compilation"
...
This reverts commit f97993ee66
.
2023-02-13 10:15:33 +01:00
Eli Zaretskii
56e8607dc9
Fix spurious errors on Windows when deleting temporary *.eln files
...
* lisp/emacs-lisp/comp.el (comp--native-compile): On MS-Windows,
ignore errors when deleting a temporary .eln file. (Bug#60996)
2023-01-29 09:44:53 +02:00
Eli Zaretskii
cae528457c
; Add 2023 to copyright years.
2023-01-01 05:31:12 -05:00
Andrea Corallo
e59216d3be
* Invoke spawed Emacs processes with '-Q' when native compiling (bug#60208)
...
* lisp/emacs-lisp/comp.el (comp-final): Invoke spawned Emacs with '-Q'.
(comp-run-async-workers): Likewise.
2022-12-21 23:29:33 +01:00
Eli Zaretskii
5a245bc786
Prevent Abort dialogs from async-compiling jobs on Windows
...
* lisp/emacs-lisp/comp.el (comp-run-async-workers): Disable Abort
dialog popping in the sub-processes that perform async
compilation, by passing w32-disable-abort-dialog=t on their
command line.
2022-12-17 20:35:11 +02:00
Eli Zaretskii
6fb9a03cbd
; Remove debugging leftover message
...
* lisp/emacs-lisp/comp.el (comp--native-compile): Remove
unnecessary call to 'message'. (Bug#59766)
2022-12-03 22:06:34 +02:00
Juanma Barranquero
2772ebe366
Do not prune native-compiled system directories (bug#59658)
...
* lisp/emacs-lisp/comp.el (native-compile-prune-cache):
Skip last directory in `native-comp-eln-load-path'.
2022-11-28 17:46:21 +01:00
Stefan Kangas
ba485eb949
; Fix typos
2022-11-18 16:02:19 +01:00
Stefan Kangas
93036209fa
; Fix typos (duplicate words)
2022-11-17 09:34:24 +01:00
Eli Zaretskii
df7ca69920
Set 'native-comp-debug' to zero on MS-Windows
...
* lisp/emacs-lisp/comp.el (native-comp-debug): Don't emit debug
symbols on MS-Windows. The default was originally made 1 because
without that, C backtraces on Windows would not show
natively-compiled functions correctly, or would even stop short of
reaching the topmost call frame. But that turned out to be due to
a bug in GDB, which was meanwhile fixed in GDB 12. So we can now
reset the value back to zero, and gain smaller *.eln files on
MS-Windows.
2022-10-29 18:59:04 +03:00
Alan Mackenzie
31e7b9c073
Fix the subr-arity returned by native compiled functions with lots of args
...
This fixes bug #58739 . Make subr-arity return, e.g., (12 . 12) rather than
(12 . many) for a function with a fixed number of arguments more than 8.
* lisp/emacs-lisp/comp.el (comp-prepare-args-for-top-level): Only return a cdr
of 'many when there are &rest arguments.
* src/eval.c (eval_sub): Also check for a fixed number of args over 8 when
using the nargs + *args calling convention.
(funcall_subr): Also check numargs <= 8 before using the fixed args calling
convention. Include the case numargs > 8 in the aMany calling convention.
* src/lisp.h (DEFUN): Amend the comment about MANY.
2022-10-29 13:21:39 +00:00
Andrea Corallo
5ad5b797f7
Set `comp-no-spawn' earlier using -no-comp-spawn
...
* src/emacs.c (standard_args): Add '-no-comp-spawn' cmd line option.
* lisp/startup.el (command-line): Parse '-no-comp-spawn' cmd line
option.
* lisp/emacs-lisp/comp.el (comp-run-async-workers, comp-final):
Use '-no-comp-spawn'.
2022-10-26 08:30:09 +02:00
Andrea Corallo
56c63ca21b
* Fix async native compilation (bug#58637)
...
* lisp/emacs-lisp/comp.el (comp--native-compile): Fix gate condition.
(comp-run-async-workers): Add assetion.
2022-10-19 22:21:03 +02:00
Andrea Corallo
1a8015b837
* Prevent potential native compilation infinite recursions
...
* lisp/emacs-lisp/comp.el (comp-no-spawn): New var.
(comp-subr-trampoline-install, comp-final, comp-run-async-workers)
(comp--native-compile): Update.
2022-10-18 10:42:13 +02:00
Stefan Kangas
eff4a4f49a
Improve native-compile-prune-cache messages
...
* lisp/emacs-lisp/comp.el (native-compile-prune-cache): Quote name of
pruned directory.
2022-10-17 15:28:25 +02:00
Stefan Kangas
40b734c500
Don't prune *.eln files in parent of eln-load-path
...
* lisp/emacs-lisp/comp.el (native-compile-prune-cache): Don't
prune *.eln files in parent directory of `native-comp-eln-load-path'.
* test/lisp/emacs-lisp/comp-tests.el
(test-native-compile-prune-cache/dont-delete-in-parent-of-cache):
New test.
2022-10-17 15:26:34 +02:00
Lars Ingebrigtsen
b9aff5fdb8
Fix spurious "Compilation finished" native-comp messages
...
* lisp/emacs-lisp/comp.el (native--compile-async): Don't start the
async compilation if we didn't add anything. This avoids spurious
"Compilation finished" messages in the *Async* buffer when it
turned out that all the files we considered nativecomping were
skipped.
2022-10-17 14:30:54 +02:00
Lars Ingebrigtsen
5176d00611
Avoid having the async compile log saying it's compiling loaddefs
...
* lisp/loadup.el (featurep): Define the hash table in nativecomp
builds (but not otherwise). A more natural place to define this
would be in comp.el, but comp.el isn't loaded yet when we load the
.elc file that updates comp--no-native-compile. We could change
the load order and move the definition to comp.el, though.
* lisp/emacs-lisp/bytecomp.el (byte-compile-from-buffer): Allow
inhibiting nativecomp earlier (bug#57627).
* lisp/emacs-lisp/comp.el (native-compile-async-skip-p): Use the data.
2022-10-17 10:48:20 +02:00
Andrea Corallo
3744720904
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.
2022-10-11 21:19:21 +02:00
Lars Ingebrigtsen
f97993ee66
Rename to inhibit-automatic-native-compilation
...
* src/comp.c (maybe_defer_native_compilation):
(syms_of_comp):
* lisp/subr.el (native-comp-deferred-compilation):
* lisp/startup.el (inhibit-native-compilation):
(normal-top-level):
* lisp/progmodes/elisp-mode.el (emacs-lisp-native-compile-and-load):
* lisp/emacs-lisp/comp.el (comp-trampoline-compile):
* etc/NEWS:
* doc/lispref/compile.texi (Native-Compilation Variables): Rename
inhibit-native-compilation to inhibit-automatic-native-compilation.
2022-10-03 19:50:03 +02:00
Lars Ingebrigtsen
5fec9182db
Add new variable 'inhibit-native-compilation'
...
* doc/lispref/compile.texi (Native-Compilation Variables):
Document it.
* lisp/startup.el (normal-top-level): Set
inhibit-native-compilation from environment variable.
* lisp/subr.el (native-comp-deferred-compilation): Make obsolete.
* lisp/emacs-lisp/comp.el (comp-trampoline-compile): Don't write
trampolines to disk.
* lisp/progmodes/elisp-mode.el
(emacs-lisp-native-compile-and-load): Adjust.
* src/comp.c (syms_of_comp): New variable
inhibit-native-compilation.
(maybe_defer_native_compilation): Use it.
2022-10-03 15:26:13 +02:00
Stefan Kangas
9b14e312f4
Merge from origin/emacs-28
...
478b786d5a
; * doc/lispref/windows.texi (Window Hooks): Fix a typo (b...
5085351645
* lisp/text-modes/tex-mode.el (tex-mode): Fix AUCTeX regre...
ee6f8598ca
Add vc-annotate-switches to manual
616dcf27e5
; Fix typos in Lisp symbols
5405852541
Remove mention of non-existent `annotate-switches'
191505b8a3
Mention that src/macuvs.h sometimes needs committing
10373c4b68
; More comment fixes in font.h (bug#57935)
c2595b8dcc
; * src/font.h (struct font_driver): Comment fix.
97b928ce09
MacOS ld warning from native compilation (bug#57849)
2022-09-21 10:25:06 +02:00
Mattias Engdegård
60102016e4
Abolish max-specpdl-size (bug#57911)
...
The max-lisp-eval-depth limit is sufficient to prevent unbounded stack
growth including the specbind stack; simplify matters for the user by
not having them to worry about two different limits. This change
turns max-specpdl-size into a harmless variable with no effects,
to keep existing code happy.
* lisp/subr.el (max-specpdl-size):
Define as an ordinary (but obsolete) dynamic variable.
* admin/grammars/Makefile.in:
* doc/lispintro/emacs-lisp-intro.texi (Loops & Recursion):
* doc/lispref/control.texi (Cleanups):
* doc/lispref/edebug.texi (Checking Whether to Stop):
* doc/lispref/eval.texi (Eval):
* doc/lispref/variables.texi (Local Variables):
* doc/misc/calc.texi (Recursion Depth):
Update documentation.
* etc/NEWS: Announce.
* src/eval.c
(FletX): Use safe iteration to guard against circular bindings list.
(syms_of_eval): Remove old max-specpdl-size definition.
(init_eval_once, restore_stack_limits, call_debugger)
(signal_or_quit, grow_specpdl_allocation):
* leim/Makefile.in:
* lisp/Makefile.in:
* lisp/calc/calc-stuff.el (calc-more-recursion-depth)
(calc-less-recursion-depth):
* lisp/calc/calc.el (calc-do):
* lisp/cedet/semantic/ede-grammar.el (ede-proj-makefile-insert-rules):
* lisp/cedet/semantic/grammar.el (semantic-grammar-batch-build-one-package):
* lisp/cus-start.el (standard):
* lisp/emacs-lisp/comp.el (comp--native-compile):
* lisp/emacs-lisp/edebug.el (edebug-max-depth):
(edebug-read-and-maybe-wrap-form, edebug-default-enter):
* lisp/emacs-lisp/regexp-opt.el (regexp-opt):
* lisp/eshell/esh-mode.el (eshell-mode):
* lisp/loadup.el (max-specpdl-size):
* lisp/mh-e/mh-e.el (mh-invisible-headers):
* lisp/net/shr.el (shr-insert-document, shr-descend):
* lisp/play/hanoi.el (hanoi-internal):
* lisp/progmodes/cperl-mode.el:
* src/fileio.c (Fdo_auto_save):
Remove references to and modifications of max-specpdl-size.
2022-09-19 19:30:03 +02:00
Gerd Möllmann
97b928ce09
MacOS ld warning from native compilation (bug#57849)
...
* lisp/emacs-lisp/comp.el (native-comp-driver-options): Add "-Wl,-w"
on Darwin systems.
* etc/NEWS: Describe change.
2022-09-19 07:14:58 +02:00
Stefan Kangas
5c8b76fc87
Merge from origin/emacs-28
...
5713c730f2
Update to Org 9.5.5
aad38d6010
* lisp/emacs-lisp/comp.el (comp-run-async-workers): Fail m...
2022-09-05 06:30:32 +02:00
Stefan Monnier
aad38d6010
* lisp/emacs-lisp/comp.el (comp-run-async-workers): Fail more gracefully
...
Otherwise Emacs may fail to start if it can't find a writable
`~/.emacs.d/eln-cache` directory.
Fixes bug#57562. See also Debian's bug #1017739 .
2022-09-03 15:14:58 -04:00
Eli Zaretskii
dcfe3314cd
Teach 'max-char' about the Unicode code range
...
* src/character.c (Fmax_char): Accept an optional argument
UNICODE, and, if non-nil, return the maximum codepoint defined by
Unicode.
* lisp/emacs-lisp/comp.el (comp-known-type-specifiers): Update the
signature of 'max-char'.
* etc/NEWS:
* doc/lispref/nonascii.texi (Character Codes): Update the
documentation of 'max-char'.
2022-09-03 13:45:53 +03:00
Andrea Corallo
a5e36575ae
* lisp/emacs-lisp/comp.el (comp-known-type-specifiers): Fix some type spec
2022-08-22 10:29:18 +02:00
Mattias Engdegård
1ad0d60740
Fix string-to-syntax signature in comp-known-type-specifiers
...
* lisp/emacs-lisp/comp.el (comp-known-type-specifiers):
`string-to-syntax` can return nil.
2022-08-18 17:25:41 +02:00
Andrea Corallo
67ec994180
* lisp/emacs-lisp/comp.el (comp-known-type-specifiers): Fix some type
2022-08-18 17:11:59 +02:00