std::forward_list optim for always equal allocator
François Dumont
frs.dumont@gmail.com
Thu Nov 23 21:49:00 GMT 2017
Gentle reminder for this patch.
I looked when the constructor got unused and I think it is back in June
2015 in git commit:
commit debb6aabb771ed02cb7256a7719555e5fbd7d3f7
Author: redi <redi@138bc75d-0d04-0410-961f-82ee72b054a4>
Date:Â Â Wed Jun 17 17:45:45 2015 +0000
       * include/bits/forward_list.h
       (_Fwd_list_base(const _Node_alloc_type&)): Change parameter to
       rvalue-reference.
If you fear abi breaking change I can restore it in a
!_GLIBCXX_INLINE_VERSION section.
François
On 28/08/2017 21:09, François Dumont wrote:
> Hi
>
> Â Â Â Any news for this patch ?
>
> Â Â Â It does remove a constructor:
> -Â Â Â Â Â Â Â _Fwd_list_impl(const _Node_alloc_type& __a)
> -Â Â Â Â Â Â Â : _Node_alloc_type(__a), _M_head()
>
> Â Â Â Â It was already unused before the patch. Do you think it has ever
> been used and so do I need to restore it ?
>
> Â Â Â I eventually restore the _M_head() in _Fwd_list_impl constructors
> cause IMO it is the inline init of _M_next in _Fwd_list_node_base
> which should be removed. But I remember Jonathan that you didn't want
> to do so because gcc was not good enough in detecting usage of
> uninitialized variables, is it still true ?
>
> François
>
>
> On 17/07/2017 22:10, François Dumont wrote:
>> Hi
>>
>> Â Â Â Here is the patch to implement the always equal alloc
>> optimization for forward_list. With this version there is no abi issue.
>>
>> Â Â Â I also prefer to implement the _Fwd_list_node_base move operator
>> for consistency with the move constructor and used it where applicable.
>>
>>
>> Â Â Â * include/bits/forward_list.h
>> Â Â Â (_Fwd_list_node_base& operator=(_Fwd_list_node_base&&)): Implement.
>> Â Â Â (_Fwd_list_impl(_Fwd_list_impl&&, _Node_alloc_type&&)): New.
>> Â Â Â (_Fwd_list_base(_Fwd_list_base&&, _Node_alloc_type&&,
>> std::true_type)):
>> Â Â Â New, use latter.
>> Â Â Â (forward_list(forward_list&&, _Node_alloc_type&&, std::false_type)):
>> Â Â Â New.
>> Â Â Â (forward_list(forward_list&&, _Node_alloc_type&&, std::true_type)):
>> Â Â Â New.
>> Â Â Â (forward_list(forward_list&&, const _Alloc&)): Adapt to use latters.
>> Â Â Â * include/bits/forward_list.tcc
>> Â Â Â (_Fwd_list_base(_Fwd_list_base&&, _Node_alloc_type&&)): Adapt to use
>> Â Â Â _M_impl._M_head move assignment.
>> Â Â Â (forward_list<>::merge(forward_list<>&&, _Comp)): Likewise.
>>
>> Tested under Linux x86_64, ok to commit ?
>>
>> François
>>
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: forward_list.patch
Type: text/x-patch
Size: 12182 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20171123/8aeca9a7/attachment.bin>
More information about the Gcc-patches
mailing list