emacs-diffs
[Top][All Lists]
Advanced

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

scratch/no-purespace 5f48bd7f026 09/13: Pure storage removal: Remove pur


From: Pip Cet
Subject: scratch/no-purespace 5f48bd7f026 09/13: Pure storage removal: Remove purecopy hash table flag
Date: Tue, 20 Aug 2024 15:42:48 -0400 (EDT)

branch: scratch/no-purespace
commit 5f48bd7f026f8d5d0f004e995da7099c98099d41
Author: Pip Cet <pipcet@protonmail.com>
Commit: Pip Cet <pipcet@protonmail.com>

    Pure storage removal: Remove purecopy hash table flag
    
    * lisp/emacs-liqsp/comp.el (comp--jump-table-optimizable): Adjust
    comment.
    * src/category.c (hash_get_category_set):
    * src/emacs-module.c (syms_of_module):
    * src/fns.c (make_hash_table): Remove 'purecopy' flag.
    (Fmake_hash_table): Ignore ':purecopy' argument.
    * src/frame.c (make_frame):
    * src/image.c (xpm_make_color_table_h):
    * src/json.c (json_parse_object): Adjust calls to 'make_hash_table'.
    * src/lisp.h (struct Lisp_Hash_Table): Drop 'purecopy' flag.
    * src/lread.c (readevalloop):
    (read_internal_start): Adjust calls to 'make_hash_table'.
    * src/pdumper.c (dump_hash_table): Don't dump 'purecopy' flag.
    * src/print.c (print_object): Don't print 'purecopy' flag
    * src/profiler.c (export_log):
    * src/xfaces.c (syms_of_xfaces):
    * src/xterm.c (syms_of_xterm): Adjust calls to 'make_hash_table'.
---
 lisp/emacs-lisp/comp.el |  2 +-
 src/category.c          |  2 +-
 src/emacs-module.c      |  2 +-
 src/fns.c               | 22 ++++++----------------
 src/frame.c             |  2 +-
 src/image.c             |  2 +-
 src/json.c              |  2 +-
 src/lisp.h              |  6 +-----
 src/lread.c             |  8 ++++----
 src/pdumper.c           |  1 -
 src/print.c             |  3 ---
 src/profiler.c          |  2 +-
 src/xfaces.c            |  2 +-
 src/xterm.c             |  2 +-
 14 files changed, 20 insertions(+), 38 deletions(-)

diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el
index 9447f68c362..56a7250c7ec 100644
--- a/lisp/emacs-lisp/comp.el
+++ b/lisp/emacs-lisp/comp.el
@@ -1190,7 +1190,7 @@ Return value is the fall-through block name."
 (defun comp--jump-table-optimizable (jmp-table)
   "Return t if JMP-TABLE can be optimized out."
   ;; Identify LAP sequences like:
-  ;; (byte-constant #s(hash-table test eq purecopy t data (created 126 deleted 
126 changed 126)) . 24)
+  ;; (byte-constant #s(hash-table test eq data (created 126 deleted 126 
changed 126)) . 24)
   ;; (byte-switch)
   ;; (TAG 126 . 10)
   (let ((targets (hash-table-values jmp-table)))
diff --git a/src/category.c b/src/category.c
index ef29a1a681a..85a2ea0ad0f 100644
--- a/src/category.c
+++ b/src/category.c
@@ -51,7 +51,7 @@ hash_get_category_set (Lisp_Object table, Lisp_Object 
category_set)
   if (NILP (XCHAR_TABLE (table)->extras[1]))
     set_char_table_extras
       (table, 1,
-       make_hash_table (&hashtest_equal, DEFAULT_HASH_SIZE, Weak_None, false));
+       make_hash_table (&hashtest_equal, DEFAULT_HASH_SIZE, Weak_None));
   struct Lisp_Hash_Table *h = XHASH_TABLE (XCHAR_TABLE (table)->extras[1]);
   hash_hash_t hash;
   ptrdiff_t i = hash_lookup_get_hash (h, category_set, &hash);
