Commit graph

7062 commits

Author SHA1 Message Date
Andrea Corallo
898f929215 Fix nativecomp cond-rw pass
* lisp/emacs-lisp/comp.el (comp-mvar-symbol-p): Improve it.
	(comp-cond-rw-func): Fix logic for multiple predecessor on target
	block.
	* test/src/comp-tests.el (comp-test-cond-rw-1): New test.
	* test/src/comp-test-funcs.el (comp-test-cond-rw-1-1-f)
	(comp-test-cond-rw-1-2-f): New functions.
2020-11-16 15:32:52 +01:00
Andrea Corallo
54f2e9c06d * Improve `comp-fwprop-call'
* lisp/emacs-lisp/comp.el (comp-function-call-maybe-fold):
	Document return value.
	(comp-fwprop-call): Simplify and improve.
2020-11-15 21:16:23 +01:00
Andrea Corallo
2f8d0fca88 * Add more type specifiers
* lisp/emacs-lisp/comp.el (comp-known-type-specifiers): Add more
	pure functions.
2020-11-15 18:51:06 +01:00
Andrea Corallo
2a8bf2222d Merge remote-tracking branch 'savannah/master' into dev 2020-11-14 22:07:54 +01:00
Andrea Corallo
f702426780 Add `comp-constraint-to-type-spec' and better handle boolean type spec
* lisp/emacs-lisp/comp.el (comp-constraint-to-type-spec): New
	function splitting out code from comp-ret-type-spec + better
	handle boolean type specifier.
	(comp-ret-type-spec): Rework to leverage
	`comp-constraint-to-type-spec'.
	* test/src/comp-tests.el (comp-tests-type-spec-tests): Add a
	testcase.
2020-11-14 22:06:31 +01:00
Andrea Corallo
bcecdedcb7 Handle correctly quoting in *Native-compile-Log* buffer
* lisp/emacs-lisp/comp.el (comp-log): Add `quoted' parameter and
	pass it to `comp-log-to-buffer'.
	(comp-log-to-buffer): Add `quoted' parameter and leverage `prin1'
	or `princ' accordingly.
2020-11-14 22:06:31 +01:00
Andrea Corallo
22da28cf66 * Split logic into comp-fwprop-call and improve it
* lisp/emacs-lisp/comp.el (comp-func-ret-valset)
	(comp-fwprop-call): New functions.
	(comp-fwprop-insn): Remove code duplicaiton and call
	`comp-fwprop-call'.
2020-11-14 22:06:31 +01:00
Andrea Corallo
aced2cf6ac * Add a number of type specifiers for pure function
* lisp/emacs-lisp/comp.el (comp-known-type-specifiers): Add 60
	pure function type specifiers.
