emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v2 15/16] Remove local_flags array in struct buffer


From: Spencer Baugh
Subject: [PATCH v2 15/16] Remove local_flags array in struct buffer
Date: Sat, 21 Nov 2020 21:34:44 -0500

Previously, we used the local_flags array in each struct buffer to
know which field was buffer-local.  Now, we just set the field to
Qunbound if it's not buffer-local, and fall back to the corresponding
field in buffer_defaults.  So we can delete the local_flags array.

Because of this fallback logic, we now no longer need to update all
struct buffer objects whenever we set a value in buffer_defaults,
which provides a substantial performance gain.

The fallback logic applies for all accesses to Lisp_Object fields in
struct buffer, but it should now be very fast: It's one branch on
already-loaded data to check if it's equal to the Qunbound constant.

In these changes, we just add the Qunbound fall back logic, delete
local_flags, and delete several loops which updated all buffers when
buffer_defaults changed.

We also delete some calls to reset_buffer_local_variables on
buffer_defaults and buffer_local_symbols.  Since resetting a
buffer-local now requires setting it to Qunbound, those would set
fields on buffer_defaults and buffer_local_symbols.  Fortunately, the
calls are not necessary anymore.
---
 src/buffer.c           | 119 +++++++++++++++++++----------------------
 src/buffer.h           |  54 ++++++++-----------
 src/category.c         |   4 --
 src/data.c             |  53 +-----------------
 src/pdumper.c          |   3 --
 src/syntax.c           |   4 --
 test/src/data-tests.el |   1 -
 7 files changed, 79 insertions(+), 159 deletions(-)

diff --git a/src/buffer.c b/src/buffer.c
index 7e0b19e19a..b565d232f6 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -55,8 +55,7 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
    defined with DEFVAR_PER_BUFFER, that have special slots in each buffer.
    The default value occupies the same slot in this structure
    as an individual buffer's value occupies in that buffer.
-   Setting the default value also goes through the alist of buffers
-   and stores into each buffer that does not say it has a local value.  */
+*/
 
 struct buffer buffer_defaults;
 
@@ -89,6 +88,8 @@ struct buffer buffer_local_symbols;
 #define PER_BUFFER_SYMBOL(OFFSET) \
       (*(Lisp_Object *)((OFFSET) + (char *) &buffer_local_symbols))
 
+#define BVAR_DIRECT(buf, field) ((buf)->field ## _)
+
 /* Maximum length of an overlay vector.  */
 #define OVERLAY_COUNT_MAX                                              \
   ((ptrdiff_t) min (MOST_POSITIVE_FIXNUM,                              \
@@ -535,8 +536,6 @@ even if it is dead.  The return value is never nil.  */)
   /* No one shows us now.  */
   b->window_count = 0;
 
-  memset (&b->local_flags, 0, sizeof (b->local_flags));
-
   BUF_GAP_SIZE (b) = 20;
   block_input ();
   /* We allocate extra 1-byte at the tail and keep it always '\0' for
@@ -697,8 +696,6 @@ clone_per_buffer_values (struct buffer *from, struct buffer 
*to)
       set_per_buffer_value (to, offset, obj);
     }
 
-  memcpy (to->local_flags, from->local_flags, sizeof to->local_flags);
-
   set_buffer_overlays_before (to, copy_overlays (to, from->overlays_before));
   set_buffer_overlays_after (to, copy_overlays (to, from->overlays_after));
 
@@ -800,8 +797,6 @@ CLONE nil means the indirect buffer's state is reset to 
default values.  */)
   /* Always -1 for an indirect buffer.  */
   b->window_count = -1;
 
-  memset (&b->local_flags, 0, sizeof (b->local_flags));
-
   b->pt = b->base_buffer->pt;
   b->begv = b->base_buffer->begv;
   b->zv = b->base_buffer->zv;
@@ -963,8 +958,6 @@ reset_buffer (register struct buffer *b)
   bset_display_count (b, make_fixnum (0));
   bset_display_time (b, Qnil);
   bset_enable_multibyte_characters (b, Qt);
-  bset_cursor_type (b, BVAR (&buffer_defaults, cursor_type));
-  bset_extra_line_spacing (b, BVAR (&buffer_defaults, extra_line_spacing));
 
   b->display_error_modiff = 0;
 }
