Commit graph

7184 commits

Author SHA1 Message Date
Andrea Corallo
715cac119a * lisp/emacs-lisp/comp.el (comp-limplify-lap-inst): Opencode byte-not. 2020-12-24 15:36:36 +01:00
Andrea Corallo
c07c9f6bf8 Extend cstrs pass to match `when' like code
* lisp/emacs-lisp/comp.el (comp-emit-assume): Better parameter names.
	(comp-add-cond-cstrs-simple): New function.
	(comp-add-cond-cstrs): Rename assume-target -> block-target.
	(comp-add-cstrs): Call `comp-add-cond-cstrs-simple'.
	* test/src/comp-tests.el (comp-tests-type-spec-tests): Add test.
2020-12-24 15:36:09 +01:00
Andrea Corallo
4deeb2f2ee Invert basic block argument order in LIMPLE cond-jump
* lisp/emacs-lisp/comp.el (comp-emit-cond-jump)
	(comp-emit-switch, comp-emit-narg-prologue, comp-add-cond-cstrs):
	Invert basic block argument order in LIMPLE cond-jump.
	* src/comp.c (emit_limple_insn): Likewise.
2020-12-24 15:22:32 +01:00
Andrea Corallo
b99a474482 Merge remote-tracking branch 'savannah/master' into HEAD 2020-12-23 19:49:58 +01:00
Andrea Corallo
ffcd490cb4 Negate only values while constraining variables (bug#45376)
* lisp/emacs-lisp/comp-cstr.el (comp-cstr-value-negation): New
	function.
	* lisp/emacs-lisp/comp.el (comp-fwprop-insn): Use
	`comp-cstr-value-negation'.
	* test/src/comp-test-funcs.el (comp-test-45376-1-f): Rename.
	(comp-test-45376-2-f): New funcion.
	* test/src/comp-tests.el (bug-45376-1): Rename test.
	(bug-45376-2): Add test.
2020-12-23 16:17:58 +01:00
Andrea Corallo
0a89ed7a96 * Fix non range cstr union operation
* lisp/emacs-lisp/comp-cstr.el (comp-cstr-union-homogeneous): Add
	range parameter and handle the non range case.
	(comp-cstr-union-1-no-mem, comp-cstr-intersection-no-mem): Update
	`comp-cstr-union-homogeneous' call sites.
2020-12-23 16:17:40 +01:00
Andrea Corallo
c90aa68d90 * Follow cstr basic blocks to perform latch recognition
* lisp/emacs-lisp/comp.el (comp-fwprop-insn): Fix latch
	recognition.
2020-12-23 12:03:39 +01:00
Andrea Corallo
fd8dd75a71 Make input constraints into memoization hash immutable (bug#45376)
* lisp/emacs-lisp/comp-cstr.el (comp-cstr-union-1)
	(comp-cstr-intersection): Copy input before soting it into the
	memoization hash table.
2020-12-23 10:58:42 +01:00
Andrea Corallo
2a22fa8b68 * lisp/emacs-lisp/comp-cstr.el (comp-cstr-copy): Tweak for perf. 2020-12-23 10:58:20 +01:00
Lars Ingebrigtsen
5c86a53296 Improve the string-limit doc string
* lisp/emacs-lisp/subr-x.el (string-limit): Mention
truncate-string-to-width in the doc string.
2020-12-23 07:59:24 +01:00
Lars Ingebrigtsen
22c1f00d99 Allow string-slice to take zero-length matches
* lisp/emacs-lisp/subr-x.el (string-slice): Allow zero-length
matches.  Code adapted from s.el by Magnar Sveen.
2020-12-23 07:45:19 +01:00
Basil L. Contovounesios
e42a63a960 ; Fix docstrings in last change to subr-x.el 2020-12-22 09:01:47 +00:00
Lars Ingebrigtsen
051d8f7535 Make string-pad take an optional START parameter
* lisp/emacs-lisp/subr-x.el (string-pad): Alter the calling
convention.
2020-12-22 06:59:25 +01:00
Lars Ingebrigtsen
9480169f1b Change the string-limit parameter semantics
* lisp/emacs-lisp/subr-x.el (string-limit): Alter the calling
convention.
2020-12-22 06:54:32 +01:00
Lars Ingebrigtsen
d2b8611862 Further string-clean-whitespace tweaks
* lisp/emacs-lisp/subr-x.el (string-clean-whitespace): Put \r
back, which was mistakenly removed.
2020-12-22 04:24:25 +01:00
Basil L. Contovounesios
27fab4b140 Tiny string-clean-whitespace simplification
* lisp/emacs-lisp/subr-x.el (string-clean-whitespace): Streamline by
treating replacement string as being literal and having fixed case.
2020-12-21 22:36:55 +00:00
Lars Ingebrigtsen
7e86d3bb9b Make string-chop-newline more efficient
* lisp/emacs-lisp/subr-x.el (string-chop-newline): Make more
efficient.
2020-12-21 23:18:05 +01:00
Lars Ingebrigtsen
768522750d Make string-clean-whitespace work on non-ASCII whitespace, too
* lisp/emacs-lisp/subr-x.el (string-clean-whitespace): Also clean
up non-ASCII whitespace.
2020-12-21 22:41:37 +01:00
Lars Ingebrigtsen
c9a95237a8 Add try-completion to the string shortdoc
* lisp/emacs-lisp/shortdoc.el (string): Mention try-completion here.
2020-12-21 22:08:56 +01:00
Lars Ingebrigtsen
f329a3180e Add string-chop-newline
* doc/lispref/strings.texi (Creating Strings): Document it.
* lisp/emacs-lisp/subr-x.el (string-chop-newline): Add new function.
2020-12-21 22:05:37 +01:00
Basil L. Contovounesios
e967ba3018 ; Fix recent string utility additions
* etc/NEWS: Fix typo.
* lisp/emacs-lisp/subr-x.el (string-limit): Fix typos in docstring.
Simplify.
(string-slice): Improve docstring wording.
(string-pad): Simplify.
2020-12-21 20:51:29 +00:00
Lars Ingebrigtsen
fd9431dde4 Fix shorter-than-length case for string-limit
* lisp/emacs-lisp/subr-x.el (string-limit): Fix
shorter-than-length case.
2020-12-21 20:42:17 +01:00
Andrea Corallo
ebf8963a91 * Fix a bunch of known type specifiers
* lisp/emacs-lisp/comp.el (comp-known-type-specifiers): Fixes for:
	=, string-search, substring.
2020-12-21 20:22:03 +01:00
Andrea Corallo
5376563517 Fix `comp-add-call-cstr' and add a test
* lisp/emacs-lisp/comp.el (comp-add-call-cstr): Fix it.
	* test/src/comp-tests.el (assume-in-loop-1): New test.
	* test/src/comp-test-funcs.el (comp-test-assume-in-loop-1-f): New
	function.
2020-12-21 20:22:03 +01:00
Andrea Corallo
6f3570cd4a Fix value type inference for doubly negate constraints
* lisp/emacs-lisp/comp.el (comp-fwprop-insn): Do not propagate in
	case of double negation.
	* test/src/comp-test-funcs.el (comp-test-assume-double-neg-f):
	New function.
	* test/src/comp-tests.el (assume-double-neg): New test.
2020-12-21 20:22:03 +01:00
Andrea Corallo
e0f20da6ec Simplify correctly (or (integer 1 1) (not (integer 1 1))) as t
* lisp/emacs-lisp/comp-cstr.el (comp-cstr-union-1-no-mem): Logic
	update.
	* test/lisp/emacs-lisp/comp-cstr-tests.el
	(comp-cstr-typespec-tests-alist): Add a test.
2020-12-21 20:22:03 +01:00
Andrea Corallo
3540b1f167 * Guarantee fwprop convergence and termination
* lisp/emacs-lisp/comp.el (comp-emit-call-cstr): Have new-mvar as
	LHS *and* RHS when constraining in and to ensure monotonicity and
	fwprop convergence.
	(comp-fwprop): Raise a warning for debug reasons in case fwprop
	does not converge within 100 iterations.
2020-12-21 20:22:03 +01:00
Andrea Corallo
c70c08013f * Allow for overlapping src and dst in cstr set operations
* lisp/emacs-lisp/comp-cstr.el (comp-cstr-union-1-no-mem)
	(comp-cstr-union-1, comp-cstr-intersection-no-mem)
	(comp-cstr-intersection): Logic update.
2020-12-21 20:22:03 +01:00
Andrea Corallo
8e816b0ad5 Symplify type specifier (not t) as nil
* lisp/emacs-lisp/comp-cstr.el (comp-cstr-intersection-no-mem):
	Add logic.
	* test/lisp/emacs-lisp/comp-cstr-tests.el
	(comp-cstr-typespec-tests-alist): Add two tests.
2020-12-21 20:22:03 +01:00
Andrea Corallo
07b75deea9 Enhance type inference constraining function arguments
* lisp/emacs-lisp/comp.el: Add some commentary.
	(comp-cond-cstrs-target-mvar): Rename and update docstring.
	(comp-add-cond-cstrs): Update to use
	`comp-cond-cstrs-target-mvar'.
	(comp-emit-call-cstr, comp-lambda-list-gen, comp-add-call-cstr):
	New functions.
	(comp-add-cstrs): Call `comp-add-call-cstr'.
	* test/src/comp-tests.el (comp-tests-type-spec-tests): Update two
	type specifier tests.
2020-12-21 20:22:03 +01:00
Andrea Corallo
23791cf74d * Allow for modifying insn-cell inside `comp-loop-insn-in-block'
* lisp/emacs-lisp/comp.el (comp-loop-insn-in-block): Update.
2020-12-21 20:22:02 +01:00
Andrea Corallo
02551085c1 * Rename comp-cond-cstr into comp-add-cstrs
* lisp/emacs-lisp/comp.el (comp-add-cond-cstrs-target-mvar)
	(comp-add-cond-cstrs, comp-add-cstrs): Rename comp-cond-cstr
	-> comp-add-cstrs.
2020-12-21 20:22:02 +01:00
Andrea Corallo
d072ee9d34 * Two minors in comp.el
* lisp/emacs-lisp/comp.el (comp-known-func-cstr-h)
	(comp-ret-type-spec): Style.
2020-12-21 20:22:02 +01:00
Andrea Corallo
48d43f579e * Improve constraint simplification logic in comp-cstr.el
* lisp/emacs-lisp/comp-cstr.el (with-comp-cstr-accessors):
	Simplify.
	(comp-cstr-empty-p): New Funchion.
	(comp-split-pos-neg): Minor.
	(comp-normalize-typeset): Logic update.
	(comp-union-typesets): Minor.
	(comp-intersect-two-typesets): New functio.
	(comp-intersect-typesets): Logic update.
	(comp-range-union, comp-range-intersection): Minor.
	(comp-cstr-union-homogeneous, comp-cstr-union-1-no-mem)
	(comp-cstr-intersection-homogeneous)
	(comp-cstr-intersection-no-mem, comp-cstr-negation)
	(comp-type-spec-to-cstr, comp-cstr-to-type-spec): Logic update.

* lisp/emacs-lisp/comp-cstr.el (with-comp-cstr-accessors): Simplify.
2020-12-21 20:21:33 +01:00
Lars Ingebrigtsen
cf2e832185 Rename slice-string to string-slice
* lisp/emacs-lisp/subr-x.el (string-slice): Rename from slice-string.
* doc/lispref/strings.texi (Creating Strings): Ditto.
2020-12-21 20:18:57 +01:00
Lars Ingebrigtsen
b3dec31766 Add `string-pad'
* doc/lispref/strings.texi (Creating Strings): Document it.
* lisp/emacs-lisp/shortdoc.el (string): Add example.

* lisp/emacs-lisp/subr-x.el (string-pad): New function.
2020-12-21 20:01:28 +01:00
Andrea Corallo
bad18f509d * Improve comp-fwprop pass
Wire-up comp-cstr.el routines in fwprop and constraint mvars also on
the else side of branches.

	* lisp/emacs-lisp/comp.el (comp-emit-assume)
	(comp-cond-cstr-target-mvar, comp-cond-cstr-func)
	(comp-fwprop-insn): Logic update.
	(comp-mvar-value-vld-p, comp-mvar-propagate, comp-fwprop-call):
	Handle neg slot.
2020-12-21 19:00:39 +01:00
Lars Ingebrigtsen
87e422f104 Beef up the Emacs string utility set a bit
* doc/lispref/strings.texi (Modifying Strings): Document them.
* lisp/emacs-lisp/shortdoc.el (string): Add examples.

* lisp/emacs-lisp/subr-x.el (string-clean-whitespace)
(string-fill, string-limit, string-lines, slice-string): New
functions.
2020-12-21 18:53:40 +01:00
Andrea Corallo
2a117ad3d7 * Add mvar pretty print support when dumping LIMPLE
* lisp/emacs-lisp/comp.el (comp-prettyformat-mvar)
	(comp-prettyformat-insn): New function.
	(comp-log-func): Update to use `comp-prettyformat-insn'.
	(comp-finalize-phis): Change LIMPLE phi format to ease
	`comp-prettyformat-insn' destructuring.
2020-12-21 18:23:46 +01:00
Andrea Corallo
f244c21902 Merge remote-tracking branch 'savannah/master' into HEAD 2020-12-20 22:08:42 +01:00
Andrea Corallo
72c1a41573 Have native compiler always preserve multibyte strings (bug#45342)
* lisp/emacs-lisp/comp.el (comp-final): Escape multibyte string
	when offloading compilation to child process.
	* test/src/comp-test-funcs.el (comp-test-45342-f): New function
	* test/src/comp-tests.el (bug-45342): New test
2020-12-20 21:21:39 +01:00
Stefan Kangas
34a73666d9 Shorten some over-wide docstrings in functions and macros
* lisp/allout-widgets.el (allout-widgets-tally-string):
* lisp/array.el (array-mode):
* lisp/calc/calc-units.el (calc-spn):
* lisp/cedet/ede/generic.el (ede-generic-new-autoloader):
* lisp/cedet/semantic/analyze.el (semantic-analyze-find-tag-sequence-default)
(semantic-analyze-find-tag-sequence):
* lisp/cedet/semantic/bovine/c.el (semantic-c-evaluate-symbol-for-hideif):
* lisp/cedet/semantic/bovine/make.el (semantic-lex-make-command):
* lisp/cedet/semantic/db-typecache.el (semanticdb-typecache-include-tags):
* lisp/cedet/semantic/doc.el (semantic-documentation-for-tag):
* lisp/cedet/semantic/tag-ls.el (semantic--tag-attribute-similar-p):
* lisp/emacs-lisp/advice.el (ad-map-arglists):
* lisp/emacs-lisp/bytecomp.el (byte-constant2)
(byte-save-restriction, byte-catch-OBSOLETE, byte-unwind-protect):
* lisp/emacs-lisp/cl-generic.el (cl-generic-combine-methods):
* lisp/emacs-lisp/seq.el (seq-partition, seq-set-equal-p)
(seq-filter):
* lisp/faces.el (face-attribute-specified-or, face-equal):
* lisp/info.el (Info-prev-reference-or-link)
(Info-next-reference-or-link):
* lisp/isearch.el (with-isearch-suspended):
* lisp/kmacro.el (kmacro-step-edit-macro, kmacro-set-counter):
* lisp/org/org-agenda.el (org-agenda-filter-by-category):
* lisp/ses.el (ses-cell-symbol):
* lisp/w32-fns.el (w32-shell-dos-semantics): Shorten doc strings to
not exceed 80-column limits.  (Bug#44858)
2020-12-19 18:21:06 +01:00
Stefan Kangas
f88a7897a8 Shorten over-wide docstrings in variables
* lisp/cedet/semantic/util-modes.el (semantic-highlight-func-popup-menu):
* lisp/emacs-lisp/elint.el (elint-top-form-logged):
* lisp/erc/erc-dcc.el (erc-dcc-list):
* lisp/expand.el (expand-pos):
* lisp/font-lock.el (cpp-font-lock-keywords-source-depth):
* lisp/gnus/gnus-sum.el (gnus-sort-gathered-threads-function):
* lisp/gnus/message.el (message-cite-style-thunderbird):
* lisp/gnus/nnmh.el (nnmh-be-safe):
* lisp/gnus/nntp.el (nntp-open-telnet-envuser):
* lisp/international/mule-cmds.el (current-transient-input-method):
* lisp/net/tramp.el (tramp-file-name-structure):
* lisp/org/ob-R.el (org-babel-R-write-object-command):
* lisp/org/org-attach.el (org-attach-after-change-hook):
* lisp/org/org.el (org-stamp-time-of-day-regexp):
* lisp/progmodes/elisp-mode.el (elisp-xref-find-def-functions):
* lisp/progmodes/ruby-mode.el (ruby-block-mid-re):
* lisp/progmodes/verilog-mode.el (verilog-cache-enabled):
* lisp/term.el (term-scroll-end):
* lisp/textmodes/table.el (table-command-remap-alist)
(table-inhibit-auto-fill-paragraph, table-command-remap-alist):
* lisp/vc/ediff-diff.el (ediff-ignore-similar-regions):
* lisp/vc/ediff-wind.el (ediff-mouse-pixel-threshold):
* lisp/vc/smerge-mode.el (smerge-refine-ignore-whitespace):
* lisp/vc/vc.el (vc-log-short-style):
* lisp/view.el (view-exit-action): Shorten doc strings to not exceed
80-column limits.  (Bug#44858)
2020-12-19 18:21:06 +01:00
Stefan Kangas
5ab5c38987 Shorten over-wide docstrings in defcustoms
* lisp/calc/calc.el (calc-embedded-announce-formula-alist)
(calc-embedded-open-formula, calc-embedded-close-formula)
(calc-matrix-mode):
* lisp/cedet/semantic/imenu.el (semantic-imenu-sort-bucket-function):
* lisp/emacs-lisp/find-func.el (find-feature-regexp):
* lisp/emulation/cua-base.el (cua-paste-pop-rotate-temporarily):
* lisp/emulation/viper-init.el (viper-fast-keyseq-timeout)
(viper-related-files-and-buffers-ring):
* lisp/emulation/viper-keym.el (viper-want-ctl-h-help):
* lisp/gnus/gnus-art.el (gnus-article-banner-alist):
* lisp/gnus/gnus-group.el (gnus-keep-same-level):
* lisp/gnus/gnus-score.el (gnus-adaptive-word-length-limit):
* lisp/gnus/gnus-sum.el (gnus-inhibit-user-auto-expire):
* lisp/gnus/gnus-uu.el (gnus-uu-ignore-files-by-type)
(gnus-uu-do-not-unpack-archives)
(gnus-uu-unmark-articles-not-decoded)
(gnus-uu-correct-stripped-uucode, gnus-uu-save-in-digest)
(gnus-uu-post-include-before-composing):
* lisp/gnus/gnus.el (gnus-use-long-file-name)
(gnus-install-group-spam-parameters):
* lisp/gnus/message.el (message-cite-style):
* lisp/gnus/nnmail.el
(nnmail-split-fancy-with-parent-ignore-groups)
(nnmail-cache-ignore-groups):
* lisp/ido.el (ido-rewrite-file-prompt-functions):
* lisp/mail/feedmail.el (feedmail-fiddle-plex-user-list)
(feedmail-spray-address-fiddle-plex-list):
* lisp/mh-e/mh-e.el (mh-annotate-msg-hook):
* lisp/net/imap.el (imap-process-connection-type):
* lisp/net/rcirc.el (rcirc-omit-threshold):
* lisp/net/tramp-sh.el (tramp-copy-size-limit):
* lisp/nxml/nxml-mode.el (nxml-default-buffer-file-coding-system):
* lisp/obsolete/landmark.el (landmark-max-stall-time):
* lisp/obsolete/tls.el (tls-checktrust):
* lisp/org/org-indent.el
(org-indent-mode-turns-off-org-adapt-indentation)
(org-indent-mode-turns-on-hiding-stars):
* lisp/org/org-protocol.el (org-protocol-project-alist):
* lisp/progmodes/cc-vars.el (c-doc-comment-style):
* lisp/progmodes/cperl-mode.el (cperl-indent-subs-specially):
* lisp/progmodes/flymake-proc.el (flymake-proc-allowed-file-name-masks):
* lisp/progmodes/hideif.el (hide-ifdef-expand-reinclusion-protection):
* lisp/simple.el (minibuffer-history-case-insensitive-variables):
* lisp/tab-bar.el (tab-bar-close-last-tab-choice):
* lisp/textmodes/reftex-vars.el
(reftex-special-environment-functions):
* lisp/vc/ediff-init.el (ediff-startup-hook, ediff-cleanup-hook)
(ediff-metachars):
* lisp/vc/ediff-merg.el (ediff-show-clashes-only):
* lisp/vc/ediff-mult.el (ediff-default-filtering-regexp): Shorten doc
strings to not exceed 80-column limits.  (Bug#44858)
2020-12-19 18:21:06 +01:00
Mattias Engdegård
4c7df434a0 Correct units and spacing in memory-report
* lisp/emacs-lisp/memory-report.el (memory-report--format):
Use IEC unit prefixes and a space before.
2020-12-19 16:48:02 +01:00
Stefan Monnier
c7fdc17c16 * lisp/emacs-lisp/package.el (package-quickstart-refresh): Fix last change
Actually allow byte-compiling the file.
Reported by Basil L. Contovounesios <contovob@tcd.ie>.
2020-12-18 18:29:52 -05:00
Stefan Monnier
eeade2b647 * lisp/emacs-lisp/package.el: Byte compile the quickstart file
Earlier tests had found problems when byte-compiling the file,
but later investigations indicated the problem was not
directly related.  The performance difference is appreciable.

(package-quickstart-refresh): Byte compile the file.
(package-activate-all): Load byte-compiled version if available.
(package--quickstart-maybe-refresh): Delete the byte-compiled file as well.
2020-12-18 10:02:15 -05:00
Philipp Stephani
7fad959114 Ensure that byte compilation works for relative files (Bug#45287).
* lisp/emacs-lisp/bytecomp.el (byte-compile-file): Don’t fail if
target filename doesn’t contain a directory name.

* test/lisp/emacs-lisp/bytecomp-tests.el
(bytecomp-tests--target-file-no-directory): New unit test.
2020-12-17 12:19:27 +01:00
Stefan Monnier
485898c18b * lisp/emacs-lisp/gv.el (error): Allow it as a place 2020-12-14 16:16:01 -05:00
Stefan Kangas
4c41a8acc0 Make XEmacs compat variable warning-level-aliases obsolete
* lisp/emacs-lisp/warnings.el (warning-level-aliases): Make obsolete.
(display-warning): Warn when using one of the warning levels defined
in above obsolete variable.  (Bug#44849)
* lisp/url/url-proxy.el (url-find-proxy-for-url): Replace obsolete
warning type 'critical with :error.
2020-12-14 15:16:13 +01:00