2020-11-14 22:06:31 +01:00
Andrea Corallo
a467fa5c49 Characterize functions in terms of type specifiers
* lisp/emacs-lisp/comp.el (comp-known-type-specifiers): New const
	in place of `comp-known-ret-types' and `comp-known-ret-ranges'.
	(comp-constraint): New struct to separate the constraint side of
	an mvar.
	(comp-constraint-f): Analogous for functions.
	(comp-mvar): Rework and include `comp-constraint'.
	(comp-type-spec-to-constraint): New function.
	(comp-known-constraints-h): New const.
	(comp-func-ret-typeset, comp-func-ret-range): Rework.
	(comp-fwprop-insn): Fix.
	* test/src/comp-tests.el (destructure-type-spec): New testcase.
2020-11-14 22:06:31 +01:00
Stefan Kangas
61dca6e92a Don't quote lambdas in several places
* lisp/align.el (align-highlight-rule):
* lisp/bookmark.el (bookmark-maybe-sort-alist):
* lisp/emacs-lisp/advice.el (ad-read-advice-name)
(ad-retrieve-args-form, ad-make-hook-form, defadvice)
(ad-with-originals):
* lisp/foldout.el (foldout-inhibit-key-bindings):
* lisp/gnus/gnus-bookmark.el (gnus-bookmark-maybe-sort-alist):
* lisp/mail/rfc822.el (rfc822-addresses-1):
* lisp/net/eudcb-ldap.el (eudc-ldap-cleanup-record-simple):
* lisp/net/net-utils.el (network-connection-to-service):
* lisp/net/socks.el (socks-build-auth-list):
* lisp/org/ox-odt.el (org-odt--image-size):
* lisp/pcomplete.el (pcomplete-command-completion-function)
(pcomplete-default-completion-function, pcomplete-opt):
* lisp/progmodes/cperl-mode.el (cperl-highlight-charclass)
(cperl-tags-hier-init, cperl-tags-treeify)
(cperl-next-interpolated-REx, cperl-time-fontification):
* lisp/shadowfile.el (shadow-copy-files, shadow-shadows-of-1)
(shadow-save-buffers-kill-emacs):
* lisp/strokes.el (strokes-renormalize-to-grid):
* lisp/tempo.el (tempo-insert, tempo-forward-mark)
(tempo-backward-mark):
* lisp/textmodes/artist.el (artist-submit-bug-report):
* lisp/textmodes/ispell.el (ispell-complete-word):
* lisp/url/url-auth.el (url-get-authentication):
* lisp/url/url-cache.el (url-cache-create-filename-human-readable):
* lisp/vcursor.el (vcursor-find-window):
* test/lisp/textmodes/reftex-tests.el
(reftex-parse-bibtex-entry-test): Don't quote lambdas.
2020-11-14 17:04:23 +01:00
Andrea Corallo
c412d396b0 * lisp/emacs-lisp/comp.el (comp-mvar-value-vld-p): Fix logic. 2020-11-12 23:58:15 +01:00
Andrea Corallo
a37cc95e21 * Memoize `comp-common-supertype'
* lisp/emacs-lisp/comp.el (comp-ctxt): Add `common-supertype-mem'
	slot.
	(comp-common-supertype): Memoize.
2020-11-12 23:57:43 +01:00
Andrea Corallo
6f10e0f09f * Rework comp-ret-type-spec' in terms of comp-phi'
* lisp/emacs-lisp/comp.el (comp-ret-type-spec): Use `comp-func'
	not to duplicate logic plus add null type specifier support and
	some comments.
