diff options
| author | Mattias EngdegÄrd | 2023-11-04 16:34:09 +0100 |
|---|---|---|
| committer | Mattias EngdegÄrd | 2024-01-13 20:50:37 +0100 |
| commit | d3cefd3e98354929d96c9396e5920e8a123784dc (patch) | |
| tree | b0fd45c15faa88216653413229e759444810585d /src/lisp.h | |
| parent | c3d0cc50faf588479db62e20ceabe044dd89e244 (diff) | |
| download | emacs-d3cefd3e98354929d96c9396e5920e8a123784dc.tar.gz emacs-d3cefd3e98354929d96c9396e5920e8a123784dc.zip | |
Leaner hash table dumping and thawing
Only dump the actual data, and the test encoded as an enum. This
simplifies dumping, makes dump files smaller and saves space at run
time.
* src/lisp.h (hash_table_std_test_t): New enum.
(struct Lisp_Hash_Table): Add frozen_test member, consuming no extra space.
* src/fns.c (hashfn_user_defined): Now static.
(hash_table_test_from_std): New.
(hash_table_rehash): Rename to...
(hash_table_thaw): ...this and rewrite.
* src/pdumper.c (hash_table_contents): Only include actual data, not
unused space.
(hash_table_std_test): New.
(hash_table_freeze): Set frozen_test from test.
(dump_hash_table): Dump frozen_test, not the whole test struct.
Don't bother other dumping fields that can be derived.
Diffstat (limited to 'src/lisp.h')
| -rw-r--r-- | src/lisp.h | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/lisp.h b/src/lisp.h index 48e1f943ed8..d9b828b0328 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -2385,6 +2385,12 @@ INLINE int | |||
| 2385 | 2385 | ||
| 2386 | struct Lisp_Hash_Table; | 2386 | struct Lisp_Hash_Table; |
| 2387 | 2387 | ||
| 2388 | typedef enum { | ||
| 2389 | Test_eql, | ||
| 2390 | Test_eq, | ||
| 2391 | Test_equal, | ||
| 2392 | } hash_table_std_test_t; | ||
| 2393 | |||
| 2388 | struct hash_table_test | 2394 | struct hash_table_test |
| 2389 | { | 2395 | { |
| 2390 | /* Function used to compare keys; always a bare symbol. */ | 2396 | /* Function used to compare keys; always a bare symbol. */ |
| @@ -2473,6 +2479,9 @@ struct Lisp_Hash_Table | |||
| 2473 | /* Weakness of the table. */ | 2479 | /* Weakness of the table. */ |
| 2474 | hash_table_weakness_t weakness : 8; | 2480 | hash_table_weakness_t weakness : 8; |
| 2475 | 2481 | ||
| 2482 | /* Hash table test (only used when frozen in dump) */ | ||
| 2483 | hash_table_std_test_t frozen_test : 8; | ||
| 2484 | |||
| 2476 | /* True if the table can be purecopied. The table cannot be | 2485 | /* True if the table can be purecopied. The table cannot be |
| 2477 | changed afterwards. */ | 2486 | changed afterwards. */ |
| 2478 | bool purecopy; | 2487 | bool purecopy; |
| @@ -2563,7 +2572,7 @@ hash_from_key (struct Lisp_Hash_Table *h, Lisp_Object key) | |||
| 2563 | return h->test.hashfn (key, h); | 2572 | return h->test.hashfn (key, h); |
| 2564 | } | 2573 | } |
| 2565 | 2574 | ||
| 2566 | void hash_table_rehash (Lisp_Object); | 2575 | void hash_table_thaw (Lisp_Object hash_table); |
| 2567 | 2576 | ||
| 2568 | /* Default size for hash tables if not specified. */ | 2577 | /* Default size for hash tables if not specified. */ |
| 2569 | 2578 | ||
| @@ -4038,7 +4047,6 @@ extern void hexbuf_digest (char *, void const *, int); | |||
| 4038 | extern char *extract_data_from_object (Lisp_Object, ptrdiff_t *, ptrdiff_t *); | 4047 | extern char *extract_data_from_object (Lisp_Object, ptrdiff_t *, ptrdiff_t *); |
| 4039 | EMACS_UINT hash_string (char const *, ptrdiff_t); | 4048 | EMACS_UINT hash_string (char const *, ptrdiff_t); |
| 4040 | EMACS_UINT sxhash (Lisp_Object); | 4049 | EMACS_UINT sxhash (Lisp_Object); |
| 4041 | Lisp_Object hashfn_user_defined (Lisp_Object, struct Lisp_Hash_Table *); | ||
| 4042 | Lisp_Object make_hash_table (struct hash_table_test, EMACS_INT, | 4050 | Lisp_Object make_hash_table (struct hash_table_test, EMACS_INT, |
| 4043 | hash_table_weakness_t, bool); | 4051 | hash_table_weakness_t, bool); |
| 4044 | Lisp_Object hash_table_weakness_symbol (hash_table_weakness_t weak); | 4052 | Lisp_Object hash_table_weakness_symbol (hash_table_weakness_t weak); |