@@ -1238,7 +1231,7 @@ buffer_local_value (Lisp_Object variable, Lisp_Object 
buffer)
       {
        lispfwd fwd = SYMBOL_FWD (sym);
        if (BUFFER_OBJFWDP (fwd))
-         result = per_buffer_value (buf, XBUFFER_OBJFWD (fwd)->offset);
+          result = bvar_get (buf, XBUFFER_OBJFWD (fwd)->offset);
        else
          result = Fdefault_value (variable);
        break;
@@ -5163,49 +5156,49 @@ init_buffer_once (void)
   bset_last_selected_window (&buffer_local_flags, make_fixnum (0));
 
   idx = 1;
-  XSETFASTINT (BVAR (&buffer_local_flags, mode_line_format), idx); ++idx;
-  XSETFASTINT (BVAR (&buffer_local_flags, abbrev_mode), idx); ++idx;
-  XSETFASTINT (BVAR (&buffer_local_flags, overwrite_mode), idx); ++idx;
-  XSETFASTINT (BVAR (&buffer_local_flags, case_fold_search), idx); ++idx;
-  XSETFASTINT (BVAR (&buffer_local_flags, auto_fill_function), idx); ++idx;
-  XSETFASTINT (BVAR (&buffer_local_flags, selective_display), idx); ++idx;
-  XSETFASTINT (BVAR (&buffer_local_flags, selective_display_ellipses), idx); 
++idx;
-  XSETFASTINT (BVAR (&buffer_local_flags, tab_width), idx); ++idx;
-  XSETFASTINT (BVAR (&buffer_local_flags, truncate_lines), idx); ++idx;
-  XSETFASTINT (BVAR (&buffer_local_flags, word_wrap), idx); ++idx;
-  XSETFASTINT (BVAR (&buffer_local_flags, ctl_arrow), idx); ++idx;
-  XSETFASTINT (BVAR (&buffer_local_flags, fill_column), idx); ++idx;
-  XSETFASTINT (BVAR (&buffer_local_flags, left_margin), idx); ++idx;
-  XSETFASTINT (BVAR (&buffer_local_flags, abbrev_table), idx); ++idx;
-  XSETFASTINT (BVAR (&buffer_local_flags, display_table), idx); ++idx;
-  XSETFASTINT (BVAR (&buffer_local_flags, syntax_table), idx); ++idx;
-  XSETFASTINT (BVAR (&buffer_local_flags, cache_long_scans), idx); ++idx;
-  XSETFASTINT (BVAR (&buffer_local_flags, category_table), idx); ++idx;
-  XSETFASTINT (BVAR (&buffer_local_flags, bidi_display_reordering), idx); 
++idx;
-  XSETFASTINT (BVAR (&buffer_local_flags, bidi_paragraph_direction), idx); 
++idx;
-  XSETFASTINT (BVAR (&buffer_local_flags, bidi_paragraph_separate_re), idx); 
++idx;
-  XSETFASTINT (BVAR (&buffer_local_flags, bidi_paragraph_start_re), idx); 
++idx;
-  XSETFASTINT (BVAR (&buffer_local_flags, buffer_file_coding_system), idx); 
++idx;
-  XSETFASTINT (BVAR (&buffer_local_flags, left_margin_cols), idx); ++idx;
-  XSETFASTINT (BVAR (&buffer_local_flags, right_margin_cols), idx); ++idx;
-  XSETFASTINT (BVAR (&buffer_local_flags, left_fringe_width), idx); ++idx;
-  XSETFASTINT (BVAR (&buffer_local_flags, right_fringe_width), idx); ++idx;
-  XSETFASTINT (BVAR (&buffer_local_flags, fringes_outside_margins), idx); 
++idx;
-  XSETFASTINT (BVAR (&buffer_local_flags, scroll_bar_width), idx); ++idx;
-  XSETFASTINT (BVAR (&buffer_local_flags, scroll_bar_height), idx); ++idx;
-  XSETFASTINT (BVAR (&buffer_local_flags, vertical_scroll_bar_type), idx); 
++idx;
-  XSETFASTINT (BVAR (&buffer_local_flags, horizontal_scroll_bar_type), idx); 
++idx;
-  XSETFASTINT (BVAR (&buffer_local_flags, indicate_empty_lines), idx); ++idx;
-  XSETFASTINT (BVAR (&buffer_local_flags, indicate_buffer_boundaries), idx); 
++idx;
-  XSETFASTINT (BVAR (&buffer_local_flags, fringe_indicator_alist), idx); ++idx;
-  XSETFASTINT (BVAR (&buffer_local_flags, fringe_cursor_alist), idx); ++idx;
-  XSETFASTINT (BVAR (&buffer_local_flags, scroll_up_aggressively), idx); ++idx;
-  XSETFASTINT (BVAR (&buffer_local_flags, scroll_down_aggressively), idx); 
++idx;
-  XSETFASTINT (BVAR (&buffer_local_flags, header_line_format), idx); ++idx;
-  XSETFASTINT (BVAR (&buffer_local_flags, tab_line_format), idx); ++idx;
-  XSETFASTINT (BVAR (&buffer_local_flags, cursor_type), idx); ++idx;
-  XSETFASTINT (BVAR (&buffer_local_flags, extra_line_spacing), idx); ++idx;
-  XSETFASTINT (BVAR (&buffer_local_flags, cursor_in_non_selected_windows), 
idx); ++idx;
+  XSETFASTINT (BVAR_DIRECT (&buffer_local_flags, mode_line_format), idx); 
++idx;
+  XSETFASTINT (BVAR_DIRECT (&buffer_local_flags, abbrev_mode), idx); ++idx;
+  XSETFASTINT (BVAR_DIRECT (&buffer_local_flags, overwrite_mode), idx); ++idx;
+  XSETFASTINT (BVAR_DIRECT (&buffer_local_flags, case_fold_search), idx); 
++idx;
+  XSETFASTINT (BVAR_DIRECT (&buffer_local_flags, auto_fill_function), idx); 
++idx;
+  XSETFASTINT (BVAR_DIRECT (&buffer_local_flags, selective_display), idx); 
++idx;
+  XSETFASTINT (BVAR_DIRECT (&buffer_local_flags, selective_display_ellipses), 
idx); ++idx;
+  XSETFASTINT (BVAR_DIRECT (&buffer_local_flags, tab_width), idx); ++idx;
+  XSETFASTINT (BVAR_DIRECT (&buffer_local_flags, truncate_lines), idx); ++idx;
+  XSETFASTINT (BVAR_DIRECT (&buffer_local_flags, word_wrap), idx); ++idx;
+  XSETFASTINT (BVAR_DIRECT (&buffer_local_flags, ctl_arrow), idx); ++idx;
+  XSETFASTINT (BVAR_DIRECT (&buffer_local_flags, fill_column), idx); ++idx;
+  XSETFASTINT (BVAR_DIRECT (&buffer_local_flags, left_margin), idx); ++idx;
+  XSETFASTINT (BVAR_DIRECT (&buffer_local_flags, abbrev_table), idx); ++idx;
+  XSETFASTINT (BVAR_DIRECT (&buffer_local_flags, display_table), idx); ++idx;
+  XSETFASTINT (BVAR_DIRECT (&buffer_local_flags, syntax_table), idx); ++idx;
+  XSETFASTINT (BVAR_DIRECT (&buffer_local_flags, cache_long_scans), idx); 
++idx;
+  XSETFASTINT (BVAR_DIRECT (&buffer_local_flags, category_table), idx); ++idx;
+  XSETFASTINT (BVAR_DIRECT (&buffer_local_flags, bidi_display_reordering), 
idx); ++idx;
+  XSETFASTINT (BVAR_DIRECT (&buffer_local_flags, bidi_paragraph_direction), 
idx); ++idx;
+  XSETFASTINT (BVAR_DIRECT (&buffer_local_flags, bidi_paragraph_separate_re), 
idx); ++idx;
+  XSETFASTINT (BVAR_DIRECT (&buffer_local_flags, bidi_paragraph_start_re), 
idx); ++idx;
+  XSETFASTINT (BVAR_DIRECT (&buffer_local_flags, buffer_file_coding_system), 
idx); ++idx;
+  XSETFASTINT (BVAR_DIRECT (&buffer_local_flags, left_margin_cols), idx); 
++idx;
+  XSETFASTINT (BVAR_DIRECT (&buffer_local_flags, right_margin_cols), idx); 
++idx;
+  XSETFASTINT (BVAR_DIRECT (&buffer_local_flags, left_fringe_width), idx); 
++idx;
+  XSETFASTINT (BVAR_DIRECT (&buffer_local_flags, right_fringe_width), idx); 
++idx;
+  XSETFASTINT (BVAR_DIRECT (&buffer_local_flags, fringes_outside_margins), 
idx); ++idx;
+  XSETFASTINT (BVAR_DIRECT (&buffer_local_flags, scroll_bar_width), idx); 
++idx;
+  XSETFASTINT (BVAR_DIRECT (&buffer_local_flags, scroll_bar_height), idx); 
++idx;
+  XSETFASTINT (BVAR_DIRECT (&buffer_local_flags, vertical_scroll_bar_type), 
idx); ++idx;
+  XSETFASTINT (BVAR_DIRECT (&buffer_local_flags, horizontal_scroll_bar_type), 
idx); ++idx;
+  XSETFASTINT (BVAR_DIRECT (&buffer_local_flags, indicate_empty_lines), idx); 
++idx;
+  XSETFASTINT (BVAR_DIRECT (&buffer_local_flags, indicate_buffer_boundaries), 
idx); ++idx;
+  XSETFASTINT (BVAR_DIRECT (&buffer_local_flags, fringe_indicator_alist), 
idx); ++idx;
+  XSETFASTINT (BVAR_DIRECT (&buffer_local_flags, fringe_cursor_alist), idx); 
++idx;
+  XSETFASTINT (BVAR_DIRECT (&buffer_local_flags, scroll_up_aggressively), 
idx); ++idx;
+  XSETFASTINT (BVAR_DIRECT (&buffer_local_flags, scroll_down_aggressively), 
idx); ++idx;
+  XSETFASTINT (BVAR_DIRECT (&buffer_local_flags, header_line_format), idx); 
++idx;
+  XSETFASTINT (BVAR_DIRECT (&buffer_local_flags, tab_line_format), idx); ++idx;
+  XSETFASTINT (BVAR_DIRECT (&buffer_local_flags, cursor_type), idx); ++idx;
+  XSETFASTINT (BVAR_DIRECT (&buffer_local_flags, extra_line_spacing), idx); 
++idx;
+  XSETFASTINT (BVAR_DIRECT (&buffer_local_flags, 
cursor_in_non_selected_windows), idx); ++idx;
 
   /* buffer_local_flags contains no pointers, so it's safe to treat it
      as a blob for pdumper.  */
@@ -5220,11 +5213,9 @@ init_buffer_once (void)
   /* Make sure all markable slots in buffer_defaults
      are initialized reasonably, so mark_buffer won't choke.  */
   reset_buffer (&buffer_defaults);
-  eassert (NILP (BVAR (&buffer_defaults, name)));
-  reset_buffer_local_variables (&buffer_defaults, 1);
-  eassert (NILP (BVAR (&buffer_local_symbols, name)));
+  eassert (NILP (BVAR_DIRECT (&buffer_defaults, name)));
+  eassert (NILP (BVAR_DIRECT (&buffer_local_symbols, name)));
   reset_buffer (&buffer_local_symbols);
-  reset_buffer_local_variables (&buffer_local_symbols, 1);
   /* Prevent GC from getting confused.  */
   buffer_defaults.text = &buffer_defaults.own_text;
   buffer_local_symbols.text = &buffer_local_symbols.own_text;
@@ -5265,7 +5256,7 @@ init_buffer_once (void)
   set_buffer_overlays_after (&buffer_defaults, NULL);
   buffer_defaults.overlay_center = BEG;
 
-  XSETFASTINT (BVAR (&buffer_defaults, tab_width), 8);
+  XSETFASTINT (BVAR_DIRECT (&buffer_defaults, tab_width), 8);
   bset_truncate_lines (&buffer_defaults, Qnil);
   bset_word_wrap (&buffer_defaults, Qnil);
   bset_ctl_arrow (&buffer_defaults, Qt);
@@ -5279,13 +5270,13 @@ init_buffer_once (void)
 
   bset_enable_multibyte_characters (&buffer_defaults, Qt);
   bset_buffer_file_coding_system (&buffer_defaults, Qnil);
-  XSETFASTINT (BVAR (&buffer_defaults, fill_column), 70);
-  XSETFASTINT (BVAR (&buffer_defaults, left_margin), 0);
+  XSETFASTINT (BVAR_DIRECT (&buffer_defaults, fill_column), 70);
+  XSETFASTINT (BVAR_DIRECT (&buffer_defaults, left_margin), 0);
   bset_cache_long_scans (&buffer_defaults, Qt);
   bset_file_truename (&buffer_defaults, Qnil);
-  XSETFASTINT (BVAR (&buffer_defaults, display_count), 0);
-  XSETFASTINT (BVAR (&buffer_defaults, left_margin_cols), 0);
-  XSETFASTINT (BVAR (&buffer_defaults, right_margin_cols), 0);
+  XSETFASTINT (BVAR_DIRECT (&buffer_defaults, display_count), 0);
+  XSETFASTINT (BVAR_DIRECT (&buffer_defaults, left_margin_cols), 0);
+  XSETFASTINT (BVAR_DIRECT (&buffer_defaults, right_margin_cols), 0);
   bset_left_fringe_width (&buffer_defaults, Qnil);
   bset_right_fringe_width (&buffer_defaults, Qnil);
   bset_fringes_outside_margins (&buffer_defaults, Qnil);
diff --git a/src/buffer.h b/src/buffer.h
index b95379db82..ef44da0787 100644
--- a/src/buffer.h
+++ b/src/buffer.h
@@ -280,9 +280,12 @@ struct buffer_text
     bool_bf redisplay : 1;
   };
 
