Andrea Corallo [Thu, 11 Jun 2020 20:53:31 +0000 (22:53 +0200)]
* Introduce latches
Define a new kind of basic block 'latch' to close over loops. Its
purpose is for now to emit calls to `comp-maybe-gc-or-quit' but in
future will be usefull for the loop optimizer to exploit unboxes.
* lisp/emacs-lisp/comp.el (comp-block): New base class.
(comp-block-lap): New class for LAP derived basic blocks.
(comp-latch): New class.
(comp-bb-maybe-add, comp-make-curr-block, comp-emit-handler)
(comp-emit-switch, comp-emit-switch, comp-limplify-top-level)
(comp-addr-to-bb-name, comp-limplify-block)
(comp-limplify-function): Update logic for new bb objects
arrangment.
(comp-latch-make-fill): New function.
(comp-emit-uncond-jump, comp-emit-cond-jump): Update to emit
latches.
(comp-new-block-sym): Add a postfix paramenter.
Andrea Corallo [Thu, 11 Jun 2020 18:23:00 +0000 (20:23 +0200)]
Fix recursive load for non cons hashed 'data_ephemeral_vec' content
Removing `Vcomp_sym_subr_c_name_h' all c_name functions are GC
markable only through 'data_ephemeral_vec'. A recursive load must not
overide its content otherwise a previously activated load will have
the original content collected before it's used.
Andrea Corallo [Thu, 11 Jun 2020 20:22:00 +0000 (22:22 +0200)]
Remove `Vcomp_sym_subr_c_name_h'
Given there's no more unique relation symbol-name -> c-name remove
`Vcomp_sym_subr_c_name_h' and store the c_name directly in struct
Lisp_Subr. The old approach would have failed dumping two functions
with the same symbol-name.
Add a predicate, color-dark-p, for deciding whether a colour is more
readable with black or white as contrast. It has experimentally been
shown to be more accurate and robust than the various methods
currently employed.
The new predicate compares the relative luminance of the colour to an
empirically determined cut-off value, and it seems to get it right in
almost all cases, with no value leading to outright bad results.
* lisp/faces.el (readable-foreground-color): Use color-dark-p.
(color-dark-p): New function.
* lisp/facemenu.el (list-colors-print): Use readable-foreground-color,
improving readability of list-colors-display.
* lisp/textmodes/css-mode.el (css--contrasty-color): Remove.
(css--fontify-region): Use readable-foreground-color.
* lisp/emacs-lisp/cl-macs.el (cl-lambda-list, cl-lambda-list1)
(cl-macro-list, cl-macro-list1): Use exactly the same specification as
for &optional (sans the third optional list element).
Nicolás Bértolo [Tue, 9 Jun 2020 01:01:25 +0000 (22:01 -0300)]
Copy suffixes passed to 'openp' to avoid GC crashes. Fixes bug#41755
In openp_add_middle_dir_to_suffixes we build a heap-based list from
the passed suffixes. It is crucial that we don't create a heap-based
cons that points to a stack-based list.
* src/lread.c (openp_add_middle_dir_to_suffixes): Copy suffixes when
building a list of middle-dirs and suffixes.
Save the project list file as lisp data instead of line separated
strings to make it more extendable in the future.
* lisp/progmodes/project.el (project--read-project-list)
(project--write-project-list, project--add-to-project-list-front)
(project--remove-from-project-list): Adjust to `project--list' now
being an alist.
Juri Linkov [Mon, 8 Jun 2020 23:34:53 +0000 (02:34 +0300)]
* lisp/simple.el (shell-command-on-region): Handle nil replace on rectangles.
When 'region-noncontiguous-p' is non-nil (rectangular region)
but 'replace' is nil, pop up the shell output buffer (bug#41440).
When 'replace' is non-nil, trim the trailing newline.
Andrea Corallo [Mon, 8 Jun 2020 15:21:03 +0000 (17:21 +0200)]
* Fix load logic for the reloading CU case (bug#41754)
* src/comp.c (load_comp_unit): When swapping the compilation unit
abandoning the new one for the original do not forget to set its
loaded_once field to true because is in use by
`comp--register-lambda'.
(Fcomp__register_lambda): Add sanity a check to spot
early if we are trying to load the same lambda twice.
Invalid arguments to color-values, such as "#abcdefg" or "#1234", or
valid ones like "#111222333", should not yield nonsense values.
* src/nsterm.m (ns_get_color):
Only accept "#RGB" strings with 1-4 digits per components, equal number
of digits each, and no trailing characters. Parse 12-bit colours
correctly.
Michael Albinus [Mon, 8 Jun 2020 08:18:35 +0000 (10:18 +0200)]
Add autoload problem in tramp-crypt.el.
* lisp/net/tramp-crypt.el (tramp-crypt-encfs-config):
Add ;;;###tramp-autoload cookie.
(tramp-crypt-directories): Move it up.
(tramp-crypt-file-name-p): Move it up. Add ;;;###tramp-autoload
cookie. Make it a defsubst.
* test/lisp/net/tramp-tests.el (tramp-crypt): Do not require.
`make-byte-code' wraps `vector' doing some sanity check on the input
arguments. `vector' is in side-effect-and-error-free-fns so add
`make-byte-code' to side-effect-free-fns.
Glenn Morris [Sun, 7 Jun 2020 16:03:59 +0000 (09:03 -0700)]
Merge from origin/emacs-27
35661ef943 (origin/emacs-27) Fix typo in "(elisp) Type Keywords" 1af0e95fec Gnus nnir-summary-line-format has no effect dd366b5d3b Improve documentation of 'window-text-pixel-size' fbd49f969e * src/xdisp.c (Fwindow_text_pixel_size): Doc fix. (Bug#41... d8593fd19f Minor improvements to EDE and EIEIO manuals 3916e63f9e Have Fido mode also imitate Ido mode in ignore-case options cc35b197c7 Update package-menu-quick-help bf09106256 Improve documentation of 'sort-subr' 73749efa13 Update Ukrainian transliteration 30a7ee505a Fix Arabic shaping when eww/shr fill the text to be rendered 7d323f07c0 Silence some byte-compiler warnings in tests cf473e742f * test/lisp/battery-tests.el: New file. b07e3b1d97 Improve format-spec documentation (bug#41571)
Andrea Corallo [Sat, 6 Jun 2020 22:34:21 +0000 (00:34 +0200)]
* Optimize optimizable variables
* lisp/emacs-lisp/comp.el (comp-symbol-values-optimizable): New
defconst.
(comp-function-call-maybe-remove): New logic to to remove
unnecessary `symbol-value' calls.
Tassilo Horn [Sun, 7 Jun 2020 08:01:41 +0000 (10:01 +0200)]
Gnus nnir-summary-line-format has no effect
* lisp/gnus/nnir.el (nnir-mode): Update summary format specs if
nnir-summary-line-format is set and different from
gnus-summary-line-format.
(nnir-open-server): Run nnir-mode in gnus-summary-generate-hook
instead of gnus-summary-prepared-hook.
Andrea Corallo [Sat, 6 Jun 2020 14:53:34 +0000 (16:53 +0200)]
* Mitigate possible speed 3 miss-optimization
Do not perform trampoline optimization at speed 3 on function if their
name is not unique inside the compilation unit. Note that the
function can still be redefined in any other way therefore this is a
mitigation.
* lisp/emacs-lisp/comp.el (comp-func-unique-in-cu-p): New
predicate.
(comp-call-optim-form-call): Perform trampoline optimization
for named functions only if they are unique within the current
compilation unit.
Is cleaner to have the function c-name as first argument of
'direct-call' 'direct-callref'. This is preparatory to anonymous
lambdas optimization.
* lisp/emacs-lisp/comp.el (comp-propagate-insn): Use c-name when
gathering the comp-func definition for direct calls.
(comp-call-optim-form-call): Add put c-name as first argument of
direct-call direct-callref when optimizing.
* src/comp.c (emit_call): Update logic for having c-name as
first arg of direct calls.
(emit_call_ref): Rename 'subr_sym' into 'func'.
Nicolás Bértolo [Mon, 25 May 2020 21:05:23 +0000 (18:05 -0300)]
Reduce the number of files probed when finding a lisp file.
* src/lread.c (get-load-suffixes): Do not add any suffix to files that
need to be loaded by the dynamic linker.
(effective_load_path): Remove function.
(load): Don't add any suffix if file ends in a suffix already.
(effective_load_path): Remove function.
(openp_add_middle_dir_to_suffixes): Add helper function to create
pairs of middle directories and suffixes.
(openp_max_middledir_and_suffix_len): Add helper function to count the
number of bytes needed to store the middle directory and suffix.
(openp_fill_filename_buffer): Add helper function to copy middle
directory, basename and suffix to the filename buffer.
Paul Eggert [Sat, 6 Jun 2020 19:05:10 +0000 (12:05 -0700)]
make-text-button no longer modifies its string arg
* etc/NEWS: Mention this.
* lisp/apropos.el (apropos-library-button):
* lisp/ibuf-ext.el (ibuffer-old-saved-filters-warning):
There’s no longer a need copy make-text-button’s string arg.
* lisp/button.el (make-text-button): Return a copy of a string arg.
Delay making the copy until after error-checking.
For discussion see the following threads:
https://lists.gnu.org/archive/html/emacs-devel/2020-05/msg00630.html
https://lists.gnu.org/archive/html/emacs-devel/2020-05/msg00674.html
https://lists.gnu.org/archive/html/emacs-devel/2020-06/msg00099.html
* lisp/emacs-lisp/eieio.el (oset, oset-default): Un-deprecate.
* lisp/emacs-lisp/eieio-core.el (eieio-oref): Declare gv-setter here
instead of in lisp/emacs-lisp/eieio.el. Suggested by
Stefan Monnier <monnier@iro.umontreal.ca>.
(eieio-oref-default): Add gv-setter declaration.
* etc/NEWS: Announce these changes.
* doc/misc/eieio.texi (Accessing Slots): Document oref and
oref-default as generalized variables. Consistently document
getters before setters.
* test/lisp/emacs-lisp/eieio-tests/eieio-tests.el: Use
lexical-binding.
(eieio-test-13-init-methods): Simplify.
(eieio-test-33-instance-tracker): Declare IT-list as special.
For discussion, see the following threads:
https://lists.gnu.org/archive/html/emacs-devel/2020-05/msg00630.html
https://lists.gnu.org/archive/html/emacs-devel/2020-06/msg00099.html
* doc/misc/ede.texi (ede-generic-project): Clean up example.
* doc/misc/eieio.texi (Accessing Slots): Document slot-value as a
generalized variable and set-slot-value as obsolete.
(Predicates): Fix typo.
(Introspection): Document eieio-class-slots in place of the obsolete
object-slots.
Andrea Corallo [Sat, 6 Jun 2020 12:00:45 +0000 (13:00 +0100)]
Some fixes for --without-nativecomp config
* src/pdumper.c (dump_subr): Do not add RELOC_NATIVE_SUBR for
VERY_LATE_RELOCS in --without-nativecomp.
(dump_do_dump_relocation): Add a sanity check that no
RELOC_NATIVE_SUBR exists in --without-nativecomp.
* src/lread.c (Fload): As Fnative_elisp_load is not defined
in --without-nativecomp so ifdef this block.
* lisp/emacs-lisp/package.el (package--quick-help-keys): Filtering
is now bound to the prefix '/', not the key 'f' (bug#41721).
Advertise only the standard 'g' binding now that both it and 'r' are
bound to revert-buffer (bug#35504).
(package--prettify-quick-help-key): Avoid modifying string literals.
(package-menu-filter): Reintroduce as obsolete alias of
package-menu-filter-by-keyword for backward
compatibility (bug#36981).
Paul Eggert [Fri, 5 Jun 2020 01:46:11 +0000 (18:46 -0700)]
Streamline live_*_holding
(live_string_holding, live_cons_holding, live_symbol_holding)
(live_float_p, live_vector_holding):
Assert that m->type is correct, instead of testing this at
runtime. All callers changed.
(live_large_vector_holding, live_small_vector_holding):
Now two functions instead of the old live_vector_holding.
All callers changed.
(live_large_vector_p, live_small_vector_p):
Now two functions instead of the old live_vector_p.
All callers changed.
(mark_maybe_object): Ignore Lisp_Type_Unused0 quickly too,
since that cannot possibly be an object.
(CHECK_LIVE, CHECK_ALLOCATED_AND_LIVE):
New arg MEM_TYPE. All callers changed.
(CHECK_ALLOCATED_AND_LIVE_SYMBOL): Simplify by combining
GC_CHECK_MARKED_OBJECTS code.
Paul Eggert [Fri, 5 Jun 2020 01:46:10 +0000 (18:46 -0700)]
Make live_*_p more accurate
* src/alloc.c (live_string_holding, live_cons_holding)
(live_symbol_holding, live_vector_holding):
Return a C pointer, not a Lisp_Object. All callers changed.
This helps the compiler a bit.
(live_string_p, live_cons_p, live_symbol_p, live_vector_p):
Require that P point directly at the object, rather than
somewhere within the object. This fixes some false positives
with valid_lisp_object_p (used only in debugging).
(mark_maybe_object): Rely on the new accuracy.
For discussion, see the following thread:
https://lists.gnu.org/archive/html/emacs-devel/2020-06/msg00117.html
* lisp/apropos.el (apropos-library-button):
* lisp/help-fns.el (help-fns--first-release): Return result of
make-text-button instead of relying on its side effects.
* lisp/ibuf-ext.el (ibuffer-old-saved-filters-warning): Avoid
modifying an immutable string.
Juri Linkov [Thu, 4 Jun 2020 22:17:30 +0000 (01:17 +0300)]
* lisp/dired.el (dired-toggle-marks): Use region for non-nil dired-mark-region
(dired-mark--region-use-p, dired-mark--region-beginning)
(dired-mark--region-end): New internal functions.
(dired-mark-if): Use new functions. (Bug#39902)
Use characters for keys in project-switch-commands
* lisp/progmodes/project.el (project-switch-commands): Use
characters for keys instead of string for better future
compatibility with 'read-multiple-choice'.
(project-switch-project): Adjust to above change.
Stefan Monnier [Thu, 4 Jun 2020 13:58:22 +0000 (09:58 -0400)]
* lisp/font-lock.el (font-lock--syntax-table-affects-ppss): New var
This tries to make `font-lock-syntax-table` work correctly even when
it changes the parsing of strings and comments, as was the case in
`font-latex.el`.
We should probably deprecate the use of `font-lock-syntax-table` since
the present fix is still not 100% and since it comes with performance
problems in large files.
(font-lock-set-defaults): Set it.
(font-lock-fontify-syntactically-region): Don't use `syntax-ppss`
when we think that `font-lock-syntax-table` would interfere.
Paul Eggert [Thu, 4 Jun 2020 01:58:45 +0000 (18:58 -0700)]
Don’t default to Valgrind unless ENABLE_CHECKING
* src/alloc.c (USE_VALGRIND): If not defined, don’t default it to
1 unless ENABLE_CHECKING. The Valgrind hooks bloat the garbage
collector a bit in production, and there’s no need for them these
days if one has a Valgrind suppressions file (which one needs anyway).
(mark_maybe_pointer): Use ‘#if USE_VALGRIND’ instead of ‘#ifdef
USE_VALGRIND’ for consistency with other uses of USE_VALGRIND.
This is in case someone builds with ‘-DENABLE_CHECKING
-DUSE_VALGRIND=0’ in CFLAGS.
Paul Eggert [Thu, 4 Jun 2020 01:15:54 +0000 (18:15 -0700)]
Revert make-text-button string copy
* lisp/button.el (make-text-button): Don’t make a copy of
a button’s string label. This reverts the change made in
2020-05-17T05:23:28Z!eggert@cs.ucla.edu, which broke SLY.
Problem reported by João Távora in:
https://lists.gnu.org/r/emacs-devel/2020-06/msg00117.html
However, we’ll need a better fix for this once string
literals become contents, if SLY uses string constants
for text button labels.
Paul Eggert [Wed, 3 Jun 2020 22:39:29 +0000 (15:39 -0700)]
Fix make-text-button bug with string copy
* lisp/button.el (make-text-button): Use the copy of BEG
uniformly, instead of in just one place. This fixes a typo
introduced in 2020-05-17T05:23:28Z!eggert@cs.ucla.edu.
Problem reported by João Távora in:
https://lists.gnu.org/r/emacs-devel/2020-06/msg00117.html
Andrea Corallo [Wed, 3 Jun 2020 21:06:26 +0000 (22:06 +0100)]
* Introduce `comp-loop-insn-in-block'
* lisp/emacs-lisp/comp.el (comp-loop-insn-in-block): New macro.
(comp-call-optim-func, comp-dead-assignments-func)
(comp-remove-type-hints-func): Use `comp-loop-insn-in-block'.
* src/xfaces.c (color_distance): Don't throw away the low 8 bits of
the colours, and make the function symmetric (bug41544)
(Fcolor_distance): Add caution about this not being a true metric.
* test/src/xfaces-tests.el: New file.
Paul Eggert [Wed, 3 Jun 2020 01:40:10 +0000 (18:40 -0700)]
Fix bug in recent byte-code checking hoist
Problem reported by Daniel Colascione (Bug#41680).
* src/lread.c (read1): Check that AREF (tmp, COMPILED_BYTECODE)
is a string before subjecting it to STRING_MULTIBYTE.
Be more consistent about using AREF in the neighborhood,
to help prevent this sort of problem from recurring.
* test/lisp/emacs-lisp/cl-generic-tests.el:
* test/lisp/progmodes/elisp-mode-tests.el: Declare functions
referred to within macroexpansions.
(xref-elisp-overloadable-no-default)
(xref-elisp-overloadable-co-located-default)
(xref-elisp-overloadable-separate-default): Prefix unused arguments
with underscore.
* test/lisp/international/ccl-tests.el:
* test/lisp/wdired-tests.el:
* test/lisp/emacs-lisp/package-tests.el: Declare functions used.
(package-test-update-archives, package-test-signed): Use
revert-buffer in place of its obsolete alias package-menu-refresh.
Nicolás Bértolo [Mon, 1 Jun 2020 22:53:00 +0000 (19:53 -0300)]
Fix DLL imports of gccjit version functions.
* src/comp.c (init_gccjit_functions): Use LOAD_DLL_FN_OPT macro to
load gcc_jit_version_major, gcc_jit_version_major and
gcc_jit_version_patchlevel.
* src/w32common.h (LOAD_DLL_FN_OPT): Add macro optionally load a
function from a DLL.
Dmitry Gutov [Tue, 2 Jun 2020 21:27:29 +0000 (00:27 +0300)]
project-list-file: New user option
* lisp/progmodes/project.el (project): New custom group.
(project-vc): Use it as parent.
(project-vc-merge-submodules): Tag with Emacs version.
(project-read-file-name-function): Assign to the 'project' group.
(project-list-file): New user option (bug#41600).
(project--write-project-list, project--read-project-list): Use it.
Simen Heggestøyl [Fri, 29 May 2020 14:58:09 +0000 (16:58 +0200)]
Remove 'project--ensure-file-exists'
* lisp/progmodes/project.el (project--ensure-file-exists): Remove.
(project--read-project-list): Set 'project--list' to nil when the
project list file doesn't exist.
* doc/lispref/text.texi (Interpolated Strings): Move from here...
* doc/lispref/strings.texi (Custom Format Strings): ...to here,
renaming the node and clarifying the documentation.
(Formatting Strings): End node with sentence referring to the next
one.
* lisp/format-spec.el (format-spec): Clarify docstring.