diff --git a/src/emacs-module.c b/src/emacs-module.c
index 2c2f42e6558..b568ebbfd96 100644
--- a/src/emacs-module.c
+++ b/src/emacs-module.c
@@ -1710,7 +1710,7 @@ syms_of_module (void)
 {
   staticpro (&Vmodule_refs_hash);
   Vmodule_refs_hash
-    = make_hash_table (&hashtest_eq, DEFAULT_HASH_SIZE, Weak_None, false);
+    = make_hash_table (&hashtest_eq, DEFAULT_HASH_SIZE, Weak_None);
 
   DEFSYM (Qmodule_load_failed, "module-load-failed");
   Fput (Qmodule_load_failed, Qerror_conditions,
diff --git a/src/fns.c b/src/fns.c
index 3b2bbf501b0..f97c53c0cd5 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -4859,15 +4859,11 @@ static const hash_idx_t empty_hash_index_vector[] = 
{-1};
 
    Give the table initial capacity SIZE, 0 <= SIZE <= MOST_POSITIVE_FIXNUM.
 
-   WEAK specifies the weakness of the table.
-
-   If PURECOPY is non-nil, the table can be copied to pure storage via
-   `purecopy' when Emacs is being dumped. Such tables can no longer be
-   changed after purecopy.  */
+   WEAK specifies the weakness of the table.  */
 
 Lisp_Object
 make_hash_table (const struct hash_table_test *test, EMACS_INT size,
-                hash_table_weakness_t weak, bool purecopy)
+                hash_table_weakness_t weak)
 {
   eassert (SYMBOLP (test->name));
   eassert (0 <= size && size <= min (MOST_POSITIVE_FIXNUM, PTRDIFF_MAX));
@@ -4913,7 +4909,6 @@ make_hash_table (const struct hash_table_test *test, 
EMACS_INT size,
     }
 
   h->next_weak = NULL;
-  h->purecopy = purecopy;
   h->mutable = true;
   return make_lisp_hash_table (h);
 }
@@ -5747,11 +5742,6 @@ key, value, one of key or value, or both key and value, 
depending on
 WEAK.  WEAK t is equivalent to `key-and-value'.  Default value of WEAK
 is nil.
 
-:purecopy PURECOPY -- If PURECOPY is non-nil, the table can be copied
-to pure storage when Emacs is being dumped, making the contents of the
-table read only. Any further changes to purified tables will result
-in an error.
-
 The keywords arguments :rehash-threshold and :rehash-size are obsolete
 and ignored.
 
@@ -5778,9 +5768,9 @@ usage: (make-hash-table &rest KEYWORD-ARGS)  */)
   else
     testdesc = get_hash_table_user_test (test);
 
-  /* See if there's a `:purecopy PURECOPY' argument.  */
-  i = get_key_arg (QCpurecopy, nargs, args, used);
-  bool purecopy = i && !NILP (args[i]);
+  /* Ignore a `:purecopy PURECOPY' argument.  We used to accept those, but
+     they were only meaningful when we had the purespace. */
+  get_key_arg (QCpurecopy, nargs, args, used);
   /* See if there's a `:size SIZE' argument.  */
   i = get_key_arg (QCsize, nargs, args, used);
   Lisp_Object size_arg = i ? args[i] : Qnil;
@@ -5821,7 +5811,7 @@ usage: (make-hash-table &rest KEYWORD-ARGS)  */)
       }
 
   SAFE_FREE ();
-  return make_hash_table (testdesc, size, weak, purecopy);
+  return make_hash_table (testdesc, size, weak);
 }
 
 
diff --git a/src/frame.c b/src/frame.c
index fdf7a3149ec..2b53f3d5efc 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -1043,7 +1043,7 @@ make_frame (bool mini_p)
   rw->pixel_height = rw->total_lines * FRAME_LINE_HEIGHT (f);
 
   fset_face_hash_table