2020-11-12 23:55:49 +01:00
Andrea Corallo
c4749cebeb * Move phi function code into dedicated function and improve it
* lisp/emacs-lisp/comp.el (comp-phi): New function moving logic
	from `comp-fwprop-insn'.
2020-11-12 23:53:26 +01:00
Stefan Kangas
206dd9d592 Don't quote lambdas in several places
* lisp/allout-widgets.el (allout-widgets-adjusting-message)
(allout-widgets-exposure-change-processor)
(allout-widgets-count-buttons-in-region):
* lisp/ansi-color.el (ansi-color-make-color-map):
* lisp/case-table.el (describe-buffer-case-table):
* lisp/emacs-lisp/byte-opt.el (byte-decompile-bytecode-1):
* lisp/gnus/gnus-agent.el (gnus-agent-regenerate-group):
* lisp/gnus/nnir.el (nnir-run-swish++, nnir-run-swish-e)
(nnir-run-hyrex, nnir-run-namazu):
* lisp/hippie-exp.el (make-hippie-expand-function)
(try-complete-lisp-symbol, try-complete-lisp-symbol-partially)
(try-expand-all-abbrevs):
* lisp/international/mule-cmds.el (sort-coding-systems)
(select-safe-coding-system, select-message-coding-system)
(read-language-name, encoded-string-description):
* lisp/international/quail.el (quail-keyseq-translate)
(quail-get-translations, quail-build-decode-map)
(quail-insert-decode-map):
* lisp/jka-compr.el (jka-compr-uninstall):
* lisp/locate.el (locate-in-alternate-database):
* lisp/mail/mailabbrev.el (mail-resolve-all-aliases-1)
(mail-abbrev-make-syntax-table):
* lisp/mh-e/mh-seq.el (mh-read-folder-sequences):
* lisp/net/eudcb-ldap.el (eudc-ldap-simple-query-internal):
* lisp/progmodes/make-mode.el (makefile-query-targets)
(makefile-prompt-for-gmake-funargs):
* lisp/shadowfile.el (shadow-cancel, shadow-shadows-of):
* lisp/sort.el (sort-pages, sort-fields, sort-regexp-fields):
* lisp/subr.el (listify-key-sequence):
* lisp/term/wyse50.el (terminal-init-wyse50):
* lisp/textmodes/ispell.el (ispell-help)
(ispell-begin-tex-skip-regexp):
* lisp/textmodes/page-ext.el (pages-sort-region):
* lisp/textmodes/refer.el (refer-find-entry-in-file):
* lisp/url/url-expand.el (url-expand-file-name): Don't quote lambdas.
2020-11-12 22:24:58 +01:00
Lars Ingebrigtsen
4ad3402fb3 Remove mention of `edebug-on-signal' from a doc string
* lisp/emacs-lisp/edebug.el (edebug-mode): Don't mention
non-existent user option (bug#44577).
2020-11-12 13:39:40 +01:00
Stefan Kangas
4e94267042 Remove redundant installation instructions
* lisp/net/newsticker.el:
* lisp/net/sieve-mode.el:
* lisp/play/bubbles.el:
* lisp/play/handwrite.el:
* lisp/progmodes/python.el:
* lisp/progmodes/ruby-mode.el:
* lisp/whitespace.el: Remove redundant installation instructions.
These packages are distributed with Emacs and/or GNU ELPA.
* lisp/calendar/timeclock.el:
* lisp/ehelp.el:
* lisp/emacs-lisp/checkdoc.el:
* lisp/filesets.el:
* lisp/mail/reporter.el:
* lisp/net/rfc2104.el:
* lisp/net/webjump.el:
* lisp/pixel-scroll.el: Remove redundant recommendation to call
require before using autoloaded functions.
* lisp/tar-mode.el: Remove reference to package uncompress, removed in
Emacs 23.
2020-11-12 03:12:35 +01:00
Andrea Corallo
93a80a4fae * Add nativecomp derived return type specifier computation support
* lisp/emacs-lisp/comp.el (comp-post-pass-hooks): Nit.
	(comp-func): Add `ret-type-specifier' slot.
	(comp-ret-type-spec): New function.
	(comp-final): Call `comp-ret-type-spec'.
2020-11-12 00:55:37 +01:00
Andrea Corallo
6b7c257e0b * Unline some functions to optimize bootstrap time
* lisp/emacs-lisp/comp.el (comp-mvar-value-vld-p)
	(comp-mvar-value, comp-mvar-fixnum-p, comp-set-op-p)
	(comp-assign-op-p, comp-call-op-p, comp-type-hint-p)
	(comp-func-ret-typeset, comp-function-pure-p)
	(comp-alloc-class-to-container, comp-lex-byte-func-p)
	(comp-lap-eob-p, comp-lap-fall-through-p, comp-emit)
	(comp-emit-set-call, comp-mvar-propagate)
	(comp-function-foldable-p, comp-function-call-maybe-fold)
	(comp-trampoline-filename): Uninline functions.
2020-11-12 00:55:37 +01:00
Andrea Corallo
00b4e0a9bb * Fix limple-mode for new type and range limple semantic
* lisp/emacs-lisp/comp.el (comp-limple-branches, comp-limple-ops):
	New variables.
	(comp-limple-lock-keywords): Update value.
2020-11-12 00:55:36 +01:00
Andrea Corallo
e96cd4e82c Add initial nativecomp typeset and range propagation support
This commit add an initial support for a better type propagation and
integer range propagation.

Each mvar can be now characterized by a set of types, a set of values
and an integral range.

	* lisp/emacs-lisp/comp.el (comp-known-ret-types): Store into
	typeset and remove fixnum.
	(comp-known-ret-ranges, comp-type-predicates): New variables.
	(comp-ctxt): Remove supertype-memoize slot and add
	union-typesets-mem.
	(comp-mvar): Remove const-vld, constant, type slots. Add typeset,
	valset, range slots.
	(comp-mvar-value-vld-p, comp-mvar-value, comp-mvar-fixnum-p)
	(comp-mvar-symbol-p, comp-mvar-cons-p)
	(comp-mvar-type-hint-match-p, comp-func-ret-typeset)
	(comp-func-ret-range): New functions.
	(make-comp-mvar, make-comp-ssa-mvar): Update logic.
	(comp--typeof-types): New variable.
	(comp-supertypes, comp-common-supertype): Logic update.
	(comp-subtype-p, comp-union-typesets, comp-range-1+)
	(comp-range-1-, comp-range-<, comp-range-union)
	(comp-range-intersection): New functions.
	(comp-fwprop-prologue, comp-mvar-propagate)
	(comp-function-foldable-p, comp-function-call-maybe-fold)
	(comp-fwprop-insn, comp-call-optim-func, comp-finalize-relocs):
	Logic update.

	* src/comp.c (emit_mvar_rval, emit_call_with_type_hint)
	(emit_call2_with_type_hint): Logic update.

	* lisp/emacs-lisp/cl-preloaded.el (cl--typeof-types): Undo the add
	of fixnum and bignum as unnecessary.

	* test/src/comp-tests.el
	(comp-tests-mentioned-p-1, comp-tests-cond-rw-checker-val)
	(comp-tests-cond-rw-checker-type, cond-rw-1, cond-rw-2)
	(cond-rw-3, cond-rw-4, cond-rw-5): Update for new type interface.
	(range-simple-union, range-simple-intersection): New integer range
	tests.
	(union-types): New union type test.
2020-11-12 00:55:36 +01:00
Andrea Corallo
c3d0e2a09f * Rename two nativecomp functions
* lisp/emacs-lisp/comp.el (comp-function-foldable-p): Rename from
	comp-function-optimizable-p.
	(comp-function-call-maybe-fold): Same from
	comp-function-call-maybe-fold.
2020-11-12 00:54:46 +01:00
Brian Leung
916eb895d1 shortdoc: prefer seq-contains-p over seq-contains
* lisp/emacs-lisp/shortdoc.el (sequence): use seq-contains-p instead
of seq-contains, which is obsolete as of 27.1.  (Bug#44536)

Copyright-paperwork-exempt: yes
2020-11-09 21:19:10 +01:00
Mattias Engdegård
575b0681d9 Fix pcase rx form snag with '?' and '??' (bug#44532)
This is a regression from Emacs 26.
Reported by Phillip Stephani.

* lisp/emacs-lisp/rx.el (rx--pcase-transform): Process ? and ?? correctly.
* test/lisp/emacs-lisp/rx-tests.el (rx-pcase): Add test case.
2020-11-09 17:28:37 +01:00
Lars Ingebrigtsen
391260e46c Clarify Lisp warning about elements following other expressions
* lisp/emacs-lisp/lisp-mode.el (lisp-fdefs): Clarify warning in
help text (bug#44482).
2020-11-09 16:50:51 +01:00
Andrea Corallo
e20cdf937e * lisp/emacs-lisp/comp.el (comp-fwprop-insn): Fix phi function. 2020-11-08 21:22:53 +01:00
Andrea Corallo
a5408d5715 * lisp/emacs-lisp/comp.el (comp-common-supertype-2): Fix null intersection 2020-11-07 21:11:39 +01:00
Andrea Corallo
75e8ee728f Merge remote-tracking branch 'savannah/master' into HEAD 2020-11-07 16:21:36 +01:00
Stefan Monnier
e8f5657bc7 * lisp/emacs-lisp/lisp-mode.el: Avoid false-positive "hidden arg" in strings
(lisp--match-hidden-arg): Don't misfire in strings and comments.

Reported by: Andrii Kolomoiets <andreyk.mad@gmail.com>
2020-11-07 10:15:22 -05:00
Andrea Corallo
6c271ffaa8 * Fix non native compiled build
* lisp/emacs-lisp/advice.el (ad-add-advice): Do not try to
	install trampolines in vanilla builds.
2020-11-07 12:43:06 +01:00
Andrea Corallo
4a69e953f3 Allow for native compilation qualities to be specified per input file
* lisp/emacs-lisp/bytecomp.el (byte-native-qualities): Define
	variable.
	(byte-compile-from-buffer): Spill compilation qualities.
	* lisp/emacs-lisp/comp.el (comp-speed, comp-debug): Make
	them file local variables.
	(comp-ctxt): Add `speed' and `debug' slots.
	(comp-spill-speed, comp-spill-lap-function): Make use of these.
	(comp-spill-lap-function): Spill qualities from
	`byte-native-qualities'.
	(comp-limplify-top-level): Do not use `comp-speed' but ctxt value
	unstead.
	(comp-final): Do not propagate qualities as they are already
	in the `comp-ctxt'.
	(comp--native-compile): Close on `byte-native-qualities'.
	* src/comp.c (comp_t): Add 'speed' and 'debug' fields.
	(emit_comment, emit_mvar_rval, emit_static_object)
	(emit_ctxt_code, Fcomp__init_ctxt): Use these instead of the
	global variables.
	(Fcomp__compile_ctxt_to_file): Set comp.speed and comp.debug and
	use them.
2020-11-07 11:45:55 +01:00
Andrea Corallo
acf101c636 Handle type hierarchy in native compiler forward propagation
2020-11-07  Andrea Corallo  <andrea.corallo@arm.com>

	* lisp/emacs-lisp/cl-preloaded.el (cl--typeof-types): Add fixnum
	and bignum.
	* lisp/emacs-lisp/comp.el (comp-ctxt): Add `supertype-memoize'
	slot.
	(comp-supertypes, comp-common-supertype-2)
	(comp-common-supertype): New functions.
	(comp-fwprop-insn): Make use of `comp-common-supertype' to
	identify the common supertype to be propagated.
2020-11-07 11:27:14 +01:00
Andrea Corallo
c6abe97f94 * A native compiler forward propagation fix
* lisp/emacs-lisp/comp.el (comp-fwprop-insn): Fix `comp-mvar'
	`const-vld' slot left unset while propagating in phis.
2020-11-05 22:34:12 +01:00
Stephen Berman
233d350d19 Improve display of tabulated list header line labels (bug#44068)
* lisp/emacs-lisp/tabulated-list.el (tabulated-list-init-header):
Ensure sort indicator appears after the label of any selected
sortable column that is wide enough and enable label truncation
when narrowing a column.

* lisp/emacs-lisp/timer-list.el (timer-list-mode): Improve column
alignment.
(timer-list--function-predicate): Correct typo in doc string.
2020-11-04 23:52:21 +01:00
Stefan Monnier
d6cb106a37 * lisp-mode.el: Fix missing highlight of "hidden" string arg
* lisp/emacs-lisp/lisp-mode.el (lisp-el-font-lock-keywords-2)
(lisp-cl-font-lock-keywords-2): Highlight "hidden arg" even if it
already has another face.
2020-11-04 11:37:00 -05:00
Stefan Kangas
6ad628b865 Improve ert-resource-directory docstring
* lisp/emacs-lisp/ert-x.el (ert-resource-directory): Improve
docstring.
2020-11-03 00:11:02 +01:00
Glenn Morris
018e0c36fb Merge from origin/emacs-27
1fc9de4b81 Improve reproducibility of generated -pkg.el files
da6234e2df Make sure pixel sizes are zero when setting window size fo...
2d15296db1 Fix failure of 'emacs --daemon' on Cygwin
8abce5b0c6 CC Mode: Only recognize foo (*bar) as a function pointer w...
85d1d8d768 Fix NEWS entry for fix of Bug#44080
2443b15a91 * src/buffer.c (syms_of_buffer) <fill-column>: Improve doc...

# Conflicts:
#	etc/NEWS
2020-11-02 09:27:40 -08:00
Lars Ingebrigtsen
5cea77af41 Partially revert previous define-minor-mode change
* lisp/emacs-lisp/easy-mmode.el (easy-mmode--arg-docstring):
Only document the values we want to support, not the ones we
actually support.
(define-minor-mode): Partially revert to previous behaviour.
2020-11-02 10:17:08 +01:00
Glenn Morris
8761c155e4 * lisp/emacs-lisp/easy-mmode.el (easy-mmode--arg-docstring): Doc typo. 2020-11-01 09:39:44 -08:00
Mattias Engdegård
d85e0df7ad Add missing side-effect-free and error-free properties
Any function that is pure is also side-effect-free and some are also
error-free.  Right now these have to be declared separately.

* lisp/emacs-lisp/byte-opt.el (side-effect-free-fns): Add
bool-vector-count-consecutive, bool-vector-count-population,
bool-vector-subsetp, copysign, isnan, lax-plist-get, ldexp, memql,
regexp-opt and string-to-syntax.
(side-effect-and-error-free-fns): Add type-of.
* lisp/subr.el (kbd, string-replace): Declare side-effect-free.
2020-11-01 18:22:11 +01:00
Mattias Engdegård
d860168493 * lisp/emacs-lisp/byte-opt.el (pure-fns): Fix typos. 2020-11-01 16:00:49 +01:00
Andrea Corallo
3e3843512b * Fix 'comp-call-optim pass' for anonymous lambdas
* lisp/emacs-lisp/comp.el (comp-call-optim-func): Remove anonymous
	lambdas gate.
	(comp-call-optim-form-call): Add the correct missing condition.
2020-11-01 15:17:00 +01:00
Andrea Corallo
42970cceb9 Add new cond-rw pass to have forward propagation track cond branches
Add a new pass to rewrite conditional branches.  This is introducing
and placing a new LIMPLE operator 'assume' in use by fwprop to
propagate conditional branch test informations on target basic blocks.

	* lisp/emacs-lisp/comp.el (comp-passes): Add `comp-cond-rw'.
	(comp-limple-assignments): Add `assume' operator.
	(comp-emit-assume, comp-cond-rw-target-slot, comp-cond-rw-func)
	(comp-cond-rw): Add new functions.
	(comp-fwprop-insn): Update to pattern match `assume' insns.
	* src/comp.c (emit_limple_insn): Add for `assume'.
	(syms_of_comp): Define 'Qassume' symbol.
2020-11-01 15:17:00 +01:00
Lars Ingebrigtsen
2a4b0da28c Make minor mode ARG work as documented
* lisp/emacs-lisp/easy-mmode.el (easy-mmode--arg-docstring):
Clarify when minor modes are switched on/off when called from lisp
(bug#44341).
(define-minor-mode): Make calls from Lisp switch the mode on/off
as documented.
2020-11-01 15:00:44 +01:00
Lars Ingebrigtsen
7a3d8559c9 Doc string clarification for cl-some
* lisp/emacs-lisp/cl-extra.el (cl-some): Clarify the return value
(bug#44330).
2020-11-01 13:55:29 +01:00
Andrea Corallo
f7f5d59ab4 Merge remote-tracking branch 'savannah/master' into HEAD 2020-10-31 15:00:00 +00:00
Mattias Engdegård
0cbcc6223a 'assoc' is not side-effect-free; constprop its pure subset
Since a supplied test function can do anything, assoc is not
side-effect-free (bug#44018).  However, with only two arguments it is
pure and should be optimised accordingly.

* lisp/emacs-lisp/byte-opt.el (side-effect-free-fns): Remove 'assoc'.
(byte-optimize-assoc): Constant-propagate through 2-arg assoc calls.
* test/lisp/emacs-lisp/bytecomp-tests.el
(byte-opt-testsuite-arith-data): Add test cases.
2020-10-31 14:31:43 +01:00
Mattias Engdegård
c3a20804a8 Trim and explain set of safe forms for 'unsafep' (bug#44018)
* lisp/emacs-lisp/unsafep.el:
Add comment explaining the policy for which forms can be considered
'safe' in the sense of unsafep.  Remove ones that didn't make the cut:

 play-sound-file (large attack surface)
 catch, throw (alter program flow, inject data)
 replace-regexp-in-string (execute arbitary code)
 error, signal (deceptive messages)

* test/lisp/emacs-lisp/unsafep-tests.el (unsafep-tests--unsafe):
Add test cases.
* etc/NEWS: Announce the change.
2020-10-31 13:42:07 +01:00
Glenn Morris
1fc9de4b81 Improve reproducibility of generated -pkg.el files
* lisp/emacs-lisp/package.el (package-generate-description-file):
Don't include the full name of the source file in the header,
since that varies non-reproducibly according to the build directory.
https://bugs.debian.org/972861
Note that elpa.gnu.org's admin/archive-contents.el does this by hand
and already only includes the nondirectory part.
2020-10-30 19:21:04 -07:00
João Távora
74c45a62e1 Shoosh byte-compilation warning in lisp/emacs-lisp/eldoc.el
Per bug#43609, elisp-eldoc-documentation-function is again in master,
but since it's now officially obsoleted, this backward compatibility
shim in eldoc--eval-expression-setup shouldn't unnecessarily trigger
warnings in master's code.

* lisp/emacs-lisp/eldoc.el (eldoc--eval-expression-setup): Shoosh
by-compilation warning.
2020-10-30 22:31:20 +00:00