Commit graph

824 commits

Author SHA1 Message Date
Andrea Corallo
c3514a6274 Merge remote-tracking branch 'savannah/master' into HEAD 2020-08-29 11:33:37 +02:00
Michael Albinus
36f2f67c96 Merge from origin/emacs-27
44104a607a Fix error in GMP test
e26e63444d Add Feature testing for Windows binaries
4e2caef384 ; * src/character.c (str_as_multibyte): Fix the commentary.
d3a4ce8420 Revert "; * etc/NEWS: Remove temporary note on documentati...
16f00e36dc * admin/admin.el (set-version): Trap yet another NEWS error.
121be3e118 ; * etc/NEWS: Remove temporary note on documentation.  (Bu...
5fcb97dabd Fix cond jump table compilation (bug#42919)
2020-08-25 15:29:38 +02:00
Mattias Engdegård
5fcb97dabd Fix cond jump table compilation (bug#42919)
This bug affected compilation of

 (cond ((member '(some list) variable) ...) ...)

While equal is symmetric, member is not; in the latter case the
arguments must be a variable and a constant list, in that order.

Reported by Ikumi Keita.

* lisp/emacs-lisp/bytecomp.el (byte-compile--cond-switch-prefix):
Don't treat equality and member predicates in the same way; only
the former are symmetric in their arguments.
* test/lisp/emacs-lisp/bytecomp-tests.el
(byte-opt-testsuite-arith-data): Add test cases.
2020-08-19 15:26:34 +02:00
Andrea Corallo
40de06390d * Remove a false permission related error while native compiling
* lisp/emacs-lisp/bytecomp.el (byte-compile-file): Do not crash if
	native compiling we have no permission to create the .elc
	file.  We are not creating it.
2020-08-17 18:04:23 +02:00
Andrea Corallo
dd814b0a58 * lisp/emacs-lisp/bytecomp.el: Guard against double native compilation. 2020-08-09 15:03:53 +02:00
Andrea Corallo
12a982d978 Merge remote-tracking branch 'savannah/master' into HEAD 2020-08-09 15:03:23 +02:00
Mattias Engdegård
0facaeec1a Clean up and improve compilation of arithmetic (bug#42597)
* lisp/emacs-lisp/byte-opt.el (byte-optimize-associative-math)
(byte-optimize-min-max): Transform 3-arg min/max call into two 2-arg
calls, which is faster.
* lisp/emacs-lisp/bytecomp.el (byte-compile-associative): Rename to...
(byte-compile-variadic-numeric): ...this function and simplify,
fixing incorrect comments.  The 3-arg strength reduction is now
always done in the optimisers and is no longer needed here.
(byte-compile-min-max): New function.
(byte-compile-minus): Simplify, remove incorrect comment, and use
byte-compile-variadic-numeric.
(byte-compile-quo): Simplify and fix comment.
2020-08-07 10:00:45 +02:00
Mattias Engdegård
204273c3b9 Fix byte-compilation of (+ -0.0) (bug#42597)
* lisp/emacs-lisp/bytecomp.el (byte-compile-associative):
Translate numerical identity expressions, such as (+ x) and (* x),
into (* x 1) since the previous translation (+ x 0) gets it wrong
for x = -0.0.
* test/lisp/emacs-lisp/bytecomp-tests.el
(byte-opt-testsuite-arith-data): Add test cases.
2020-08-07 09:41:15 +02:00
Andrea Corallo
decced8337 Allow per function speed declaration
* src/comp.c (COMP_SPEED): Rename.
	(comp_t): Add 'func_speed' field.
	(emit_mvar_lval, compile_function): Update for per function speed.
	(Fcomp__compile_ctxt_to_file): COMP_SPEED renamed.

	* lisp/emacs-lisp/comp.el (comp-speed): Doc update.
	(comp-func): New 'speed' slot.
	(comp-spill-speed): New function.
	(comp-spill-lap-function, comp-intern-func-in-ctxt): Fill 'speed'
	slot.
	(comp-spill-lap-function): Gate -1 speed functions for native
	compilation and emit bytecode instead.
	(comp-spill-lap): Close over `byte-to-native-plist-environment'.
	(comp-latch-make-fill): Update for per function speed.
	(comp-limplify-top-level): Fill speed.
	(comp-propagate1, comp-call-optim-form-call, comp-call-optim)
	(comp-dead-code, comp-tco, comp-remove-type-hints): Update for per
	function speed.
2020-06-22 00:05:29 +02:00
Andrea Corallo
29b2a08c36 Execute top level forms in the right lex/dyn scope.
* lisp/emacs-lisp/bytecomp.el (byte-to-native-top-level): Add
	'lexical' slot.
	(byte-compile-output-file-form): Update for new slot.
	(byte-compile-file-form-defmumble): Capture scope.

	* lisp/emacs-lisp/comp.el (comp-emit-for-top-level): Specify
	execution scope.
2020-06-22 00:03:23 +02:00
Andrea Corallo
f5ea65b436 Merge remote-tracking branch 'savannah/master' into HEAD 2020-06-04 10:33:07 +01:00
Paul Eggert
e10bd9e249 Merge from origin/emacs-27
44c0e074f7 * doc/emacs/buffers.texi (Icomplete): Mention icomplete-mi...
68b6dad1d8 Be more aggressive in marking objects during GC
36f508f589 ; * src/xdisp.c (find_last_unchanged_at_beg_row): Fix a typo.
cc340da1fe Fix bug #41618 "(byte-compile 'foo) errors when foo is a m...
41232e6797 Avoid crashes due to bidi cache being reset during redisplay
f72bb4ce36 * lisp/tab-bar.el (switch-to-buffer-other-tab): Normalize ...
d3e0023aaa ; * etc/TODO: Fix formatting.  (Bug#41497)
a8ad94cd2f Fix mingw.org's MinGW GCC 9 warning about 'execve'

# Conflicts:
#	lisp/tab-bar.el
#	nt/inc/ms-w32.h
#	src/alloc.c
2020-06-01 22:26:32 -07:00
Alan Mackenzie
cc340da1fe Fix bug #41618 "(byte-compile 'foo) errors when foo is a macro."
* lisp/emacs-lisp/bytecomp.el (byte-compile): Disentangle the eval of the
final form from the pushing of 'macro onto it, doing the former first.
2020-05-31 16:46:06 +00:00
Andrea Corallo
a335f7eeac Update spill LAP machinery and compile anonymous lambdas
* lisp/emacs-lisp/comp.el (comp-spill-lap-function): Make use of
	byte-to-native-lambdas-h and update for 'byte-to-native-func-def'.
	(comp-spill-lap-function): Rework logic to retrive LAP using
	'byte-to-native-lambdas-h'.
	(comp-emit-for-top-level): Update for 'byte-to-native-function'.

	* lisp/emacs-lisp/bytecomp.el: Add commentary on new spill LAP
	mechanism.
	(byte-to-native-lambda, byte-to-native-func-def): New structures.
	(byte-to-native-top-level): Indent.
	(byte-to-native-lambdas-h): Update doc.
	(byte-compile-lapcode): Add a 'byte-to-native-lambda' instance
	into byte-to-native-lambdas-h instead of just LAP.
	(byte-compile-file-form-defmumble): Store into
	'byte-to-native-func-def' only the byte compiled function, the LAP
	will be retrived through 'byte-to-native-lambdas-h'.
	(byte-compile-lambda): Return the byte compiled function.
2020-05-14 21:50:31 +01:00
Andrea Corallo
c6a610ecdc Merge remote-tracking branch 'savannah/master' into HEAD 2020-05-04 18:24:00 +01:00
Michael Heerdegen
0c899eede3 Make `make-local-variable' declare the var locally dynamic
The only effect of this change is to get rid of some unnecessary
"assignment to free variable" warnings.

* lisp/emacs-lisp/bytecomp.el (byte-compile-make-local-variable): New
function.
2020-04-30 20:50:33 +02:00
Andrea Corallo
f8b254d195 Rework spill LAP mechanism in preparation of compiling lambdas.
* lisp/emacs-lisp/comp.el (comp-spill-lap-function): No need anymore
	to have `byte-native-compiling' bound to free-func.
	(comp-spill-lap-function): Make use of `byte-to-native-lap-h' and
	clean-up.
	(comp-spill-lap-function): Likewise.

	* lisp/emacs-lisp/bytecomp.el (byte-to-native-function): Add lap slot.
	(byte-to-native-lap): Rename into byte-to-native-lap-h.
	(byte-compile-lapcode): Spill lap after having int assembled and
	store it into `byte-to-native-lap-h'.
	(byte-compile-not-top-level): Remove.
	(byte-compile-file-form-defmumble): Fill directly lap slot.
	(byte-compile-lambda): Remove `byte-compile-not-top-level'.
	(byte-compile-out-toplevel): Restore original code.
	(byte-compile-form): Remove `byte-compile-not-top-level'.
	(byte-compile-function-form): Likewise.
	(byte-compile-flush-pending): No need anymore to set
	`byte-compile-current-form' so restore orignal code.
2020-04-26 22:17:37 +01:00
Andrea Corallo
81389d5f2d * lisp/emacs-lisp/bytecomp.el (byte-compile-refresh-preloaded): Add comp.eln 2020-04-23 08:54:46 +01:00
Andrea Corallo
301cf0d278 Merge remote-tracking branch 'savannah/master' into HEAD 2020-04-23 08:41:15 +01:00
Glenn Morris
477b9eaf45 Merge from origin/emacs-27
05089a4d65 (origin/emacs-27) Tweak wording re constant variables
a1040861f1 Tweak setcar-related wording
751510f865 * lisp/image-mode.el: Add prefix key 's' and reduce depend...
9261a219ec * doc/emacs/windows.texi (Window Convenience): Decribe mor...
e1d42da0d6 Fix mutability glitches reported by Drew Adams
5805df74f5 Improve mutability doc
dca35b31d0 Improve mutability documentation
81e7d7f111 Document that quoting yields constants
5734339f40 * doc/lispref/keymaps.texi (Extended Menu Items, Easy Menu...
14a570afae Remove #' and function quoting from lambda forms in manual
d5ec18c66b * src/regex-emacs.c (re_match_2_internal): Rework comment ...
4df8a61117 Add new node "Image Mode" to Emacs Manual.
d7d5ee6c57 ; Fix a typo in cmdargs.texi (bug#40701)
5e9db48fbe * doc/lispref/display.texi (Customizing Bitmaps): Fix typo.
eebfb72c90 Document constant vs mutable objects better
6c187ed6b0 Improve documentation of 'sort-lines'
52288f4b66 Mention 'spam-stat-process-directory-age' in the documenta...
067b070598 ; Fix some typos and doc issues (bug#40695)

# Conflicts:
#	etc/NEWS
2020-04-20 07:50:19 -07:00
Štěpán Němec
067b070598 ; Fix some typos and doc issues (bug#40695) 2020-04-18 17:10:02 +02:00
Andrea Corallo
530faee275 Fix free function compilation 2020-03-29 12:30:33 +01:00
Andrea Corallo
d5f6dc131b Prevent collisions in C namespace and function shadowing
This rework make functions being indexed by their unique C symbol name
preventing multiple lisp function with the same name colliding.
2020-03-29 12:30:33 +01:00
Andrea Corallo
87ee6ff4eb Merge remote-tracking branch 'savannah/master' into HEAD 2020-03-09 07:49:33 +00:00
Stefan Monnier
e4fb95fa18 * lisp/emacs-lisp/bytecomp.el: Drop warning for loading into Emacs<23
Stash the major version of the compiling Emacs such that the loading
Emacs can later detect when loading a file compiled by a too-new Emacs.

(byte-compile-fix-header): Remove.
(byte-compile-from-buffer): Don't call it any more.
(byte-compile-insert-header): Stash the emacs-major-version in it.
Don't leave space for `byte-compile-fix-header`.
2020-03-07 23:28:12 -05:00
Mattias Engdegård
03c07c88d9 Generate 'substring' byte op (bug#39709)
The 'substring' byte op was not emitted, apparently by mistake.  Fix.
Suggested by Mark Oteiza <mvoteiza@udel.edu>.

* lisp/emacs-lisp/bytecomp.el (byte-defop-compiler): Add '1-3' clause.
(byte-compile-one-to-three-args): New.
* lisp/emacs-lisp/byte-opt.el (byte-compile-side-effect-free-ops):
Add 'byte-substring'.
* test/lisp/emacs-lisp/bytecomp-tests.el
(byte-opt-testsuite-arith-data): Test 'substring'.
2020-02-25 16:40:11 +01:00
Paul Eggert
9d626dffc6 Add 'nofollow' flag to set-file-modes etc.
This avoids some race conditions (Bug#39683).  E.g., if some other
program changes a file to a symlink between the time Emacs creates
the file and the time it changes the file’s permissions, using the
new flag prevents Emacs from inadvertently changing the
permissions of a victim in some completely unrelated directory.
* admin/merge-gnulib (GNULIB_MODULES): Add fchmodat.
* doc/lispref/files.texi (Testing Accessibility, Changing Files):
* doc/lispref/os.texi (File Notifications):
* etc/NEWS:
Adjust documentation accordingly.
* lib/chmodat.c, lib/fchmodat.c, lib/lchmod.c, m4/fchmodat.m4:
* m4/lchmod.m4: New files, copied from Gnulib.
* lib/gnulib.mk.in: Regenerate.
* lisp/dired-aux.el (dired-do-chmod):
* lisp/doc-view.el (doc-view-make-safe-dir):
* lisp/emacs-lisp/autoload.el (autoload--save-buffer):
* lisp/emacs-lisp/bytecomp.el (byte-compile-file):
* lisp/eshell/em-pred.el (eshell-pred-file-mode):
* lisp/files.el (backup-buffer-copy, copy-directory):
* lisp/gnus/mail-source.el (mail-source-movemail):
* lisp/gnus/mm-decode.el (mm-display-external):
* lisp/gnus/nnmail.el (nnmail-write-region):
* lisp/net/tramp-adb.el (tramp-adb-handle-file-local-copy)
(tramp-adb-handle-write-region):
* lisp/net/tramp-sh.el (tramp-do-copy-or-rename-file-directly):
* lisp/net/tramp-sudoedit.el (tramp-sudoedit-handle-write-region):
* lisp/net/tramp.el (tramp-handle-write-region)
(tramp-make-tramp-temp-file):
* lisp/server.el (server-ensure-safe-dir):
* lisp/url/url-util.el (url-make-private-file):
When getting or setting file modes, avoid following symbolic links
when the file is not supposed to be a symbolic link.
* lisp/doc-view.el (doc-view-make-safe-dir):
Omit no-longer-needed separate symlink test.
* lisp/gnus/gnus-util.el (gnus-set-file-modes):
* lisp/net/tramp.el (tramp-handle-file-modes):
* lisp/net/tramp-gvfs.el (tramp-gvfs-handle-set-file-modes):
* src/fileio.c (symlink_nofollow_flag): New function.
(Ffile_modes, Fset_file_modes):
Support an optional FLAG arg.  All C callers changed.
* lisp/net/ange-ftp.el (ange-ftp-set-file-modes):
* lisp/net/tramp-adb.el (tramp-adb-handle-set-file-modes):
* lisp/net/tramp-sh.el (tramp-sh-handle-set-file-modes):
* lisp/net/tramp-smb.el (tramp-smb-handle-set-file-modes):
* lisp/net/tramp-sudoedit.el (tramp-sudoedit-handle-set-file-modes):
Accept an optional FLAG arg that is currently ignored,
and add a FIXME comment for it.
* m4/gnulib-comp.m4: Regenerate.
2020-02-23 16:45:50 -08:00
Andrea Corallo
3e1ec5d87d Merge remote-tracking branch 'savannah/master' into HEAD 2020-02-26 10:39:15 +00:00
Andrea Corallo
1dc237f280 Make build process robust against interruptions
During boo-strap we produce both the .eln and the .elc together.
Because the make target is the later this has to be produced as last
to be resilient to build interruptions.
2020-02-23 16:50:15 +00:00
Andrea Corallo
f1bc8e480c Merge remote-tracking branch 'savannah/master' into HEAD 2020-02-14 23:22:10 +01:00
Stefan Kangas
feb681dc36 Silence byte-compiler warning
* lisp/emacs-lisp/bytecomp.el (byte-compile-insert-header): Silence
byte-compiler warning about "Unused lexical variable".
2020-02-05 13:28:31 +01:00
Andrea Corallo
15aedf3e3d Merge remote-tracking branch 'savannah/master' into HEAD 2020-02-04 15:11:20 +01:00
Glenn Morris
cd2d812ec1 Unbreak byte compilation
* lisp/emacs-lisp/bytecomp.el (byte-compile-fix-header):
Update for recent header changes.
(byte-compile-insert-header): Add more padding.
2020-01-23 12:22:49 -08:00
Stefan Kangas
c4687d920d Remove irrelevant info from .elc headers
* lisp/emacs-lisp/bytecomp.el (byte-compile-insert-header): Don't
insert information on ancient Emacs in bytecode headers.  (Bug#39233)
2020-01-23 17:55:02 +01:00
Rüdiger Sonderfeld
0e57792395 Add space before messsage in byte compiler warnings
According to the GNU coding standards (info "(standards) Errors"):
> If you want to mention the column number, use one of these formats:
>      SOURCE-FILE-NAME:LINENO:COLUMN: MESSAGE
>      SOURCE-FILE-NAME:LINENO.COLUMN: MESSAGE

* lisp/emacs-lisp/bytecomp.el (byte-compile-warning-prefix): Add space
before message in byte compiler warnings to comply with the GNU coding
standards.  (Bug#18969)
2020-01-19 02:02:28 +01:00
Mattias Engdegård
35d5694825 Mark 'catch' and 'condition-case' bytecodes as obsolete
They have not been generated by the byte-compiler since Emacs 25.

* lisp/emacs-lisp/bytecomp.el (byte-catch, byte-condition-case):
* src/bytecode.c (BYTE_CODES, exec_byte_code):
Mark as obsolete (since Emacs 25; they were still generated in 24.4).
2020-01-05 23:30:05 +01:00
Mattias Engdegård
2d5d0fa1b4 Remove generation of old bytecodes for catch/unwind
* lisp/emacs-lisp/bytecomp.el (byte-compile--use-old-handlers)
(byte-compile-condition-case, byte-compile-condition-case--old):
Remove.
(byte-compile-condition-case--new):
Rename to byte-compile-condition-case.
(byte-compile-catch, byte-compile-unwind-protect):
* lisp/emacs-lisp/cconv.el (cconv-convert, cconv-analyze-form):
* lisp/emacs-lisp/byte-opt.el (byte-optimize-form-code-walker):
Simplify.
2020-01-05 11:19:52 +01:00
Andrea Corallo
25332bb0d3 Fix bytecomp message when native compiling 2020-01-02 23:01:38 +01:00
Andrea Corallo
037b9897a4 add batch-byte-native-compile-for-bootstrap 2020-01-01 11:38:18 +01:00
Andrea Corallo
d7071c6457 spill also interactive functions 2020-01-01 11:38:12 +01:00
Andrea Corallo
ce254ffa44 do not emit elc file while native compiling 2020-01-01 11:38:11 +01:00
Andrea Corallo
9650e5a1a9 revert unnecessary modifications 2020-01-01 11:38:10 +01:00
Andrea Corallo
a421c27723 fix single function compilation 2020-01-01 11:38:09 +01:00
Andrea Corallo
33d8b736b0 do not native compile interactive functions 2020-01-01 11:38:01 +01:00
Andrea Corallo
9f15b4c3ca fix top level macro generation 2020-01-01 11:38:01 +01:00
Andrea Corallo
5eb8d3dba1 rework bytecomp spill code 2020-01-01 11:38:00 +01:00
Andrea Corallo
0ae14c17a2 fix compilation of devar defconst with doc string 2020-01-01 11:37:55 +01:00
Andrea Corallo
0a014a3862 rework lap spilling 2020-01-01 11:37:51 +01:00
Andrea Corallo
59a428ed6c fix single function compilation 2020-01-01 11:37:45 +01:00
Andrea Corallo
555450c7b1 fix lambda handling and add a test for that 2020-01-01 11:37:45 +01:00