Commit graph

7246 commits

Author SHA1 Message Date
Andrea Corallo
43d0e8483e Fix `functionp' contraining (bug#45576)
* lisp/emacs-lisp/comp.el (comp-known-predicates)
	(comp-known-predicates-h): New constants.
	(comp-known-predicate-p, comp-pred-to-cstr): New functions.
	* lisp/emacs-lisp/cl-macs.el (cl-deftype-satisfies): Don't define.
	* test/src/comp-tests.el (comp-test-45576): New testcase.
	* test/src/comp-test-funcs.el (comp-test-45576-f): New function.
2021-01-02 13:07:41 +01:00
Andrea Corallo
03be03d366 * Rename dom' slot into idom' in `comp-block' struct
* lisp/emacs-lisp/comp.el (comp-block): Rename dom `slot' into
	`idom'.
	(comp-clean-ssa, comp-compute-dominator-tree)
	(comp-compute-dominator-frontiers, comp-dom-tree-walker)
	(comp-remove-unreachable-blocks): Update accordingly.
2021-01-02 12:36:40 +01:00
Andrea Corallo
5db5064395 Merge remote-tracking branch 'savannah/master' into HEAD 2021-01-02 10:11:15 +01:00
Andrea Corallo
9420ea6e08 Add `throw' to non returning functions
* lisp/emacs-lisp/comp.el (comp-known-type-specifiers): Add throw.
2021-01-01 14:19:35 +01:00
Andrea Corallo
807471f9ff ; * lisp/emacs-lisp/comp.el (comp-compute-dominator-tree): Reindent. 2021-01-01 14:07:27 +01:00
Andrea Corallo
c29037c877 * lisp/emacs-lisp/comp.el (comp-compute-dominator-tree): Fix. 2021-01-01 14:07:27 +01:00
Andrea Corallo
93ff838575 * Clean unreachable block using dominance tree to handle circularities
With this commit unreachable basic blocks are pruned automatically by
comp-ssa relying on dominance analysis.  This solves the issue of
unreachable cluster of basic blocks referencing each other.

	* lisp/emacs-lisp/comp.el (comp-block-lap): New `no-ret' slot.
	(comp-compute-dominator-tree): Update.
	(comp-remove-unreachable-blocks): New functions.
	(comp-ssa): Update to call `comp-remove-unreachable-blocks'.
	(comp-clean-orphan-blocks): Delete.
	(comp-rewrite-non-locals): Update and simplify.
2021-01-01 14:06:00 +01:00
Andrea Corallo
67c443adc1 Introduce 'unreachable' LIMPLE operator
Introduce 'unreachable' as LIMPLE operater so we can handle correctly
in the CFG functions throwing values or signaling errors.

	* src/comp.c (retrive_block): Better error diagnostic.
	(emit_limple_insn): Add `unreachable'.
	(compile_function): Fix block iteration.
	(syms_of_comp): Define 'Qunreachable'.
	* lisp/emacs-lisp/comp.el (comp-block): New variable.
	(comp-block-lap): Add `non-ret-insn' slot.
	(comp-branch-op-p): New predicate.
	(comp-limple-lock-keywords): Color `unreachable' as red.
	(comp-compute-edges): Add `unreachable'.
	(comp-fwprop-call): Store non returning function call.
	(comp-fwprop*): Update.
	(comp-clean-orphan-blocks, comp-rewrite-non-locals): New functions.
	(comp-fwprop): Call `comp-rewrite-non-locals'.
	* test/src/comp-tests.el (comp-tests-type-spec-tests): Add two
	tests.
	* test/src/comp-test-funcs.el (comp-test-non-local-1)
	(comp-test-non-local-2, comp-test-non-local-3)
	(comp-test-non-local-4): New functions.
2021-01-01 14:04:58 +01:00
Andrea Corallo
e9f5fadb0e * Fix two predicates for missing negation handling
* lisp/emacs-lisp/comp-cstr.el (comp-cstr-empty-p)
	(comp-cstr-null-p): Fix missing negation handling.
