emacs-diffs
[Top][All Lists]
Advanced

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

pkg a3f99fde48 22/76: Remove Lisp_Symbol::next pointer


From: Gerd Moellmann
Subject: pkg a3f99fde48 22/76: Remove Lisp_Symbol::next pointer
Date: Fri, 21 Oct 2022 00:16:10 -0400 (EDT)

branch: pkg
commit a3f99fde48f1ed0b3969d2237654ca1d9404be14
Author: Gerd Möllmann <gerd@gnu.org>
Commit: Gerd Möllmann <gerd@gnu.org>

    Remove Lisp_Symbol::next pointer
    
    * src/lisp.h (struct Lisp_Symbol): Remvoe next field.
    (next_free_symbol, set_next_free_symbol): New.
    (set_symbol_next): Remove.
    * src/alloc.c (init_symbol): symbol_free_list done differently.
    * src/pdumper.c (dump_symbol): Don't dump Lisp_Symbol::next.
---
 src/alloc.c   | 14 ++++----------
 src/lisp.h    | 23 ++++++++++++++---------
 src/pdumper.c |  2 --
 3 files changed, 18 insertions(+), 21 deletions(-)

diff --git a/src/alloc.c b/src/alloc.c
index ba5629c9c9..c2c449cb44 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -3626,7 +3626,6 @@ init_symbol (Lisp_Object val, Lisp_Object name)
   SET_SYMBOL_VAL (p, Qunbound);
   set_symbol_function (val, Qnil);
   set_symbol_package (val, Qnil);
-  set_symbol_next (val, NULL);
   p->u.s.gcmarkbit = false;
   p->u.s.trapped_write = SYMBOL_UNTRAPPED_WRITE;
   p->u.s.declared_special = false;
@@ -3648,7 +3647,7 @@ Its value is void, and its function definition and 
property list are nil.  */)
   if (symbol_free_list)
     {
       XSETSYMBOL (val, symbol_free_list);
-      symbol_free_list = symbol_free_list->u.s.next;
+      symbol_free_list = next_free_symbol (symbol_free_list);
     }
   else
     {
@@ -4643,8 +4642,7 @@ live_symbol_holding (struct mem_node *m, void *p)
          || off == offsetof (struct Lisp_Symbol, u.s.val)
          || off == offsetof (struct Lisp_Symbol, u.s.function)
          || off == offsetof (struct Lisp_Symbol, u.s.package)
-         || off == offsetof (struct Lisp_Symbol, u.s.plist)
-         || off == offsetof (struct Lisp_Symbol, u.s.next))
+         || off == offsetof (struct Lisp_Symbol, u.s.plist))
        {
          struct Lisp_Symbol *s = p = cp -= off;
          if (!deadp (s->u.s.function))
@@ -6941,7 +6939,6 @@ process_mark_stack (ptrdiff_t base_sp)
        case Lisp_Symbol:
          {
            struct Lisp_Symbol *ptr = XBARE_SYMBOL (obj);
-         nextsym:
            if (symbol_marked_p (ptr))
              break;
            CHECK_ALLOCATED_AND_LIVE_SYMBOL ();
@@ -6979,9 +6976,6 @@ process_mark_stack (ptrdiff_t base_sp)
              set_string_marked (XSTRING (ptr->u.s.name));
            mark_interval_tree (string_intervals (ptr->u.s.name));
            /* Inner loop to mark next symbol in this bucket, if any.  */
-           po = ptr = ptr->u.s.next;
-           if (ptr)
-             goto nextsym;
          }
          break;
 
@@ -7325,7 +7319,7 @@ sweep_symbols (void)
                      time we sweep this symbol_block (bug#29066).  */
                   sym->u.s.redirect = SYMBOL_PLAINVAL;
                 }
-              sym->u.s.next = symbol_free_list;
+              set_next_free_symbol (sym, symbol_free_list);
               symbol_free_list = sym;
               symbol_free_list->u.s.function = dead_object ();
               ++this_free;
@@ -7347,7 +7341,7 @@ sweep_symbols (void)
         {
           *sprev = sblk->next;
           /* Unhook from the free list.  */
-          symbol_free_list = sblk->symbols[0].u.s.next;
+          symbol_free_list = next_free_symbol (&sblk->symbols[0]);
           lisp_free (sblk);
         }
       else
diff --git a/src/lisp.h b/src/lisp.h
index c1c0e29a3d..cea15c2cda 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -873,15 +873,26 @@ struct Lisp_Symbol
 
       /* The symbol's package, or nil.  */
       Lisp_Object package;
-
-      /* Next symbol in obarray bucket, if the symbol is interned.  */
-      struct Lisp_Symbol *next;
     } s;
     GCALIGNED_UNION_MEMBER
   } u;
 };
 verify (GCALIGNED (struct Lisp_Symbol));
 
+INLINE struct Lisp_Symbol *
+next_free_symbol (struct Lisp_Symbol *sym)
+{
+  return *(struct Lisp_Symbol **) sym;
+}
+
+INLINE void
+set_next_free_symbol (struct Lisp_Symbol *sym, struct Lisp_Symbol *free)
+{
+  *(struct Lisp_Symbol **) sym = free;
+}
+
+
+
 /* Declare a Lisp-callable function.  The MAXARGS parameter has the same
    meaning as in the DEFUN macro, and is used to construct a prototype.  */
 /* We can use the same trick as in the DEFUN macro to generate the
@@ -3869,12 +3880,6 @@ set_symbol_plist (Lisp_Object sym, Lisp_Object plist)
   XSYMBOL (sym)->u.s.plist = plist;
 }
 
-INLINE void
-set_symbol_next (Lisp_Object sym, struct Lisp_Symbol *next)
-{
-  XSYMBOL (sym)->u.s.next = next;
-}
-
 INLINE void
 make_symbol_constant (Lisp_Object sym)
 {
diff --git a/src/pdumper.c b/src/pdumper.c
index fdbdf1db10..1caa09d2b0 100644
--- a/src/pdumper.c
+++ b/src/pdumper.c
@@ -2474,8 +2474,6 @@ dump_symbol (struct dump_context *ctx,
   dump_field_lv (ctx, &out, symbol, &symbol->u.s.function, WEIGHT_NORMAL);
   dump_field_lv (ctx, &out, symbol, &symbol->u.s.package, WEIGHT_NORMAL);
   dump_field_lv (ctx, &out, symbol, &symbol->u.s.plist, WEIGHT_NORMAL);
-  dump_field_lv_rawptr (ctx, &out, symbol, &symbol->u.s.next, Lisp_Symbol,
-                        WEIGHT_STRONG);
 
   offset = dump_object_finish (ctx, &out, sizeof (out));
   dump_off aux_offset;



reply via email to

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