diff options
| author | Stefan Monnier <monnier@iro.umontreal.ca> | 2019-07-26 14:59:15 -0400 |
|---|---|---|
| committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2019-07-26 15:03:03 -0400 |
| commit | 0dc5a85a1c3772a6e78f077719d82f437f626b1e (patch) | |
| tree | abe77c1082f55453027d08937302a3e122069be7 /src/pdumper.c | |
| parent | c74da403aa95ec67598c41aa4f1b97975391135b (diff) | |
| download | emacs-0dc5a85a1c3772a6e78f077719d82f437f626b1e.tar.gz | |
Don't dump the `hash` vector if it will need to be recomputed anyway
* src/fns.c (hash_table_rehash): Only set `hash` field at the end.
(sweep_weak_table): Only set slot of `hash` vector when that vector exists.
(Fhash_table_count): No need to hash_rehash_if_needed any more.
* src/lisp.h (hash_rehash_needed_p): Test the presence of `hash` instead.
* src/pdumper.c (check_hash_table_rehash, dump_hash_table):
Set `hash` to nil to indicate that the table needs to be rehashed.
Diffstat (limited to 'src/pdumper.c')
| -rw-r--r-- | src/pdumper.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/pdumper.c b/src/pdumper.c index 4ba819b4103..1a5d1f32ba5 100644 --- a/src/pdumper.c +++ b/src/pdumper.c @@ -2666,7 +2666,7 @@ check_hash_table_rehash (Lisp_Object table_orig) hash_rehash_if_needed (XHASH_TABLE (table_orig)); Lisp_Object table_rehashed = Fcopy_hash_table (table_orig); eassert (!hash_rehash_needed_p (XHASH_TABLE (table_rehashed))); - XHASH_TABLE (table_rehashed)->count *= -1; + XHASH_TABLE (table_rehashed)->hash = Qnil; eassert (count == 0 || hash_rehash_needed_p (XHASH_TABLE (table_rehashed))); hash_rehash_if_needed (XHASH_TABLE (table_rehashed)); eassert (!hash_rehash_needed_p (XHASH_TABLE (table_rehashed))); @@ -2733,7 +2733,13 @@ dump_hash_table (struct dump_context *ctx, the need to rehash-on-access if we can load the dump where we want. */ if (hash->count > 0 && !is_stable) - hash->count = -hash->count; + /* Hash codes will have to be recomputed anyway, so let's not dump them. + Also set `hash` to nil for hash_rehash_needed_p. + We could also refrain from dumping the `next' and `index' vectors, + except that `next' is currently used for HASH_TABLE_SIZE and + we'd have to rebuild the next_free list as well as adjust + sweep_weak_hash_table for the case where there's no `index'. */ + hash->hash = Qnil; START_DUMP_PVEC (ctx, &hash->header, struct Lisp_Hash_Table, out); dump_pseudovector_lisp_fields (ctx, &out->header, &hash->header); |