2021-01-01 12:29:50 +01:00
Andrea Corallo
f78580a0f5 * lisp/emacs-lisp/comp.el (comp-limple-lock-keywords): Color returns as red. 2021-01-01 12:29:40 +01:00
Andrea Corallo
e81643bef5 * Add `comp-insert-insn'
* lisp/emacs-lisp/comp.el (comp-insert-insn): New inline.
	(comp-emit-call-cstr): Split logic and call `comp-insert-insn'.
2021-01-01 12:28:27 +01:00
Paul Eggert
50f3949119 Merge from origin/emacs-27
33d159c36f Fix copyright years by hand
2021-01-01 01:28:16 -08:00
Paul Eggert
ba05d005e5 Update copyright year to 2021
Run "TZ=UTC0 admin/update-copyright".
2021-01-01 01:13:56 -08:00
Paul Eggert
33d159c36f Fix copyright years by hand
These are dates that admin/update-copyright did not update.
2021-01-01 00:33:28 -08:00
Paul Eggert
8c1fe1e5ef Update copyright year to 2021
Run "TZ=UTC0 admin/update-copyright $(git ls-files)".
2021-01-01 00:32:32 -08:00
Stefan Kangas
72b8430fea Add lexical-binding cookie to autoload files
* build-aux/update-subdirs:
* lisp/emacs-lisp/autoload.el (autoload-rubric): Add lexical-binding
cookie to generated files (bug#44854).
2020-12-31 06:35:49 +01:00
Andrea Corallo
db2a49327a * Order function types in aphabetical order
* lisp/emacs-lisp/comp.el (comp-known-type-specifiers): Reorder in
	aphabetical order and comment.
2020-12-30 14:05:19 +01:00
Andrea Corallo
0593f47876 * Add more function type specifiers
* lisp/emacs-lisp/comp.el (comp-known-type-specifiers): Add more
	type specifiers.
2020-12-30 14:03:46 +01:00
Stefan Kangas
dd662fc972 Fix some over-wide docstrings
* lisp/cedet/semantic/analyze/refs.el
(semantic-analyze-refs-proto)
(semantic-analyze-refs-impl):
* lisp/cedet/semantic/symref.el
(semantic-symref-hit-to-tag-via-buffer):
* lisp/emacs-lisp/chart.el (chart-axis-draw):
* lisp/emacs-lisp/cl-macs.el (cl-defstruct, cl-loop):
* lisp/emacs-lisp/eieio-core.el (eieio--add-new-slot):
* lisp/eshell/em-unix.el (eshell/info):
* lisp/gnus/deuglify.el (gnus-outlook-rearrange-article):
* lisp/gnus/gnus-agent.el (gnus-agent-read-article-number):
* lisp/gnus/gnus-util.el (gnus-put-overlay-excluding-newlines)
(gnus-put-text-property-excluding-newlines):
* lisp/gnus/message.el (message-sort-headers):
* lisp/gnus/nntp.el (nntp-with-open-group)
(nntp-with-open-group-function):
* lisp/gnus/nnvirtual.el (nnvirtual-create-mapping):
* lisp/mail/feedmail.el (feedmail-fiddle-list-of-fiddle-plexes)
(feedmail-queue-reminder, feedmail-mail-send-hook-splitter):
* lisp/net/dictionary.el (dictionary-do-matching):
* lisp/obsolete/longlines.el (longlines-auto-wrap):
* lisp/org/ob-sql.el (org-babel-sql-dbstring-vertica):
* lisp/org/ol-bbdb.el (org-bbdb-date-list):
* lisp/progmodes/cc-cmds.el (c-mark-function):
* lisp/progmodes/cperl-mode.el (cperl-add-tags-recurse)
(cperl-add-tags-recurse-noxs-fullpath)
(cperl-add-tags-recurse-noxs):
* lisp/progmodes/etags.el (tags-search):
* lisp/progmodes/verilog-mode.el (verilog-delete-auto-buffer)
(verilog-auto-re-search-do, verilog-expand-vector-internal):
* lisp/textmodes/reftex-parse.el (reftex-init-section-numbers):
* lisp/textmodes/reftex-toc.el
(reftex-toc-load-all-files-for-promotion):
* lisp/textmodes/sgml-mode.el (html-mode):
* lisp/textmodes/table.el (table--transcoord-cache-to-table)
(table--transcoord-table-to-cache, table--remove-eol-spaces)
(table--region-in-cell-p, table-goto-bottom-right-corner)
(table-split-cell-horizontally):
* lisp/url/url-handlers.el (url-insert):
* lisp/vc/ediff-util.el (ediff-inferior-compare-regions): Fix doc
strings to not exceed 80-column limits.  (Bug#44858)
2020-12-30 12:44:19 +01:00
Lars Ingebrigtsen
dc771b6c40 Also count symbol plists in memory-report
* lisp/emacs-lisp/memory-report.el (memory-report--symbol-plist):
New function.
(memory-report): Use it.
2020-12-30 08:29:06 +01:00
Andrea Corallo
3f00d666e9 Fix missing negation handling in a bunch of predicates
* lisp/emacs-lisp/comp.el (comp-mvar-fixnum-p)
	(comp-mvar-symbol-p, comp-mvar-cons-p): Consider neg slot.
	* test/src/comp-tests.el (comp-test-not-cons): New test.
	* test/src/comp-test-funcs.el (comp-test-not-cons-f): New
	function.
2020-12-29 17:49:30 +01:00
Andrea Corallo
a3b816ff8c * lisp/emacs-lisp/comp-cstr.el (comp-cstr): Better `comp-value-to-cstr'. 2020-12-29 17:49:30 +01:00
Andrea Corallo
c4efb49a27 Constrain mvars under compare and branch with built-in predicates
* lisp/emacs-lisp/comp.el (comp-emit-assume): Update.
	(comp-known-predicate-p): New function.
	(comp-add-cond-cstrs): Extend to pattern match predicate calls.
	* lisp/emacs-lisp/comp-cstr.el (comp-cstr-null-p)
	(comp-pred-to-cstr): New function.
	* test/src/comp-tests.el (comp-tests-type-spec-tests): Add a
	number of tests and fix comments.
2020-12-29 17:49:30 +01:00
Andrea Corallo
e83c6994e1 * Define `cl-satisfies-deftype' mapping predicate -> type
* lisp/emacs-lisp/cl-macs.el (cl-satisfies-deftype): Define symbol
	property as reverse of `cl-deftype-satisfies'.
2020-12-29 14:47:16 +01:00
Andrea Corallo
ba41a183dd * lisp/emacs-lisp/comp-cstr.el (comp-cstr): Better `comp-type-to-cstr'. 2020-12-29 14:46:23 +01:00
Andrea Corallo
2b3c7c7517 Store function type and expose it with `subr-type'
* src/lisp.h (struct Lisp_Subr): Add 'type' field.
	(SUBR_TYPE): New inline accessor.
	* src/pdumper.c (dump_subr): Update for 'type' field.
	* src/data.c (Fsubr_type): New primitive.
	(syms_of_data): Update.
	* src/comp.c (ABI_VERSION): Bump new ABI version.
	(make_subr): Set type.
	(Fcomp__register_lambda, Fcomp__register_subr)
	(Fcomp__late_register_subr): Receive and pass subr type to
	'make_subr'.
	* src/alloc.c (mark_object): Mark subr type.
	* lisp/emacs-lisp/comp.el (comp-func): Change slot type into mvar.
	(comp-emit-for-top-level, comp-emit-lambda-for-top-level): Pass
	type mvar to subr register functions.
	(comp-compute-function-type): Fix-up subr type mvars.
	* test/src/comp-tests.el (comp-tests-check-ret-type-spec): Use
	`subr-type'.
2020-12-28 16:15:23 +01:00
Andrea Corallo
5a8622ba2c Reorder subr register function arguments to make some room
* src/comp.c (Fcomp__register_lambda, Fcomp__register_subr)
	(Fcomp__late_register_subr): Use a rest arg to pass 'doc_idx' and
	'intspec' parameters.
	* lisp/emacs-lisp/comp.el (comp-emit-for-top-level)
	(comp-emit-lambda-for-top-level): Update.
2020-12-28 16:13:31 +01:00
Andrea Corallo
eafcc8eda0 Propagate function calls also when hiddend under funcall
* lisp/emacs-lisp/comp.el (comp-fwprop-call): Propagate functions
	also when called under `funcall'.
	* test/src/comp-tests.el (comp-tests-type-spec-tests): Add a test.
2020-12-28 16:12:08 +01:00
Andrea Corallo
e532ec9552 Compute function type for native compiled functions
* lisp/emacs-lisp/comp.el (comp-func): `type' rename from
	`ret-type-specifier'.
	(comp-args-to-lambda-list): New function.
	(comp-compute-function-type): New function from
	`comp-ret-type-spec'.
	(comp-final): Update.
	* test/src/comp-tests.el (comp-tests-check-ret-type-spec): Update.
2020-12-28 16:09:31 +01:00
Andrea Corallo
8a0467e2ef ; lisp/emacs-lisp/comp.el (comp-emit-narg-prologue): Nit. 2020-12-28 16:08:38 +01:00
Andrea Corallo
ccce15299b * Improve some slot type into comp.el
* lisp/emacs-lisp/comp.el (comp-args-base, comp-args)
	(comp-nargs, comp-func): Fix the type of some slots.
2020-12-28 16:06:49 +01:00
Stefan Kangas
6b8bb47ac0 Fill some auto-generated docstrings
* lisp/emacs-lisp/easy-mmode.el (define-minor-mode)
(define-globalized-minor-mode): Fill auto-generated documentation
strings.  (Bug#44858)
* lisp/subr.el (internal--fill-string-single-line)
(internal--format-docstring-line): New functions.
2020-12-28 06:26:52 +01:00
Stefan Kangas
0ebea8ffbf Make byte-compiler warn about wide docstrings
* lisp/emacs-lisp/bytecomp.el (byte-compile--wide-docstring-p):
(byte-compile-docstring-length-warn): New defuns.
(byte-compile-docstring-max-column): New defcustom.
(byte-compile--wide-docstring-substitution-len): New variable.
(byte-compile-warning-types, byte-compile-warnings): New value
'docstrings'.
(byte-compile-file-form-autoload, byte-compile-file-form-defvar):
(byte-compile-file-form-defvar-function, byte-compile-lambda):
(byte-compile-defvar, byte-compile-file-form-defalias): Warn about too
wide docstrings.  (Bug#44858)

* test/lisp/emacs-lisp/bytecomp-tests.el
(bytecomp-warn-wide-docstring/defconst)
(bytecomp-warn-wide-docstring/defvar): New tests.
(bytecomp--define-warning-file-test): New macro.
(bytecomp/warn-wide-docstring-autoload\.el)
(bytecomp/warn-wide-docstring-custom-declare-variable\.el)
(bytecomp/warn-wide-docstring-defalias\.el)
(bytecomp/warn-wide-docstring-defconst\.el)
(bytecomp/warn-wide-docstring-define-abbrev-table\.el)
(bytecomp/warn-wide-docstring-define-obsolete-function-alias\.el)
(bytecomp/warn-wide-docstring-define-obsolete-variable-alias\.el)
(bytecomp/warn-wide-docstring-defun\.el)
(bytecomp/warn-wide-docstring-defvar\.el)
(bytecomp/warn-wide-docstring-defvaralias\.el)
(bytecomp/warn-wide-docstring-ignore-fill-column\.el)
(bytecomp/warn-wide-docstring-ignore-override\.el)
(bytecomp/warn-wide-docstring-ignore\.el)
(bytecomp/warn-wide-docstring-multiline-first\.el)
(bytecomp/warn-wide-docstring-multiline\.el): New tests.
* test/lisp/emacs-lisp/bytecomp-resources/warn-wide-docstring-autoload.el:
* test/lisp/emacs-lisp/bytecomp-resources/warn-wide-docstring-custom-declare-variable.el:
* test/lisp/emacs-lisp/bytecomp-resources/warn-wide-docstring-defalias.el:
* test/lisp/emacs-lisp/bytecomp-resources/warn-wide-docstring-defconst.el:
* test/lisp/emacs-lisp/bytecomp-resources/warn-wide-docstring-define-abbrev-table.el:
* test/lisp/emacs-lisp/bytecomp-resources/warn-wide-docstring-define-obsolete-function-alias.el:
* test/lisp/emacs-lisp/bytecomp-resources/warn-wide-docstring-define-obsolete-variable-alias.el:
* test/lisp/emacs-lisp/bytecomp-resources/warn-wide-docstring-defun.el:
* test/lisp/emacs-lisp/bytecomp-resources/warn-wide-docstring-defvar.el:
* test/lisp/emacs-lisp/bytecomp-resources/warn-wide-docstring-defvaralias.el:
* test/lisp/emacs-lisp/bytecomp-resources/warn-wide-docstring-ignore-fill-column.el:
* test/lisp/emacs-lisp/bytecomp-resources/warn-wide-docstring-ignore-override.el:
* test/lisp/emacs-lisp/bytecomp-resources/warn-wide-docstring-ignore.el:
* test/lisp/emacs-lisp/bytecomp-resources/warn-wide-docstring-multiline-first.el:
* test/lisp/emacs-lisp/bytecomp-resources/warn-wide-docstring-multiline.el:
New files.
2020-12-28 06:26:52 +01:00
Tim Landscheidt
8914fb2227 Do not output two spaces for non-autoloaded ieieo constructor functions
* lisp/emacs-lisp/eieio-opt.el (eieio-help-constructor): Amend
format to avoid two spaces for non-autoloaded object constructor
functions (bug#45454).

Copyright-paperwork-exempt: yes
2020-12-28 00:40:15 +01:00
Stefan Monnier
8d5a6c9ef5 * lisp/emacs-lisp/package.el (package-archives): Add NonGNU ELPA 2020-12-27 17:32:01 -05:00
Andrea Corallo
42fb6de0b3 Add 1+ 1- integer range propagation support
* lisp/emacs-lisp/comp-cstr.el (comp-cstr-one): New special var.
	* lisp/emacs-lisp/comp.el (comp-fwprop-call): Propagate integer
	ranges on +1 -1.
	* test/src/comp-tests.el (comp-tests-type-spec-tests): Add two tests.
2020-12-27 21:50:34 +01:00
Andrea Corallo
7d07a71841 Add sum/subtraction integer range propagation support
* lisp/emacs-lisp/comp-cstr.el (comp-range-+, comp-range--): New
	functions.
	(comp-cstr-set-range-for-arithm): New macro.
	(comp-cstr-add-2, comp-cstr-sub-2, comp-cstr-add, comp-cstr-sub):
	New function.
	* lisp/emacs-lisp/comp.el (comp-fwprop-call): Wire-up + - integer
	range propagation.
2020-12-27 21:34:03 +01:00
Andrea Corallo
92af4e8fc9 * lisp/emacs-lisp/comp-cstr.el (comp-cstr-set-cmp-range): Improve. 2020-12-27 21:33:42 +01:00
Andrea Corallo
34e9aae440 * Add comp-cstr-greatest-in-range comp-cstr-smallest-in-range
* lisp/emacs-lisp/comp-cstr.el (comp-cstr-smallest-in-range)
	(comp-cstr-greatest-in-range): New function.
	(comp-cstr->, comp-cstr->=, comp-cstr-<, comp-cstr-<=): Make use of.
2020-12-27 19:45:24 +01:00
Andrea Corallo
8fb9463013 Merge remote-tracking branch 'savannah/master' into HEAD 2020-12-27 17:54:57 +01:00
Basil L. Contovounesios
df882c9701 ; Fix recent shortdoc.el and fns.c additions
* lisp/emacs-lisp/shortdoc.el (list): Fix typos.
* src/fns.c (Flength_equal): Fix docstring.
2020-12-27 13:14:30 +00:00
Daniel Martín
80420faf49 Improve "find definition" in *Help* buffers
* lisp/emacs-lisp/find-func.el (find-function-search-for-symbol): If
our regexp algorithm could not find a location for the symbol
definition, resort to find-function--search-by-expanding-macros.
* test/lisp/emacs-lisp/find-func-tests.el: Add a automatic test for a
function and variable generated by a macro.
* etc/NEWS: Advertise the improved functionality (bug#45443).
2020-12-27 09:04:56 +01:00
Lars Ingebrigtsen
0f790464d5 Add new predicates for sequence lengths
* doc/lispref/sequences.texi (Sequence Functions): Document them.
* lisp/emacs-lisp/byte-opt.el (side-effect-free-fns): Mark them as
side-effect-free.

* lisp/emacs-lisp/shortdoc.el (list): Mention them.

* src/fns.c (Flength): Mention them in the doc string.
(length_internal): New function.
(Flength_less, Flength_greater, Flength_equal): New defuns.
(syms_of_fns): Sym them.
2020-12-27 09:00:23 +01:00
Lars Ingebrigtsen
714ca849ba Improve the edebug-form-data doc string
* lisp/emacs-lisp/edebug.el (edebug-form-data): Doc string
clarification (bug#42776).
2020-12-26 23:13:29 +01:00
Andrea Corallo
271fb8a269 * Fix `byte-compile-file' for native compilation (bug#45442)
* lisp/emacs-lisp/bytecomp.el (byte-compile-file): Fix logic for
	native compilation.
2020-12-26 20:38:36 +01:00
Andrea Corallo
d893952053 Fix missing float handling into `comp-cstr-set-cmp-range'
* lisp/emacs-lisp/comp-cstr.el (comp-cstr-set-cmp-range): Add
	float handling.
	* test/src/comp-tests.el (comp-tests-type-spec-tests): Update results.
2020-12-26 20:00:01 +01:00
Andrea Corallo
fcd8c60182 * Remove unnecessary lhs rename in `comp-ssa-rename-insn'
* lisp/emacs-lisp/comp.el (comp-ssa-rename-insn): No point to
	rename lhs as it's being replaced.
2020-12-26 12:30:58 +01:00
Andrea Corallo
c5c0c06b1c * lisp/emacs-lisp/comp.el (comp-known-type-specifiers): Add two functions. 2020-12-26 12:22:21 +01:00
Andrea Corallo
89d5a3a760 Enable integer range narrowing under compare and branch
* lisp/emacs-lisp/comp-cstr.el (comp-cstr-set-cmp-range)
	(comp-cstr->, comp-cstr->=, comp-cstr-<, comp-cstr-<=): New
	functions.
	* lisp/emacs-lisp/comp.el (comp-equality-fun-p)
	(comp-range-cmp-fun-p): New functions.
	(comp-collect-rhs): Use `comp-assign-op-p' in place of
	`comp-set-op-p'.
	(comp-negate-range-cmp-fun, comp-reverse-cmp-fun): New functions.
	(comp-emit-assume): Rework to be able to emit also comparision
	assumption.
	(comp-add-cond-cstrs-simple): Update for new `comp-emit-assume'.
	(comp-add-cond-cstrs-simple): Update to emit range assumption.
	(comp-fwprop-insn): Execute range assumptions.
	* test/src/comp-tests.el (comp-tests-type-spec-tests): Add tests.
2020-12-26 10:53:54 +01:00
Lars Ingebrigtsen
90e40099de Fix infloop in memory-report
* lisp/emacs-lisp/memory-report.el (memory-report--object-size-1):
Fix infloop on circular lists.
2020-12-26 00:57:01 +01:00