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
Lars Ingebrigtsen
d18b1c8c75
Fix package reloading problems on systems with symlinks
...
* lisp/emacs-lisp/package.el (package--files-load-history): We're
comparing the truenames, so ensure that we've using that
everywhere. This fixes problems when there's symlinks in the paths.
2020-12-25 22:44:56 +01:00
Lars Ingebrigtsen
443a53874b
Refactor package--list-loaded-files for easier debuggability
...
* lisp/emacs-lisp/package.el (package--files-load-history)
(package--list-of-conflicts): Factor out from...
(package--list-loaded-files): ... this function for easier
debuggability.
2020-12-25 22:29:46 +01:00
Andrea Corallo
bd693ccea7
* Don't emit byte op-code annotations in LIMPLE to optimize for compile-time
...
Saves 10~15% in bootstrap time.
* lisp/emacs-lisp/comp.el (comp-op-case): Don't emit op-code
annotaitons.
(comp-limplify-lap-inst, comp-add-cond-cstrs-simple)
(comp-add-cond-cstrs, comp-tco-func): Update accordingly.
2020-12-25 09:44:30 +01:00
Lars Ingebrigtsen
af359de917
Allow `string-limit' to work on encoded strings
...
* doc/lispref/strings.texi (Creating Strings): Document it.
* lisp/emacs-lisp/subr-x.el (string-limit): Allow limiting on
encoded strings.
2020-12-25 05:58:09 +01:00
Lars Ingebrigtsen
269cec13a2
Remove `string-slice' -- it's not very well defined
...
* doc/lispref/strings.texi (Creating Strings): Ditto.
* lisp/emacs-lisp/subr-x.el (string-slice): Remove.
2020-12-25 05:16:46 +01:00
Andrea Corallo
b4ee13c942
* Memoize `comp-subtype-p'
...
* lisp/emacs-lisp/comp-cstr.el (comp-subtype-p): Memoize.
(comp-cstr-ctxt): Add `subtype-p-mem' slot.
2020-12-24 15:40:53 +01:00
Andrea Corallo
2327a98319
* Constrain only mvars that are actually used
...
* lisp/emacs-lisp/comp.el (comp-mvar-used-p, comp-collect-mvars)
(comp-collect-rhs): New functions.
(comp-add-cond-cstrs-simple, comp-add-cond-cstrs): Update logic.
(comp-add-cstrs): Call `comp-collect-rhs' before doing anything
else.
2020-12-24 15:40:50 +01:00
Andrea Corallo
2a6c6bf324
* Use `comp-assign-op-p' into dead code elimination pass
...
* lisp/emacs-lisp/comp.el (comp-dead-assignments-func): Use
`comp-assign-op-p' in place of `comp-set-op-p'.
2020-12-24 15:36:46 +01:00
Andrea Corallo
96d4c70412
* Fix logic for constraining block with multiple predecessors
...
* lisp/emacs-lisp/comp.el (comp-limple-lock-keywords)
(comp-add-cond-cstrs-target-block): Logic update.
2020-12-24 15:36:46 +01:00
Andrea Corallo
672988e961
Symplify (not t) => nil and (not nil) => t
...
* lisp/emacs-lisp/comp-cstr.el (comp-cstr-negation): Symplify (not
t) => nil and (not nil) => t.
* test/lisp/emacs-lisp/comp-cstr-tests.el
(comp-cstr-typespec-tests-alist): Add two tests.
2020-12-24 15:36:46 +01:00
Andrea Corallo
538f59806c
Extend cstrs pass to match `unless' like code
...
* lisp/emacs-lisp/comp.el (comp-emit-assume): Add assertion.
(comp-add-new-block-between): Fix two typos.
(comp-add-cond-cstrs-target-block): Fix typo.
(comp-add-cond-cstrs-simple): Logic update.
* test/src/comp-tests.el (comp-tests-type-spec-tests): Add a test.
2020-12-24 15:36:39 +01:00
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
Stefan Monnier
b68d52c81b
* lisp/emacs-lisp/lisp-mnt.el (lm-section-end): Stop at the right heading
...
`lisp-outline-level` assumes the match-data is that set by
`outline-regexp`.
2020-12-23 18:31:52 -05: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