summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp
Commit message (Collapse)AuthorAgeFilesLines
...
* | | * Fix `byte-compile-file' for native compilation (bug#45442)Andrea Corallo2020-12-261-11/+12
| | | | | | | | | | | | | | | * lisp/emacs-lisp/bytecomp.el (byte-compile-file): Fix logic for native compilation.
* | | Fix missing float handling into `comp-cstr-set-cmp-range'Andrea Corallo2020-12-261-1/+1
| | | | | | | | | | | | | | | | | | * 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.
* | | * Remove unnecessary lhs rename in `comp-ssa-rename-insn'Andrea Corallo2020-12-261-1/+1
| | | | | | | | | | | | | | | * lisp/emacs-lisp/comp.el (comp-ssa-rename-insn): No point to rename lhs as it's being replaced.
* | | * lisp/emacs-lisp/comp.el (comp-known-type-specifiers): Add two functions.Andrea Corallo2020-12-261-1/+4
| | |
* | | Enable integer range narrowing under compare and branchAndrea Corallo2020-12-262-22/+148
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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.
* | | * Don't emit byte op-code annotations in LIMPLE to optimize for compile-timeAndrea Corallo2020-12-251-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | * Memoize `comp-subtype-p'Andrea Corallo2020-12-241-1/+8
| | | | | | | | | | | | | | | * lisp/emacs-lisp/comp-cstr.el (comp-subtype-p): Memoize. (comp-cstr-ctxt): Add `subtype-p-mem' slot.
* | | * Constrain only mvars that are actually usedAndrea Corallo2020-12-241-14/+49
| | | | | | | | | | | | | | | | | | | | | | | | * 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.
* | | * Use `comp-assign-op-p' into dead code elimination passAndrea Corallo2020-12-241-2/+2
| | | | | | | | | | | | | | | * lisp/emacs-lisp/comp.el (comp-dead-assignments-func): Use `comp-assign-op-p' in place of `comp-set-op-p'.
* | | * Fix logic for constraining block with multiple predecessorsAndrea Corallo2020-12-241-7/+16
| | | | | | | | | | | | | | | * lisp/emacs-lisp/comp.el (comp-limple-lock-keywords) (comp-add-cond-cstrs-target-block): Logic update.
* | | Symplify (not t) => nil and (not nil) => tAndrea Corallo2020-12-241-4/+21
| | | | | | | | | | | | | | | | | | | | | * 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.
* | | Extend cstrs pass to match `unless' like codeAndrea Corallo2020-12-241-6/+17
| | | | | | | | | | | | | | | | | | | | | | | | * 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.
* | | * lisp/emacs-lisp/comp.el (comp-limplify-lap-inst): Opencode byte-not.Andrea Corallo2020-12-241-1/+3
| | |
* | | Extend cstrs pass to match `when' like codeAndrea Corallo2020-12-241-10/+35
| | | | | | | | | | | | | | | | | | | | | | | | * 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.
* | | Invert basic block argument order in LIMPLE cond-jumpAndrea Corallo2020-12-241-6/+6
| | | | | | | | | | | | | | | | | | | | | * 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.
* | | Merge remote-tracking branch 'savannah/master' into HEADAndrea Corallo2020-12-232-0/+111
|\| |
| * | Improve the string-limit doc stringLars Ingebrigtsen2020-12-232-1/+8
| | | | | | | | | | | | | | | * lisp/emacs-lisp/subr-x.el (string-limit): Mention truncate-string-to-width in the doc string.
| * | Allow string-slice to take zero-length matchesLars Ingebrigtsen2020-12-231-13/+10
| | | | | | | | | | | | | | | * lisp/emacs-lisp/subr-x.el (string-slice): Allow zero-length matches. Code adapted from s.el by Magnar Sveen.
| * | ; Fix docstrings in last change to subr-x.elBasil L. Contovounesios2020-12-221-3/+3
| | |
| * | Make string-pad take an optional START parameterLars Ingebrigtsen2020-12-222-7/+9
| | | | | | | | | | | | | | | * lisp/emacs-lisp/subr-x.el (string-pad): Alter the calling convention.
| * | Change the string-limit parameter semanticsLars Ingebrigtsen2020-12-222-9/+12
| | | | | | | | | | | | | | | * lisp/emacs-lisp/subr-x.el (string-limit): Alter the calling convention.
| * | Further string-clean-whitespace tweaksLars Ingebrigtsen2020-12-221-1/+1
| | | | | | | | | | | | | | | * lisp/emacs-lisp/subr-x.el (string-clean-whitespace): Put \r back, which was mistakenly removed.
| * | Tiny string-clean-whitespace simplificationBasil L. Contovounesios2020-12-211-1/+1
| | | | | | | | | | | | | | | * lisp/emacs-lisp/subr-x.el (string-clean-whitespace): Streamline by treating replacement string as being literal and having fixed case.
| * | Make string-chop-newline more efficientLars Ingebrigtsen2020-12-211-1/+1
| | | | | | | | | | | | | | | * lisp/emacs-lisp/subr-x.el (string-chop-newline): Make more efficient.
| * | Make string-clean-whitespace work on non-ASCII whitespace, tooLars Ingebrigtsen2020-12-211-1/+3
| | | | | | | | | | | | | | | * lisp/emacs-lisp/subr-x.el (string-clean-whitespace): Also clean up non-ASCII whitespace.
| * | Add try-completion to the string shortdocLars Ingebrigtsen2020-12-211-0/+2
| | | | | | | | | | | | * lisp/emacs-lisp/shortdoc.el (string): Mention try-completion here.
| * | Add string-chop-newlineLars Ingebrigtsen2020-12-212-0/+6
| | | | | | | | | | | | | | | * doc/lispref/strings.texi (Creating Strings): Document it. * lisp/emacs-lisp/subr-x.el (string-chop-newline): Add new function.
| * | ; Fix recent string utility additionsBasil L. Contovounesios2020-12-211-9/+9
| | | | | | | | | | | | | | | | | | | | | | | | * 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.
| * | Fix shorter-than-length case for string-limitLars Ingebrigtsen2020-12-211-1/+1
| | | | | | | | | | | | | | | * lisp/emacs-lisp/subr-x.el (string-limit): Fix shorter-than-length case.
| * | Rename slice-string to string-sliceLars Ingebrigtsen2020-12-212-4/+4
| | | | | | | | | | | | | | | * lisp/emacs-lisp/subr-x.el (string-slice): Rename from slice-string. * doc/lispref/strings.texi (Creating Strings): Ditto.
| * | Add `string-pad'Lars Ingebrigtsen2020-12-212-0/+24
| | | | | | | | | | | | | | | | | | | | | * 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.
| * | Beef up the Emacs string utility set a bitLars Ingebrigtsen2020-12-212-0/+68
| | | | | | | | | | | | | | | | | | | | | | | | | | | * 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.
* | | Negate only values while constraining variables (bug#45376)Andrea Corallo2020-12-232-1/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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.
* | | * Fix non range cstr union operationAndrea Corallo2020-12-231-8/+10
| | | | | | | | | | | | | | | | | | | | | * 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.
* | | * Follow cstr basic blocks to perform latch recognitionAndrea Corallo2020-12-231-3/+6
| | | | | | | | | | | | | | | * lisp/emacs-lisp/comp.el (comp-fwprop-insn): Fix latch recognition.
* | | Make input constraints into memoization hash immutable (bug#45376)Andrea Corallo2020-12-231-2/+2
| | | | | | | | | | | | | | | | | | * lisp/emacs-lisp/comp-cstr.el (comp-cstr-union-1) (comp-cstr-intersection): Copy input before soting it into the memoization hash table.
* | | * lisp/emacs-lisp/comp-cstr.el (comp-cstr-copy): Tweak for perf.Andrea Corallo2020-12-231-3/+3
| | |
* | | * Fix a bunch of known type specifiersAndrea Corallo2020-12-211-4/+3
| | | | | | | | | | | | | | | * lisp/emacs-lisp/comp.el (comp-known-type-specifiers): Fixes for: =, string-search, substring.
* | | Fix `comp-add-call-cstr' and add a testAndrea Corallo2020-12-211-5/+8
| | | | | | | | | | | | | | | | | | | | | * 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.
* | | Fix value type inference for doubly negate constraintsAndrea Corallo2020-12-211-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | * 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.
* | | Simplify correctly (or (integer 1 1) (not (integer 1 1))) as tAndrea Corallo2020-12-211-6/+11
| | | | | | | | | | | | | | | | | | | | | * 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.
* | | * Guarantee fwprop convergence and terminationAndrea Corallo2020-12-211-5/+12
| | | | | | | | | | | | | | | | | | | | | | | | * 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.
* | | * Allow for overlapping src and dst in cstr set operationsAndrea Corallo2020-12-211-185/+185
| | | | | | | | | | | | | | | | | | * 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.
* | | Symplify type specifier (not t) as nilAndrea Corallo2020-12-211-0/+9
| | | | | | | | | | | | | | | | | | | | | * 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.
* | | Enhance type inference constraining function argumentsAndrea Corallo2020-12-211-9/+71
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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.
* | | * Allow for modifying insn-cell inside `comp-loop-insn-in-block'Andrea Corallo2020-12-211-6/+7
| | | | | | | | | | | | * lisp/emacs-lisp/comp.el (comp-loop-insn-in-block): Update.
* | | * Rename comp-cond-cstr into comp-add-cstrsAndrea Corallo2020-12-211-27/+29
| | | | | | | | | | | | | | | | | | * 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.
* | | * Two minors in comp.elAndrea Corallo2020-12-211-2/+2
| | | | | | | | | | | | | | | * lisp/emacs-lisp/comp.el (comp-known-func-cstr-h) (comp-ret-type-spec): Style.
* | | * Improve constraint simplification logic in comp-cstr.elAndrea Corallo2020-12-211-113/+131
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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.
* | | * Improve comp-fwprop passAndrea Corallo2020-12-211-40/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.