diff options
author | Mattias EngdegÄrd <mattiase@acm.org> | 2023-11-22 13:47:56 +0100 |
---|---|---|
committer | Mattias EngdegÄrd <mattiase@acm.org> | 2024-01-13 20:50:38 +0100 |
commit | 7ad5d427730fea3865bc678c6673ffd58b6af653 (patch) | |
tree | e683d27d4c5dd989f7af673d5764c3ef3b461dde /src/pdumper.c | |
parent | 68f8bc3111424527205ebfe4498e5bebf50f50bf (diff) | |
download | emacs-7ad5d427730fea3865bc678c6673ffd58b6af653.tar.gz |
Don't dump Qunbound
The dumper uses a hash table to keep track of dumped objects but as
this clashes with the use of Qunbound for marking unused hash table
entries, don't dump that value at all. The symbol name is fixed up
after loading.
An alternative solution would be to use a different unique value for
unused entries.
* src/pdumper.c (dump_object_needs_dumping_p): Skip Qunbound.
(dump_vectorlike_generic): New function.
(pdumper_load): Call it.
Diffstat (limited to 'src/pdumper.c')
-rw-r--r-- | src/pdumper.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/pdumper.c b/src/pdumper.c index 13077526776..38682816f0a 100644 --- a/src/pdumper.c +++ b/src/pdumper.c @@ -1337,7 +1337,9 @@ dump_object_needs_dumping_p (Lisp_Object object) included in the dump despite all references to them being bitwise-invariant. */ return (!dump_object_self_representing_p (object) - || dump_object_emacs_ptr (object)); + || (dump_object_emacs_ptr (object) + /* Don't dump Qunbound -- it's not a legal hash table key. */ + && !BASE_EQ (object, Qunbound))); } static void @@ -2551,6 +2553,19 @@ dump_symbol (struct dump_context *ctx, return offset; } +/* Give Qunbound its name. + All other symbols are dumped and loaded but not Qunbound because it + cannot be used as a key in a hash table. + FIXME: A better solution would be to use a value other than Qunbound + as a marker for unused entries in hash tables. */ +static void +pdumper_init_symbol_unbound (void) +{ + eassert (NILP (SYMBOL_NAME (Qunbound))); + const char *name = "unbound"; + init_symbol (Qunbound, make_pure_c_string (name, strlen (name))); +} + static dump_off dump_vectorlike_generic (struct dump_context *ctx, const union vectorlike_header *header) @@ -5749,6 +5764,8 @@ pdumper_load (const char *dump_filename, char *argv0) for (int i = 0; i < nr_dump_hooks; ++i) dump_hooks[i] (); + pdumper_init_symbol_unbound (); + #ifdef HAVE_NATIVE_COMP pdumper_set_emacs_execdir (argv0); #else |