1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-04-27 08:43:40 -07:00
Commit graph

188128 commits

Author SHA1 Message Date
Helmut Eller
2f17f9a372 Move the attribute field of charsets to a separate vector
This simplifies the GC code, as this was the only field in the charset
struct that referenced the GC heap.  Without it, we no longer need to
trace the charset_table.

* src/charset.h (struct charset.attributes): Removed.
(charset_attributes_getter): New helper.
(CHARSET_ATTRIBUTES): Use it.
* src/charset.c (charset_attributes_table): New.
(Fdefine_charset_internal): Place attrs in charset_attributes_table.
(syms_of_charset): Initialize charset_attributes_table.
(mark_charset): Deleted.
* src/pdumper.c (dump_charset): Skip attributes field.
* src/lisp.h (mark_charset): Deleted.
* src/igc.c (fix_charset_table): Nothing to do anymore.
* src/alloc.c (garbage_collect): mark_charset no longer needed.
2025-10-28 09:21:23 +01:00
Helmut Eller
988b4b6c5d * src/gc-handles.c (Fgc_handles_info): Include per-object refcounts 2025-10-27 14:39:25 +01:00
Helmut Eller
7e189d1504 Try to avoid alignment problems with 64 bit builds
* src/w32proc.c (timer_loop): Make stk_bot a pointer; that is more
likely word aligned than a DWORD.
* src/w32fns.c (w32_msg_worker): Idem.
2025-10-26 21:34:18 +01:00
Pip Cet
9395f76710 Remove 'glib_user_data'
* src/gtkutil.c (free_glib_user_data):
* src/gtkutil.h (glib_user_data, get_glib_user_data): Functions
removed.
2025-10-26 14:44:42 +00:00
Pip Cet
e1713417ab Remove glib_user_data in PGTK code
* src/pgtkmenu.c (menu_highlight_callback, menubar_selection_callback)
(popup_selection_callback):
* src/pgtkterm.c (size_allocate, pgtk_set_event_handler): Use
'gc_handle' or raw pointer, not 'glib_user_data'.
2025-10-26 14:42:27 +00:00
Pip Cet
9d0b537589 New function to count number of allocated gc handles
* src/gc-handles.c (Fgc_handles__refs): New function.
(syms_of_gc_handles): Define it.
2025-10-26 14:27:55 +00:00
Pip Cet
109306480e Don't leak objects through gc_handles
* src/gtkutil.c (xg_free_frame_widgets):
(unref_cl_data):
(xg_mark_data):
(xg_update_menu_item):
(find_icon_from_name):
(update_frame_tool_bar): Use 'free_gc_handle'.
(menuitem_highlight_callback): Use 'gc_handle_value'.
2025-10-26 13:57:29 +00:00
Pip Cet
cf53356c8b Use GC handles to store GTK callback data
* src/gtkutil.c (struct xg_frame_tb_info): Use 'gc_handle', not
'Lisp_Object'.
(free_glib_gc_handle): New function.
(hierarchy_ch_cb, qttip_cb): Use 'gc_handle', not 'glib_user_data'.
(style_changed_cb): Use pointer directly, not through
'glib_user_data'.
(xg_create_frame_widgets,xg_create_frame_outer_widgets): Use
'gc_handle' or pointer.
(xg_free_frame_widgets) [MPS]: Use 'xfree'
(create_dialog, xg_dialog_response_cb, xg_dialog_run):
(xg_toggle_notify_cb, xg_get_file_with_chooser): Use pointers
directly.
(make_cl_data, update_cl_data, unref_cl_data): Use 'gc_handle' values.
(xg_mark_data): Simplify, since 'gc_handle' values are marked elsewhere.
(menuitem_destroy_callback, menu_destroy_callback): Use pointers
directly.
(xg_create_one_menuitem): Use 'gc_handle' values for callback data.
(menu_bar_button_pressed_cb, create_menus):
(xg_update_menu_item): Use 'gc_handle' values.
(menubar_map_cb): Use pointer to stack variable.
(xg_update_frame_menubar, find_scrollbar_cb): Use 'gc_handle' value.
(xg_get_widget_from_map): Use pointer to stack variable.
(xg_gtk_scroll_free_scroll_bar_cell): Funtion removed.
(xg_finish_scroll_bar_creation): Use 'gc_handle' value. The object we
create a handle for is unprintable and must not be leaked to Lisp.
(draw_page):
(xg_print_frames_dialog): Use 'gc_handle' values.
(xg_tool_bar_callback, xg_tool_bar_help_callback): Use integers cast
to pointers.
(tb_size_cb): Use 'gc_handle' value.
(xg_create_tool_bar) [MPS]: Use 'xmalloc'.
(xg_make_tool_item): Use integers cast to pointers.
(update_frame_tool_bar): Use 'gc_handle' values.
(free_frame_tool_bar) [MPS]: Use 'xfree'.
(xg_im_context_commit, xg_widget_style_updated):
* src/gtkutil.h (xg_menu_cb_data, xg_menu_item_cb_data):
* src/xmenu.c (menu_highlight_callback, menubar_selection_callback):
Use 'gc_handle' values, not Lisp_Object values.
2025-10-26 13:57:29 +00:00
Eli Zaretskii
31dd90d222 Register with MPS non-Lisp w32 threads that need to access Lisp data
* src/igc.c (w32_add_non_lisp_thread)
(w32_remove_non_lisp_thread) [HAVE_NTGUI]: New functions to
register w32 threads with MPS.
* src/igc.h: Define their prototypes.
* src/w32proc.c (timer_loop):
* src/w32fns.c (w32_msg_worker) [HAVE_MPS]: Call
'w32_add_non_lisp_thread' when the thread starts and
'w32_remove_non_lisp_thread' when it is about to exit.
2025-10-26 12:28:16 +02:00
Helmut Eller
6595ee3a0a Fix Motif scrollbars using GC handles as for Athena
* src/xterm.c (xt_free_gc_handle): Renamed from xaw_free_gc_handle.
(x_create_toolkit_scroll_bar)
(x_create_horizontal_toolkit_scroll_bar) [MOTIF]: Create a GC handle.
(xm_scroll_callback): Adapt to GC handle.
2025-10-25 20:51:02 +02:00
Eli Zaretskii
a45ca7eeba * src/fns.c (strengthen_hash_table_for_dump): Fix a thinko (bug#79695). 2025-10-25 20:54:52 +03:00
Helmut Eller
33d9346348 Fix horizontal Athena scrollbars
Must use GC handles there too.

* src/xterm.c (xaw_jump_callback, xaw_scroll_callback)
(x_create_toolkit_scroll_bar): Some reformatting.
(xaw_free_gc_handle): Renamed from xaw_destroy_scrollbar_callback.
(x_create_horizontal_toolkit_scroll_bar): Create a GC handle.
2025-10-25 18:39:39 +02:00
Helmut Eller
b33d0c5982 * src/gc-handles.{h,c}: Add license headers 2025-10-25 17:27:58 +02:00
Pip Cet
eac2799565 Introduce a GC handle type
* src/gc-handles.h: New file.
* src/gc-handles.c: New file.
* src/Makefile.in (base_obj): Add gc-handles.o.
* src/emacs.c (main): Call syms_of_gc_handles.
* src/xterm.c (xaw_jump_callback, xaw_scroll_callback)
x_create_toolkit_scroll_bar): Use GC handles.
(xaw_destroy_scrollbar_callback): New helper.

