Disabling write barrier deferral in config.h, uncovered a second
problem: mps/test/function/eph1.c fails because segments aren't scanned
if the segment's summary doesn't intersect with the white set.
* mps/code/trace.c (traceFindGrey): Force rescanning by adding the white
set to the segments summary.
In traceScanSegRes, the assertion
AVER(RefSetSub(ScanStateUnfixedSummary(ss), SegSummary(seg)));
can fail if we call MPS_FIX1 on a reference but not MPS_FIX2. In a
normal Emacs session that tends to happen after ~10 minutes. If "write
barrier deferral" is disabled in config.h, then the tests in
mps/test/function/eph1.c will also run into this assertion.
I failed to create a reproducible test with write barrier deferral
enabled. Obvioulsy, I don't understand this issue fully.
* mps/code/poolawl.c (aephFixKey): Include the key in the SegSummary.
(aephIsWhite): Return the new reference, so that we can avoid calling
MPS_FIX2 twice.
* test/src/fns-tests.el (ft-weak-equal-table): With wide-ints, the test
unexpecetly passed probably because some stray reference to '(key 0) was
on the stack. With a helper thread, the test works as expected.
It can be enabled with -DUSE_EPHEMERON_POOL.
This variant uses the ephemeron pool and hence sovles the key-in-value
problem.
This version stores key/values pairs a vector-of-pairs instead of a
pair-of-vectors. The same vector-of-pairs type is used for weak and
non-weak. This avoids the code duplication used by the pair-of-vector
version; though it adds a bit of overhead to the non-weak code path.
* src/lisp.h: (struct vector_pair [!USE_EPHEMERON_POOL]): New type.
(struct pair_vector [USE_EPHEMERON_POOL]):New type.
(hash_table_kv): New typedef used to both version.
(hash_table_kv_create, hash_table_kv_free, hash_table_kv_key)
(hash_table_kv_value, hash_table_kv_set_key, hash_table_kv_set_value)
(hash_table_kv_null): New helpers
(struct Lisp_Hash_Table): Use a single field kv of type hash_table_kv
instead of two fields.
(HASH_KEY, HASH_VALUE, WEAK_HASH_KEY, WEAK_HASH_VALUE, DOHASH)
(DOHASH_WEAK, set_hash_key_slot, set_hash_value_slot)
(set_weak_hash_key_slot, set_weak_hash_value_slot): Adapt to
hash_table_kv.
(DOHASH [USE_EPHEMERON_POOL]): New version.
* src/igc.h (enum igc_obj_type): Add IGC_OBJ_PAIR_VECTOR,
IGC_OBJ_WEAK_KEY_PAIR_VECTOR, IGC_OBJ_WEAK_VALUE_PAIR_VECTOR,
IGC_OBJ_WEAK_OR_PAIR_VECTOR.
(igc_alloc_pair_vector): New prototype.
* src/igc.c (obj_type_names, set_header, dflt_scan_obj, thread_ap):
Handle new tpes.
(struct igc_thread, create_ephemeron_ap, create_thread_aps)
(igc_thread_remove): Add allocation point for ephemeron pool.
(struct igc, make_pool_aeph, make_igc): Add ephemeron pool.
(as_igc_header, fix_pair_vector, decode_ptr, encode_ptr)
(increment_ndeleted, splat_pair, fix_weak_key_pair, fix_weak_value_pair)
(fix_weak_or_pair, fix_weak_and_pair, scan_pair_vector)
(fix_weak_key_pair_vector, fix_weak_value_pair_vector)
(fix_weak_or_pair_vector, fix_weak_and_pair_vector): New helpers.
(fix_hash_table, fix_weak_hash_table_strong_part)
(fix_weak_hash_table_weak_part): Adapt to hash_table_kv.
(igc_alloc_pair_vector): New function.
* src/fns.c (maybe_resize_hash_table): Call maybe_resize_hash_table.
(Fgethash): Add assertion for HASH_UNUSED_ENTRY_KEY.
(Fhash_table_count): Take deleted entries into account.
(hash_table_kv_init, hash_table_kv_create)
(hash_table_kv_resize, hash_table_kv_free): New helpers.
(hash_table_kv_ndeleted, hash_table_ndeleted)
(hash_table_count, reclaim_deleted_entries)
(maybe_reclaim_deleted_entries): New helpers.
(make_hash_table, copy_hash_table, hash_table_thaw, hash_table_rehash)
(allocate_weak_hash_table_parts, make_weak_hash_table)
(maybe_resize_weak_hash_table): Adapt to hash_table_kv.
* src/alloc.c (cleanup_vector): Adapt to hash_table_kv.
* src/pdumper.c (hash_table_contents, hash_table_freeze)
(dump_hash_table): Adapt to hash_table_kv.
(dump_hash_table_kv_slot, dump_hash_table_kv, dump_hash_table_kv_part):
New helpers.
* src/print.c (print_object): Use Fhash_table_count instead
of the h->count field.
* test/src/fns-tests.el (ft--check-entries): Check hash-table-count.
(ft-weak-fixnums2, ft--test-weak-fixnums2): New test.
(ft--test-ephemeron-table): Better check for hash-table-count.
* mps/code/trace.c (TraceRankForAccess): While in the ephemeron band,
use RankFINAL for final segments and RankEXACT for the others.
* mps/test/function/eph5.c: New Test.
* mps/test/testsets/passing: Include eph5.c.
* mps/test/test/testlib/ephfmt.h (union header): Use a one-word header.
* mps/test/test/testlib/ephfmt.c: Update accordingly.
* mps/test/function/eph1.c: Update accordingly.
* lisp/icomplete.el (icomplete-exit): New alias for 'icomplete-fido-exit'.
(icomplete-minibuffer-map): Bind it to "M-j" .
* lisp/replace.el (multi-occur--prompt): Show "M-j" bound to 'icomplete-exit'
in 'icomplete-mode'.
If the completion table requests eager-update (so *Completions*
should be updated as the user types, when already displayed)
then *Completions* will be dismissed automatically if the user
types something which isn't a completion. Previously,
*Completions* wouldn't be redisplayed until the user requests it
again. Now, if the completion table also enables eager-display
in addition to eager-update, then automatically redisplay
*Completions* after it disappears.
* lisp/minibuffer.el (completions--start-eager-display): Add
REQUIRE-EAGER-UPDATE argument and don't run if Completions is
already displayed.
(completions--after-change): Call
'completions--start-eager-display'.
(minibuffer-completion-help): Add the 'completions--after-change'
hook earlier, and let it remove itself (bug#80055).
* lisp/minibuffer.el (minibuffer--message-overlay)
(minibuffer--message-timer): New variables.
(minibuffer--delete-message-overlay): New function.
(minibuffer-message): Use a timer and 'pre-command-hook' to
clear message overlay instead of blocking with
'sit-for'. (bug#79510)
* etc/NEWS: Document the change.
* lisp/tutorial.el (tutorial--default-keys):
Don't sort quoted list in-place. Sort at compile time, not load time.
Uniform key representation (vectors) so that the default comparison can
be used. Eliminate unnecessary backquote.
(tutorial--sort-keys): Remove.
* src/frame.c (delete_frame) [HAVE_X_WINDOWS]: Block input while
child frame is displayed, and process the X events triggered by
that later. Patch by Byakuren (https://web.liminal.cafe/~byakuren/).
(Bug#76186)
Copyright-paperwork-exempt: yes
* lisp/progmodes/xref.el (xref--parse-hits, xref--sort-hits):
Extract from xref-matches-in-directory and xref-matches-in-files.
Use in both for better consistency between these functions.
* lisp/emacs-lisp/loaddefs-gen.el (loaddefs-generate--make-autoload):
Try and (auto)load the macro in case that defines `autoload-macro`.
Simplify the code for the `loaddefs--defining-macros` case.
* test/lisp/emacs-lisp/package-vc-tests.el
(package-vc-tests-repos): New variable.
(package-vc-tests-create-repository): Add argument `repos-dir'.
(package-vc-tests-make-temp-dir): Create a temporary directory
with prefix.
(package-vc-with-tests-environment): Use
`package-vc-tests-make-temp-dir' to create a temporary directory
for package test. Use `package-vc-tests-repos' to cache test
package repository.
(package-vc-tests-preserve-pkg-artifacts-p): Detect when to
preserve package temporary files.
(package-vc-tests-environment-tear-down): Use
`package-vc-tests-preserve-pkg-artifacts-p'. Use plural there
are more than one buffer. Report temporary directory with test
repository.
(package-vc-tests-add-ert-run-tests-listener): Wrap listener in
args with custom functionality for `package-vc-tests'. On tests
run start reset `package-vc-tests-repos' cache. On tests run
end delete temporary directories.
The main reason for this is that then these commands can have
the same bindings in VC-Dir buffers that they have under
vc-prefix-map. 'T' is a good mnemonic for "Topic" and a
serviceable mnemonic for "outsTanding".
* lisp/vc/vc-hooks.el (vc-prefix-map): Move 'o' to 'T'.
* lisp/vc/vc-dir.el (vc-dir-mode-map): New 'T' bindings.
* src/treesit.c (ts_tree_cursor_copy) [WINDOWSNT]: Remove, as it
is no longer used.
(ts_tree_cursor_goto_previous_sibling) [WINDOWSNT]: Add. (Bug#80108)
Historically only the GIF code did this (since it stores animation
metadata in lisp_data), and recently the WebP code followed suit.
The benefit of clearing lisp_data is not 100% clear (to me:
bug#66221#41), but it probably can't hurt, so do it unconditionally
for all image types to simplify conditional compilation and avoid
warnings (bug#80266).
* src/image.c (image_clear_image): Set lisp_data to nil.
[HAVE_GIF || HAVE_WEBP] (gif_clear_image):
[HAVE_IMAGEMAGICK] (imagemagick_clear_image): Remove, replacing all
uses with image_clear_image.
* configure.ac (LIBSYSTEMD_CFLAGS): Increase minimal required
tree-sitter version to 0.20.10.
* src/treesit.c (treesit_traverse_sibling_helper): When
traversing forward, use the new function
ts_tree_cursor_goto_previous_sibling.
Optionally use find and grep directly instead of going through the
Semantic framework (bug#80246).
* lisp/progmodes/project.el (project--vc-ignores): Require 'vc' to
ensure that vc-default-ignore-completion-table is available.
* lisp/progmodes/xref.el (xref-references-in-directory-function):
New user option.
(xref-references-in-directory): Call it.
(xref-references-in-directory-grep): Implementation based on find/grep.
(xref-references-in-directory-semantic): Implementation using Semantic.
(xref-matches-in-directory): Add new argument DELIMITED.
Co-authored-by: Dmitry Gutov <dmitry@gutov.dev>