This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [v3] Fix management of non empty hash functor
- From: Jonathan Wakely <jwakely dot gcc at gmail dot com>
- To: François Dumont <frs dot dumont at gmail dot com>
- Cc: Paolo Carlini <paolo dot carlini at oracle dot com>, "libstdc++ at gcc dot gnu dot org" <libstdc++ at gcc dot gnu dot org>, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 28 Jan 2013 15:42:58 +0000
- Subject: Re: [v3] Fix management of non empty hash functor
- References: <50CA498A.2070902@gmail.com> <50E6BA2C.2060109@oracle.com> <50EF2C6F.3050609@gmail.com>
On 10 January 2013 21:02, François Dumont wrote:
> Hi
>
> Here is an other version of this patch. Indeed there were no need to
> expose many stuff public. Inheriting from _Hash_code_base is fine, it is not
> final and it deals with EBO itself. I only kept usage of
> _Hashtable_ebo_helper when embedding H2 functor. As it is an extension we
> could have impose it not to be final but it doesn't cost a lot to deal with
> it. Finally I only needed a single friend declaration to get access to the
> H2 part of _Hash_code_base.
OK.
> I didn't touch the default cache policy for the moment except reducing
> constraints on the hash functor. I prefer to submit an other patch to change
> when we cache or not depending on the hash functor expected performance.
OK. The reduced constraints are good. Does this actually affect
performance? In my tests it doesn't, so I assume we still need to
change the caching decision to notice any performance improvements?
(Do the performance benchmarks actually tell us anything useful?
When I run them I get such varying results it doesn't seem to be reliable.)
> I also took the time to replace some typedef expressions with using
> ones. I really know what is the rule about using one or the other but I
> remembered that Benjamin spent quite some time changing typedef in using so
> I prefer to stick to this approach in this file, even if there are still
> some typedef left.
OK, that doesn't make any difference so isn't important which is used.
> Tested under linux x86_64 normal and debug modes.
>
> 2013-01-10 François Dumont <fdumont@gcc.gnu.org>
>
>
> * include/bits/hashtable_policy.h (_Local_iterator_base): Use
> _Hashtable_ebo_helper to embed necessary functors into the
> local_iterator when necessary. Pass information about functors
Repeating "necessary" seems unnecessary here :)
> involved in hash code by copy.
> * include/bits/hashtable.h (__cache_default): Do not cache for
> builtin integral types unless the hash functor is not noexcept
> qualified or is not default constructible. Adapt static assertions
> and local iteraror instantiations.
^^ "iteraror"
+ // When hash codes are not cached local iterator inherits from
+ // __hash_code_base above to compute node bucket index so it has to be
+ // default constructible.
+ static_assert(__if_hash_not_cached<
+ is_default_constructible<__hash_code_base>>::value,
+ "Cache the hash code or make functors involved in hash code"
+ " and bucket index computation default constructibles");
"constructible" not "constructibles"
This is OK for trunk, but not 4.7