From: Pip Cet Date: Tue, 20 Aug 2024 19:04:44 +0000 (+0000) Subject: Pure storage removal: Remove purecopy hash table flag X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=25200f707aabfc2fa56fa98be4fe494979ad3f36;p=emacs.git 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 and update docstring. (Fmake_hash_table): Ignore ':purecopy' argument. * src/frame.c (make_frame): * src/image.c (xpm_make_color_table_h): * src/lisp.h (struct Lisp_Hash_Table): Drop 'purecopy' flag. * src/pdumper.c (dump_hash_table): Don't dump 'purecopy' flag. * src/print.c (print_object): Don't print 'purecopy' flag * src/json.c (json_parse_object): * src/lread.c (readevalloop, read_internal_start): * src/pgtkterm.c (syms_of_pgtkterm): * src/profiler.c (export_log): * src/xfaces.c (syms_of_xfaces): * src/xterm.c (syms_of_xterm): Adjust calls to 'make_hash_table'. (cherry picked from commit afd61deaaeb5e5e6845bdf995ac5ee9a3479599c) --- diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el index bcc728fc0c2..92b06d83f84 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 b5eb2136bb3..297ba94c73d 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 18760182a03..0a67433ec70 100644 --- a/src/emacs-module.c +++ b/src/emacs-module.c @@ -1709,7 +1709,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 d62712f24d9..aa8576588cb 100644 --- a/src/fns.c +++ b/src/fns.c @@ -4856,15 +4856,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)); @@ -4910,7 +4906,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); } @@ -5745,13 +5740,8 @@ 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. +The keywords arguments :rehash-threshold, :rehash-size, and :purecopy +are obsolete and ignored. usage: (make-hash-table &rest KEYWORD-ARGS) */) (ptrdiff_t nargs, Lisp_Object *args) @@ -5759,7 +5749,6 @@ usage: (make-hash-table &rest KEYWORD-ARGS) */) Lisp_Object test_arg = Qnil; Lisp_Object weakness_arg = Qnil; Lisp_Object size_arg = Qnil; - Lisp_Object purecopy_arg = Qnil; if (nargs & 1) error ("Odd number of arguments"); @@ -5773,9 +5762,8 @@ usage: (make-hash-table &rest KEYWORD-ARGS) */) weakness_arg = arg; else if (BASE_EQ (kw, QCsize)) size_arg = arg; - else if (BASE_EQ (kw, QCpurecopy)) - purecopy_arg = arg; - else if (BASE_EQ (kw, QCrehash_threshold) || BASE_EQ (kw, QCrehash_size)) + else if (BASE_EQ (kw, QCrehash_threshold) || BASE_EQ (kw, QCrehash_size) + || BASE_EQ (kw, QCpurecopy)) ; /* ignore obsolete keyword arguments */ else signal_error ("Invalid keyword argument", kw); @@ -5791,8 +5779,6 @@ usage: (make-hash-table &rest KEYWORD-ARGS) */) else test = get_hash_table_user_test (test_arg); - bool purecopy = !NILP (purecopy_arg); - EMACS_INT size; if (NILP (size_arg)) size = DEFAULT_HASH_SIZE; @@ -5815,7 +5801,7 @@ usage: (make-hash-table &rest KEYWORD-ARGS) */) else signal_error ("Invalid hash table weakness", weakness_arg); - return make_hash_table (test, size, weak, purecopy); + return make_hash_table (test, size, weak); } diff --git a/src/frame.c b/src/frame.c index 511c4d8718d..d060fbfd54d 100644 --- a/src/frame.c +++ b/src/frame.c @@ -1078,7 +1078,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 0d7e77164b6..dfab0d76edb 100644 --- a/src/image.c +++ b/src/image.c @@ -6225,7 +6225,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 4e156658ef7..f438d191bde 100644 --- a/src/json.c +++ b/src/json.c @@ -1564,7 +1564,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 8e096675ba7..0a44a3c029b 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -2622,10 +2622,6 @@ struct Lisp_Hash_Table /* Hash table test (only used when frozen in dump) */ ENUM_BF (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. */ @@ -4251,7 +4247,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 0e4512be122..6af95873bb8 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 @@ -2738,11 +2738,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 fd61a40d8ae..830e3630cdb 100644 --- a/src/pdumper.c +++ b/src/pdumper.c @@ -2737,7 +2737,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/pgtkterm.c b/src/pgtkterm.c index afaab483d57..d47b1da7262 100644 --- a/src/pgtkterm.c +++ b/src/pgtkterm.c @@ -7482,7 +7482,7 @@ If set to a non-float value, there will be no wait at all. */); DEFVAR_LISP ("pgtk-keysym-table", Vpgtk_keysym_table, doc: /* Hash table of character codes indexed by X keysym codes. */); - Vpgtk_keysym_table = make_hash_table (&hashtest_eql, 900, Weak_None, false); + Vpgtk_keysym_table = make_hash_table (&hashtest_eql, 900, Weak_None); window_being_scrolled = Qnil; staticpro (&window_being_scrolled); diff --git a/src/print.c b/src/print.c index 43698f309b1..c7cba5bface 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 03e8d007e9f..43409688a93 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 602f551252e..fbbaffb8889 100644 --- a/src/xfaces.c +++ b/src/xfaces.c @@ -7537,7 +7537,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 5159aed495c..0a877e9edf9 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -32736,7 +32736,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,