[PATCH] _Hashtable implementation cleanup
Jonathan Wakely
jwakely@redhat.com
Wed May 10 08:37:16 GMT 2023
On Wed, 10 May 2023 at 05:59, François Dumont via Libstdc++ <
libstdc++@gcc.gnu.org> wrote:
> Hi
>
> Rather than providing a series of patches for _Hashtable I prefer to
> submit them one by one. It will maximize the chances to have some of
> them in gcc 14.
>
> I'm starting with this simple patch to do some cleanup in the current
> implementation to ease compiler optimizations by making some methods
> implicitly inline and avoiding the iterator abstraction when useless.
>
> It is also replacing some faulty usages of __node_type* with __node_ptr.
> It should simplify the patch to make use of allocator custom pointer I
> would like to reactivate.
>
> libstdc++: [_Hashtable] Implement several small methods implicitly inline
>
> Make implementation of 3 simple _Hashtable methods implicitly inline.
>
> Avoid usage of const_iterator abstraction within _Hashtable implementation.
>
> Replace several usages of __node_type* with expected __node_ptr.
>
> libstdc++-v3/ChangeLog:
>
> * include/bits/hashtable_policy.h
> (_NodeBuilder<>::_S_build): Use __node_ptr.
> (_ReuseOrAllocNode<>): Use __node_ptr in place of
> __node_type*.
> (_AllocNode<>): Likewise.
> (_Equality<>::_M_equal): Remove const_iterator usages. Only
> preserved
> to call std::is_permutation in the non-unique key
> implementation.
> * include/bits/hashtable.h
> (_Hashtable<>::_M_update_begin()): Capture
> _M_begin() once.
> (_Hashtable<>::_M_bucket_begin(size_type)): Implement
> implicitly inline.
> (_Hashtable<>::_M_insert_bucket_begin): Likewise.
> (_Hashtable<>::_M_remove_bucket_begin): Likewise.
> (_Hashtable<>::_M_compute_hash_code): Use __node_ptr rather
> than
> const_iterator.
> (_Hashtable<>::find): Likewise.
> (_Hashtable<>::_M_emplace): Likewise.
> (_Hashtable<>::_M_insert_unique): Likewise.
>
> Ok to commit ?
>
OK, thanks
More information about the Gcc-patches
mailing list