commit 19e76f6190c5c7b939bb15c8ab1137c5db2871c0 (HEAD, refs/remotes/origin/master) Author: Paul Eggert Date: Mon Aug 3 15:21:59 2020 -0700 Use void * for pointers in with_echo_area_buffer * src/xdisp.c (with_echo_area_buffer): Pass void * instead of ptrdiff_t, since the values are typically pointers and this ports better to (mostly-theoretical) hosts where ptrdiff_t is narrower than intptr_t. All uses changed. diff --git a/src/xdisp.c b/src/xdisp.c index 9f07361d48..4fe1c4288a 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -993,12 +993,12 @@ static void handle_line_prefix (struct it *); static void handle_stop_backwards (struct it *, ptrdiff_t); static void unwind_with_echo_area_buffer (Lisp_Object); static Lisp_Object with_echo_area_buffer_unwind_data (struct window *); -static bool current_message_1 (ptrdiff_t, Lisp_Object); -static bool truncate_message_1 (ptrdiff_t, Lisp_Object); +static bool current_message_1 (void *, Lisp_Object); +static bool truncate_message_1 (void *, Lisp_Object); static void set_message (Lisp_Object); -static bool set_message_1 (ptrdiff_t, Lisp_Object); -static bool display_echo_area_1 (ptrdiff_t, Lisp_Object); -static bool resize_mini_window_1 (ptrdiff_t, Lisp_Object); +static bool set_message_1 (void *, Lisp_Object); +static bool display_echo_area_1 (void *, Lisp_Object); +static bool resize_mini_window_1 (void *, Lisp_Object); static void unwind_redisplay (void); static void extend_face_to_end_of_line (struct it *); static intmax_t message_log_check_duplicate (ptrdiff_t, ptrdiff_t); @@ -11278,8 +11278,8 @@ ensure_echo_area_buffers (void) static bool with_echo_area_buffer (struct window *w, int which, - bool (*fn) (ptrdiff_t, Lisp_Object), - ptrdiff_t a1, Lisp_Object a2) + bool (*fn) (void *, Lisp_Object), + void *a1, Lisp_Object a2) { Lisp_Object buffer; bool this_one, the_other, clear_buffer_p, rc; @@ -11550,8 +11550,7 @@ display_echo_area (struct window *w) window_height_changed_p = with_echo_area_buffer (w, display_last_displayed_message_p, - display_echo_area_1, - (intptr_t) w, Qnil); + display_echo_area_1, w, Qnil); if (no_message_p) echo_area_buffer[i] = Qnil; @@ -11568,10 +11567,9 @@ display_echo_area (struct window *w) Value is true if height of W was changed. */ static bool -display_echo_area_1 (ptrdiff_t a1, Lisp_Object a2) +display_echo_area_1 (void *a1, Lisp_Object a2) { - intptr_t i1 = a1; - struct window *w = (struct window *) i1; + struct window *w = a1; Lisp_Object window; struct text_pos start; @@ -11612,7 +11610,7 @@ resize_echo_area_exactly (void) struct window *w = XWINDOW (echo_area_window); Lisp_Object resize_exactly = (minibuf_level == 0 ? Qt : Qnil); bool resized_p = with_echo_area_buffer (w, 0, resize_mini_window_1, - (intptr_t) w, resize_exactly); + w, resize_exactly); if (resized_p) { windows_or_buffers_changed = 42; @@ -11630,10 +11628,9 @@ resize_echo_area_exactly (void) returns. */ static bool -resize_mini_window_1 (ptrdiff_t a1, Lisp_Object exactly) +resize_mini_window_1 (void *a1, Lisp_Object exactly) { - intptr_t i1 = a1; - return resize_mini_window ((struct window *) i1, !NILP (exactly)); + return resize_mini_window (a1, !NILP (exactly)); } @@ -11769,8 +11766,7 @@ current_message (void) msg = Qnil; else { - with_echo_area_buffer (0, 0, current_message_1, - (intptr_t) &msg, Qnil); + with_echo_area_buffer (0, 0, current_message_1, &msg, Qnil); if (NILP (msg)) echo_area_buffer[0] = Qnil; } @@ -11780,10 +11776,9 @@ current_message (void) static bool -current_message_1 (ptrdiff_t a1, Lisp_Object a2) +current_message_1 (void *a1, Lisp_Object a2) { - intptr_t i1 = a1; - Lisp_Object *msg = (Lisp_Object *) i1; + Lisp_Object *msg = a1; if (Z > BEG) *msg = make_buffer_string (BEG, Z, true); @@ -11857,7 +11852,8 @@ truncate_echo_area (ptrdiff_t nchars) just an informative message; if the frame hasn't really been initialized yet, just toss it. */ if (sf->glyphs_initialized_p) - with_echo_area_buffer (0, 0, truncate_message_1, nchars, Qnil); + with_echo_area_buffer (0, 0, truncate_message_1, + (void *) (intptr_t) nchars, Qnil); } } @@ -11866,8 +11862,9 @@ truncate_echo_area (ptrdiff_t nchars) message to at most NCHARS characters. */ static bool -truncate_message_1 (ptrdiff_t nchars, Lisp_Object a2) +truncate_message_1 (void *a1, Lisp_Object a2) { + intptr_t nchars = (intptr_t) a1; if (BEG + nchars < Z) del_range (BEG + nchars, Z); if (Z == BEG) @@ -11919,7 +11916,7 @@ set_message (Lisp_Object string) This function is called with the echo area buffer being current. */ static bool -set_message_1 (ptrdiff_t a1, Lisp_Object string) +set_message_1 (void *a1, Lisp_Object string) { eassert (STRINGP (string)); commit fd50b3fc45d35549b842a3ac4889b10f7fcf574c Author: Paul Eggert Date: Mon Aug 3 15:21:59 2020 -0700 Ignore another memory leak * src/pdumper.c (dump_mmap_contiguous_heap): Ignore the heap control block when checking for leaks. diff --git a/src/pdumper.c b/src/pdumper.c index 865ceff6ff..63ee0fcb7f 100644 --- a/src/pdumper.c +++ b/src/pdumper.c @@ -4680,15 +4680,15 @@ dump_mmap_contiguous_heap (struct dump_memory_map *maps, int nr_maps, Beware: the simple patch 2019-03-11T15:20:54Z!eggert@cs.ucla.edu is worse, as it sometimes frees this storage twice. */ struct dump_memory_map_heap_control_block *cb = calloc (1, sizeof (*cb)); - - char *mem; if (!cb) goto out; + __lsan_ignore_object (cb); + cb->refcount = 1; cb->mem = malloc (total_size); if (!cb->mem) goto out; - mem = cb->mem; + char *mem = cb->mem; for (int i = 0; i < nr_maps; ++i) { struct dump_memory_map *map = &maps[i]; commit a1436544ff826b8c51242f4afb7c5d485c8e2e32 Author: Paul Eggert Date: Mon Aug 3 15:21:59 2020 -0700 Simplify use of __lsan_ignore_object * configure.ac: Use AC_CHECK_FUNCS_ONCE for __lsan_ignore_object. * src/buffer.c, src/data.c, src/emacs-module.c, src/regex-emacs.c: * src/search.c: Use __lsan_ignore_object unconditionally, and don’t include sanitizer/lsan_interface.h. * src/lisp.h (__lsan_ignore_object): Provide a dummy in the typical case where leak sanitization is not available. diff --git a/configure.ac b/configure.ac index 93463e344a..4ee4517e11 100644 --- a/configure.ac +++ b/configure.ac @@ -4512,11 +4512,13 @@ AC_CHECK_HEADERS(valgrind/valgrind.h) AC_CHECK_MEMBERS([struct unipair.unicode], [], [], [[#include ]]) -AC_CHECK_FUNCS_ONCE([sbrk]) +AC_CHECK_FUNCS_ONCE([__lsan_ignore_object sbrk]) AC_FUNC_FORK -AC_CHECK_FUNCS(snprintf __lsan_ignore_object) +dnl AC_CHECK_FUNCS_ONCE wouldn’t be right for snprintf, which needs +dnl the current CFLAGS etc. +AC_CHECK_FUNCS(snprintf) dnl Check for glib. This differs from other library checks in that dnl Emacs need not link to glib unless some other library is already diff --git a/src/buffer.c b/src/buffer.c index e441499aeb..241f2d43a9 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -28,10 +28,6 @@ along with GNU Emacs. If not, see . */ #include #include -#ifdef HAVE_SANITIZER_LSAN_INTERFACE_H -#include -#endif - #include #include "lisp.h" @@ -5087,9 +5083,7 @@ enlarge_buffer_text (struct buffer *b, ptrdiff_t delta) #else p = xrealloc (b->text->beg, new_nbytes); #endif -#ifdef HAVE___LSAN_IGNORE_OBJECT __lsan_ignore_object (p); -#endif if (p == NULL) { diff --git a/src/data.c b/src/data.c index 5fff52d24c..59d148166f 100644 --- a/src/data.c +++ b/src/data.c @@ -23,10 +23,6 @@ along with GNU Emacs. If not, see . */ #include #include -#ifdef HAVE_SANITIZER_LSAN_INTERFACE_H -#include -#endif - #include #include #include @@ -1788,9 +1784,7 @@ make_blv (struct Lisp_Symbol *sym, bool forwarded, set_blv_defcell (blv, tem); set_blv_valcell (blv, tem); set_blv_found (blv, false); -#ifdef HAVE___LSAN_IGNORE_OBJECT __lsan_ignore_object (blv); -#endif return blv; } diff --git a/src/emacs-module.c b/src/emacs-module.c index f57101946b..a0bab11801 100644 --- a/src/emacs-module.c +++ b/src/emacs-module.c @@ -84,10 +84,6 @@ To add a new module function, proceed as follows: #include #include -#ifdef HAVE_SANITIZER_LSAN_INTERFACE_H -#include -#endif - #include "lisp.h" #include "bignum.h" #include "dynlib.h" @@ -1103,9 +1099,7 @@ DEFUN ("module-load", Fmodule_load, Smodule_load, 1, 1, 0, if (module_assertions) { rt = xmalloc (sizeof *rt); -#ifdef HAVE___LSAN_IGNORE_OBJECT __lsan_ignore_object (rt); -#endif } else rt = &rt_pub; @@ -1426,9 +1420,7 @@ initialize_environment (emacs_env *env, struct emacs_env_private *priv) if (module_assertions) { env = xmalloc (sizeof *env); -#ifdef HAVE___LSAN_IGNORE_OBJECT __lsan_ignore_object (env); -#endif } priv->pending_non_local_exit = emacs_funcall_exit_return; diff --git a/src/lisp.h b/src/lisp.h index fdf69ab736..22ddf3e5fa 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -4789,6 +4789,17 @@ lispstpcpy (char *dest, Lisp_Object string) return dest + len; } +#if (defined HAVE___LSAN_IGNORE_OBJECT \ + && defined HAVE_SANITIZER_LSAN_INTERFACE_H) +# include +#else +/* Treat *P as a non-leak. */ +INLINE void +__lsan_ignore_object (void const *p) +{ +} +#endif + extern void xputenv (const char *); extern char *egetenv_internal (const char *, ptrdiff_t); diff --git a/src/regex-emacs.c b/src/regex-emacs.c index 1ecbc74b96..c44cce9f78 100644 --- a/src/regex-emacs.c +++ b/src/regex-emacs.c @@ -29,10 +29,6 @@ #include -#ifdef HAVE_SANITIZER_LSAN_INTERFACE_H -#include -#endif - #include "character.h" #include "buffer.h" #include "syntax.h" @@ -1761,9 +1757,7 @@ regex_compile (re_char *pattern, ptrdiff_t size, /* Initialize the compile stack. */ compile_stack.stack = xmalloc (INIT_COMPILE_STACK_SIZE * sizeof *compile_stack.stack); -#ifdef HAVE___LSAN_IGNORE_OBJECT __lsan_ignore_object (compile_stack.stack); -#endif compile_stack.size = INIT_COMPILE_STACK_SIZE; compile_stack.avail = 0; diff --git a/src/search.c b/src/search.c index 7b74ff9148..38c64caf7c 100644 --- a/src/search.c +++ b/src/search.c @@ -21,10 +21,6 @@ along with GNU Emacs. If not, see . */ #include -#ifdef HAVE_SANITIZER_LSAN_INTERFACE_H -#include -#endif - #include "lisp.h" #include "character.h" #include "buffer.h" @@ -619,9 +615,7 @@ newline_cache_on_off (struct buffer *buf) if (base_buf->newline_cache == 0) { base_buf->newline_cache = new_region_cache (); -#ifdef HAVE___LSAN_IGNORE_OBJECT __lsan_ignore_object (base_buf->newline_cache); -#endif } } return base_buf->newline_cache; commit a4ed198e8f3754a59cabbb03ab6bae8a49597ee0 Author: Paul Eggert Date: Mon Aug 3 15:21:58 2020 -0700 Simplify pointer computation in mark_maybe_object * src/alloc.c (mark_maybe_object): Use simpler way to avoid -fsanitize=undefined false alarms, by converting the word tag to intptr_t first. Omit now-unnecessary runtime overflow check. (mark_memory): Work even if UINTPTR_MAX <= INT_MAX (!). diff --git a/src/alloc.c b/src/alloc.c index 5220ef8478..3a02ef3f8c 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -4625,7 +4625,7 @@ mark_maybe_object (Lisp_Object obj) #endif int type_tag = XTYPE (obj); - intptr_t offset; + intptr_t pointer_word_tag = LISP_WORD_TAG (type_tag), offset, ipo; switch (type_tag) { @@ -4641,19 +4641,8 @@ mark_maybe_object (Lisp_Object obj) break; } - bool overflow - = INT_SUBTRACT_WRAPV (offset, LISP_WORD_TAG (type_tag), &offset); -#if !defined WIDE_EMACS_INT || USE_LSB_TAG - /* If we don't use wide integers, then `intptr_t' should always be - large enough to not overflow. Furthermore, when using the least - significant bits as tag bits, the tag is small enough to not - overflow either. */ - eassert (!overflow); -#else - (void) overflow; -#endif - INT_ADD_WRAPV (offset, (intptr_t) (char *) XLP (obj), &offset); - void *po = (char *) offset; + INT_ADD_WRAPV ((intptr_t) XLP (obj), offset - pointer_word_tag, &ipo); + void *po = (void *) ipo; /* If the pointer is in the dump image and the dump has a record of the object starting at the place where the pointer points, we @@ -4856,7 +4845,7 @@ mark_memory (void const *start, void const *end) for (pp = start; (void const *) pp < end; pp += GC_POINTER_ALIGNMENT) { - char *p = *(char *const *) pp; + void *p = *(void *const *) pp; mark_maybe_pointer (p); /* Unmask any struct Lisp_Symbol pointer that make_lisp_symbol @@ -4864,8 +4853,9 @@ mark_memory (void const *start, void const *end) On a host with 32-bit pointers and 64-bit Lisp_Objects, a Lisp_Object might be split into registers saved into non-adjacent words and P might be the low-order word's value. */ - p = (char *) ((uintptr_t) p + (uintptr_t) lispsym); - mark_maybe_pointer (p); + intptr_t ip; + INT_ADD_WRAPV ((intptr_t) p, (intptr_t) lispsym, &ip); + mark_maybe_pointer ((void *) ip); verify (alignof (Lisp_Object) % GC_POINTER_ALIGNMENT == 0); if (alignof (Lisp_Object) == GC_POINTER_ALIGNMENT commit ca419812d35f252fca2708ffdd132c223d094c0f Author: Philipp Stephani Date: Mon Aug 3 21:07:32 2020 +0200 Avoid duplicate Edebug symbols when backtracking (Bug#42701) When Edebug backtracks, it nevertheless generates definitions for the non-matching branches, see Bug#41988 and Bug#42701. This should be fixed eventually (probably by deferring the definition until a branch is known to match), but for now add a band-aid to avoid these duplicate symbols, at least for anonymous forms. * lisp/emacs-lisp/edebug.el (edebug-make-enter-wrapper): Regenerate anonymous names. * test/lisp/emacs-lisp/edebug-tests.el (edebug-tests-duplicate-symbol-backtrack): New regression test. diff --git a/lisp/emacs-lisp/edebug.el b/lisp/emacs-lisp/edebug.el index cef97e0fb4..d9bbf6129c 100644 --- a/lisp/emacs-lisp/edebug.el +++ b/lisp/emacs-lisp/edebug.el @@ -1240,6 +1240,13 @@ purpose by adding an entry to this alist, and setting ;; since it wraps the list of forms with a call to `edebug-enter'. ;; Uses the dynamically bound vars edebug-def-name and edebug-def-args. ;; Do this after parsing since that may find a name. + (when (string-match-p (rx bos "edebug-anon" (+ digit) eos) + (symbol-name edebug-old-def-name)) + ;; FIXME: Due to Bug#42701, we reset an anonymous name so that + ;; backtracking doesn't generate duplicate definitions. It would + ;; be better to not define wrappers in the case of a non-matching + ;; specification branch to begin with. + (setq edebug-old-def-name nil)) (setq edebug-def-name (or edebug-def-name edebug-old-def-name (gensym "edebug-anon"))) `(edebug-enter diff --git a/test/lisp/emacs-lisp/edebug-tests.el b/test/lisp/emacs-lisp/edebug-tests.el index 1be68f6ff4..04a7b2f5a0 100644 --- a/test/lisp/emacs-lisp/edebug-tests.el +++ b/test/lisp/emacs-lisp/edebug-tests.el @@ -1000,5 +1000,37 @@ clashes (Bug#41853)." inner@cl-flet@10005 edebug-tests-cl-flet-2)))))) +(ert-deftest edebug-tests-duplicate-symbol-backtrack () + "Check that Edebug doesn't create duplicate symbols when +backtracking (Bug#42701)." + (with-temp-buffer + (dolist (form '((require 'subr-x) + (defun edebug-tests-duplicate-symbol-backtrack () + (if-let (x (funcall (lambda (y) 1) 2)) 3 4)))) + (print form (current-buffer))) + (let* ((edebug-all-defs t) + (edebug-initial-mode 'Go-nonstop) + (instrumented-names ()) + (edebug-new-definition-function + (lambda (name) + (when (memq name instrumented-names) + (error "Duplicate definition of `%s'" name)) + (push name instrumented-names) + (edebug-new-definition name))) + ;; Make generated symbols reproducible. + (gensym-counter 10000)) + (eval-buffer) + ;; The anonymous symbols are uninterned. Use their names so we + ;; can perform the assertion. The names should still be unique. + (should (equal (mapcar #'symbol-name (reverse instrumented-names)) + ;; The outer definition comes after the inner + ;; ones because its body ends later. + ;; FIXME: There are twice as many inner + ;; definitions as expected due to Bug#42701. + ;; Once that bug is fixed, remove the duplicates. + '("edebug-anon10000" + "edebug-anon10001" + "edebug-tests-duplicate-symbol-backtrack")))))) + (provide 'edebug-tests) ;;; edebug-tests.el ends here commit 16b7f413a9ff819c374e07ee927c1fd2b4138109 Merge: 078d75fb47 8576297b2a Author: Glenn Morris Date: Mon Aug 3 08:32:39 2020 -0700 Merge from origin/emacs-27 8576297b2a (origin/emacs-27) ; lisp/so-long.el: Prevent potential err... 986c12b20f ; * lisp/so-long.el: Byte-compilation bug fix 19f8f36f11 ; * lisp/so-long.el (so-long-variable-overrides): Improve doc 83bc4ad369 ; * so-long.el: Documentation and spelling 72c5f71cd4 Avoid segfaults if XIM is set but not xim_styles f54ddb0198 (emacs-27) ; * test/lisp/emacs-lisp/generator-tests.el: St... # Conflicts: # test/lisp/emacs-lisp/generator-tests.el commit 078d75fb475c1c81853de93df5a4090777a8b2ff Merge: 78d1092bcc d767418b76 Author: Glenn Morris Date: Mon Aug 3 08:31:15 2020 -0700 ; Merge from origin/emacs-27 The following commits were skipped: d767418b76 Backport: Make checking for liveness of global values more... 8c94ca94dc Backport: Fix subtle bug when checking liveness of module ... 8ecca2f09f Backport: Fix memory leak for global module objects (Bug#4... commit 78d1092bcc2d2e77602657bb5ae85ff5ac9f1faf Merge: 99275822c6 e12d1fbc15 Author: Glenn Morris Date: Mon Aug 3 08:31:15 2020 -0700 Merge from origin/emacs-27 e12d1fbc15 ; ChangeLog.3 and etc/AUTHORS fixes 748f0d4bc6 * admin/authors.el (authors-aliases): Remove a faulty regexp. # Conflicts: # etc/AUTHORS commit 99275822c6c36ac308a7b77b5271066df5f38dfb Author: Eli Zaretskii Date: Mon Aug 3 17:56:40 2020 +0300 Fix last change in 'try_window' * src/xdisp.c (try_window): Don't modify the logic when EOB is in the viewport. (Bug#42653) diff --git a/src/xdisp.c b/src/xdisp.c index a8cd4dc853..9f07361d48 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -19234,9 +19234,8 @@ try_window (Lisp_Object window, struct text_pos pos, int flags) seems to give wrong results. We don't want to recenter when the last line is partly visible, we want to allow that case to be handled in the usual way. */ - || (it_charpos < ZV /* if EOB is visible, disable bottom margin */ - && w->cursor.y > (it.last_visible_y - partial_line_height (&it) - - this_scroll_margin - 1))) + || w->cursor.y > (it.last_visible_y - partial_line_height (&it) + - this_scroll_margin - 1)) { w->cursor.vpos = -1; clear_glyph_matrix (w->desired_matrix); commit 8576297b2a657d1944b7d824b30a1cb6459685c6 Author: Phil Sainty Date: Sat Jul 11 19:40:27 2020 +1200 ; lisp/so-long.el: Prevent potential error if comment-use-syntax is nil * lisp/so-long.el (so-long-detected-long-line-p): Ensure that `comment-start-skip' and `comment-end-skip' are both set if `comment-use-syntax' is nil, as `comment-forward' requires them to be bound in this scenario. diff --git a/lisp/so-long.el b/lisp/so-long.el index 21dc7de75c..1332ae1263 100644 --- a/lisp/so-long.el +++ b/lisp/so-long.el @@ -1047,7 +1047,9 @@ This is the default value of `so-long-predicate'." (let ((count 0) start) (save-excursion (goto-char (point-min)) - (when so-long-skip-leading-comments + (when (and so-long-skip-leading-comments + (or comment-use-syntax ;; Refer to `comment-forward'. + (and comment-start-skip comment-end-skip))) ;; Skip the shebang line, if any. This is not necessarily comment ;; syntax, so we need to treat it specially. (when (looking-at "#!") commit 986c12b20fa29c37f13563846fddf6edcd0b4945 Author: Phil Sainty Date: Sat Jul 4 01:43:08 2020 +1200 ; * lisp/so-long.el: Byte-compilation bug fix As this `require' is not at the top-level (it is only conditionally evaluated, when loading the library over the top of an earlier version), we need `eval-and-compile' to ensure that both macros and functions from advice.el are accounted for. diff --git a/lisp/so-long.el b/lisp/so-long.el index b3596bdab7..21dc7de75c 100644 --- a/lisp/so-long.el +++ b/lisp/so-long.el @@ -1819,9 +1819,10 @@ If it appears in `%s', you should remove it." ;; Update to version 1.0 from earlier versions: (when (version< so-long-version "1.0") (remove-hook 'change-major-mode-hook 'so-long-change-major-mode) - (require 'advice) + (eval-and-compile (require 'advice)) ;; Both macros and functions. (declare-function ad-find-advice "advice") (declare-function ad-remove-advice "advice") + (declare-function ad-activate "advice") (when (ad-find-advice 'hack-local-variables 'after 'so-long--file-local-mode) (ad-remove-advice 'hack-local-variables 'after 'so-long--file-local-mode) (ad-activate 'hack-local-variables)) commit 19f8f36f11cf5ae62a7b92dc1496c72db4d377b3 Author: Phil Sainty Date: Sun Dec 8 23:35:48 2019 +1300 ; * lisp/so-long.el (so-long-variable-overrides): Improve doc diff --git a/lisp/so-long.el b/lisp/so-long.el index 68614ca002..b3596bdab7 100644 --- a/lisp/so-long.el +++ b/lisp/so-long.el @@ -783,7 +783,18 @@ to their original states. The combination of `line-move-visual' (enabled) and `truncate-lines' (disabled) is important for maximising responsiveness when moving vertically within an extremely long line, as otherwise the full length of the line may need to be -scanned to find the next position." +scanned to find the next position. + +Bidirectional text display -- especially handling the large quantities of +nested parentheses which are liable to occur in minified programming code -- +can be very expensive for extremely long lines, and so this support is disabled +by default (insofar as is supported; in particular `bidi-inhibit-bpa' is not +available in Emacs versions < 27). For more information refer to info node +`(emacs) Bidirectional Editing' and info node `(elisp) Bidirectional Display'. + +Buffers are made read-only by default to prevent potentially-slow editing from +occurring inadvertantly, as buffers with excessively long lines are likely not +intended to be edited manually." :type '(alist :key-type (variable :tag "Variable") :value-type (sexp :tag "Value")) :options '((bidi-inhibit-bpa boolean) @@ -1863,7 +1874,7 @@ If it appears in `%s', you should remove it." ; LocalWords: defadvice nadvice whitespace ie bos eos eobp origmode un Un setq ; LocalWords: docstring auf Wiedersehen longlines alist autoload Refactored Inc ; LocalWords: MERCHANTABILITY RET REGEXP VAR ELPA WS mitigations EmacsWiki eval -; LocalWords: rx filename filenames +; LocalWords: rx filename filenames bidi bpa ;; So long, farewell, auf Wiedersehen, goodbye ;; You have to go, this code is minified commit 83bc4ad369b3c31abafb7f939711da1ba13416ba Author: Phil Sainty Date: Sun Dec 15 02:00:05 2019 +1300 ; * so-long.el: Documentation and spelling Reverting certain changes from commits b0f20651e3 and d1a791f8ed. Please refer to the comments on spelling at the end of the library. M-x ispell-buffer should find no misspellings in the documentation. See also test/lisp/so-long-tests/spelling-tests.el (The current spelling will persist while so-long.el is maintained in its own Savannah repository, to avoid unnecessary conflicts between the two versions. If in the future it is maintained solely in the Emacs repository, changing the spelling would become an option.) Note that "mitigations" (plural) is intentional -- this library identifies a collection of different performance mitigations, multiple of which will typically be in effect together. diff --git a/lisp/so-long.el b/lisp/so-long.el index dcf7e62ca7..68614ca002 100644 --- a/lisp/so-long.el +++ b/lisp/so-long.el @@ -38,7 +38,7 @@ ;; compacted into the smallest file size possible, which often entails removing ;; newlines should they not be strictly necessary). This can result in lines ;; which are many thousands of characters long, and most programming modes -;; simply aren't optimized (remotely) for this scenario, so performance can +;; simply aren't optimised (remotely) for this scenario, so performance can ;; suffer significantly. ;; ;; When such files are detected, the command `so-long' is automatically called, @@ -69,7 +69,7 @@ ;; the long lines. In such circumstances you may find that `longlines-mode' is ;; the most helpful facility. ;; -;; Note also that the mitigation is automatically triggered when visiting a +;; Note also that the mitigations are automatically triggered when visiting a ;; file. The library does not automatically detect if long lines are inserted ;; into an existing buffer (although the `so-long' command can be invoked ;; manually in such situations). @@ -90,7 +90,7 @@ ;; * Overview of modes and commands ;; -------------------------------- ;; - `global-so-long-mode' - A global minor mode which enables the automated -;; behavior, causing the user's preferred action to be invoked whenever a +;; behaviour, causing the user's preferred action to be invoked whenever a ;; newly-visited file contains excessively long lines. ;; - `so-long-mode' - A major mode, and the default action. ;; - `so-long-minor-mode' - A minor mode version of the major mode, and an @@ -111,7 +111,7 @@ ;; ;; On rare occasions you may choose to manually invoke the `so-long' command, ;; which invokes your preferred `so-long-action' (exactly as the automatic -;; behavior would do if it had detected long lines). You might use this if a +;; behaviour would do if it had detected long lines). You might use this if a ;; problematic file did not meet your configured criteria, and you wished to ;; trigger the performance improvements manually. ;; @@ -120,7 +120,7 @@ ;; available to `so-long' but, like any other mode, they can be invoked directly ;; if you have a need to do that (see also "Other ways of using so-long" below). ;; -;; If the behavior ever triggers when you did not want it to, you can use the +;; If the behaviour ever triggers when you did not want it to, you can use the ;; `so-long-revert' command to restore the buffer to its original state. ;; * Basic configuration @@ -199,7 +199,7 @@ ;; ;; Note that `so-long-minor-modes' is not useful for other global minor modes ;; (as distinguished from globalized minor modes), but in some cases it will be -;; possible to inhibit or otherwise counter-act the behavior of a global mode +;; possible to inhibit or otherwise counter-act the behaviour of a global mode ;; by overriding variables, or by employing hooks (see below). You would need ;; to inspect the code for a given global mode (on a case by case basis) to ;; determine whether it's possible to inhibit it for a single buffer -- and if @@ -211,7 +211,7 @@ ;; If `so-long-action' is set to either `so-long-mode' or `so-long-minor-mode', ;; the buffer-local value for each variable in the list is set to the associated ;; value in the alist. Use this to enforce values which will improve -;; performance or otherwise avoid undesirable behaviors. If `so-long-revert' +;; performance or otherwise avoid undesirable behaviours. If `so-long-revert' ;; is called, then the original values are restored. ;; * Hooks @@ -325,7 +325,7 @@ ;; meaning you would need to add to `safe-local-variable-values' in order to ;; avoid being queried about them. ;; -;; Finally, the `so-long-predicate' user option enables the automated behavior +;; Finally, the `so-long-predicate' user option enables the automated behaviour ;; to be determined by a custom function, if greater control is needed. ;; * Implementation notes @@ -342,7 +342,7 @@ ;; * Caveats ;; --------- -;; The variables affecting the automated behavior of this library (such as +;; The variables affecting the automated behaviour of this library (such as ;; `so-long-action') can be used as file- or dir-local values in Emacs 26+, but ;; not in previous versions of Emacs. This is on account of improvements made ;; to `normal-mode' in 26.1, which altered the execution order with respect to @@ -386,7 +386,7 @@ ;; - Added sgml-mode and nxml-mode to `so-long-target-modes'. ;; 0.7.4 - Refactored the handling of `whitespace-mode'. ;; 0.7.3 - Added customize group `so-long' with user options. -;; - Added `so-long-original-values' to generalize the storage and +;; - Added `so-long-original-values' to generalise the storage and ;; restoration of values from the original mode upon `so-long-revert'. ;; - Added `so-long-revert-hook'. ;; 0.7.2 - Remember the original major mode even with M-x `so-long-mode'. @@ -399,7 +399,7 @@ ;; 0.6 - Added `so-long-minor-modes' and `so-long-hook'. ;; 0.5 - Renamed library to "so-long.el". ;; - Added explicit `so-long-enable' command to activate our advice. -;; 0.4 - Amended/documented behavior with file-local 'mode' variables. +;; 0.4 - Amended/documented behaviour with file-local 'mode' variables. ;; 0.3 - Defer to a file-local 'mode' variable. ;; 0.2 - Initial release to EmacsWiki. ;; 0.1 - Experimental. @@ -421,7 +421,7 @@ Has no effect if `global-so-long-mode' is not enabled.") (defvar-local so-long--active nil ; internal use - "Non-nil when `so-long' mitigation is in effect.") + "Non-nil when `so-long' mitigations are in effect.") (defvar so-long--set-auto-mode nil ; internal use "Non-nil while `set-auto-mode' is executing.") @@ -500,7 +500,7 @@ files would prevent Emacs from handling them correctly." (defcustom so-long-invisible-buffer-function #'so-long-deferred "Function called in place of `so-long' when the buffer is not displayed. -This affects the behavior of `global-so-long-mode'. +This affects the behaviour of `global-so-long-mode'. We treat invisible buffers differently from displayed buffers because, in cases where a library is using a buffer for behind-the-scenes processing, @@ -548,7 +548,7 @@ Defaults to `so-long-detected-long-line-p'." (defun so-long--action-type () "Generate a :type for `so-long-action' based on `so-long-action-alist'." ;; :type seemingly cannot be a form to be evaluated on demand, so we - ;; endeavor to keep it up-to-date with `so-long-action-alist' by + ;; endeavour to keep it up-to-date with `so-long-action-alist' by ;; calling this from `so-long--action-alist-setter'. `(radio ,@(mapcar (lambda (x) (list 'const :tag (cadr x) (car x))) (assq-delete-all nil so-long-action-alist)) @@ -609,7 +609,7 @@ will be automatically processed; but custom actions can also do these things. The value `longlines-mode' causes that minor mode to be enabled. See longlines.el for more details. -Each action likewise determines the behavior of `so-long-revert'. +Each action likewise determines the behaviour of `so-long-revert'. If the value is nil, or not defined in `so-long-action-alist', then no action will be taken." @@ -740,7 +740,7 @@ was established." ) ;; It's not clear to me whether all of these would be problematic, but they ;; seemed like reasonable targets. Some are certainly excessive in smaller - ;; buffers of minified code, but we should be aiming to maximize performance + ;; buffers of minified code, but we should be aiming to maximise performance ;; by default, so that Emacs is as responsive as we can manage in even very ;; large buffers of minified code. "List of buffer-local minor modes to explicitly disable. @@ -756,7 +756,7 @@ By default this happens if `so-long-action' is set to either `so-long-mode' or `so-long-minor-mode'. If `so-long-revert' is subsequently invoked, then the disabled modes are re-enabled by calling them with the numeric argument 1. -`so-long-hook' can be used where more custom behavior is desired. +`so-long-hook' can be used where more custom behaviour is desired. Please submit bug reports to recommend additional modes for this list, whether they are in Emacs core, GNU ELPA, or elsewhere." @@ -781,7 +781,7 @@ If `so-long-revert' is subsequently invoked, then the variables are restored to their original states. The combination of `line-move-visual' (enabled) and `truncate-lines' (disabled) -is important for maximizing responsiveness when moving vertically within an +is important for maximising responsiveness when moving vertically within an extremely long line, as otherwise the full length of the line may need to be scanned to find the next position." :type '(alist :key-type (variable :tag "Variable") @@ -822,18 +822,18 @@ If nil, no mode line indicator will be displayed." (defface so-long-mode-line-active '((t :inherit mode-line-emphasis)) - "Face for `so-long-mode-line-info' when mitigation is active." + "Face for `so-long-mode-line-info' when mitigations are active." :package-version '(so-long . "1.0")) (defface so-long-mode-line-inactive '((t :inherit mode-line-inactive)) - "Face for `so-long-mode-line-info' when mitigation has been reverted." + "Face for `so-long-mode-line-info' when mitigations have been reverted." :package-version '(so-long . "1.0")) ;; Modes that go slowly and line lengths excessive ;; Font-lock performance becoming oppressive ;; All of my CPU tied up with strings -;; These are a few of my least-favorite things +;; These are a few of my least-favourite things (defvar-local so-long-original-values nil "Alist holding the buffer's original `major-mode' value, and other data. @@ -983,7 +983,7 @@ Displayed as part of `mode-line-misc-info'. `so-long-mode-line-label' defines the text to be displayed (if any). -Face `so-long-mode-line-active' is used while mitigation is active, and +Face `so-long-mode-line-active' is used while mitigations are active, and `so-long-mode-line-inactive' is used if `so-long-revert' is called. Not displayed when `so-long-mode' is enabled, as the major mode construct @@ -1129,7 +1129,7 @@ This minor mode is a standard `so-long-action' option." (if so-long-minor-mode ;; We are enabling the mode. (progn ;; Housekeeping. `so-long-minor-mode' might be invoked directly rather - ;; than via `so-long', so replicate the necessary behaviors. The minor + ;; than via `so-long', so replicate the necessary behaviours. The minor ;; mode also cares about whether `so-long' was already active, as we do ;; not want to remember values which were potentially overridden already. (unless (or so-long--calling so-long--active) @@ -1201,9 +1201,9 @@ values), despite potential performance issues, type \\[so-long-revert]. Use \\[so-long-commentary] for more information. -Use \\[so-long-customize] to configure the behavior." +Use \\[so-long-customize] to configure the behaviour." ;; Housekeeping. `so-long-mode' might be invoked directly rather than via - ;; `so-long', so replicate the necessary behaviors. We could use this same + ;; `so-long', so replicate the necessary behaviours. We could use this same ;; test in `so-long-after-change-major-mode' to run `so-long-hook', but that's ;; not so obviously the right thing to do, so I've omitted it for now. (unless so-long--calling @@ -1249,7 +1249,7 @@ Use \\[so-long-customize] to configure the behavior." This advice acts before `so-long-mode', with the previous mode still active." (unless (derived-mode-p 'so-long-mode) ;; Housekeeping. `so-long-mode' might be invoked directly rather than - ;; via `so-long', so replicate the necessary behaviors. + ;; via `so-long', so replicate the necessary behaviours. (unless so-long--calling (so-long-remember-all :reset)) ;; Remember the original major mode, regardless. @@ -1334,7 +1334,7 @@ This is the `so-long-revert-function' for `so-long-mode'." ;; Emacs 26+ has already called `hack-local-variables' (during ;; `run-mode-hooks'; provided there was a `buffer-file-name'), but for older ;; versions we need to call it here. In Emacs 26+ the revised 'HANDLE-MODE' - ;; argument is set to `no-mode' (being the non-nil-and-non-t behavior), + ;; argument is set to `no-mode' (being the non-nil-and-non-t behaviour), ;; which we mimic here by binding `so-long--hack-local-variables-no-mode', ;; in order to prevent a local 'mode' variable from clobbering the major ;; mode we have just called. @@ -1371,7 +1371,7 @@ because we do not want to downgrade the major mode in that scenario." ;; Act only if `so-long-mode' would be enabled by the current action. (when (and (symbolp (so-long-function)) (provided-mode-derived-p (so-long-function) 'so-long-mode)) - ;; Downgrade from `so-long-mode' to the `so-long-minor-mode' behavior. + ;; Downgrade from `so-long-mode' to the `so-long-minor-mode' behaviour. (setq so-long-function 'turn-on-so-long-minor-mode so-long-revert-function 'turn-off-so-long-minor-mode)))) @@ -1391,7 +1391,7 @@ and cannot be conveniently intercepted, so we are forced to replicate it here. This special-case code will ultimately be removed from Emacs, as it exists to deal with a deprecated feature; but until then we need to replicate it in order -to inhibit our own behavior in the presence of a header comment `mode' +to inhibit our own behaviour in the presence of a header comment `mode' declaration. If a file-local mode is detected in the header comment, then we call the @@ -1526,7 +1526,7 @@ by testing the value against `major-mode'; but as we may have changed the major mode to `so-long-mode' by this point, that protection is insufficient and so we need to perform our own test. -We likewise need to support an equivalent of the `no-mode' behavior in 26.1+ +We likewise need to support an equivalent of the `no-mode' behaviour in 26.1+ to ensure that `so-long-mode-revert' will not restore a file-local mode again after it has already reverted to the original mode. @@ -1659,7 +1659,7 @@ Equivalent to calling (global-so-long-mode 0)" ;;;###autoload (define-minor-mode global-so-long-mode - "Toggle automated performance mitigation for files with long lines. + "Toggle automated performance mitigations for files with long lines. Many Emacs modes struggle with buffers which contain excessively long lines, and may consequently cause unacceptable performance issues. @@ -1673,7 +1673,7 @@ When such files are detected by `so-long-predicate', we invoke the selected Use \\[so-long-commentary] for more information. -Use \\[so-long-customize] to configure the behavior." +Use \\[so-long-customize] to configure the behaviour." :global t :group 'so-long (if global-so-long-mode @@ -1862,7 +1862,7 @@ If it appears in `%s', you should remove it." ; LocalWords: noerror selectable mapc sgml nxml hl flydiff defs arg Phil Sainty ; LocalWords: defadvice nadvice whitespace ie bos eos eobp origmode un Un setq ; LocalWords: docstring auf Wiedersehen longlines alist autoload Refactored Inc -; LocalWords: MERCHANTABILITY RET REGEXP VAR ELPA WS EmacsWiki eval +; LocalWords: MERCHANTABILITY RET REGEXP VAR ELPA WS mitigations EmacsWiki eval ; LocalWords: rx filename filenames ;; So long, farewell, auf Wiedersehen, goodbye commit 72c5f71cd45c860299950cd058d8e13b87375741 Author: Grégory Mounié Date: Sun Aug 2 15:56:33 2020 +0200 Avoid segfaults if XIM is set but not xim_styles Emacs segfaults at the X11 initialization if XIM is set and xim_styles is NULL. This patch avoids the crash. * src/xfns.c: Check also if FRAME_X_XIM_STYLES(f) is NULL. (Bug#42676) (Bug#42673) (Bug#42677) Copyright-paperwork-exempt: yes diff --git a/src/xfns.c b/src/xfns.c index b89fac1cda..f9a00a6daf 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -2658,7 +2658,7 @@ create_frame_xic (struct frame *f) goto out; xim = FRAME_X_XIM (f); - if (!xim) + if (!xim || ! FRAME_X_XIM_STYLES(f)) goto out; /* Determine XIC style. */ commit f54ddb0198640e38c1d34bf6031ff5117c117c85 Author: Philipp Stephani Date: Fri Jul 31 23:50:04 2020 +0200 ; * test/lisp/emacs-lisp/generator-tests.el: Style fixes. diff --git a/test/lisp/emacs-lisp/generator-tests.el b/test/lisp/emacs-lisp/generator-tests.el index 0d325f1485..e0d9167118 100644 --- a/test/lisp/emacs-lisp/generator-tests.el +++ b/test/lisp/emacs-lisp/generator-tests.el @@ -22,6 +22,10 @@ ;;; Commentary: +;; Unit tests for generator.el. + +;;; Code: + (require 'generator) (require 'ert) (require 'cl-lib) @@ -38,8 +42,7 @@ `cps-testcase' defines an ERT testcase called NAME that evaluates BODY twice: once using ordinary `eval' and once using lambda-generators. The test ensures that the two forms produce -identical output. -" +identical output." `(progn (ert-deftest ,name () (should @@ -302,3 +305,5 @@ identical output. (lambda (it) (- it)) (1+ it))))))) -2))) + +;;; generator-tests.el ends here commit d767418b76818e4e83bf19cc08307c1329144c13 Author: Philipp Stephani Date: Sat Jul 25 23:23:19 2020 +0200 Backport: Make checking for liveness of global values more precise. We can't just use a hash lookup because a global and a local reference might refer to the same Lisp object. * src/emacs-module.c (module_free_global_ref): More precise check for global liveness. (cherry picked from commit 9f01ce6327af886f26399924a9aadf16cdd4fd9f) diff --git a/src/emacs-module.c b/src/emacs-module.c index 099a6a3cf2..a90a9765db 100644 --- a/src/emacs-module.c +++ b/src/emacs-module.c @@ -448,6 +448,14 @@ module_free_global_ref (emacs_env *env, emacs_value ref) Lisp_Object obj = value_to_lisp (ref); ptrdiff_t i = hash_lookup (h, obj, NULL); + if (module_assertions) + { + ptrdiff_t n = 0; + if (! module_global_reference_p (ref, &n)) + module_abort ("Global value was not found in list of %"pD"d globals", + n); + } + if (i >= 0) { Lisp_Object value = HASH_VALUE (h, i); @@ -456,11 +464,6 @@ module_free_global_ref (emacs_env *env, emacs_value ref) if (--ref->refcount == 0) hash_remove_from_table (h, obj); } - else if (module_assertions) - { - module_abort ("Global value was not found in list of %"pD"d globals", - h->count); - } } static enum emacs_funcall_exit commit 8c94ca94dc2772e5c651de6cf46bfffc388234d5 Author: Philipp Stephani Date: Sat Jul 25 23:04:05 2020 +0200 Backport: Fix subtle bug when checking liveness of module values. We can't simply look up the Lisp object in the global reference table because an invalid local and a valid global reference might refer to the same object. Instead, we have to test the address of the global reference against the stored references. * src/emacs-module.c (module_global_reference_p): New helper function. (value_to_lisp): Use it. (cherry picked from commit 6355a3ec62f43c9b99d483982ff851d32dd78891) diff --git a/src/emacs-module.c b/src/emacs-module.c index 4269b0ba2a..099a6a3cf2 100644 --- a/src/emacs-module.c +++ b/src/emacs-module.c @@ -78,6 +78,7 @@ To add a new module function, proceed as follows: #include "emacs-module.h" #include +#include #include #include #include @@ -380,6 +381,28 @@ XMODULE_GLOBAL_REFERENCE (Lisp_Object o) return XUNTAG (o, Lisp_Vectorlike, struct module_global_reference); } +/* Returns whether V is a global reference. Only used to check module + assertions. If V is not a global reference, increment *N by the + number of global references (for debugging output). */ + +static bool +module_global_reference_p (emacs_value v, ptrdiff_t *n) +{ + struct Lisp_Hash_Table *h = XHASH_TABLE (Vmodule_refs_hash); + /* Note that we can't use `hash_lookup' because V might be a local + reference that's identical to some global reference. */ + for (ptrdiff_t i = 0; i < HASH_TABLE_SIZE (h); ++i) + { + if (!EQ (HASH_KEY (h, i), Qunbound) + && &XMODULE_GLOBAL_REFERENCE (HASH_VALUE (h, i))->value == v) + return true; + } + /* Only used for debugging, so we don't care about overflow, just + make sure the operation is defined. */ + INT_ADD_WRAPV (*n, h->count, n); + return false; +} + static emacs_value module_make_global_ref (emacs_env *env, emacs_value ref) { @@ -1217,10 +1240,8 @@ value_to_lisp (emacs_value v) ++num_environments; } /* Also check global values. */ - struct Lisp_Hash_Table *h = XHASH_TABLE (Vmodule_refs_hash); - if (hash_lookup (h, v->v, NULL) != -1) + if (module_global_reference_p (v, &num_values)) goto ok; - INT_ADD_WRAPV (num_values, h->count, &num_values); module_abort (("Emacs value not found in %"pD"d values " "of %"pD"d environments"), num_values, num_environments); commit 8ecca2f09f6bc387412f258c4fc4e3ddf807b2b3 Author: Philipp Stephani Date: Thu Jul 23 13:48:43 2020 +0200 Backport: Fix memory leak for global module objects (Bug#42482). Instead of storing the global values in a global 'emacs_value_storage' object, store them as hash values alongside the reference counts. That way the garbage collector takes care of cleaning them up. * src/emacs-module.c (global_storage): Remove. (struct module_global_reference): New pseudovector type. (XMODULE_GLOBAL_REFERENCE): New helper function. (module_make_global_ref, module_free_global_ref): Use 'module_global_reference' struct for global reference values. (value_to_lisp, module_handle_nonlocal_exit): Adapt to deletion of 'global_storage'. (cherry picked from commit 5c5eb9790898e4ab10bcbbdb6871947ed3018569) diff --git a/src/emacs-module.c b/src/emacs-module.c index 911b82b8a1..4269b0ba2a 100644 --- a/src/emacs-module.c +++ b/src/emacs-module.c @@ -159,11 +159,11 @@ struct emacs_value_frame /* A structure that holds an initial frame (so that the first local values require no dynamic allocation) and keeps track of the current frame. */ -static struct emacs_value_storage +struct emacs_value_storage { struct emacs_value_frame initial; struct emacs_value_frame *current; -} global_storage; +}; /* Private runtime and environment members. */ @@ -351,10 +351,35 @@ module_get_environment (struct emacs_runtime *ert) } /* To make global refs (GC-protected global values) keep a hash that - maps global Lisp objects to reference counts. */ + maps global Lisp objects to 'struct module_global_reference' + objects. We store the 'emacs_value' in the hash table so that it + is automatically garbage-collected (Bug#42482). */ static Lisp_Object Vmodule_refs_hash; +/* Pseudovector type for global references. The pseudovector tag is + PVEC_OTHER since these values are never printed and don't need to + be special-cased for garbage collection. */ + +struct module_global_reference { + /* Pseudovector header, must come first. */ + union vectorlike_header header; + + /* Holds the emacs_value for the object. The Lisp_Object stored + therein must be the same as the hash key. */ + struct emacs_value_tag value; + + /* Reference count, always positive. */ + ptrdiff_t refcount; +}; + +static struct module_global_reference * +XMODULE_GLOBAL_REFERENCE (Lisp_Object o) +{ + eassert (PSEUDOVECTORP (o, PVEC_OTHER)); + return XUNTAG (o, Lisp_Vectorlike, struct module_global_reference); +} + static emacs_value module_make_global_ref (emacs_env *env, emacs_value ref) { @@ -363,21 +388,30 @@ module_make_global_ref (emacs_env *env, emacs_value ref) Lisp_Object new_obj = value_to_lisp (ref), hashcode; ptrdiff_t i = hash_lookup (h, new_obj, &hashcode); + /* Note: This approach requires the garbage collector to never move + objects. */ + if (i >= 0) { Lisp_Object value = HASH_VALUE (h, i); - EMACS_INT refcount = XFIXNAT (value) + 1; - if (MOST_POSITIVE_FIXNUM < refcount) + struct module_global_reference *ref = XMODULE_GLOBAL_REFERENCE (value); + bool overflow = INT_ADD_WRAPV (ref->refcount, 1, &ref->refcount); + if (overflow) overflow_error (); - value = make_fixed_natnum (refcount); - set_hash_value_slot (h, i, value); + return &ref->value; } else { - hash_put (h, new_obj, make_fixed_natnum (1), hashcode); + struct module_global_reference *ref + = ALLOCATE_PLAIN_PSEUDOVECTOR (struct module_global_reference, + PVEC_OTHER); + ref->value.v = new_obj; + ref->refcount = 1; + Lisp_Object value; + XSETPSEUDOVECTOR (value, ref, PVEC_OTHER); + hash_put (h, new_obj, value, hashcode); + return &ref->value; } - - return allocate_emacs_value (env, &global_storage, new_obj); } static void @@ -393,23 +427,16 @@ module_free_global_ref (emacs_env *env, emacs_value ref) if (i >= 0) { - EMACS_INT refcount = XFIXNAT (HASH_VALUE (h, i)) - 1; - if (refcount > 0) - set_hash_value_slot (h, i, make_fixed_natnum (refcount)); - else - { - eassert (refcount == 0); - hash_remove_from_table (h, obj); - } + Lisp_Object value = HASH_VALUE (h, i); + struct module_global_reference *ref = XMODULE_GLOBAL_REFERENCE (value); + eassert (0 < ref->refcount); + if (--ref->refcount == 0) + hash_remove_from_table (h, obj); } - - if (module_assertions) + else if (module_assertions) { - ptrdiff_t count = 0; - if (value_storage_contains_p (&global_storage, ref, &count)) - return; module_abort ("Global value was not found in list of %"pD"d globals", - count); + h->count); } } @@ -1190,8 +1217,10 @@ value_to_lisp (emacs_value v) ++num_environments; } /* Also check global values. */ - if (value_storage_contains_p (&global_storage, v, &num_values)) + struct Lisp_Hash_Table *h = XHASH_TABLE (Vmodule_refs_hash); + if (hash_lookup (h, v->v, NULL) != -1) goto ok; + INT_ADD_WRAPV (num_values, h->count, &num_values); module_abort (("Emacs value not found in %"pD"d values " "of %"pD"d environments"), num_values, num_environments); @@ -1404,10 +1433,7 @@ module_handle_nonlocal_exit (emacs_env *env, enum nonlocal_exit type, void init_module_assertions (bool enable) { - /* If enabling module assertions, use a hidden environment for - storing the globals. This environment is never freed. */ module_assertions = enable; - initialize_storage (&global_storage); } /* Return whether STORAGE contains VALUE. Used to check module commit e12d1fbc1568cc90b3b99bb6b9f244e5d10e97a4 Author: Nicolas Petton Date: Wed Jul 29 22:50:01 2020 +0200 ; ChangeLog.3 and etc/AUTHORS fixes diff --git a/ChangeLog.3 b/ChangeLog.3 index 4aa52a762f..c8dd40b5eb 100644 --- a/ChangeLog.3 +++ b/ChangeLog.3 @@ -58779,7 +58779,7 @@ * lisp/net/soap-client.el (soap-type-of): Optimize for Emacs≥26 -2018-07-17 Alex +2018-07-17 Alexander Gramiak Remove menu name from emacs-lisp-mode-map (Bug#27114) diff --git a/etc/AUTHORS b/etc/AUTHORS index 2d4e073120..848d9e07f9 100644 --- a/etc/AUTHORS +++ b/etc/AUTHORS @@ -127,18 +127,84 @@ Albert L. Ting: changed gnus-group.el mail-hist.el Aleksei Gusev: changed progmodes/compile.el -Alexandru Harsanyi: changed soap-client.el soap-inspect.el emacs3.py - vc-hooks.el vc.el xml.el +Alexander Becher: changed vc-annotate.el -Alex Gramiak: wrote ansi-color.el conf-mode-tests.el cus-theme.el - erc-compat.el erc-hecomplete.el erc-join.el erc-lang.el erc-ring.el - erc.el gnus-mlspl.el master.el soap-client.el soap-inspect.el - spam-stat.el sql.el vc-git.el which-func.el +Alexander Gramiak: changed w32term.c xterm.c nsterm.m dispextern.h + xdisp.c frame.c image.c nsgui.h w32gui.h xfns.c frame.el termhooks.h + w32fns.c w32term.h faces.el nsterm.h xfaces.c xterm.h frame.h xfont.c + configure.ac and 65 other files + +Alexander Haeckel: changed getset.el + +Alexander Klimov: changed files.el calc-graph.el files.texi man.el rx.el + sendmail.el + +Alexander Kreuzer: changed nnrss.el + +Alexander Kuleshov: changed dns-mode.el files.texi image-mode.el + keyboard.c ld-script.el xdisp.c + +Alexander L. Belikoff: wrote erc.el + +Alexander Pohoyda: co-wrote mail/rmailmm.el +and changed rmailsum.el man.el rmail.el sendmail.el + +Alexander Shopov: changed code-pages.el + +Alexander Vorobiev: changed org-compat.el + +Alexander Zhuckov: changed ebrowse.c + +Alexandre Garreau: changed message.el + +Alexandre Julliard: wrote vc-git.el +and changed vc.el ewoc.el + +Alexandre Oliva: wrote gnus-mlspl.el +and changed unexelf.c format.el iris4d.h iris5d.h regex.c unexsgi.c + +Alexandre Veyrenc: changed fr-refcard.tex + +Alexandru Harsanyi: wrote soap-client.el soap-inspect.el +and changed emacs3.py vc-hooks.el vc.el xml.el + +Alex Branham: changed checkdoc.el bibtex.el em-rebind.el esh-util.el + indent.el js.el lpr.el message.el subr.el text.texi .dir-locals.el + auth-source-pass.el bug-reference.el comint.el conf-mode-tests.el + conf-mode.el dired-x.el dired.el ediff-diff.el ediff-help.el + ediff-hook.el and 41 other files + +Alex Coventry: changed files.el + +Alex Dunn: changed subr-tests.el subr.el + +Alexei Khlebnikov: changed autorevert.el vc-git.el + +Alex Gramiak: changed prolog.el terminal.c + +Alex Kosorukoff: changed org-capture.el + +Alex Murray: changed erc-desktop-notifications.el network-stream.el + +Alex Ott: changed TUTORIAL.ru ede/files.el ru-refcard.tex base.el + cedet-files.el cpp-root.el ede.el ede/generic.el idle.el ispell.el + semantic/format.el + +Alex Reed: changed verilog-mode.el + +Alex Rezinsky: wrote which-func.el + +Alex Schroeder: wrote ansi-color.el cus-theme.el erc-compat.el + erc-hecomplete.el erc-join.el erc-lang.el erc-ring.el master.el + spam-stat.el sql.el and co-wrote longlines.el mail/rmailmm.el -and changed erc-track.el erc-button.el w32term.c xterm.c erc-stamp.el - nsterm.m xdisp.c dispextern.h frame.c image.c nsgui.h w32gui.h xfns.c - erc-match.el frame.el termhooks.h w32fns.c Makefile TUTORIAL.ru - erc-autoaway.el erc-nickserv.el and 215 other files +and changed erc.el erc-track.el erc-button.el erc-stamp.el erc-match.el + erc-autoaway.el erc-nickserv.el rcirc.texi Makefile erc-autojoin.el + erc-fill.el erc-pcomplete.el erc-complete.el erc-ibuffer.el + erc-members.el rmail.el comint.el custom.el erc-bbdb.el erc-chess.el + erc-ezbounce.el and 35 other files + +Alex Shinn: changed files.el Alfred Correira: changed generic-x.el @@ -700,7 +766,7 @@ and co-wrote longlines.el tango-dark-theme.el tango-theme.el and changed simple.el display.texi xdisp.c files.el frames.texi cus-edit.el files.texi custom.el subr.el text.texi faces.el keyboard.c startup.el package.el misc.texi emacs.texi modes.texi mouse.el - custom.texi image.c window.el and 933 other files + custom.texi image.c window.el and 934 other files Chris Chase: co-wrote idlw-shell.el idlwave.el @@ -1381,7 +1447,7 @@ Eli Zaretskii: wrote [bidirectional display in xdisp.c] and changed xdisp.c msdos.c w32.c display.texi w32fns.c simple.el files.el fileio.c keyboard.c w32term.c emacs.c w32proc.c files.texi text.texi dispnew.c frames.texi lisp.h dispextern.h window.c process.c - term.c and 1191 other files + term.c and 1192 other files Emanuele Giaquinta: changed configure.ac rxvt.el charset.c etags.c fontset.c frame.el gnus-faq.texi loadup.el lread.c sh-script.el @@ -1466,7 +1532,7 @@ and changed c.srt ede.texi info.el rmail.el speedbspec.el cedet.el ede-autoconf.srt ede-make.srt eieio.texi gud.el sb-dir-minus.xpm sb-dir-plus.xpm sb-dir.xpm sb-mail.xpm sb-pg-minus.xpm sb-pg-plus.xpm sb-pg.xpm sb-tag-gt.xpm sb-tag-minus.xpm sb-tag-plus.xpm - and 50 other files + and 51 other files Eric Schulte: wrote ob-asymptote.el ob-awk.el ob-calc.el ob-comint.el ob-coq.el ob-css.el ob-ditaa.el ob-dot.el ob-emacs-lisp.el ob-eval.el @@ -1793,7 +1859,7 @@ and changed configure.ac Makefile.in src/Makefile.in calendar.el diary-lib.el lisp/Makefile.in files.el make-dist rmail.el progmodes/f90.el bytecomp.el simple.el authors.el admin.el startup.el emacs.texi misc/Makefile.in display.texi lib-src/Makefile.in ack.texi - subr.el and 1760 other files + subr.el and 1761 other files Glynn Clements: wrote gamegrid.el snake.el tetris.el @@ -1925,7 +1991,7 @@ Hideki Iwamoto: changed etags.c Hiroshi Fujishima: changed efaq.texi gnus-score.el mail-source.el spam-stat.el -Hiroshi Nakano: changed ralloc.c unexelf.c +Hiroshi Nakano: changed unexelf.c ralloc.c Hiroshi Oota: changed coding.c @@ -2085,6 +2151,8 @@ Jaeyoun Chung: changed hangul3.el hanja3.el gnus-mule.el hangul.el Jakub-W: changed calculator.el +J. Alexander Branham: wrote conf-mode-tests.el + Jambunathan K: wrote ox-odt.el and co-wrote ox-html.el and changed org-lparse.el org.el org.texi ox.el icomplete.el @@ -2121,7 +2189,7 @@ James Wright: changed em-unix.el Jamie Zawinski: wrote mailabbrev.el tar-mode.el and co-wrote byte-opt.el byte-run.el bytecomp.el disass.el font-lock.el -and changed bytecode.c mail-extr.el subr.el +and changed mail-extr.el subr.el bytecode.c Jan Beich: changed configure.ac mml-smime.el @@ -2578,7 +2646,7 @@ and changed xterm.c xfns.c keyboard.c screen.c dispnew.c xdisp.c window.c process.c alloc.c buffer.h files.el screen.el insdel.c emacs.c and 106 other files -Joseph M. Kelsey: changed fileio.c skeleton.el +Joseph M. Kelsey: changed skeleton.el fileio.c Josh Elsasser: changed configure.ac @@ -2652,7 +2720,7 @@ Juri Linkov: wrote files-x.el misearch.el replace-tests.el tab-bar.el and changed isearch.el info.el simple.el replace.el dired.el dired-aux.el progmodes/grep.el image-mode.el progmodes/compile.el startup.el subr.el diff-mode.el files.el menu-bar.el faces.el display.texi bindings.el - desktop.el comint.el minibuffer.el search.texi and 419 other files + desktop.el comint.el minibuffer.el search.texi and 420 other files Jussi Lahdenniemi: changed w32fns.c ms-w32.h msdos.texi w32.c w32.h w32console.c w32heap.c w32inevt.c w32term.h @@ -2676,7 +2744,7 @@ and co-wrote longlines.el tramp-sh.el tramp.el and changed message.el gnus-agent.el gnus-sum.el files.el nnmail.el tramp.texi nntp.el gnus.el simple.el ange-ftp.el dired.el paragraphs.el bindings.el files.texi gnus-art.el gnus-group.el man.el INSTALL - Makefile.in crisp.el fileio.c and 44 other files + Makefile.in crisp.el fileio.c and 45 other files Kailash C. Chowksey: changed HELLO ind-util.el kannada.el knd-util.el lisp/Makefile.in loadup.el @@ -3080,7 +3148,7 @@ Luc Teirlinck: wrote help-at-pt.el and changed files.el autorevert.el cus-edit.el subr.el simple.el frames.texi startup.el display.texi files.texi dired.el comint.el modes.texi custom.texi emacs.texi fns.c frame.el ielm.el minibuf.texi - variables.texi buffers.texi commands.texi and 211 other files + variables.texi buffers.texi commands.texi and 212 other files Ludovic Courtès: wrote nnregistry.el and changed configure.ac gnus.texi loadup.el @@ -3505,7 +3573,7 @@ Michael Olson: changed erc.el erc-backend.el Makefile erc-track.el erc-log.el erc-stamp.el erc-autoaway.el erc-dcc.el erc-goodies.el erc-list.el erc-compat.el erc-identd.el erc.texi ERC-NEWS erc-bbdb.el erc-match.el erc-notify.el erc-ibuffer.el erc-services.el remember.el - erc-button.el and 54 other files + erc-button.el and 55 other files Michael Orlitzky: changed tex-mode.el @@ -3924,7 +3992,7 @@ and co-wrote cal-dst.el and changed lisp.h configure.ac alloc.c process.c fileio.c editfns.c xdisp.c sysdep.c image.c keyboard.c emacs.c data.c fns.c lread.c xterm.c eval.c callproc.c Makefile.in frame.c buffer.c gnulib-comp.m4 - and 1822 other files + and 1824 other files Paul Fisher: changed fns.c @@ -4357,7 +4425,7 @@ and changed process.c ftfont.c gtkutil.c processes.texi vc-git.el configure.ac font.c network-stream.el nsm.el process-tests.el xfns.c custom.texi dispextern.h files.texi ftcrfont.c gnus-icalendar.el gnutls.el gtkutil.h network-stream-tests.el nsterm.m text.texi - and 92 other files + and 93 other files Robert Thorpe: changed cus-start.el indent.el @@ -4379,8 +4447,8 @@ Rodrigo Real: changed pt-br-refcard.tex Roger Breitenstein: changed smtpmail.el -Roland B. Roberts: changed buffer.h callproc.c dired.c files.el - gnus-group.el gnus-sum.el process.c sort.el sysdep.c systty.h +Roland B. Roberts: changed gnus-group.el gnus-sum.el buffer.h callproc.c + dired.c files.el process.c sort.el sysdep.c systty.h Roland Kaufmann: changed ox.el @@ -4644,7 +4712,7 @@ Shun-ichi Goto: changed url-http.el Shyam Karanatt: changed image-mode.el -Sidney Markowitz: changed doctor.el nsmenu.m +Sidney Markowitz: changed nsmenu.m doctor.el Sigbjorn Finne: changed gnus-srvr.el @@ -4767,7 +4835,7 @@ and changed wdired.el todo-mode.texi diary-lib.el wdired-tests.el dired-tests.el doc-view.el files.el minibuffer.el dired.el frames.texi hl-line.el info.el menu-bar.el mouse.el otodo-mode.el subr.el .gitattributes TUTORIAL allout.el artist.el compile.texi - and 44 other files + and 45 other files Stephen C. Gilardi: changed configure.ac @@ -4939,7 +5007,7 @@ Teodor Zlatanov: wrote auth-source.el gnus-registry.el gnus-tests.el and changed spam.el gnus.el nnimap.el gnus.texi gnutls.c gnus-sum.el auth.texi cfengine.el gnus-sync.el gnus-util.el gnus-start.el netrc.el gnutls.h message.el spam-stat.el encrypt.el mail-source.el nnir.el - nnmail.el auth-source-tests.el configure.ac and 119 other files + nnmail.el auth-source-tests.el configure.ac and 120 other files Terje Rosten: changed xfns.c version.el xterm.c xterm.h @@ -5140,7 +5208,7 @@ and co-wrote package.el tcl.el and changed data.c lisp.h js.el buffer.c data-tests.el alloc.c css-mode.el js-tests.el mhtml-mode.el process.c window.c editfns.c fns.c keyboard.c keymap.c lread.c makefile.el xfns.c bytecode.c cmds.c - configure.ac and 206 other files + configure.ac and 208 other files Tom Willemse: changed elec-pair.el package.el perl-mode.el prog-mode.el progmodes/python.el simple.el @@ -5239,6 +5307,8 @@ Valentin Gatien-Baron: changed emacs-module.c Valentin Wüstholz: changed org.el +Valery Alexeev: changed cyril-util.el cyrillic.el + Van L: changed subr.el Vasilij Schneidermann: changed cus-start.el eww.el cc-mode.el @@ -5298,6 +5368,8 @@ and changed erc-backend.el erc.el erc-services.el hexl.el emacs.c erc-button.el erc-capab.el erc-join.el htmlfontify.texi sh-script.el xterm.c xterm.h +Vladimir Alexiev: changed arc-mode.el nnvirtual.el tmm.el + Vladimir Kazanov: changed java.srt Vladimir Lomov: changed ox-html.el @@ -5402,9 +5474,9 @@ and changed configure.ac gmalloc.c gnus-agent.el image-mode.el man.el Wolfgang Lux: changed nsterm.m keyboard.c Wolfgang Rupprecht: wrote float-sup.el floatfns.c sup-mouse.el -and changed process.c alloc.c callint.c config.in configure.ac data.c - fns.c lisp-mode.el lisp.h loadup.el lread.c net-utils.el nntp.el - print.c sort.el +and changed process.c config.in configure.ac net-utils.el nntp.el alloc.c + callint.c data.c fns.c lisp-mode.el lisp.h loadup.el lread.c print.c + sort.el Wolfgang Scherer: changed vc-cvs.el vc-dir.el vc-svn.el vc.el pcvs.el commit 748f0d4bc65b601dd05077d26361eda35289778f Author: Nicolas Petton Date: Wed Jul 29 22:48:14 2020 +0200 * admin/authors.el (authors-aliases): Remove a faulty regexp. diff --git a/admin/authors.el b/admin/authors.el index acaa7dfaa7..a418efea44 100644 --- a/admin/authors.el +++ b/admin/authors.el @@ -212,7 +212,6 @@ files.") ("Carlos Pita" "memeplex") ("Vinicius Jose Latorre" "viniciusjl") ("Gaby Launay" "galaunay") - ("Alex Gramiak" "alex") ("Dick R. Chiang" "dickmao") ) "Alist of author aliases.