-    (f, make_hash_table (&hashtest_eq, DEFAULT_HASH_SIZE, Weak_None, false));
+    (f, make_hash_table (&hashtest_eq, DEFAULT_HASH_SIZE, Weak_None));
 
   if (mini_p)
     {
diff --git a/src/image.c b/src/image.c
index 48694a13341..97dc897b896 100644
--- a/src/image.c
+++ b/src/image.c
@@ -6196,7 +6196,7 @@ xpm_make_color_table_h (void (**put_func) (Lisp_Object, 
const char *, int,
 {
   *put_func = xpm_put_color_table_h;
   *get_func = xpm_get_color_table_h;
-  return make_hash_table (&hashtest_equal, DEFAULT_HASH_SIZE, Weak_None, 
false);
+  return make_hash_table (&hashtest_equal, DEFAULT_HASH_SIZE, Weak_None);
 }
 
 static void
diff --git a/src/json.c b/src/json.c
index 21066d21328..d92198ca99f 100644
--- a/src/json.c
+++ b/src/json.c
@@ -1574,7 +1574,7 @@ json_parse_object (struct json_parser *parser)
     case json_object_hashtable:
       {
        EMACS_INT value = (parser->object_workspace_current - first) / 2;
-       result = make_hash_table (&hashtest_equal, value, Weak_None, false);
+       result = make_hash_table (&hashtest_equal, value, Weak_None);
        struct Lisp_Hash_Table *h = XHASH_TABLE (result);
        for (size_t i = first; i < parser->object_workspace_current; i += 2)
          {
diff --git a/src/lisp.h b/src/lisp.h
index ccda02ab4e1..460599be735 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -2619,10 +2619,6 @@ struct Lisp_Hash_Table
   /* Hash table test (only used when frozen in dump)  */
   hash_table_std_test_t frozen_test : 2;
 
-  /* True if the table can be purecopied.  The table cannot be
-     changed afterwards.  */
-  bool_bf purecopy : 1;
-
   /* True if the table is mutable.  Ordinarily tables are mutable, but
      some tables are not: while a table is being mutated it is immutable
      for recursive attempts to mutate it.  */
@@ -4257,7 +4253,7 @@ extern char *extract_data_from_object (Lisp_Object, 
ptrdiff_t *, ptrdiff_t *);
 EMACS_UINT hash_string (char const *, ptrdiff_t);
 EMACS_UINT sxhash (Lisp_Object);
 Lisp_Object make_hash_table (const struct hash_table_test *, EMACS_INT,
-                             hash_table_weakness_t, bool);
+                             hash_table_weakness_t);
 Lisp_Object hash_table_weakness_symbol (hash_table_weakness_t weak);
 ptrdiff_t hash_lookup (struct Lisp_Hash_Table *, Lisp_Object);
 ptrdiff_t hash_lookup_get_hash (struct Lisp_Hash_Table *h, Lisp_Object key,
diff --git a/src/lread.c b/src/lread.c
index 2c562ee0f0b..b11591ee492 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -2490,11 +2490,11 @@ readevalloop (Lisp_Object readcharfun,
       if (! HASH_TABLE_P (read_objects_map)
          || XHASH_TABLE (read_objects_map)->count)
        read_objects_map
-         = make_hash_table (&hashtest_eq, DEFAULT_HASH_SIZE, Weak_None, false);
+         = make_hash_table (&hashtest_eq, DEFAULT_HASH_SIZE, Weak_None);
       if (! HASH_TABLE_P (read_objects_completed)
          || XHASH_TABLE (read_objects_completed)->count)
        read_objects_completed
-         = make_hash_table (&hashtest_eq, DEFAULT_HASH_SIZE, Weak_None, false);
+         = make_hash_table (&hashtest_eq, DEFAULT_HASH_SIZE, Weak_None);
       if (!NILP (Vpurify_flag) && c == '(')
        val = read0 (readcharfun, false);
       else
@@ -2740,11 +2740,11 @@ read_internal_start (Lisp_Object stream, Lisp_Object 
start, Lisp_Object end,
   if (! HASH_TABLE_P (read_objects_map)
       || XHASH_TABLE (read_objects_map)->count)
     read_objects_map
-      = make_hash_table (&hashtest_eq, DEFAULT_HASH_SIZE, Weak_None, false);
+      = make_hash_table (&hashtest_eq, DEFAULT_HASH_SIZE, Weak_None);
   if (! HASH_TABLE_P (read_objects_completed)
       || XHASH_TABLE (read_objects_completed)->count)
     read_objects_completed
-      = make_hash_table (&hashtest_eq, DEFAULT_HASH_SIZE, Weak_None, false);
+      = make_hash_table (&hashtest_eq, DEFAULT_HASH_SIZE, Weak_None);
 
   if (STRINGP (stream)
       || ((CONSP (stream) && STRINGP (XCAR (stream)))))
diff --git a/src/pdumper.c b/src/pdumper.c
index ef786f4a678..4557695199c 100644
--- a/src/pdumper.c
+++ b/src/pdumper.c
@@ -2747,7 +2747,6 @@ dump_hash_table (struct dump_context *ctx, Lisp_Object 
object)
   dump_pseudovector_lisp_fields (ctx, &out->header, &hash->header);
   DUMP_FIELD_COPY (out, hash, count);
   DUMP_FIELD_COPY (out, hash, weakness);
-  DUMP_FIELD_COPY (out, hash, purecopy);
   DUMP_FIELD_COPY (out, hash, mutable);
   DUMP_FIELD_COPY (out, hash, frozen_test);
   if (hash->key_and_value)
diff --git a/src/print.c b/src/print.c
index 8f28b14e8b6..35a2dac6263 100644
--- a/src/print.c
+++ b/src/print.c
@@ -2605,9 +2605,6 @@ print_object (Lisp_Object obj, Lisp_Object printcharfun, 
bool escapeflag)
                              printcharfun, escapeflag);
              }
 
-           if (h->purecopy)
-             print_c_string (" purecopy t", printcharfun);
-
            ptrdiff_t size = h->count;
            if (size > 0)
              {
diff --git a/src/profiler.c b/src/profiler.c
index 6e1dc46abd3..80173ac735e 100644
--- a/src/profiler.c
+++ b/src/profiler.c
@@ -562,7 +562,7 @@ export_log (struct profiler_log *plog)
      the log but close enough, and will never confuse two distinct
      keys in the log.  */
   Lisp_Object h = make_hash_table (&hashtest_equal, DEFAULT_HASH_SIZE,
-                                  Weak_None, false);
+                                  Weak_None);
   for (int i = 0; i < log->size; i++)
     {
       int count = get_log_count (log, i);
diff --git a/src/xfaces.c b/src/xfaces.c
index 224398f25d4..619e9e14e9f 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -7513,7 +7513,7 @@ only for this purpose.  */);
     doc: /* Hash table of global face definitions (for internal use only.)  
*/);
   Vface_new_frame_defaults =
     /* 33 entries is enough to fit all basic faces */
-    make_hash_table (&hashtest_eq, 33, Weak_None, false);
+    make_hash_table (&hashtest_eq, 33, Weak_None);
 
   DEFVAR_LISP ("face-default-stipple", Vface_default_stipple,
     doc: /* Default stipple pattern used on monochrome displays.
diff --git a/src/xterm.c b/src/xterm.c
index 26ddc58bdca..2bb42741e09 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -32739,7 +32739,7 @@ If set to a non-float value, there will be no wait at 
all.  */);
 
   DEFVAR_LISP ("x-keysym-table", Vx_keysym_table,
     doc: /* Hash table of character codes indexed by X keysym codes.  */);
-  Vx_keysym_table = make_hash_table (&hashtest_eql, 900, Weak_None, false);
+  Vx_keysym_table = make_hash_table (&hashtest_eql, 900, Weak_None);
 
   DEFVAR_BOOL ("x-frame-normalize-before-maximize",
               x_frame_normalize_before_maximize,



reply via email to

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