From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Paul Eggert Newsgroups: gmane.emacs.bugs Subject: bug#36597: 27.0.50; rehash hash tables eagerly in pdumper Date: Tue, 11 Aug 2020 10:31:24 -0700 Organization: UCLA Computer Science Department Message-ID: <8525b631-b24e-ce89-6314-741449ca8403@cs.ucla.edu> References: <74235afc-7043-1da7-7c71-07f0ca23b9fd@cs.ucla.edu> <83r26mv53z.fsf@gnu.org> <87ft8vbow1.fsf@gnus.org> <87v9hq4ppp.fsf@gnus.org> <83k0y544lf.fsf@gnu.org> <835z9pp16x.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------23C6A6AE843030C10CD992B8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="15142"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 Cc: larsi@gnus.org, 36597-done@debbugs.gnu.org To: Eli Zaretskii , Pip Cet Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Aug 11 19:34:27 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1k5YAN-0003ol-Dd for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 11 Aug 2020 19:34:27 +0200 Original-Received: from localhost ([::1]:50250 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k5YAM-0003Gc-Gw for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 11 Aug 2020 13:34:26 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:54964) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k5Y82-0001Aw-Ko for bug-gnu-emacs@gnu.org; Tue, 11 Aug 2020 13:32:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:58257) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1k5Y82-0008OB-AQ for bug-gnu-emacs@gnu.org; Tue, 11 Aug 2020 13:32:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1k5Y82-0002NK-1F for bug-gnu-emacs@gnu.org; Tue, 11 Aug 2020 13:32:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Paul Eggert Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 11 Aug 2020 17:32:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 36597 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 36597-done@debbugs.gnu.org id=D36597.15971670969087 (code D ref 36597); Tue, 11 Aug 2020 17:32:01 +0000 Original-Received: (at 36597-done) by debbugs.gnu.org; 11 Aug 2020 17:31:36 +0000 Original-Received: from localhost ([127.0.0.1]:41570 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k5Y7b-0002MU-Nd for submit@debbugs.gnu.org; Tue, 11 Aug 2020 13:31:35 -0400 Original-Received: from zimbra.cs.ucla.edu ([131.179.128.68]:60346) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k5Y7Y-0002ME-Lj for 36597-done@debbugs.gnu.org; Tue, 11 Aug 2020 13:31:34 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 1FC381600D1; Tue, 11 Aug 2020 10:31:27 -0700 (PDT) Original-Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id FJ1kxFIYf5On; Tue, 11 Aug 2020 10:31:25 -0700 (PDT) Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 37D59160115; Tue, 11 Aug 2020 10:31:25 -0700 (PDT) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Original-Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id Z7WmX0xznM5d; Tue, 11 Aug 2020 10:31:25 -0700 (PDT) Original-Received: from [192.168.1.9] (cpe-75-82-69-226.socal.res.rr.com [75.82.69.226]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 0473D1600D1; Tue, 11 Aug 2020 10:31:24 -0700 (PDT) Autocrypt: addr=eggert@cs.ucla.edu; prefer-encrypt=mutual; keydata= LS0tLS1CRUdJTiBQR1AgUFVCTElDIEtFWSBCTE9DSy0tLS0tCgptUUlOQkV5QWNtUUJFQURB QXlIMnhvVHU3cHBHNUQzYThGTVpFb243NGRDdmM0K3ExWEEySjJ0QnkycHdhVHFmCmhweHhk R0E5Smo1MFVKM1BENGJTVUVnTjh0TFowc2FuNDdsNVhUQUZMaTI0NTZjaVNsNW04c0thSGxH ZHQ5WG0KQUF0bVhxZVpWSVlYL1VGUzk2ZkR6ZjR4aEVtbS95N0xiWUVQUWRVZHh1NDd4QTVL aFRZcDVibHRGM1dZRHoxWQpnZDdneDA3QXV3cDdpdzdlTnZub0RUQWxLQWw4S1lEWnpiRE5D UUdFYnBZM2VmWkl2UGRlSStGV1FONFcra2doCnkrUDZhdTZQcklJaFlyYWV1YTdYRGRiMkxT MWVuM1NzbUUzUWpxZlJxSS9BMnVlOEpNd3N2WGUvV0szOEV6czYKeDc0aVRhcUkzQUZINmls QWhEcXBNbmQvbXNTRVNORnQ3NkRpTzFaS1FNcjlhbVZQa25qZlBtSklTcWRoZ0IxRApsRWR3 MzRzUk9mNlY4bVp3MHhmcVQ2UEtFNDZMY0ZlZnpzMGtiZzRHT1JmOHZqRzJTZjF0azVlVThN Qml5Ti9iClowM2JLTmpOWU1wT0REUVF3dVA4NGtZTGtYMndCeHhNQWhCeHdiRFZadWR6eERa SjFDMlZYdWpDT0pWeHEya2wKakJNOUVUWXVVR3FkNzVBVzJMWHJMdzYrTXVJc0hGQVlBZ1Jy NytLY3dEZ0JBZndoU In-Reply-To: <835z9pp16x.fsf@gnu.org> Content-Language: en-US X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:184681 Archived-At: This is a multi-part message in MIME format. --------------23C6A6AE843030C10CD992B8 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit 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. --------------23C6A6AE843030C10CD992B8 Content-Type: text/x-patch; charset=UTF-8; name="0001-Prefer-make_nil_vector-to-make-vector-with-nil.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename*0="0001-Prefer-make_nil_vector-to-make-vector-with-nil.patch" >From 669aeafbd14b0ebb824bacba0a6b3daad30847a9 Mon Sep 17 00:00:00 2001 From: Paul Eggert 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 --------------23C6A6AE843030C10CD992B8--