all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Paul Eggert <eggert@cs.ucla.edu>
To: Eli Zaretskii <eliz@gnu.org>, Pip Cet <pipcet@gmail.com>
Cc: larsi@gnus.org, 36597-done@debbugs.gnu.org
Subject: bug#36597: 27.0.50; rehash hash tables eagerly in pdumper
Date: Tue, 11 Aug 2020 10:31:24 -0700	[thread overview]
Message-ID: <8525b631-b24e-ce89-6314-741449ca8403@cs.ucla.edu> (raw)
In-Reply-To: <835z9pp16x.fsf@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 472 bytes --]

On 8/11/20 10:00 AM, Eli Zaretskii wrote:
>> I suggest going back to Fmake_vector (h->hash, Qnil), as in the
>> attached patch. It's shorter, and it actually compiles.
> Yes, I did that, thanks.

The compilation issue was due to pdumper enabling -Wconversion, which causes 
more trouble than it cures (but that is a different topic). I worked around the 
glitch by installing the attached further patch, which should also help explain 
the motivation for make_nil_vector.

[-- Attachment #2: 0001-Prefer-make_nil_vector-to-make-vector-with-nil.patch --]
[-- Type: text/x-patch, Size: 1906 bytes --]

From 669aeafbd14b0ebb824bacba0a6b3daad30847a9 Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Tue, 11 Aug 2020 10:29:02 -0700
Subject: [PATCH] Prefer make_nil_vector to make-vector with nil

* src/pdumper.c (hash_table_thaw): Pacify -Wconversion so
we can use make_nil_vector again.
* src/timefns.c (syms_of_timefns): Prefer make_nil_vector
to make_vector with Qnil.
---
 src/lisp.h    | 3 ++-
 src/pdumper.c | 4 +++-
 src/timefns.c | 2 +-
 3 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/lisp.h b/src/lisp.h
index d88038d91b..2962babb4f 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -3947,7 +3947,8 @@ make_uninit_sub_char_table (int depth, int min_char)
   return v;
 }
 
-/* Make a vector of SIZE nils.  */
+/* Make a vector of SIZE nils - faster than make_vector (size, Qnil)
+   if the OS already cleared the new memory.  */
 
 INLINE Lisp_Object
 make_nil_vector (ptrdiff_t size)
diff --git a/src/pdumper.c b/src/pdumper.c
index 6c581bcd0b..aaa760d70d 100644
--- a/src/pdumper.c
+++ b/src/pdumper.c
@@ -2664,7 +2664,9 @@ hash_table_freeze (struct Lisp_Hash_Table *h)
 hash_table_thaw (Lisp_Object hash)
 {
   struct Lisp_Hash_Table *h = XHASH_TABLE (hash);
-  h->hash = Fmake_vector (h->hash, Qnil);
+  ALLOW_IMPLICIT_CONVERSION;
+  h->hash = make_nil_vector (XFIXNUM (h->hash));
+  DISALLOW_IMPLICIT_CONVERSION;
   h->next = Fmake_vector (h->next, make_fixnum (-1));
   h->index = Fmake_vector (h->index, make_fixnum (-1));
 
diff --git a/src/timefns.c b/src/timefns.c
index 7bcc37d7c1..94cfddf0da 100644
--- a/src/timefns.c
+++ b/src/timefns.c
@@ -2048,7 +2048,7 @@ syms_of_timefns (void)
   defsubr (&Scurrent_time_zone);
   defsubr (&Sset_time_zone_rule);
 
-  flt_radix_power = make_vector (flt_radix_power_size, Qnil);
+  flt_radix_power = make_nil_vector (flt_radix_power_size);
   staticpro (&flt_radix_power);
 
 #ifdef NEED_ZTRILLION_INIT
-- 
2.17.1


  reply	other threads:[~2020-08-11 17:31 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-11 14:05 bug#36597: 27.0.50; rehash hash tables eagerly in pdumper Pip Cet
2019-07-14 14:39 ` Paul Eggert
2019-07-14 15:01   ` Pip Cet
2019-07-14 15:49     ` Paul Eggert
2019-07-14 16:54       ` Pip Cet
2019-07-15 14:39         ` Pip Cet
2019-07-19  7:23           ` Pip Cet
2019-07-19  7:46             ` Eli Zaretskii
2019-07-20 12:38               ` Pip Cet
2019-07-21  3:18                 ` Paul Eggert
2019-07-21  5:34                   ` Pip Cet
2019-07-21  6:32                     ` Paul Eggert
2019-07-21  6:32                     ` Pip Cet
2020-08-09 19:27                       ` Lars Ingebrigtsen
2020-08-10 11:51                         ` Pip Cet
2020-08-10 13:04                           ` Lars Ingebrigtsen
2020-08-11  9:33                             ` Paul Eggert
2020-08-11  9:40                               ` Pip Cet
2020-08-11 11:50                               ` Lars Ingebrigtsen
2020-08-11 14:52                               ` Eli Zaretskii
2020-08-11 15:30                                 ` Paul Eggert
2020-08-11 17:00                                   ` Eli Zaretskii
2020-08-11 18:11                                     ` Paul Eggert
2020-08-11 18:35                                       ` Eli Zaretskii
2020-08-11 18:55                                         ` Eli Zaretskii
2020-08-11 23:43                                         ` Paul Eggert
2020-08-12 14:10                                           ` Eli Zaretskii
2020-08-12 14:46                                             ` Eli Zaretskii
2020-08-12 19:11                                             ` Paul Eggert
2020-08-12 19:28                                               ` Eli Zaretskii
2020-08-12 20:41                                                 ` Andy Moreton
2020-08-11 15:59                                 ` Pip Cet
2020-08-11 17:00                                   ` Eli Zaretskii
2020-08-11 17:31                                     ` Paul Eggert [this message]
2020-08-11 18:27                                       ` Andy Moreton
2020-08-11 18:32                                       ` Eli Zaretskii
2019-07-18  5:39   ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8525b631-b24e-ce89-6314-741449ca8403@cs.ucla.edu \
    --to=eggert@cs.ucla.edu \
    --cc=36597-done@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=larsi@gnus.org \
    --cc=pipcet@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.