From: Lars Ingebrigtsen <larsi@gnus.org>
To: Stefan Monnier <monnier@IRO.UMontreal.CA>
Cc: 25743@debbugs.gnu.org
Subject: bug#25743: rehash-size ignored
Date: Fri, 26 Jul 2019 15:55:07 +0200 [thread overview]
Message-ID: <87tvb8lx38.fsf@mouse.gnus.org> (raw)
In-Reply-To: <jwvpoijl0td.fsf@lechazo> (Stefan Monnier's message of "Wed, 15 Feb 2017 14:18:54 -0500")
Stefan Monnier <monnier@IRO.UMontreal.CA> writes:
> Looking accidentally at maybe_resize_hash_table, I noticed that we don't
> obey resize_hash, although we do all the work needed for that.
> Worse, we make dangerous assumptions about the behavior of
> larger_vector:
>
> maybe_resize_hash_table takes `old_size' from `ASIZE (h->next)' and then
> uses rehash_size to compute the desired new_size. The problem comes
> here:
>
> set_hash_key_and_value (h, larger_vector (h->key_and_value,
> 2 * (new_size - old_size), -1));
> set_hash_next (h, larger_vector (h->next, new_size - old_size, -1));
>
> This says, that h->next and h->key_and_value are replaced by new vectors
> that are larger than the previous one so that they are large enough to
> accomodate new_size.
I did not follow the recent thread about hash table resizing closely,
but I do seem to remember somebody saying that they'd fixed something in
the hash resizing code, and the commits in fns.c seem to back that up:
commit 49e80e765b693736a8bb97ae5bfa341d25bf4f02
Author: Paul Eggert <eggert@cs.ucla.edu>
Date: Sat Jul 20 23:21:14 2019 -0700
Tweak recent hash-table fix
* src/fns.c (maybe_resize_hash_table): Completely initialize the
new ‘next’ vector before allocating more vectors, as this
preserves locality a bit better and it’s safer not to leave an
uninitialized Lisp object around. Use next_size instead of
new_size to compute new index size.
So is the issue discussed in this bug report fixed now?
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
next prev parent reply other threads:[~2019-07-26 13:55 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-15 19:18 bug#25743: rehash-size ignored Stefan Monnier
2019-07-26 13:55 ` Lars Ingebrigtsen [this message]
2019-07-26 17:16 ` Stefan Monnier
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87tvb8lx38.fsf@mouse.gnus.org \
--to=larsi@gnus.org \
--cc=25743@debbugs.gnu.org \
--cc=monnier@IRO.UMontreal.CA \
/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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).