1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-02-05 23:21:22 -08:00
Commit graph

49270 commits

Author SHA1 Message Date
Eli Zaretskii
03fce84016 ; Fix last change in lisp.h. 2024-02-24 11:27:12 +02:00
Spencer Baugh
526c262149 Check daemon is initialized before suppressing its init errors
Previously, the default error handler would correctly suppress
unhandled errors raised when IS_DAEMON and the initial frame
was current, since this is the normal state of operation for a
daemon-mode Emacs.  However, this also incorrectly suppressed
errors raised while a daemon-mode Emacs was starting up.

Now, errors raised while a daemon-mode Emacs is starting up will be
handled just like errors when a non-daemon Emacs is starting up.

This was previously the case before changes for bug#1310 and
bug#1836, which added the suppression of errors when IS_DAEMON.
DAEMON_RUNNING didn't exist at the time of those changes, but now
it does, so we can do better.

* src/keyboard.c (Fcommand_error_default_function): Check
!DAEMON_RUNNING in addition to IS_DAEMON.  (Bug#68799)
* src/lisp.h (DAEMON_RUNNING): Add a clarifying comment about
what this #define means.
2024-02-24 11:24:26 +02:00
Mattias Engdegård
3ea77c735d Use the new obarray type for the initial obarray
This can improve performance a lot, especially after the obarray has
been fed many symbols.

* src/lread.c (OBARRAY_SIZE): Remove.
(load_path_check): Create an obarray object instead of a vector.
2024-02-23 13:02:27 +01:00
Mattias Engdegård
462d8ba813 Add a proper type for obarrays
The new opaque type replaces the previous use of vectors for obarrays.
`obarray-make` now returns objects of this type.  Functions that take
obarrays continue to accept vectors for compatibility, now just using
their first slot to store an actual obarray object.

obarray-size and obarray-default-size now obsolete.

* lisp/obarray.el (obarray-default-size, obarray-size):
Declare obsolete.
(obarray-make, obarrayp, obarray-clear): Remove from here.
* src/fns.c (reduce_emacs_uint_to_hash_hash): Remove from here.
* src/lisp.h (struct Lisp_Obarray, OBARRAYP, XOBARRAY, CHECK_OBARRAY)
(make_lisp_obarray, obarray_size, check_obarray)
(obarray_iter_t, make_obarray_iter, obarray_iter_at_end)
(obarray_iter_step, obarray_iter_symbol, DOOBARRAY, knuth_hash): New.
(reduce_emacs_uint_to_hash_hash): Moved here.
* src/lread.c (check_obarray): Renamed and reworked as...
(checked_obarray_slow): ...this.
(intern_sym, Funintern, oblookup, map_obarray)
(Finternal__obarray_buckets): Adapt to new type.
(obarray_index, allocate_obarray, make_obarray, grow_obarray)
(obarray_default_bits, Fobarray_make, Fobarrayp, Fobarray_clear): New.
* etc/emacs_lldb.py (Lisp_Object):
* lisp/emacs-lisp/cl-macs.el (`(,type . ,pred)):
* lisp/emacs-lisp/cl-preloaded.el (cl--typeof-types):
* lisp/emacs-lisp/comp-common.el (comp-known-type-specifiers):
* lisp/emacs-lisp/comp.el (comp-known-predicates):
* src/alloc.c (cleanup_vector, process_mark_stack):
* src/data.c (Ftype_of, syms_of_data):
* src/minibuf.c (Ftry_completion, Fall_completions, Ftest_completion):
* src/pdumper.c (dump_obarray_buckets, dump_obarray, dump_vectorlike):
* src/print.c (print_vectorlike_unreadable):
* test/lisp/abbrev-tests.el (abbrev-make-abbrev-table-test):
* test/lisp/obarray-tests.el (obarrayp-test)
(obarrayp-unchecked-content-test, obarray-make-default-test)
(obarray-make-with-size-test):
Adapt to new type.
2024-02-23 13:02:27 +01:00
Andrea Corallo
32843c7b36 * src/pdumper.c (dump_subr): Rename 'native_comp' -> 'non_primitive'. 2024-02-23 11:40:56 +01:00
Mattias Engdegård
6a53836a24 * src/fns.c (sxhash_bignum): Include sign bit in hash. 2024-02-23 11:26:45 +01:00
Mattias Engdegård
53e60fb004 * src/fns.c (hash_string): Suppress warning on 32-bit platforms
Remove a shift-too-wide complaint by GCC in code that is never reached
on platforms where that shift is too wide.
2024-02-23 11:09:49 +01:00
Po Lu
b868690fef Fix bug#69140
* src/window.c (grow_mini_window): Don't adjust frame matrices
or force redisplay if the provided window cannot be
resized.  (bug#69140)
2024-02-23 10:18:17 +08:00
Po Lu
8e0f134653 ; Insert missing JNI prologues
* src/android.c (shouldForwardMultimediaButtons)
(shouldForwardCtrlSpace, notifyPixelsChanged, setupSystemThread):

* src/androidvfs.c (safSyncAndReadInput, safSync, safPostRequest)
(ftruncate): Insert absent JNI prologues.
2024-02-22 13:30:18 +08:00
Po Lu
39a8423270 Enable inotify on systems with inotify_init yet no init1 variant
* configure.ac (HAVE_INOTIFY): Check for the presence of
inotify_init in addition to inotify_init1.

* src/inotify.c (Finotify_add_watch): Implement with
inotify_init if inotify_init1 is absent.
2024-02-22 09:53:48 +08:00
Eli Zaretskii
8987e1b093 Remove redundant call to 'eln_load_path_final_clean_up'
* src/emacs.c (shut_down_emacs): Remove redundant call to
'eln_load_path_final_clean_up'.  We call it from 'kill-emacs'
right before the call to 'exit'.
2024-02-21 17:16:45 +02:00
Mattias Engdegård
a2eb123fb6 ; * src/lisp.h: Add Lisp_Object tagging scheme overview 2024-02-21 15:50:35 +01:00
Mattias Engdegård
2379360077 Slight switch byte op speedup
* src/bytecode.c (exec_byte_code): Hoist symbols_with_pos_enabled check
from fast loop, and eliminate the initial index check.
2024-02-19 15:57:49 +01:00
Mattias Engdegård
188fe6bffa Replace XSET_HASH_TABLE with make_lisp_hash_table
* src/lisp.h (XSET_HASH_TABLE): Remove, replace with...
(make_lisp_hash_table): ...this.  All callers adapted.
2024-02-19 15:57:05 +01:00
Paul Eggert
4a8d3c5b75 Use -Wanalyzer-deref-before-check in GCC 14
* src/marker.c: Work around GCC bug 113253 only if GCC 13.
The GCC bug reportedly will be fixed in GCC 14.
2024-02-18 00:38:16 -08:00
Paul Eggert
659770fdf5 Do not ignore -Wanalyzer-allocation-size in GCC 14
* src/lisp.h (SAFE_ALLOCA_LISP_EXTRA): Use pragma to ignore the
warning only in GCC 13, as the GCC developers say GCC bug 109577
is fixed in GCC 14.
2024-02-18 00:38:15 -08:00
Paul Eggert
42c6cf4e58 Remove no-longer-needed pdumper_load workaround
* src/pdumper.c (pdumper_load): Revert my commit "Pacify GCC
12.1.1 in default developer build" dated 2022-06-13 13:21:18 -07,
as GCC bug 105961 is fixed, and this workaround is not needed for
unfixed GCC as these builds should not use --enable-gcc-warnings.
2024-02-18 00:38:15 -08:00
Paul Eggert
f8d27a8a1f Ignore fewer GCC -fanalyzer diagnostics in ccl.c
* src/ccl.c: Do not ignore -Wanalyzer-use-of-uninitialized-value,
as that bug has been fixed in GCC.  Ignore
-Wanalyzer-out-of-bounds only if GCC 13, as the bug will
reportedly be fixed when GCC 14 comes out.
2024-02-18 00:38:15 -08:00
Po Lu
c2d714886e Implement tooltip_reuse_hidden_frame for Android
* java/org/gnu/emacs/EmacsWindow.java
(findSuitableActivityContext): Return Activity rather than
Context.
(mapWindow): Provide window token manually.

* src/androidfns.c (Fx_show_tip, Fx_hide_tip): Respect
tooltip_reuse_hidden_frame.
2024-02-18 12:48:41 +08:00
Eli Zaretskii
77576cd762 ; Don't use non-ASCII characters in C comments in xdisp.c. 2024-02-17 12:15:11 +02:00
Po Lu
5b65c2ad75 Properly record mtime after insert-file-contents on Android
* src/fileio.c (write_region): Do not verify file identity after
retreiving file status for the second time if st_ino is 0.
2024-02-17 10:27:26 +08:00
Po Lu
4b89fb08bd * src/androidvfs.c (android_scan_directory_tree): Get rid of xstrdup. 2024-02-16 22:17:57 +08:00
Po Lu
e058380324 Fix the MS-DOS build
* configure.ac (REQUIRE_GNUISH_STRFTIME_AM_PM): Move definition
to...

* src/conf_post.h (REQUIRE_GNUISH_STRFTIME_AM_PM):
...conf_post.h.
2024-02-15 22:13:04 +08:00
Po Lu
783a511d1e Handle /assets and /content file names in `android-browse-url'
* lisp/net/browse-url.el (android-browse-url): New function.

* lisp/term/android-win.el (android-browse-url-internal): Update
function declaration.

* src/androidselect.c (Fandroid_browse_url): Rename to...
(Fandroid_browse_url_internal): ... this.
(syms_of_androidselect): Adjust to match.
2024-02-15 14:24:21 +08:00
Mattias Engdegård
3a93e301dd String hashing improvements (spread and performance)
Fix gaps in hashing coverage in the middle and end of even fairly short
strings.  E.g., `outline-1`, `outline-2` etc all hashed to the exact
same value but with the patch, there are no collisions among the ~160000
symbols in the Emacs tree.

This change also improves average hashing speed by using fewer mixing
operations.

* src/fns.c (hash_string):
Use unit stride for fairly short strings, while retaining the cap of 8
samples for long ones.

Always hash the last word to ensure that the end of the string is
covered.  For strings shorter than a word, use fewer loads and a single
reduction step.
2024-02-14 14:29:54 +01:00
Paul Eggert
a4a99405d0 Simplify position-symbol
* src/data.c (Fposition_symbol): Simplify by calling Fbare_symbol
rather than open-coding it.
2024-02-13 11:20:33 -08:00
Paul Eggert
d202f1b9e7 XSYMBOL eassume speedups
* src/lisp.h (XSYMBOL_WITH_POS_SYM, XSYMBOL): Help the compiler by using
eassume instead of eassert for XSYMBOL postconditions likely to be
useful for optimization later.  With gcc 13.2 -O2 x86-64 this improved
speed on my usual “compile all .el files” benchmark by 0.7% and shrank
the text size of Emacs by 0.09%.
2024-02-13 11:20:33 -08:00
Paul Eggert
10c6aea443 Remove SYMBOL_WITH_POS_{POS,SYM}
* src/fns.c (internal_equal): Turn comment into eassert
that !symbols_with_pos_enabled.
(sxhash_obj): Simplify case of symbol with pos (when enabled).
* src/lisp.h (XSYMBOL_WITH_POS_SYM, XSYMBOL_WITH_POS_POS)
(maybe_remove_pos_from_symbol): New inline functions.
(SYMBOL_WITH_POS_SYM, SYMBOL_WITH_POS_POS): Remove.
All uses replaced by the new functions.  This avoids some
double-checking in the source code, simplifies the code overall,
and avoids the need for "Type checking is done in the following
macro" comments to explain unusual code.
2024-02-13 11:20:33 -08:00
Paul Eggert
473dac8801 Remove lisp_h_XCONS etc
When configured with --enable-checking and compiled with gcc -O0,
these macros evaluated arguments multiple times, which made it too
easy to mistakenly write code that behaves differently when debugging.
This patch does not affect performance in normal builds.
In --enable-checking builds with gcc -O0 it slows down my usual
benchmark (remove all '*.elc’ files and then 'make') by 4.4%.
I hope that’s good enough; if not I can complicate the macros to
tune better for debugging builds.
* src/lisp.h (lisp_h_SET_SYMBOL_VAL, lisp_h_SYMBOL_VAL)
(lisp_h_XCONS): Remove, moving each definiens to the corresponding
inline function.  All uses removed.
2024-02-13 11:20:33 -08:00
Paul Eggert
231af322b0 Remove lisp_h_PSEUDOVECTORP etc
* src/lisp.h (lisp_h_PSEUDOVECTORP, lisp_h_EQ, lisp_h_SYMBOLP):
Refactor by removing these macros, moving each definiens to its only
use.  Now that we have symbols with position so that there is no longer
a non-lisp_h_* macro counterpart if DEFINE_KEY_OPS_AS_MACROS, there’s
no need to separate these definiens from their inline function bodies.
2024-02-13 11:20:32 -08:00
Paul Eggert
efdcd7b8f7 Remove BASE2_EQ
* src/lisp.h (lisp_h_BASE2_EQ, BASE2_EQ): Remove.  All uses
removed.  BASE2_EQ was present only for minor optimization and
with current gcc -O2, BASE2_EQ does not affect performance, so
it’s not worth the hassle.
2024-02-13 11:20:32 -08:00
Paul Eggert
08c1863257 Simplify and speed up EQ again
* src/lisp.h (lisp_h_BASE2_EQ, lisp_h_EQ): Simplify and refactor.
On x86-64 with GCC 3.2 this shrinks temacs text by 0.055% and
after removing all *.elc files speeds up 'make' by 1.0%.
2024-02-13 11:20:32 -08:00
Paul Eggert
d2a5d7534c Simplify and speed up EQ
* src/lisp.h (lisp_h_BASE2_EQ, lisp_h_EQ):
Simplify by testing symbols_with_pos_enabled first.
On x86-64 with GCC 13.2 this shrinks temacs text by 1.5%
and after removing all *.elc files speeds up 'make' by 1.2%.
2024-02-13 11:20:32 -08:00
Po Lu
6a18da80c2 ; * src/lread.c (Finternal__obarray_buckets): Fix coding style. 2024-02-13 09:47:24 +08:00
Mattias Engdegård
39cce137ba lread.c: Use bare symbol operations
* src/lread.c (read0, intern_sym, intern_driver, intern_1)
(intern_c_string_1, Fintern, Fintern_soft, Funintern, oblookup)
(map_obarray, init_obarray_once, defvar_int, defvar_bool)
(defvar_lisp_nopro, defvar_kboard, syms_of_lread):
Use the faster bare-symbol operations where provably correct to do so.
2024-02-12 18:23:33 +01:00
Mattias Engdegård
79cfc1eaa0 Internal function for obarray performance analysis (bug#68244)
* src/lread.c (Finternal__obarray_buckets): New function.
2024-02-12 18:23:33 +01:00
Basil L. Contovounesios
2f7d662dd4 ; Update Lisp_Hash_Table hash for CHECK_STRUCTS
This follows commit 05e3183ede of 2024-02-06
"Rearrange and pack hash table fields to reduce space".
2024-02-12 12:07:37 +01:00
Po Lu
bc6c55c5cf Disable exec loader when Emacs is running under an existing instance
* src/androidfns.c (syms_of_androidfns_for_pdumper): Check if
Emacs is running under process tracing, and if so, disable
android_use_exec_loader.
2024-02-12 11:55:01 +08:00
Dmitry Gutov
c0f656617d Make sure the binding shown by echo-keystrokes-help is not shadowed
And choose just one binding to display rather than two together.
(https://lists.gnu.org/archive/html/emacs-devel/2024-02/msg00311.html)

* lisp/help.el (help--append-keystrokes-help): New function.

* src/keyboard.c (syms_of_keyboard): Add a symbol for it.
(echo_dash): Use them here.
2024-02-11 22:34:41 +02:00
Andrea Corallo
faa46eb866 Rename a number of native compiler functions
* lisp/emacs-lisp/comp.el (comp-passes): Update.
(comp-mvar): Update constructor name.
(comp--loop-insn-in-block, comp--lex-byte-func-p)
(comp--spill-decl-spec, comp--spill-speed)
(comp--decrypt-arg-list, comp--byte-frame-size)
(comp--add-func-to-ctxt, comp--spill-lap-function)
(comp--intern-func-in-ctxt, comp--spill-lap-function)
(comp--spill-lap, comp--lap-eob-p, comp--lap-fall-through-p)
(comp--sp, comp--with-sp, comp--slot-n, comp--slot, comp-slot+1)
(comp--label-to-addr, comp--mark-curr-bb-closed)
(comp--bb-maybe-add, comp--call, comp--callref, make-comp-mvar)
(comp--new-frame, comp--emit, comp--emit-set-call)
(comp--copy-slot, comp--emit-annotation, comp--emit-setimm)
(comp--make-curr-block, comp--latch-make-fill)
(comp--emit-uncond-jump, comp--emit-cond-jump)
(comp--emit-handler, comp--limplify-listn, comp--new-block-sym)
(comp--fill-label-h, comp--jump-table-optimizable)
(comp--emit-switch, comp--emit-set-call-subr, comp--op-to-fun)
(comp--body-eff, comp--op-case, comp--limplify-lap-inst)
(comp--emit-narg-prologue, comp--limplify-finalize-function)
(comp--prepare-args-for-top-level, comp--emit-for-top-level)
(comp--emit-lambda-for-top-level, comp--limplify-top-level)
(comp--addr-to-bb-name, comp--limplify-block)
(comp--limplify-function, comp--limplify, comp--mvar-used-p)
(comp--collect-mvars, comp--collect-rhs)
(comp--negate-arithm-cmp-fun, comp--reverse-arithm-fun)
(comp--emit-assume, comp--maybe-add-vmvar)
(comp--add-new-block-between, comp--cond-cstrs-target-mvar)
(comp--add-cond-cstrs-target-block, comp--add-cond-cstrs-simple)
(comp--add-cond-cstrs, comp--insert-insn, comp--emit-call-cstr)
(comp--lambda-list-gen, comp--add-call-cstr, comp--add-cstrs)
(comp--collect-calls, comp--pure-infer-func, comp--ipa-pure)
(make--comp--ssa-mvar, comp--clean-ssa, comp--compute-edges)
(comp--collect-rev-post-order, comp--compute-dominator-tree)
(comp--compute-dominator-frontiers, comp--log-block-info)
(comp--place-phis, comp--dom-tree-walker, comp--ssa)
(comp--ssa-rename-insn, comp--ssa-rename, comp--finalize-phis)
(comp--remove-unreachable-blocks, comp--ssa)
(comp--fwprop-max-insns-scan, comp--copy-insn)
(comp--apply-in-env, comp--fwprop-prologue)
(comp--function-foldable-p, comp--function-call-maybe-fold)
(comp--fwprop-call, comp--fwprop-insn, comp--fwprop*)
(comp--rewrite-non-locals, comp--fwprop, comp--func-in-unit)
(comp--call-optim-form-call, comp--call-optim-func)
(comp--call-optim, comp--collect-mvar-ids)
(comp--dead-assignments-func, comp--dead-code)
(comp--form-tco-call-seq, comp--tco-func, comp--tco)
(comp--remove-type-hints-func, comp--remove-type-hints)
(comp--args-to-lambda-list, comp--compute-function-type)
(comp--finalize-container, comp--finalize-relocs)
(comp--compile-ctxt-to-file, comp--final1, comp--final)
(comp--make-lambda-list-from-subr, comp-trampoline-compile)
(comp--write-bytecode-file): Rename and/or update due to renaming.
* test/src/comp-resources/comp-test-funcs.el (comp-test-copy-insn-f): Update.
* src/comp.c (Fcomp__compile_ctxt_to_file0): Rename.
(syms_of_comp): Update.
2024-02-11 15:26:12 +01:00
Eli Zaretskii
67486ab415 Fix 'min-width' display property in 'buffer-text-pixel-size'
* src/xdisp.c (display_min_width): Don't return without doing
anything when called from the move_it_* functions.  This is needed
to have functions that simulate display layout handle the
min-width display property correctly.  (Bug#68374)
2024-02-11 15:21:14 +02:00
Po Lu
e67e7185ce Fix signed/unsigned promotion errors involving Emacs_Rectangle
* src/androidterm.c (android_note_mouse_movement):

* src/pgtkterm.c (note_mouse_movement):

* src/xdisp.c (get_glyph_string_clip_rects, remember_mouse_glyph)
(expose_area, expose_window, gui_intersect_rectangles): Cast
width or height fields in Emacs_Rectangles to int before summing
with or subtracting them from their coordinate fields, as they
are unsigned outside X, and the sign of the coordinates is thus
not preserved.
2024-02-11 10:01:31 +08:00
Po Lu
e7d1b12878 Make miscellaneous improvements to the Android port
* java/org/gnu/emacs/EmacsActivity.java (onCreate): Deal with
omitted calls to onWindowFocusChanged after activity recreation.

* java/org/gnu/emacs/EmacsService.java (clearWindow, clearArea):
Delete redundant wrapper functions.
(getUsefulContentResolver, getContentResolverContext): Delete
functions.
(openContentUri, checkContentUri): Stop searching for an
activity content resolver, as that's actually not necessary.

* src/android.c (android_init_emacs_service)
(android_init_emacs_window, android_clear_window)
(android_clear_area): Adjust to match.
2024-02-10 15:06:01 +08:00
Paul Eggert
8d09e1def5 Port to GNU Make 03ecd94488b85adc38746ec3e7c2a297a522598e
Problem reported by Collin Funk (Bug#68996).
* GNUmakefile (.): New macro.
(help): Use ‘$.’ instead of ‘$ ’.
* cross/verbose.mk.android, src/verbose.mk.in (.): New macro.
(AM_V_AR, AM_V_CC, AM_V_CXX, AM_V_CCLD, AM_V_CXXLD, AM_V_GEN):
Use ‘$.’ instead of ‘$ ’.
* lib-src/Makefile.in (install): Use ‘$.’ instead of ‘$ ’.
2024-02-08 23:22:00 -08:00
Dominique Quatravaux
4e5068b7b3
Fix treesit_traverse_get_predicate (bug#68954)
Commit d005e685e1 should have used
assq_no_signal, but didn't, this commit fixes that.

* src/treesit.c (treesit_traverse_get_predicate): Replace assq_no_quit
with assq_no_signal.

Copyright-paperwork-exempt: yes
2024-02-08 21:25:34 -08:00
Po Lu
b382135769 Set adstyle within sfnt font objects
* src/sfntfont.c (sfntfont_open): Don't incorrectly clear
desc->adstyle.
2024-02-09 13:15:57 +08:00
Po Lu
5af4e346b0 Don't lose track of adstyles during face merging
* src/xfaces.c (merge_face_vectors): If an adstyle exists in
FROM, guarantee that a font spec will exist in TO with the same.
2024-02-09 10:43:48 +08:00
Po Lu
8290a1bacb Replace a few calls to intern with constant strings
* src/fns.c (do_yes_or_no_p, Fyes_or_no_p): Use symbol globals
rather than intern.
(syms_of_fns) <Qyes_or_no_p, Qy_or_n_p>: New symbols.

* src/lread.c (readevalloop): Use symbol global.
(syms_of_lread) <Qinternal_macroexpand_for_load>: New symbol.
2024-02-09 09:53:33 +08:00
Eli Zaretskii
a48cf0c94c ; * src/keyboard.c (echo_dash): Mention F1 in echo_keystrokes_help. 2024-02-08 08:48:20 +02:00
Po Lu
ed2450e79b Prevent echo area help message from being printed repeatedly
* src/keyboard.c (echo_dash): Detect echo_keystrokes_help
messages and return if they be present.
2024-02-08 10:32:28 +08:00