[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#25743: rehash-size ignored
From: |
Lars Ingebrigtsen |
Subject: |
bug#25743: rehash-size ignored |
Date: |
Fri, 26 Jul 2019 15:55:07 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) |
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
- bug#25743: rehash-size ignored,
Lars Ingebrigtsen <=