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.
`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.
Juri Linkov [Mon, 1 Jun 2020 23:01:25 +0000 (02:01 +0300)]
* lisp/progmodes/project.el (project-vc-dir, project-shell): New commands.
(project-compile): Add args and interactive spec like in 'compile'.
(project-switch-commands): Bind project-vc-dir to "v",
project-shell to "s", and rebind project-find-regexp from "s" to "r".
* doc/emacs/maintaining.texi (Project File Commands):
Describe project-vc-dir and project-shell.
Nicolás Bértolo [Sun, 31 May 2020 21:09:12 +0000 (18:09 -0300)]
* Throw an ICE when asked to emit a cast with sign extension.
* src/comp.c (cast_kind_of_type): Enum that specifies the kind of type
in the cast enum (unsigned, signed, pointer).
(emit_coerce): Throw an ICE when asked to emit a cast with sign
extension.
(define_cast_from_to): Return NULL for casts involving sign extension.
(define_cast_functions): Specify the kind of each type in the cast
union.
For discussion of the autoloaded function declaration, see
https://lists.gnu.org/archive/html/emacs-devel/2020-05/msg00910.html.
* lisp/dnd.el (dnd-handle-one-url): It is no longer necessary to
declare the autoloaded function browse-url-select-handler after
ldefs-boot.el was updated.
* lisp/progmodes/elisp-mode.el: Declare xref.el function to silence
byte-compiler.
Dmitry Gutov [Mon, 1 Jun 2020 01:44:33 +0000 (04:44 +0300)]
Change xref-find-apropos to pass PATTERN to backend verbatim
* lisp/progmodes/xref.el (xref-backend-apropos): Rename this
generic's second arg to PATTERN, to clarify that it should be
handled entirely in the backend, with no pre-processing by the
command.
(xref-find-apropos): Update accordingly, but keep compatibility
with backends in older Emacs versions.
(xref-apropos-regexp): Extract from xref-find-apropos.
* lisp/progmodes/etags.el (xref-backend-apropos): Use it here.
* lisp/progmodes/elisp-mode.el (xref-backend-apropos): And here.
Paul Eggert [Sun, 31 May 2020 22:29:23 +0000 (15:29 -0700)]
Be more aggressive in marking objects during GC
Simplified version of a patch from Pip Cet (Bug#41321#299).
* src/alloc.c (maybe_lisp_pointer): Remove. All uses removed.
(mark_memory): Also look at the pointer offset by ‘lispsym’,
for symbols.
Andrea Corallo [Sun, 31 May 2020 19:28:31 +0000 (20:28 +0100)]
* Optimize 'emit_static_object' for load-time
* src/comp.c (emit_static_object): Use a chunck size of 200 bytes
on bugged GCCs and a longer one (1024) in sane ones. Rename
str in buff to disambiguate and prefer xmalloc to a VLA given
the buffer is not that small.
Nicolás Bértolo [Wed, 20 May 2020 03:34:32 +0000 (00:34 -0300)]
* Cut down compile-time emitting static data as string literals
This change drastically reduce compile time. Apparently GCC optimizer
does not scale up well at all for long sequences of assignments into a
single array.
Nicolás Bértolo <nicolasbertolo@gmail.com>
Andrea Corallo <akrl@sdf.org>
* src/comp.c (gcc_jit_context_new_string_literal)
(gcc_jit_block_add_assignment_op): New imports.
(comp_t): New 'size_t_type' 'memcpy' fields.
(emit_static_object): Define static objects using string literals
and memcpy.
(define_memcpy): New function.
(Fcomp__init_ctxt): Define 'size_t_type' and 'memcpy'.
Eli Zaretskii [Sun, 31 May 2020 14:34:09 +0000 (17:34 +0300)]
Protect bidi cache from inadvertent resets
* src/xdisp.c (Fline_pixel_height, Fmove_point_visually): Save and
restore the bidi cache, to avoid inadvertently resetting it by
starting a new iteration through buffer text. This could cause
trouble if these functions are called during a redisplay cycle,
especially while we were processing RTL text.
Eli Zaretskii [Sun, 31 May 2020 14:23:11 +0000 (17:23 +0300)]
Avoid crashes due to bidi cache being reset during redisplay
If automatic character composition triggers GC, and
'garbage-collection-messages' are turned on, we could have the
bidi cache reset while processing RTL text, which would then
consistently crash.
* src/xdisp.c (display_echo_area_1): Protect the bidi cache
against changes inside 'try_window'.