+INLINE Lisp_Object
+bvar_get (struct buffer *b, ptrdiff_t offset);
+
 /* Most code should use this macro to access Lisp fields in struct buffer.  */
 
-#define BVAR(buf, field) ((buf)->field ## _)
+#define BVAR(buf, field) bvar_get (buf, PER_BUFFER_VAR_OFFSET (field))
 
 /* Access a BVAR from buffer_defaults */
 #define BVAR_DEFAULT(field) (buffer_defaults.field ## _)
@@ -601,13 +604,6 @@ struct buffer
      an indirect buffer since it counts as its base buffer.  */
   int window_count;
 
-  /* A non-zero value in slot IDX means that per-buffer variable
-     with index IDX has a local value in this buffer.  The index IDX
-     for a buffer-local variable is stored in that variable's slot
-     in buffer_local_flags as a Lisp integer.  If the index is -1,
-     this means the variable is always local in all buffers.  */
-  char local_flags[MAX_PER_BUFFER_VARS];
-
   /* Set to the modtime of the visited file when read or written.
      modtime.tv_nsec == NONEXISTENT_MODTIME_NSECS means
      visited file was nonexistent.  modtime.tv_nsec ==
@@ -692,6 +688,12 @@ struct buffer
   Lisp_Object undo_list_;
 };
 
+/* Return the offset in bytes of member VAR of struct buffer
+   from the start of a buffer structure.  */
+
+#define PER_BUFFER_VAR_OFFSET(VAR) \
+  offsetof (struct buffer, VAR ## _)
+
 INLINE bool
 BUFFERP (Lisp_Object a)
 {
@@ -1110,8 +1112,7 @@ BUFFER_CHECK_INDIRECTION (struct buffer *b)
    that have special slots in each buffer.
    The default value occupies the same slot in this structure
    as an individual buffer's value occupies in that buffer.
-   Setting the default value also goes through the alist of buffers
-   and stores into each buffer that does not say it has a local value.  */
+*/
 
 extern struct buffer buffer_defaults;
 
@@ -1394,12 +1395,6 @@ OVERLAY_POSITION (Lisp_Object p)
                        Buffer-local Variables
  ***********************************************************************/
 
-/* Return the offset in bytes of member VAR of struct buffer
-   from the start of a buffer structure.  */
-
-#define PER_BUFFER_VAR_OFFSET(VAR) \
-  offsetof (struct buffer, VAR ## _)
-
 /* Used to iterate over normal Lisp_Object fields of struct buffer (all
    Lisp_Objects except undo_list).  If you add, remove, or reorder
    Lisp_Objects in a struct buffer, make sure that this is still correct.  */
@@ -1420,16 +1415,6 @@ OVERLAY_POSITION (Lisp_Object p)
 
 extern bool valid_per_buffer_idx (int);
 
-/* Set whether per-buffer variable with index IDX has a buffer-local
-   value in buffer B.  VAL zero means it hasn't.  */
-
-INLINE void
-SET_PER_BUFFER_VALUE_P (struct buffer *b, int idx, bool val)
-{
-  eassert (valid_per_buffer_idx (idx));
-  b->local_flags[idx] = val;
-}
-
 /* Return the index value of the per-buffer variable at offset OFFSET
    in the buffer structure.
 
@@ -1502,9 +1487,16 @@ BUFFER_DEFAULT_VALUE_P (int offset)
 INLINE bool
 PER_BUFFER_VALUE_P (struct buffer *b, int offset)
 {
-  int idx = PER_BUFFER_IDX (offset);
-  eassert (idx == -1 || valid_per_buffer_idx (idx));
-  return idx == -1 || b->local_flags[idx];
+  return !EQ (per_buffer_value (b, offset), Qunbound);
+}
+
+INLINE Lisp_Object
+bvar_get (struct buffer *b, ptrdiff_t offset)
+{
+  Lisp_Object val = per_buffer_value (b, offset);
+  return EQ (val, Qunbound)
+    ? per_buffer_default (offset)
+    : val;
 }
 
 /* Kill the per-buffer binding for this value, if there is one. */
@@ -1512,9 +1504,7 @@ PER_BUFFER_VALUE_P (struct buffer *b, int offset)
 INLINE void
 KILL_PER_BUFFER_VALUE (struct buffer *b, int offset)
 {
-  int idx = PER_BUFFER_IDX (offset);
-  SET_PER_BUFFER_VALUE_P (b, idx, 0);
-  set_per_buffer_value (b, offset, per_buffer_default (offset));
+  set_per_buffer_value (b, offset, Qunbound);
 }
 
 /* Downcase a character C, or make no change if that cannot be done.  */
diff --git a/src/category.c b/src/category.c
index c80571ecd4..657a2b2b65 100644
--- a/src/category.c
+++ b/src/category.c
@@ -268,12 +268,8 @@ DEFUN ("set-category-table", Fset_category_table, 
Sset_category_table, 1, 1, 0,
 Return TABLE.  */)
   (Lisp_Object table)
 {
-  int idx;
   table = check_category_table (table);
   bset_category_table (current_buffer, table);
-  /* Indicate that this buffer now has a specified category table.  */
-  idx = PER_BUFFER_VAR_IDX (category_table);
-  SET_PER_BUFFER_VALUE_P (current_buffer, idx, 1);
   return table;
 }
 
diff --git a/src/data.c b/src/data.c
index 53b08a1aa4..2e466ad207 100644
--- a/src/data.c
+++ b/src/data.c
@@ -1004,8 +1004,8 @@ do_symval_forwarding (lispfwd valcontents)
       return *XOBJFWD (valcontents)->objvar;
 
     case Lisp_Fwd_Buffer_Obj:
-      return per_buffer_value (current_buffer,
-                              XBUFFER_OBJFWD (valcontents)->offset);
+      return bvar_get (current_buffer,
+                       XBUFFER_OBJFWD (valcontents)->offset);
 
     case Lisp_Fwd_Kboard_Obj:
       /* We used to simply use current_kboard here, but from Lisp
@@ -1102,31 +1102,6 @@ store_symval_forwarding (lispfwd valcontents, 
Lisp_Object newval,
 
     case Lisp_Fwd_Obj:
       *XOBJFWD (valcontents)->objvar = newval;
-
-      /* If this variable is a default for something stored
-        in the buffer itself, such as default-fill-column,
-        find the buffers that don't have local values for it
-        and update them.  */
-      if (XOBJFWD (valcontents)->objvar > (Lisp_Object *) &buffer_defaults
-         && XOBJFWD (valcontents)->objvar < (Lisp_Object *) (&buffer_defaults 
+ 1))
-       {
-         int offset = ((char *) XOBJFWD (valcontents)->objvar
-                       - (char *) &buffer_defaults);
-         int idx = PER_BUFFER_IDX (offset);
-
-         Lisp_Object tail, buf;
-
-         if (idx <= 0)
-           break;
-
-         FOR_EACH_LIVE_BUFFER (tail, buf)
-           {
-             struct buffer *b = XBUFFER (buf);
-
-             if (! PER_BUFFER_VALUE_P (b, offset))
-               set_per_buffer_value (b, offset, newval);
-           }
-       }
       break;
 
     case Lisp_Fwd_Buffer_Obj:
@@ -1163,9 +1138,6 @@ store_symval_forwarding (lispfwd valcontents, Lisp_Object 
newval,
        if (buf == NULL)
          buf = current_buffer;
        set_per_buffer_value (buf, offset, newval);
-        int idx = PER_BUFFER_IDX (offset);
-        if (idx > 0)
-          SET_PER_BUFFER_VALUE_P (buf, idx, 1);
       }
       break;
 
@@ -1724,27 +1696,6 @@ set_default_internal (Lisp_Object symbol, Lisp_Object 
value,
            int offset = XBUFFER_OBJFWD (valcontents)->offset;
 
            set_per_buffer_default (offset, value);
-
-           /* If this variable is not always local in all buffers,
-              set it in the buffers that don't nominally have a local value.  
*/
-           if (BUFFER_DEFAULT_VALUE_P (offset))
-             {
-               Lisp_Object buf, tail;
-
-               /* Do this only in live buffers, so that if there are
-                  a lot of buffers which are dead, that doesn't slow
-                  down let-binding of variables that are
-                  automatically local when set, like
-                  case-fold-search.  This is for Lisp programs that
-                  let-bind such variables in their inner loops.  */
-               FOR_EACH_LIVE_BUFFER (tail, buf)
-                 {
-                   struct buffer *b = XBUFFER (buf);
-
-                   if (!PER_BUFFER_VALUE_P (b, offset))
-                     set_per_buffer_value (b, offset, value);
-                 }
-             }
          }
        else
           set_internal (symbol, value, Qnil, bindflag);
diff --git a/src/pdumper.c b/src/pdumper.c
index b5b4050b93..e722abda96 100644
--- a/src/pdumper.c
+++ b/src/pdumper.c
@@ -2785,9 +2785,6 @@ dump_buffer (struct dump_context *ctx, const struct 
buffer *in_buffer)
   DUMP_FIELD_COPY (out, buffer, indirections);
   DUMP_FIELD_COPY (out, buffer, window_count);
 
-  memcpy (out->local_flags,
-          &buffer->local_flags,
-          sizeof (out->local_flags));
   DUMP_FIELD_COPY (out, buffer, modtime);
   DUMP_FIELD_COPY (out, buffer, modtime_size);
   DUMP_FIELD_COPY (out, buffer, auto_save_modified);
diff --git a/src/syntax.c b/src/syntax.c
index df07809aaa..f20d5542a9 100644
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -1041,12 +1041,8 @@ DEFUN ("set-syntax-table", Fset_syntax_table, 
Sset_syntax_table, 1, 1, 0,
 One argument, a syntax table.  */)
   (Lisp_Object table)
 {
-  int idx;
   check_syntax_table (table);
   bset_syntax_table (current_buffer, table);
-  /* Indicate that this buffer now has a specified syntax table.  */
-  idx = PER_BUFFER_VAR_IDX (syntax_table);
-  SET_PER_BUFFER_VALUE_P (current_buffer, idx, 1);
   return table;
 }
 
diff --git a/test/src/data-tests.el b/test/src/data-tests.el
index 7c403870f1..cd39e6e0a4 100644
--- a/test/src/data-tests.el
+++ b/test/src/data-tests.el
@@ -424,7 +424,6 @@ comparing the subr with a much slower lisp implementation."
   (with-no-warnings (should (setq :keyword :keyword))))
 
 (ert-deftest data-tests--set-default-per-buffer ()
-  :expected-result t ;; Not fixed yet!
   ;; FIXME: Performance tests are inherently unreliable.
   ;; Using wall-clock time makes it even worse, so don't bother unless
   ;; we have the primitive to measure cpu-time.
-- 
2.28.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]