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'.
This commit is contained in:
Pip Cet 2024-08-20 19:04:44 +00:00 committed by Stefan Kangas
parent e1e101c6c1
commit afd61deaae
15 changed files with 22 additions and 44 deletions

View file

@ -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)))

View file

@ -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);

View file

@ -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,

View file

@ -4847,15 +4847,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));
@ -4901,7 +4897,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);
}
@ -5735,13 +5730,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)
@ -5749,7 +5739,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");
@ -5763,9 +5752,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);
@ -5781,8 +5769,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;
@ -5805,7 +5791,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);
}

View file

@ -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)
{

View file

@ -6200,7 +6200,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

View file

@ -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)
{

View file

@ -2620,10 +2620,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. */
@ -4258,7 +4254,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,

View file

@ -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)))))

View file

@ -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)

View file

@ -7485,7 +7485,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);

View file

@ -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)
{

View file

@ -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);

View file

@ -7518,7 +7518,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.

View file

@ -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,