libstdc++: Refactor _Hashtable to prepare for custom pointers
authorFrançois Dumont <fdumont@gcc.gnu.org>
Sun, 4 Oct 2020 16:06:11 +0000 (18:06 +0200)
committerFrançois Dumont <fdumont@gcc.gnu.org>
Tue, 20 Oct 2020 19:30:22 +0000 (21:30 +0200)
commit1b6f0476837205932613ddb2b3429a55c26c409d
tree43f1f04a8138a699cdb17f4fa34623345782ab0b
parent15b8e2af42168a41636186c53d1e833302195601
libstdc++: Refactor _Hashtable to prepare for custom pointers

Limit usage of node pointers in _Hashtable implementation details so that when
we move to allocator custom pointer type we do not need to add an _Alloc
template parameter everywhere which would impact abi.

This is done by reviewing node type definition. It is now based on new basic
types which are not pointer dependant. The _Hashtable helper
types are now using those new node base types and do not receive node pointers.

libstdc++-v3/ChangeLog

* include/bits/hashtable_policy.h
(_Hash_node_value_base<>): Remove _Hash_node_base inheritance.
(_Hash_node_code_cache<bool _Cache_hash_code>): New.
(_Hash_node_value<typename _Value, bool _Cache_hash_code>): New.
(_Hash_node<>): Inherits _Hash_node_base<> and _Hash_node_value<>.
(_Map_base<>::__node_type): Remove.
(_Map_base<>::iterator): Remove.
(_Insert_base<>::__hash_cached): New.
(_Insert_base<>::__constant_iterators): New.
(_Insert_base<>::__hashtable_alloc): New.
(_Insert_base<>::__node_type): Remove.
(_Insert_base<>::__node_ptr): New.
(_Hash_code_base<>): Remove specializations.
(_Hash_code_base<>::__node_type): Remove.
(_Hash_code_base<>::_M_bucket_index(const __node_type*, size_t)):
Replace by...
(_Hash_code_base<>::_M_bucket_index(const _Hash_node_value<>&, size_t)):
...this.
(_Hash_code_base<>::_M_store_code(__node_type*, __hash_code)):
Replace by...
(_Hash_code_base<>::_M_store_code(_Hash_node_code_cache<>&, __hash_code)):
...this.
(_Hash_code_base<>::_M_copy_code(__node_type*, const __node_type*)):
Replace by...
(_Hash_code_base<>::_M_copy_code(_Hash_node_code_cache<>&,
const _Hash_node_code_base<>&)): ...this.
(_Hashtable_base<>::__constant_iterators): Remove.
(_Hashtable_base<>::__unique_keys): Remove.
(_Hashtable_base<>::__node_type): Remove.
(_Hashtable_base<>::iterator): Remove.
(_Hashtable_base<>::const_iterator): Remove.
(_Hashtable_base<>::local_iterator): Remove.
(_Hashtable_base<>::const_local_iterator): Remove.
(_Hashtable_base<>::__ireturn_type): Remove.
(_Hashtable_base<>::_Equal_hash_code<>::_S_equals): Replace by...
(_Hashtable_base<>::_S_equals(__hash_code, const _Hash_node_code_hash<>&)):
...this.
(_Hashtable_base<>::_Equal_hash_code<>::_S_node_equals): Replace by...
(_Hashtable_base<>::_S_node_equals(__hash_code,
const _Hash_node_code_hash<>&)): ...this.
(_Hashtable_base<>::_Equal_hash_code<>): Remove.
(_Hashtable_base<>::_M_equals): Adapt.
(_Hashtable_baxe<>::_M_node_equals): Adapt.
(_Equality<>::_M_equal): Adapt.
(_Hashtable_alloc<>::__node_ptr): New.
(_Hashtable_alloc<>::__bucket_type): Rename into...
(_Hashtable_alloc<>::__node_base_ptr): ...this.
(_Hashtable_alloc<>::__bucket_alloc_type): Rename into...
(_Hashtable_alloc<>::__buckets_alloc_type): ...this.
(_Hashtable_alloc<>::__bucket_alloc_traits): Rename into...
(_Hashtable_alloc<>::__buckets_alloc_traits): ...this.
(_Hashtable_alloc<>::__buckets_ptr): New.
(_Hashtable_alloc<>::_M_allocate_node): Adapt.
(_Hashtable_alloc<>::_M_deallocate_node): Adapt.
(_Hashtable_alloc<>::_M_deallocate_node_ptr): Adapt.
(_Hashtable_alloc<>::_M_deallocate_nodes): Adapt.
(_Hashtable_alloc<>::_M_allocate_buckets): Adapt.
(_Hashtable_alloc<>::_M_deallocate_buckets): Adapt.
* include/bits/hashtable.h (_Hashtable<>): Adapt.
libstdc++-v3/include/bits/hashtable.h
libstdc++-v3/include/bits/hashtable_policy.h