aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2019-07-25 23:17:52 -0700
committerPaul Eggert2019-07-25 23:18:51 -0700
commit62047917282ac523eea3d6442fff88ef46d74f43 (patch)
treea9a780b592c06254c965fcd8d76edc6c70249d31 /src
parent0efb88150df56559e8d649e657902fb51ad43bc1 (diff)
downloademacs-62047917282ac523eea3d6442fff88ef46d74f43.tar.gz
emacs-62047917282ac523eea3d6442fff88ef46d74f43.zip
Minor pdumper tweaks
* src/pdumper.c (dump_hash_table_stable_p): Bool vectors and bignums are also stable keys. (decode_emacs_reloc, drain_reloc_list, Fdump_emacs_portable): (dump_bitset_clear): Simplify use of memset.
Diffstat (limited to 'src')
-rw-r--r--src/pdumper.c27
1 files changed, 12 insertions, 15 deletions
diff --git a/src/pdumper.c b/src/pdumper.c
index ddf44a53f86..1504f75c825 100644
--- a/src/pdumper.c
+++ b/src/pdumper.c
@@ -118,10 +118,10 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
118# endif 118# endif
119#endif 119#endif
120 120
121/* We require an architecture in which all pointers are the same size 121/* Require an architecture in which pointers, ptrdiff_t and intptr_t
122 and have the same layout, where pointers are either 32 or 64 bits 122 are the same size and have the same layout, and where bytes have
123 long, and where bytes have eight bits --- that is, a 123 eight bits --- that is, a general-purpose computer made after 1990.
124 general-purpose computer made after 1990. */ 124 Also require Lisp_Object to be at least as wide as pointers. */
125verify (sizeof (ptrdiff_t) == sizeof (void *)); 125verify (sizeof (ptrdiff_t) == sizeof (void *));
126verify (sizeof (intptr_t) == sizeof (ptrdiff_t)); 126verify (sizeof (intptr_t) == sizeof (ptrdiff_t));
127verify (sizeof (void (*) (void)) == sizeof (void *)); 127verify (sizeof (void (*) (void)) == sizeof (void *));
@@ -2634,8 +2634,10 @@ dump_hash_table_stable_p (const struct Lisp_Hash_Table *hash)
2634 Lisp_Object key = HASH_KEY (hash, i); 2634 Lisp_Object key = HASH_KEY (hash, i);
2635 bool key_stable = (dump_builtin_symbol_p (key) 2635 bool key_stable = (dump_builtin_symbol_p (key)
2636 || FIXNUMP (key) 2636 || FIXNUMP (key)
2637 || (is_equal && STRINGP (key)) 2637 || (is_equal
2638 || ((is_equal || is_eql) && FLOATP (key))); 2638 && (STRINGP (key) || BOOL_VECTOR_P (key)))
2639 || ((is_equal || is_eql)
2640 && (FLOATP (key) || BIGNUMP (key))));
2639 if (!key_stable) 2641 if (!key_stable)
2640 return false; 2642 return false;
2641 } 2643 }
@@ -3654,8 +3656,7 @@ dump_check_overlap_dump_reloc (Lisp_Object lreloc_a,
3654static struct emacs_reloc 3656static struct emacs_reloc
3655decode_emacs_reloc (struct dump_context *ctx, Lisp_Object lreloc) 3657decode_emacs_reloc (struct dump_context *ctx, Lisp_Object lreloc)
3656{ 3658{
3657 struct emacs_reloc reloc; 3659 struct emacs_reloc reloc = {0};
3658 memset (&reloc, 0, sizeof (reloc));
3659 ALLOW_IMPLICIT_CONVERSION; 3660 ALLOW_IMPLICIT_CONVERSION;
3660 int type = XFIXNUM (dump_pop (&lreloc)); 3661 int type = XFIXNUM (dump_pop (&lreloc));
3661 DISALLOW_IMPLICIT_CONVERSION; 3662 DISALLOW_IMPLICIT_CONVERSION;
@@ -3814,8 +3815,7 @@ drain_reloc_list (struct dump_context *ctx,
3814 *reloc_list = Qnil; 3815 *reloc_list = Qnil;
3815 dump_align_output (ctx, max (alignof (struct dump_reloc), 3816 dump_align_output (ctx, max (alignof (struct dump_reloc),
3816 alignof (struct emacs_reloc))); 3817 alignof (struct emacs_reloc)));
3817 struct dump_table_locator locator; 3818 struct dump_table_locator locator = {0};
3818 memset (&locator, 0, sizeof (locator));
3819 locator.offset = ctx->offset; 3819 locator.offset = ctx->offset;
3820 for (; !NILP (relocs); locator.nr_entries += 1) 3820 for (; !NILP (relocs); locator.nr_entries += 1)
3821 { 3821 {
@@ -4025,9 +4025,8 @@ types. */)
4025 filename = Fexpand_file_name (filename, Qnil); 4025 filename = Fexpand_file_name (filename, Qnil);
4026 filename = ENCODE_FILE (filename); 4026 filename = ENCODE_FILE (filename);
4027 4027
4028 struct dump_context ctx_buf; 4028 struct dump_context ctx_buf = {0};
4029 struct dump_context *ctx = &ctx_buf; 4029 struct dump_context *ctx = &ctx_buf;
4030 memset (ctx, 0, sizeof (*ctx));
4031 ctx->fd = -1; 4030 ctx->fd = -1;
4032 4031
4033 ctx->objects_dumped = make_eq_hash_table (); 4032 ctx->objects_dumped = make_eq_hash_table ();
@@ -4920,9 +4919,7 @@ dump_bitset_set_bit (struct dump_bitset *bitset, size_t bit_number)
4920static void 4919static void
4921dump_bitset_clear (struct dump_bitset *bitset) 4920dump_bitset_clear (struct dump_bitset *bitset)
4922{ 4921{
4923 int xword_size = sizeof (bitset->bits[0]); 4922 memset (bitset->bits, 0, bitset->number_words * sizeof bitset->bits[0]);
4924 if (bitset->number_words)
4925 memset (bitset->bits, 0, bitset->number_words * xword_size);
4926} 4923}
4927 4924
4928struct pdumper_loaded_dump_private 4925struct pdumper_loaded_dump_private