aboutsummaryrefslogtreecommitdiffstats
path: root/src/eval.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Reject invalid error symbols (Bug#76447)Stefan Monnier2025-08-171-0/+2
| | | | | * src/eval.c (signal_or_quit): Signal an error if 'signal' gets called with an invalid error symbol.
* ; Fix last changeEli Zaretskii2025-08-071-6/+6
| | | | | | | * src/eval.c (Fdebugger_trap): Minor wording changes in doc string. * etc/DEBUG: Some copyedits of a recently-added text.
* New debugger-trap function to break to GDBJeremy Bryant2025-08-071-0/+16
| | | | | | | | | | * src/eval.c: new primitive debugger-trap * src/.gdbinit: set breakpoint to Fdebugger_trap * etc/DEBUG: document it. Remove suggestion to use Fredraw_display. This do-nothing primitive gives control to GDB, and for debugging convenience a breakpoint is set by default in .gdbinit.
* Add `redisplay_counter` to catch nested redisplays and abort outer oneStefan Monnier2025-07-151-2/+4
| | | | | | | | | | | | | | | | The redisplay code is not re-entrant. To allow running ELisp code from within redisplay, we have some hacks (e.g. `inhibit-redisplay`) that try to avoid the resulting breakage. This commit adds another one of those hacks, which tries to get closer to the core of the problem, thereby making it "safe" to override `inhibit-redisplay`, e.g. to debug jit-lock code. * src/dispextern.h (redisplay_counter): Declare. * src/xdisp.c (redisplay_counter): Define. (redisplay_internal) Increment it. (dsafe__call): Use it, in case `inhibit-redisplay` is overridden. * src/eval.c (call_debugger): Use it as well to refine the test we already had.
* Avoid crashes when profiling multi-threaded Lisp (bug#76970)Pip Cet2025-07-121-1/+5
| | | | | * src/eval.c (backtrace_p): Check 'current_thread' before dereferencing it.
* Avoid segfault when profiling Lisp programs with threadsEli Zaretskii2025-06-211-1/+1
| | | | | * src/eval.c (backtrace_top): Don't segfault if current_thread is NULL. (Bug#76970)
* Merge from origin/emacs-30Eli Zaretskii2025-06-141-1/+1
|\ | | | | | | | | | | | | | | | | | | df3fb94f091 Insert missing step to make use of directory tracking OSC... 1bed2949583 * lisp/keymap.el (keymap-set): Refer to 'key-description'... 941158fc133 Support new tree-sitter grammar filename format (bug#78754) 888f846d377 Fix crash when evaluating "(signal nil 5)" (bug#78738) 51b9e92ab8e Merge branch 'emacs-30' of git.savannah.gnu.org:/srv/git/... c0a913ea4f3 ; * doc/lispref/modes.texi (Font Lock Basics): Remove old... 37de076017a Adapt emba integration (don't merge)
| * Fix crash when evaluating "(signal nil 5)" (bug#78738)Pip Cet2025-06-101-1/+1
| | | | | | | | | | | | | | | | | | The docstring already warns against calling signal with a nil error symbol, which is for internal use only, but we can avoid crashing in this case. * src/eval.c (Fsignal): Produce a "peculiar error" for more arguments involving non-lists.
| * Update copyright year to 2025Stefan Kangas2025-01-021-1/+1
| | | | | | | | Run "TZ=UTC0 admin/update-copyright".
* | ; Fix wording of recently-added documentationEli Zaretskii2025-05-151-3/+3
| | | | | | | | | | | | | | * src/eval.c (Fset_buffer_local_toplevel_value) (Fbuffer_local_toplevel_value): * doc/lispref/variables.texi (Default Value): Fix wording of documentation.
* | default_toplevel_binding, local_toplevel_binding: Loop upwardsSean Whitton2025-05-151-12/+8
| | | | | | | | | | | | * src/eval.c (default_toplevel_binding, local_toplevel_binding): Loop upwards, not downwards, given that we want the earliest relevant binding present in the stack.
* | New top-level buffer-local value functionsSean Whitton2025-05-151-0/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/eval.c (local_toplevel_binding) (Fbuffer_local_toplevel_value, Fset_buffer_local_toplevel_value) (syms_of_eval): New functions. * doc/lispref/variables.texi (Default Value): * lisp/subr.el (setq-local): * etc/NEWS: Document them. * test/lisp/emacs-lisp/lisp-tests.el (core-elisp-tests-4-toplevel-values): New test. * lisp/progmodes/xref.el (xref--show-xref-buffer) (xref-show-definitions-buffer-at-bottom): * lisp/vc/vc-dispatcher.el (vc-setup-buffer): Use set-buffer-local-toplevel-value.
* | ; * etc/NEWS: Fix last change.Eli Zaretskii2025-03-171-3/+3
| |
* | Correctly unload variable aliases.Jens Schmidt2025-03-161-0/+19
| | | | | | | | | | | | | | | | | | | | | | * src/eval.c (Finternal_delete_indirect_variable): Add function. * lisp/loadhist.el (loadhist-unload-element): Use it for variable aliases. * test/src/eval-tests.el (eval-tests--internal-delete-indirect-variable): Test function `internal-delete-indirect-variable'. * test/lisp/loadhist-tests.el (loadhist-test-unload-feature-alias): * test/lisp/loadhist-resources/loadhist--alias.el: Test unloading of features that define variable aliases. (Bug#76748)
* | Re-port to 32-bit systems without alignment primitivesPo Lu2025-03-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * configure.ac (ALIGNOF_INT, ALIGNOF_LONG, ALIGNOF_LONG_LONG): New variables. (emacs_cv_alignas_unavailable): Define if alignas and structure alignment primitives are unavailable. In such an environment, the MSB tagging scheme must be enabled, as must the GNU malloc. * msdos/sed2v2.inp: Adjust correspondingly. * src/alloc.c (union emacs_align_type): Remove types which contain flexible array members. The address of a field subsequent to an aggregate with flexible array members cannot validly be taken. (mark_memory) [!USE_LSB_TAG && !WIDE_EMACS_INT]: Strip type bits before scanning memory. * src/emacs.c (main): * src/eval.c (Fautoload_do_load): * src/fns.c (Frequire): Rename a number of illogically named fields. * src/lisp.h (ALIGNOF_EMACS_INT): Define to the natural alignment of EMACS_INT. (IDEAL_GCALIGNMENT): New macro. (USE_LSB_TAG): Disable if no alignment specifiers are available, WIDE_EMACS_INT is undefined, and the natural alignment of EMACS_INT falls short of LSB tagging's requirements. (gflags): Rename illogically named fields and don't define them as bitfields, which runs afoul of certain compiler issues. (will_dump_p, will_bootstrap_p, will_dump_with_pdumper_p) (dumped_with_pdumper_p): Adjust accordingly. * src/pdumper.c (VM_SUPPORTED): Define to 0 when !USE_LSB_TAG. It is better to read dump files into the heap by hand than to be supplied with an address that is not representable. (_dump_object_start_pseudovector): Rename to dump_object_start_pseudovector, to avoid encroaching on reserved names. (START_DUMP_PVEC): Adjust correspondingly. (dump_mmap_contiguous_vm): Preserve errno around failure cleanup. (dump_bitset_bit_set_p): Work around certain compiler issues. (pdumper_load) [!USE_LSB_TAG]: Reject dump file allocations that are not representable as Lisp_Objects. Tested on i386-unknown-solaris2.10, sparc-sun-solaris2.10.
* | * src/eval.c (signal_or_quit): Reduce scope of `debugger_called`Stefan Monnier2025-03-061-2/+1
| |
* | ; * src/eval.c (Fdefvar_1, Fdefconst_1): Properly quote apostrophe.Philipp Stephani2025-03-041-2/+2
| |
* | Omit 2 ‘volatile’s in internal_lisp_condition_casePaul Eggert2025-02-011-3/+2
| | | | | | | | | | | | | | | | * src/eval.c (internal_lisp_condition_case): Omit an unnecessary ‘volatile’ and an unnecessary pointer-to-volatile local var. Perhaps these were needed in previous versions of Emacs, or to pacify older versions of GCC when using --enable-gcc-warnings, but they are not needed to pacify current GCC.
* | Merge branch 'scratch/no-purespace' into 'master'Stefan Kangas2025-02-011-15/+4
|\ \
| * | Pure storage removal: Remove docstring hackPip Cet2024-12-121-6/+0
| | | | | | | | | | | | | | | | | | This should no longer be needed. * src/eval.c (Fautoload): Don't try to work around pure storage bug.
| * | Pure storage removal: Replace calls to removed functionsPip Cet2024-12-121-7/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/alloc.c (string_bytes, pin_string, valid_lisp_object_p) (process_mark_stack, survives_gc_p, syms_of_alloc): * src/androidterm.c (android_term_init): Replace call to 'build_pure_c_string'. * src/buffer.c (init_buffer_once, syms_of_buffer): * src/bytecode.c (exec_byte_code): * src/callint.c (syms_of_callint): * src/callproc.c (syms_of_callproc): * src/category.c (Fdefine_category): * src/coding.c (syms_of_coding): * src/comp.c (Fcomp__compile_ctxt_to_file0) (maybe_defer_native_compilation, syms_of_comp): * src/data.c (Fsetcar, Fsetcdr, Fdefalias, Faset, syms_of_data): * src/dbusbind.c (syms_of_dbusbind): * src/doc.c (Fsnarf_documentation): * src/emacs-module.c (syms_of_module): * src/eval.c (Finternal__define_uninitialized_variable) (Fdefconst_1, define_error, syms_of_eval): * src/fileio.c (syms_of_fileio): * src/fns.c (Ffillarray, Fclear_string, check_mutable_hash_table): * src/fontset.c (syms_of_fontset): * src/frame.c (make_initial_frame): * src/haikufns.c (syms_of_haikufns): * src/intervals.c (create_root_interval): * src/keyboard.c (syms_of_keyboard): * src/keymap.c (Fmake_sparse_keymap, Fset_keymap_parent) (store_in_keymap, syms_of_keymap): * src/lisp.h: * src/lread.c (Fload, read0, intern_c_string_1, define_symbol) (Fintern, defsubr, syms_of_lread): * src/pdumper.c (Fdump_emacs_portable): * src/pgtkfns.c (syms_of_pgtkfns): * src/pgtkterm.c (syms_of_pgtkterm): * src/process.c (syms_of_process): * src/search.c (syms_of_search): * src/sqlite.c (syms_of_sqlite): * src/syntax.c (syms_of_syntax): * src/treesit.c (syms_of_treesit): * src/w32fns.c (syms_of_w32fns): * src/xdisp.c (syms_of_xdisp): * src/xfaces.c (syms_of_xfaces): * src/xfns.c (syms_of_xfns): * src/xftfont.c (syms_of_xftfont): * src/xterm.c (syms_of_xterm): Remove calls to 'PURE_P', 'CHECK_IMPURE', 'Fpurecopy', and replace calls to 'build_pure_c_string', 'pure_list', 'pure_listn', etc., by impure equivalents.
* | | Replace call[1-8] with callnStefan Kangas2025-01-191-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since the introduction of the 'calln' macro, the 'call1', 'call2', ..., 'call8' macros are just aliases for the former. This is slightly misleading and potentially unhelpful. The number of arguments N can also easily go out-of-synch with the used alias callN. There is no reason not to replace these aliases with using 'calln' directly. To reduce the risk for mistakes, the tool Coccinelle was used to make these changes. See <https://coccinelle.gitlabpages.inria.fr/website/>. * src/alloc.c, src/androidvfs.c, src/androidfns.c, src/buffer.c: * src/callint.c, src/callproc.c, src/casefiddle.c, src/charset.c: * src/chartab.c, src/cmds.c, src/coding.c, src/composite.c: * src/data.c, src/dbusbind.c, src/dired.c, src/doc.c: * src/emacs.c, src/eval.c, src/fileio.c, src/filelock.c: * src/fns.c, src/frame.c, src/gtkutil.c, src/haikufns.c: * src/haikumenu.c, src/image.c, src/insdel.c, src/intervals.c: * src/keyboard.c, src/keymap.c, src/lisp.h, src/lread.c: * src/minibuf.c, src/nsfns.m, src/nsselect.m, src/pgtkfns.c: * src/pgtkselect.c, src/print.c, src/process.c, src/sort.c: * src/syntax.c, src/textconv.c, src/textprop.c, src/undo.c: * src/w32fns.c, src/window.c, src/xfaces.c, src/xfns.c: * src/xmenu.c, src/xselect.c, src/xterm.c: Replace all uses of 'call1', 'call2', ..., 'call8' with 'calln'.
* | | Use calln instead of calling Ffuncall directlyStefan Kangas2025-01-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/bytecode.c (bcall0): * src/comp.c (bcall0): * src/eval.c (apply1): * src/lisp.h (call0): * src/thread.c (invoke_thread_function): Use calln instead of calling Ffuncall directly. * admin/coccinelle/calln.cocci: New semantic patch.
* | | Prefer calln to CALLN where applicableStefan Kangas2025-01-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/callint.c (read_file_name): * src/comp.c (CALL0I, CALL1I, CALL2I, CALL4I, declare_imported_func): * src/data.c (Ffset, notify_variable_watchers): * src/eval.c (Ffuncall_with_delayed_message): * src/keymap.c (Fdescribe_buffer_bindings): * src/minibuf.c (Fread_buffer, Fcompleting_read): * src/pdumper.c (Fdump_emacs_portable): * src/print.c (print_vectorlike_unreadable): * src/treesit.c (treesit_traverse_match_predicate) (treesit_build_sparse_tree): Prefer calln to CALLN.
* | | Move define_error declaration and docstringStefan Kangas2025-01-081-0/+3
| | | | | | | | | | | | | | | | | | * src/lisp.h (define_error): Move declaration to its proper place, make external, and move its docstring... * src/eval.c (define_error): ...to its function definition.
* | | Update copyright year to 2025Paul Eggert2025-01-011-1/+1
|/ / | | | | | | Run "TZ=UTC0 admin/update-copyright".
* | More workarounds for GDB bug 32313Eli Zaretskii2024-10-281-11/+12
| | | | | | | | | | * src/eval.c (backtrace_args): Same treatment as backtrace_function.
* | Work around GDB bug 32313 when debugging Emacs internalsPaul Eggert2024-10-271-3/+11
| | | | | | | | | | | | | | | | | | Problem reported by Eli Zaretskii in: https://lists.gnu.org/r/emacs-devel/2024-10/msg00653.html * src/eval.c (backtrace_function_body): Rename from backtrace_function, and make it static. (GDB_FUNCPTR): New macro. (backtrace_function): New function pointer, for GDB only.
* | Prefer static_assert to verifyStefan Kangas2024-08-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Although static_assert is C11-specific, and Emacs remains on C99, it has been backported to older compilers by Gnulib. Gnulib has already changed to prefer static_assert, and we can do the same. * lib-src/asset-directory-tool.c (main_2): * src/alloc.c (BLOCK_ALIGN, aligned_alloc, lisp_align_malloc) (vectorlike_nbytes, allocate_pseudovector): * src/android.c (android_globalize_reference, android_set_dashes): * src/android.h: * src/androidfont.c (androidfont_draw, androidfont_text_extents): * src/androidvfs.c: * src/bidi.c (BIDI_CACHE_MAX_ELTS_PER_SLOT, bidi_find_bracket_pairs): * src/buffer.c (init_buffer_once): * src/casefiddle.c (do_casify_multibyte_string): * src/dispnew.c (scrolling_window, scrolling): * src/editfns.c (styled_format): * src/emacs-module.c (module_extract_big_integer): * src/fileio.c (Fdo_auto_save): * src/fns.c (next_almost_prime, hash_string): * src/fringe.c (init_fringe): * src/keyboard.h (kbd_buffer_store_event_hold): * src/keymap.c: * src/lisp.h (memclear, reduce_emacs_uint_to_hash_hash, modiff_incr): * src/lread.c (skip_lazy_string): * src/pdumper.c (dump_bignum, Fdump_emacs_portable) (dump_do_dump_relocation, pdumper_load): * src/process.c (make_process, Fmake_process, connect_network_socket): * src/regex-emacs.c: * src/sort.c (tim_sort): * src/sysdep.c (init_random, SSIZE_MAX): * src/thread.c: * src/timefns.c (trillion_factor): * src/unexelf.c: * src/xterm.c (x_send_scroll_bar_event): Prefer static_assert to Gnulib verify. Remove import of verify.h, except when used for other reasons.
* | Don’t ignore -Wclobbered in eval.cPaul Eggert2024-08-161-62/+47
| | | | | | | | | | | | | | | | | | | | | | | | This fix is also prompted by Emacs bug#71744. * src/eval.c (CACHEABLE): Remove. All uses removed. Do not ignore -Wclobbered. (internal_lisp_condition_case): Fix violations of the C standard, where setjmp clobbered oldhandlerlist, var, and clauses. Rewrite to pacify GCC, by using a sentinel rather than a count, which GCC incorrectly complained about, and by coalescing some duplicate code. If GCC_LINT && __GNUC__ && !__clang__ add a useless assignment to pacify GCC.
* | Replace some EQ with BASE_EQMattias Engdegård2024-08-151-4/+4
| | | | | | | | | | | | | | | | | | | | | | * src/eval.c (FletX, Flet, funcall_lambda) (let_shadows_buffer_binding_p): * src/data.c (set_blv_found, set_internal, default_value) (set_default_internal, Flocal_variable_p): * src/buffer.c (Fkill_buffer): (mouse_face_overlay_overlaps, compare_overlays) (report_overlay_modification): BASE_EQ is safe because we don't actually compare symbols here.
* | Merge from savannah/emacs-30Po Lu2024-08-071-11/+11
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 679f7ccc49f Prevent accesses to /content files without a GUI connection f0a7eec5a7d * lisp/net/tramp-integration.el (shortdoc): Use `tramp--w... fb642d9cf54 Merge branch 'emacs-30' of git.savannah.gnu.org:/srv/git/... f1e37ae423f Avoid crashes in very large buffers with long lines 4dc9e99349d Update description of string comparison functions 3817355aed5 Add sanity check when adding Tramp functions to shortdoc 1bbb3220179 ; * lisp/erc/erc-fill.el (erc-fill-wrap-mode): Doc fix. 3f6e7e1da68 js-ts-mode: Make jsdoc's "description" block a comment (b... 1c7e00f4f65 Also condition cjk-misc font-spec on Android b89d65df5fa ; * etc/PROBLEMS: How to install sources on SUSE Linux (b... 729b17c2026 ; * src/lread.c (Fload): Add comment. (Bug#72433) bfb1aee9989 Fix ':defer nil' in 'use-package' d787817076e Document unsupported color Emoji on OpenBSD db1f749db55 Fix regressions in Customize caused by 'widget-unselected... f94d58008eb Avoid inserting extra space in SVG data 292fcd20099 Fix c-ts-common filling function (bug#71760) e50d597f450 Fix missing type checks before specbind # Conflicts: # lisp/progmodes/c-ts-common.el
| * Fix missing type checks before specbindMattias Engdegård2024-08-031-11/+11
| | | | | | | | | | | | | | | | | | | | | | This fixes bugs that crashed Emacs when the Lisp interpreter was fed bad code. * src/eval.c (FletX, Flet, internal_lisp_condition_case) (funcall_lambda): Hoist symbol-with-pos elimination and type checks to a dominating position for efficiency. This also plugs at least two typing holes. (Mea culpa.) * test/src/eval-tests.el (eval-bad-specbind): New regression test.
* | Delete commented out code from `signal_or_quit`Stefan Kangas2024-07-161-8/+0
|/ | | | * src/eval.c (signal_or_quit): Delete code commented out since 2001.
* Rename `SUBR_NATIVE_COMPILED` to `NATIVE_COMP_FUNCTION` (bug#71123)Stefan Monnier2024-05-281-7/+7
| | | | | | | | | | | | | | | Keep the name consistent with the naming used in the ELisp world. * src/pdumper.c (dump_object_emacs_ptr, dump_do_fixup): * src/eval.c (eval_sub, funcall_general, funcall_lambda): * src/alloc.c (CHECK_ALLOCATED_AND_LIVE_SYMBOL, survives_gc_p): * src/data.c (Fcl_type_of, Ffset, Fnative_comp_function_p) (Fsubr_native_lambda_list, Finteractive_form): * src/comp.c (check_comp_unit_relocs): * src/bytecode.c (exec_byte_code): * src/lisp.h (NATIVE_COMP_FUNCTIONP, NATIVE_COMP_FUNCTION_DYNP): Rename from `SUBR_NATIVE_COMPILEDP` and `SUBR_NATIVE_COMPILED_DYNP`.
* Address compilation errors and warnings on x86 Solaris 10 systemsPo Lu2024-05-261-11/+24
| | | | | | | | | | | | | | | | * doc/misc/ede.texi (Extending EDE): * doc/misc/flymake.texi (Top, Using Flymake): Insert punctuation after xrefs. * lisp/emacs-lisp/loaddefs-gen.el (loaddefs-generate): Print number of files being scraped. * src/dired.c (directory_files_internal): * src/eval.c (Fmake_interpreted_closure, Fdefvaralias): * src/fns.c (Fassoc): Work around optimizer failures.
* Restore specbound keyboard-locals in the correct KBOARDPo Lu2024-05-231-7/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * doc/lispref/variables.texi (Intro to Buffer-Local): Fix typo in documentation. * src/data.c (KBOARD_OBJFWDP): Move to lisp.h. (kboard_for_bindings): New variable. (do_symval_forwarding, store_symval_forwarding): Call kboard_for_bindings rather than retrieving this value directly. (set_default_internal): New argument WHERE; if valcontents be a Lisp_Kboard_Objfwd and WHERE be specified, save the binding there. All callers changed. * src/eval.c (specpdl_where): Adjust for changes in structure layout. (specpdl_kboard): New function. (do_specbind): Clear let->where.kbd in ordinary SPECPDL_LETs, and set it to the kboard where the binding will be installed if binding keyboard forwards. (specbind, do_one_unbind, specpdl_unrewind): Provide specpdl_kboard in invocation of set_default_internal. * src/keyboard.c (delete_kboard): Clean thread specpdls of references to kboards. * src/keyboard.h (KBOARD_OBJFWDP): Move from data.c. * src/lisp.h (union specbinding) <let.where>: Convert into union of KBOARD and Lisp_Object. * src/thread.c (all_threads): Export. * src/thread.h: Adjust correspondingly.
* Replace calls to intern with a constant string with DEFSYMsPo Lu2024-05-091-3/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/alloc.c (display_malloc_warning, syms_of_alloc): * src/buffer.c (Fmake_indirect_buffer, Fbuffer_local_variables) (Frename_buffer, Fkill_buffer, Fset_buffer_major_mode) (Fset_buffer_multibyte, syms_of_buffer): * src/callint.c (read_file_name, Fcall_interactively) (syms_of_callint): * src/callproc.c (call_process, create_temp_file) (syms_of_callproc): * src/charset.c (Fdefine_charset_internal, syms_of_charset): * src/cmds.c (internal_self_insert, syms_of_cmds): * src/coding.c (record_conversion_result) (Fdefine_coding_system_internal, syms_of_coding): * src/dbusbind.c (xd_signature, Fdbus_message_internal) (syms_of_dbusbind): * src/dispnew.c (init_faces_initial): * src/doc.c (Fsnarf_documentation, syms_of_doc): * src/dosfns.c (system_process_attributes, syms_of_dosfns): * src/emacs.c (init_cmdargs, Fdump_emacs, decode_env_path) (syms_of_emacs): * src/eval.c (call_debugger, Fdefvaralias, syms_of_eval): * src/fileio.c (barf_or_query_if_file_exists) (Finsert_file_contents, auto_save_error, Fdo_auto_save) (syms_of_fileio): * src/filelock.c (lock_file_1, syms_of_filelock): * src/fontset.c (fontset_from_font, syms_of_fontset): * src/frame.c (make_frame_without_minibuffer, syms_of_frame): * src/gnutls.c (emacs_gnutls_certificate_details) (Fgnutls_peer_status_warning_describe, Fgnutls_peer_status) (gnutls_verify_boot, syms_of_gnutls): * src/gtkutil.c (style_changed_cb, find_rtl_image): * src/image.c (imagemagick_filename_hint, gs_load) (syms_of_image): * src/keyboard.c (command_loop_1, read_char, timer_start_idle) (read_char_minibuf_menu_prompt, Fsuspend_emacs) (syms_of_keyboard): * src/keymap.c (Fmap_keymap, Flookup_key, Fdescribe_vector) (describe_vector, syms_of_keymap): * src/lread.c (Fread, Fread_positioning_symbols, syms_of_lread): * src/minibuf.c (Fabort_minibuffers, Fread_buffer) (Fcompleting_read, syms_of_minibuf): * src/msdos.c (XMenuActivate, run_msdos_command, syms_of_msdos): * src/nsfns.m (Fx_display_backing_store, Fx_display_visual_class) (Fns_hide_emacs, Fsystem_move_file_to_trash, ns_create_tip_frame) (x_hide_tip, Fx_show_tip, syms_of_nsfns): * src/nsfont.m (ns_spec_to_descriptor, ns_descriptor_to_entity) (syms_of_nsfont): * src/pdumper.c (Fdump_emacs_portable): * src/pgtkfns.c (Fx_display_visual_class, x_create_tip_frame) (Fx_show_tip, syms_of_pgtkfns): * src/pgtkterm.c (syms_of_pgtkterm, pgtk_cr_export_frames): * src/term.c (term_get_fkeys_1, set_tty_color_mode, Fsuspend_tty) (Fresume_tty, tty_menu_activate, syms_of_term): * src/terminal.c (create_terminal, syms_of_terminal): * src/w32fns.c (Fx_display_backing_store) (Fx_display_visual_class, Fset_message_beep, Fx_open_connection) (Fx_show_tip, Fx_file_dialog, Fsystem_move_file_to_trash) (Fw32_toggle_lock_key, syms_of_w32fns): * src/w32font.c (w32_enumfont_pattern_entity, syms_of_w32font): * src/w32term.c (w32_bitmap_icon, syms_of_w32term): * src/xdisp.c (message_dolog, define_frame_cursor1) (syms_of_xdisp): * src/xfaces.c (tty_lookup_color, syms_of_xfaces): * src/xml.c (make_dom, syms_of_xml): * src/xterm.c (syms_of_xterm): * src/xwidget.c (store_xwidget_download_callback_event) (store_xwidget_js_callback_event, syms_of_xwidget): Define symbols for symbols interned with `intern' from a constant string, delete duplicate DEFSYM directives, and substitute them for such calls to intern. This excludes only those symbols which are interned and referenced only once during Emacs's initialization, the timing of whose interning is inconsequential, and symbols in w32.c, which would need to be transferred to a new syms_of_w32 function that I cannot test.
* Pacify GCC 14 -Wclobbered in eval.cPaul Eggert2024-04-301-0/+6
| | | | * src/eval.c: Ignore -Wclobbered.
* Use a dedicated type to represent interpreted-function valuesStefan Monnier2024-04-281-55/+93
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Change `function` so that when evaluating #'(lambda ...) we return an object of type `interpreted-function` rather than a list starting with one of `lambda` or `closure`. The new type reuses the existing PVEC_CLOSURE (nee PVEC_COMPILED) tag and tries to align the corresponding elements: - the arglist, the docstring, and the interactive-form go in the same slots as for byte-code functions. - the body of the function goes in the slot used for the bytecode string. - the lexical context goes in the slot used for the constants of bytecoded functions. The first point above means that `help-function-arglist`, `documentation`, and `interactive-form`s don't need to distinguish interpreted and bytecode functions any more. Main benefits of the change: - We can now reliably distinguish a list from a function value. - `cl-defmethod` can dispatch on `interactive-function` and `closure`. Dispatch on `function` also works now for interpreted functions but still won't work for functions represented as lists or as symbols, of course. - Function values are now self-evaluating. That was alrready the case when byte-compiled, but not when interpreted since (eval '(closure ...)) signals a void-function error. That also avoids false-positive warnings about "don't quote your lambdas" when doing things like `(mapcar ',func ...)`. * src/eval.c (Fmake_interpreted_closure): New function. (Ffunction): Use it and change calling convention of `Vinternal_make_interpreted_closure_function`. (FUNCTIONP, Fcommandp, eval_sub, funcall_general, funcall_lambda) (Ffunc_arity, lambda_arity): Simplify. (funcall_lambda): Adjust to new representation. (syms_of_eval): `defsubr` the new function. Remove definition of `Qclosure`. * lisp/emacs-lisp/cconv.el (cconv-make-interpreted-closure): Change calling convention and use `make-interpreted-closure`. * src/data.c (Fcl_type_of): Distinguish `byte-code-function`s from `interpreted-function`s. (Fclosurep, finterpreted_function_p): New functions. (Fbyte_code_function_p): Don't be confused by `interpreted-function`s. (Finteractive_form, Fcommand_modes): Simplify. (syms_of_data): Define new type symbols and `defsubr` the two new functions. * lisp/emacs-lisp/cl-print.el (cl-print-object) <interpreted-function>: New method. * lisp/emacs-lisp/oclosure.el (oclosure): Refine the parent to be `closure`. (oclosure--fix-type, oclosure-type): Simplify. (oclosure--copy, oclosure--get, oclosure--set): Adjust to new representation. * src/callint.c (Fcall_interactively): Adjust to new representation. * src/lread.c (bytecode_from_rev_list): * lisp/simple.el (function-documentation): * lisp/help.el (help-function-arglist): Remove the old `closure` case and adjust the byte-code case so it handles `interpreted-function`s. * lisp/emacs-lisp/cl-preloaded.el (closure): New type. (byte-code-function): Add it as a parent. (interpreted-function): Adjust parent (the type itself was already added earlier by accident). * lisp/emacs-lisp/bytecomp.el (byte-compile--reify-function): Adjust to new representation. (byte-compile): Use `interpreted-function-p`. * lisp/emacs-lisp/byte-opt.el (byte-compile-inline-expand): Adjust to new representation. (side-effect-free-fns): Add `interpreted-function-p` and `closurep`. * src/profiler.c (trace_hash, ffunction_equal): Simplify. * lisp/profiler.el (profiler-function-equal): Simplify. * lisp/emacs-lisp/nadvice.el (advice--interactive-form-1): Use `interpreted-function-p`; adjust to new representation; and take advantage of the fact that function values are now self-evaluating. * lisp/emacs-lisp/lisp-mode.el (closure): Remove `lisp-indent-function` property. * lisp/emacs-lisp/disass.el (disassemble-internal): Adjust to new representation. * lisp/emacs-lisp/edebug.el (edebug--strip-instrumentation): Use `interpreted-function-p`. * lisp/emacs-lisp/comp-common.el (comp-known-type-specifiers): Add `closurep` and `interpreted-function-p`. * test/lisp/help-fns-tests.el (help-fns-test-lisp-defun): Adjust to more precise type info in `describe-function`. * test/lisp/erc/resources/erc-d/erc-d-tests.el (erc-d--render-entries): Use `interpreted-function-p`. * test/lisp/emacs-lisp/macroexp-resources/vk.el (vk-f4, vk-f5): Don't hardcode function values. * doc/lispref/functions.texi (Anonymous Functions): Don't suggest that function values are lists. Reword "self-quoting" to reflect the fact that #' doesn't return the exact same object. Update examples with the new shape of the return value. * doc/lispref/variables.texi (Lexical Binding): * doc/lispref/lists.texi (Rearrangement): * doc/lispref/control.texi (Handling Errors): Update examples to reflect new representation of function values.
* (COMPILED): Rename to CLOSUREStefan Monnier2024-04-281-13/+13
| | | | | | | | | | | | | | | | | | In preparation for the use of `PVEC_COMPILED` objects for interpreted functions, rename them to use a more neutral name. * src/lisp.h (enum pvec_type): Rename `PVEC_COMPILED` to `PVEC_CLOSURE`. (enum Lisp_Compiled): Use `CLOSURE_` prefix i.s.o `COMPILED_`. Also use `CODE` rather than `BYTECODE`. (CLOSUREP): Rename from `COMPILEDP`. (enum Lisp_Closure): Rename from `Lisp_Compiled`. * src/alloc.c, src/bytecode.c, src/comp.c, src/data.c, src/eval.c, * src/fns.c, src/lisp.h, src/lread.c, src/pdumper.c, src/print.c, * src/profiler.c: Rename all uses accordingly. * src/.gdbinit (xclosure): Rename from `xcompiled`. (xcompiled): New obsolete alias. (xpr): Adjust accordingly. Also adjust to new PVEC_CLOSURE tag name.
* Ensure that specbind arg is always bare symbol, and drop checkMattias Engdegård2024-04-181-10/+9
| | | | | | | * src/eval.c (FletX, Flet, internal_lisp_condition_case) (funcall_lambda): Ensure that the first argument to `specbind` is a bare symbol in the few cases where this isn't statically guaranteed. (specbind): Drop the symbol argument type check on the fast path.
* ; * src/eval.c (funcall_lambda): Sink specpdl load out of fast path.Mattias Engdegård2024-04-141-8/+8
|
* ; * src/eval.c (Fhandler_bind_1): Fix docstring.Basil L. Contovounesios2024-03-161-2/+2
|
* Revert "Replace XSETSYMBOL with make_lisp_symbol"Mattias Engdegård2024-03-041-1/+1
| | | | | | | | This reverts commit de6b1e1efb1a36c69e7a6e09297e1de5b1477121. While it did simplify code, there aren't much in the way of technical benefits the change at this time, and there were protest against the unwarranted style change.
* Replace XSETSYMBOL with make_lisp_symbolMattias Engdegård2024-02-241-1/+1
| | | | | * src/lisp.h (XSETSYMBOL): Remove. All callers changed to use make_lisp_symbol.
* Eliminate lazy bytecode loadingMattias Engdegård2024-01-311-57/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The obsolete lazy-loaded bytecode feature, enabled by `byte-compile-dynamic`, slows down Lisp execution even when not in use because every call to a bytecode function has to check that function for laziness. This change forces up-front loading of all lazy bytecode so that we can remove all those checks. (Dynamically loaded doc strings are not affected.) There is no point in generating lazy bytecode any more so we stop doing that; this simplifies the compiler. `byte-compile-dynamic` now has no effect. This is a fully compatible change; the few remaining users of `byte-compile-dynamic` should not notice any difference. * src/lread.c (bytecode_from_rev_list): Force eager loading of lazy bytecode. * src/bytecode.c (exec_byte_code): Remove lazy bytecode checks. * src/eval.c (fetch_and_exec_byte_code, Ffetch_bytecode): Remove. (funcall_lambda): Call exec_byte_code directly, avoiding checks. * lisp/subr.el (fetch-bytecode): New definition, obsolete no-op. * lisp/emacs-lisp/disass.el (disassemble-1): * lisp/emacs-lisp/bytecomp.el (byte-compile-unfold-bcf): Remove calls to fetch-bytecode. (byte-compile-dynamic): Update doc string. (byte-compile-close-variables, byte-compile-from-buffer) (byte-compile-insert-header, byte-compile-output-file-form) (byte-compile--output-docform-recurse, byte-compile-output-docform) (byte-compile-file-form-defmumble): Remove effects of byte-compile-dynamic. * doc/lispref/compile.texi (Dynamic Loading): Remove node now that the entire `byte-compile-dynamic` facility has been rendered inert. * etc/NEWS: Announce changes.
* ; Fix typosStefan Kangas2024-01-281-2/+2
|
* Decouple profiler from Lisp hash table internalsMattias Engdegård2024-01-121-14/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The profiler stored data being collected in Lisp hash tables but relied heavily on their exact internal representation, which made it difficult and error-prone to change the hash table implementation. In particular, the profiler has special run-time requirements that are not easily met using standard Lisp data structures: accesses and updates are made from async signal handlers in almost any messy context you can think of and are therefore very constrained in what they can do. The new profiler tables are designed specifically for their purpose and are more efficient and, by not being coupled to Lisp hash tables, easier to keep safe. The old profiler morphed internal hash tables to ones usable from Lisp and thereby made them impossible to use internally; now export_log just makes new hash table objects for Lisp. The Lisp part of the profiler remains entirely unchanged. * src/alloc.c (garbage_collect): Mark profiler tables. * src/eval.c (get_backtrace): Fill an array of Lisp values instead of a Lisp vector. * src/profiler.c (log_t): No longer a Lisp hash table but a custom data structure: a fully associative fixed-sized cache that maps fixed-size arrays of Lisp objects to counts. (make_log): Build new struct. (mark_log, free_log, get_log_count, set_log_count, get_key_vector) (log_hash_index, remove_log_entry, trace_equal, trace_hash) (make_profiler_log, free_profiler_log, mark_profiler): New. (cmpfn_profiler, hashtest_profiler, hashfn_profiler) (syms_of_profiler_for_pdumper): Remove. (approximate_median, evict_lower_half, record_backtrace, export_log) (Fprofiler_cpu_log, Fprofiler_memory_log, syms_of_profiler): Adapt to the new data structure.
* Revert "Add new `swap` macro and use it"Po Lu2024-01-061-3/+6
| | | | | | | typeof is an extension which does not exist in Standard C, so macros using it are unsuitable for inclusion in Emacs. This reverts commit 37889523278fe65733938fb11c3701898309961c.