Co-authored-by: Helmut Eller <eller.helmut@gmail.com>
2025-10-25 17:10:38 +02:00
Gerd Möllmann
8e3cfab962 Fix duplicate root creation
* src/comp.c (load_comp_unit): Create the root for the
compilation unit once only.
2025-10-23 08:55:46 +02:00
Gerd Möllmann
2a2c46346d Check for overlapping roots if checking is enabled
* src/igc.c (check_root): New function.
(register_root): Call it.
2025-10-23 08:55:33 +02:00
Helmut Eller
8d49383f36 Avoid interior pointers into hash table vectors
Create a type alias Lisp_KV_Vector that is a struct Lisp_Vector* for
igc and a naked Lisp_Object* for the old GC.

* src/lisp.h (Lisp_KV_Vector): New typedef.
(kv_vector_data): New helper.
(struct Lisp_Obarray): Make buckets a Lisp_KV_Vector.
(struct Lisp_Hash_Table): Make key and value Lisp_KV_Vectors.
(hash_table_alloc_kv, hash_table_free_kv): Use Lisp_KV_Vector.
(obarray_iter_at_end, HASH_KEY, HASH_KEY, DOHASH, set_hash_key_slot)
(set_hash_value_slot): Adapt to Lisp_KV_Vector.
* src/alloc.c (hash_table_alloc_kv, hash_table_free_kv): Adapt to
Lisp_KV_Vector.
* src/fns.c (make_hash_table, copy_hash_table, maybe_resize_hash_table)
(hash_table_rehash): Adapt to Lisp_KV_Vector.
* src/igc.h (igc_make_hash_table_vec): Return a Lisp_Vector.
* src/igc.c (igc_make_hash_table_vec): Return a Lisp_Vector.
(fix_hash_table, fix_obarray): Use IGC_FIX12_PVEC for
Lisp_KV_Vectors.
* src/lread.c (intern_sym, Funintern, oblookup, make_obarray)
(grow_obarray, Fobarray_clear): Adapt to Lisp_KV_Vector.
* src/pdumper.c (hash_table_contents, hash_table_freeze, dump_hash_vec):
Adapt to Lisp_KV_Vector.
2025-10-22 13:03:58 +02:00
Helmut Eller
0235bf41fd * src/alloc.c (gc_in_progress): Add FIXME/igc 2025-10-19 21:09:51 +02:00
Helmut Eller
3c8f6102db Adjust module tests for igc
* test/src/emacs-module-tests.el (module--gc): New function.
(mod-test-globref-make-test,module--test-assertions--globref-invalid-free)
(module--test-assertion): Use it.
(module--test-assertions--call-emacs-from-gc): Expect this to fail.
(module/function-finalizer): Expect this to pass.
2025-10-19 21:04:58 +02:00
Pip Cet
3771f87703 ; * src/.gdbinit [defined_HAVE_MPS]: Don't print SIGSEGV messages. 2025-10-19 15:30:28 +00:00
Pip Cet
88f7f1c767 Weak hash tables: New test
* test/src/fns-tests.el (ft--test-puthash-types): New function.
(ft-puthash-types-weak): New test.
2025-10-19 14:35:54 +00:00
Pip Cet
93edfeb053 Weak hash tables: further key-or-value fixes
* src/fns.c (weak_hash_clear): Slow case for key-or-value weakness.
(Fputhash): Use the key in the table, not the (potentially different)
key we looked it up with.
(Fremhash): Destroy extra dependencies.
* src/igc.c (igc_xpointer):
(is_builtin_obj): New functions.
(scan_lispsym): Call 'dflt_scan_obj', which scans the extended header,
not 'fix_symbol' directly.
(igc_external_header): New 'is_builtin' argument.  Use it to avoid
crashes.
(find_dependency_replacement):
(remove_dependency_replacement):
(Figc__extra_dependency): New functions.
(Figc__add_extra_dependency): Simplify.  Use
'find_dependency_replacement'.
(Figc__remove_extra_dependency): Use 'find_dependency_replacement'.
Clean up when last dependency is removed.
(Vigc__dependency_replacements): New Lisp variable.
2025-10-19 14:30:29 +00:00
Helmut Eller
422336289b Merge branch 'master' into feature/igc 2025-10-18 21:00:08 +02:00
Helmut Eller
0525d4c033 Update HASH_thread_state 2025-10-18 20:58:45 +02:00
Pip Cet
ccbefa1c35 Weak hash tables: fix Fputhash bug
* src/fns.c (Fputhash): Use old value, not new value, when calling
Figc__remove_extra_dependency.
2025-10-18 18:38:20 +00:00
Pip Cet
4db43e40d6 Weak hash tables: fix long lines and whitespace
* src/fns.c (make_weak_hash_table, weak_hash_from_key)
(set_weak_hash_next_slot, set_weak_hash_hash_slot)
(set_weak_hash_index_slot, allocate_weak_hash_table)
(strong_copy_hash_table, make_weak_hash_table)
(maybe_resize_weak_hash_table, weak_hash_lookup_with_hash)
(weak_hash_put, weak_hash_remove_from_table): Whitespace and
formatting.
2025-10-18 18:23:33 +00:00
Pip Cet
7a7ddb9d8f Weak hash tables: allow small tables
* src/fns.c (make_weak_hash_table): Change lower size limit to 1 from
65.
2025-10-18 18:23:03 +00:00
Pip Cet
75bbe20dc8 Weak hash tables: copy only when necessary
Some changes suggested by Stefan Monnier in
https://lists.gnu.org/archive/html/emacs-devel/2025-10/msg00490.html

* src/fns.c (strong_copy_hash_table): Renamed from
'strengthen_hash_table'.
(strengthen_hash_table_for_dump): Return type changed to 'void'.
(make_weak_hash_table): Error for user-defined hash table tests.
(maybe_resize_weak_hash_table): Use local variable and add comment.
(Fcopy_hash_table): Avoid redundant copy.
(Fhash_table_count): Continue copying, so the count is always
accurate.
(Fhash_table_rehash_size):
(Fhash_table_rehash_threshold):
(Fhash_table_size):
(Fhash_table_test): Avoid creating copy.
(Fmaphash): Adjust API.
(Finternal__hash_table_histogram):
(Finternal__hash_table_buckets): Return nil.
(Finternal__hash_table_index_size):
* src/print.c (print_object): Adjust API.
2025-10-18 18:23:03 +00:00
Helmut Eller
48357dc612 Add a test for puthash
It's actually for a bug on the feature/igc branch.

* test/src/fns-tests.el (ft-puthash-weak): New test
(ft--puthash-weak): New helper.
2025-10-18 20:22:17 +02:00
Juri Linkov
08dc7d0c93 * lisp/minibuffer.el (completion--insert-strings): Use the correct frame.
Provide the 'frame-height' call with the frame of the window where
the *Completions* buffer is displayed for the case when the minibuffer
window uses a dedicated frame (bug#79635).
2025-10-18 20:53:44 +03:00
Alan Mackenzie
97b960ec6d Fix coding error in byte-run--strip-vector/record
* lisp/emacs-lisp/byte-run.el (byte-run--strip-vector/record):
Replace a symbol with position by its bare symbol, rather
than returning it unchanged.
2025-10-18 17:08:02 +00:00
Sean Whitton
0b4079ddb6 vc-do-command: Don't print a spurious newline
* lisp/vc/vc-dispatcher.el (vc-do-command): Don't print a
spurious newline.  Don't omit the format string with 'message'.
(Bug#79650)
2025-10-18 17:30:21 +01:00
Alcor
c66680d001 Rcirc: Fix invalid face error message when applying IRC color
* lisp/net/rcirc.el (rcirc-color-attributes): Fix invalid face.
(Bug#79561)

Copyright-paperwork-exempt: yes
2025-10-18 17:23:13 +03:00
Pip Cet
2cfc55e4f6 Also put sys_cond_t variables in ordinary memory
* src/thread.c (lisp_mutex_init) [MPS]: Allocate condition variable.
(lisp_mutex_lock_for_thread):
(lisp_mutex_unlock):
(lisp_mutex_unlock_for_wait): Adjust to pointer type.
(lisp_mutex_destroy) [MPS]: Also free condition variable.
(Fmake_condition_variable) [MPS]: Allocate condition variable.
(condition_wait_callback):
(condition_notify_callback): Adjust to pointer type.
(finalize_one_condvar) [MPS]: Also free condition variable.
* src/thread.h (lisp_mutex_t, struct Lisp_CondVar): Make 'condition'
and 'cond' a pointer or single-element array.
2025-10-18 13:29:52 +00:00
Pip Cet
02b2968f57 Fix crashes when threads are put behind a barrier
On GNU/Linux, glibc expects condvars and mutexes to be in memory which
is always accessible.

* src/thread.c (main_thread_condvar): New variable.
(main_thread): Add reference to it.
(run_thread): Adjust.
(finalize_one_thread) [MPS]: Free 'thread_condvar'.
(Fmake_thread) [MPS]: Allocate 'thread_condvar'.
(thread_join_callback):
(init_threads): Adjust.
* src/thread.h (struct thread_state): Turn 'thread_condvar' into a
pointer or single-element array.
* test/src/igc-tests.el (igc-test--list-length): New variable.
(igc-test--trigger-incremental-gc): New function.
(igc-test-thread-incremental-gc): New test.
2025-10-18 13:12:13 +00:00
Lockywolf
1f3d417736 Fix detecting a working hunspell on systems without a dictionary
Fixes bug#79477 and bug#79514

* test/lisp/textmodes/ispell-tests/ispell-hunspell-tests.el
(ispell-tests-hunspell--hunspell-working): Implement checker.
(ispell/hunspell/ispell-word/russian/check-only): Add skip-check.
(ispell/hunspell/ispell-word/english/check-only): Add skip-check.
(ispell/hunspell/ispell-word/language-switch/check-only): Add
skip-check.
(ispell/hunspell/ispell-word/russian/check-only/wrong-language): Add
skip-check.
(ispell/hunspell/ispell-word/multilang): Add skip-check.
* test/lisp/textmodes/ispell-tests/ispell-tests-common.el
(fake-aspell-path): Improve checking that an engine works.
(ispell-tests--letopt): Make restoring variables more robust,
rename to a local name.  Add debug spec.
(ispell-tests--with-ispell-global-dictionary): Rename to a local name
Add debug spec.
(ispell-tests--some-valid-dictionary): Add a selector for a safe
dictionary.
(ispell/ispell-accept-buffer-local-defs/received-file): Add.
(ispell-tests--constants/english/correct-list): Add.
(ispell-tests--constants/english/correct-one): Add.
(ispell-tests--constants/english/wrong): Add.
(ispell-tests--constants/russian/correct): Add.
(ispell-tests--constants/russian/wrong): Add.
(ispell-tests--constants/completion): Add.
* test/lisp/textmodes/ispell-tests/ispell-tests.el
(ispell/ispell-buffer-local-words/ispell-buffer-session-localwords):
reverse letopt and with-ispell-dictionary.
(ispell/ispell-buffer-local-words/ispell-words-keyword):
reverse letopt and with-ispell-dictionary.
(ispell/ispell-complete-word-interior-frag/simple):
reverse letopt and with-ispell-dictionary.
(ispell/ispell-complete-word/ispell-completion-at-point):
reverse letopt and with-ispell-dictionary.
(ispell/ispell-init-process/works-with-home):
reverse letopt and with-ispell-dictionary.
(ispell/ispell-kill-ispell):
reverse letopt and with-ispell-dictionary.
* test/lisp/textmodes/ispell-resources/fake-aspell-new.bash:
Add comments on unused function.  Replace echo with printf.
2025-10-18 13:59:07 +03:00
Eli Zaretskii
1b1ab741b8 : Update ldefs-boot.el. 2025-10-18 06:18:26 -04:00
Eli Zaretskii
521e06d3ef Merge from origin/emacs-30
53aac6aecd ; Improve documentation of commands that split current wi...
2025-10-18 06:15:46 -04:00
Pip Cet
6d815a454d Weak hash tables: Ensure ambiguous references to parts
This prevents a very subtle bug: The MPS AWL pool doesn't handle
ambiguous interior pointers.  The way DOHASH_WEAK is written, no base
pointer to the weak or strong parts of the weak hash table is on the
stack, so it's possible for the AWL segment not to update forwarding
references before allowing access to the segment.

* src/fns.c (hash_table_being_accessed): New variable.
(strengthen_hash_table): Ensure the strong and weak parts are pinned
by an ambiguous non-interior reference while we access the hash table.
2025-10-18 10:04:21 +00:00
Pip Cet
15dc4bbbc7 Weak hash tables: avoid concurrent data access during GC
* src/fns.c (weak_hash_splat_from_table): Only clear the key/value
slots.  Do not modify internal structures which may be accessed
concurrently.
2025-10-18 10:01:22 +00:00
Pip Cet
8c95d9f66e Weak hash tables: Avoid 'DOHASH_WEAK' when resizing
* src/fns.c (maybe_resize_weak_hash_table): Use
'strengthen_hash_table'.  Shrink if possible.
2025-10-18 10:01:21 +00:00
Spencer Baugh
bea16dfe69 Respect keymaps in buffer text for clicks on displayed strings
When clicking on a string displayed by a display property, also
look at the text properties of the underlying buffer text for
keymaps, not just the displayed string.  The displayed string
takes precedence over the buffer text, but it doesn't replace
it.

Also, we should use the buffer's local map even for clicks on
the mode line.  (Otherwise, what's the point of the <mode-line>
event?)

* src/keymap.c (Fcurrent_active_maps): Consider displayed
string, then buffer text, then fall back to local
map.  (Bug#79505)

* test/src/keymap-tests.el
(keymap-test-keymaps-for-non-buffer-positions): Add more tests.
2025-10-18 12:48:41 +03:00
Augusto Stoffel
59da5020da Fix an error when bookmark handler is a lambda
* lisp/bookmark.el (bookmark-type-from-full-record): Ensure
handler is a symbol before calling 'symbol-function'.
(Bug#79618)
2025-10-18 12:35:29 +03:00
Eli Zaretskii
0d8a31423a ; Fix documentation of a recent commit
* src/window.c (Fcombine_windows, Funcombine_window): Doc fixes.

* doc/lispref/windows.texi (Recombining Windows): Fix markup and
wording.
2025-10-18 12:26:28 +03:00
Eli Zaretskii
a779f7e01b Merge branch 'master' of git.savannah.gnu.org:/srv/git/emacs 2025-10-18 12:14:23 +03:00
Eli Zaretskii
30bb6770f4 ; * etc/NEWS: Document last change (bug#79597). 2025-10-18 12:13:49 +03:00
Lin Sun
1eeadd1f14 Remove directory of deleted package from `load-path'
* lisp/emacs-lisp/package.el (package--delete-directory): Remove
the directory of the to-be-deleted package `load-path'.  Doc
fix.  (Bug#79597)
2025-10-18 12:10:58 +03:00
Martin Rudalics
ef2b032567 Add functions 'combine-windows' and 'uncombine-window'
* src/window.c (make_parent_window, Fcombine_windows)
(Funcombine_window): New functions.
(Fsplit_window_internal): Use make_parent_window.
* doc/lispref/windows.texi (Recombining Windows): Describe new
functions 'combine-windows' and 'uncombine-window'.
(Window Configurations): Explain "window clones".
* etc/NEWS: Mention new functions 'combine-windows' and
'uncombine-window'.
2025-10-18 10:33:10 +02:00
john muhl
81bc83c1a5 New 'lua-mode' inferior process command & options
* lisp/progmodes/lua-mode.el (lua-process-buffer-name)
(lua-process-history-file, lua-process-startfile): New options.
(lua-start-process): Use new options.
(lua-send-file): New command.
(lua--repl-buffer-p): Remove unused internal variable.  (Bug#79573)
2025-10-18 11:22:43 +03:00
Eli Zaretskii
53aac6aecd ; Improve documentation of commands that split current window
* doc/emacs/sending.texi (Sending Mail):
* doc/emacs/dired.texi (Dired Enter, Dired Visiting):
* doc/emacs/maintaining.texi (Old Revisions)
(Change Log Commands, Looking Up Identifiers):
* doc/emacs/windows.texi (Displaying Buffers):
* doc/emacs/files.texi (Visiting): Add cross-references to where
user options are described which control how windows are split.

* lisp/mail/sendmail.el (mail-other-window):
* lisp/gnus/message.el (message-mail-other-window)
(message-news-other-window):
* lisp/replace.el (occur-mode-goto-occurrence-other-window):
* lisp/vc/vc.el (vc-revision-other-window):
* lisp/vc/vc-dir.el (vc-dir-find-file-other-window):
* lisp/progmodes/xref.el (xref-find-definitions-other-window):
* lisp/simple.el (compose-mail-other-window)
(clone-indirect-buffer-other-window):
* lisp/vc/add-log.el (add-change-log-entry-other-window):
* lisp/view.el (view-file-other-window)
(view-buffer-other-window):
* lisp/window.el (switch-to-buffer-other-window):
* lisp/files.el (find-file-other-window)
(find-file-read-only-other-window)
(find-alternate-file-other-window):
* lisp/dired.el (dired-other-window)
(dired-mouse-find-file-other-window)
(dired-find-file-other-window, dired-jump-other-window): Mention
in the doc strings how to control the way the current window is
split.
2025-10-18 10:47:29 +03:00