Deque code cleanup and optimizations

François Dumont frs.dumont@gmail.com
Tue May 14 05:50:00 GMT 2019


On 5/10/19 3:38 PM, Jonathan Wakely wrote:
> This seems generally OK, but ...
>
> On Fri, 10 May 2019, 05:59 François Dumont wrote:
>>       I remove several _M_map != nullptr checks cause in current
>> implementation it can't be null. I have several patches following this
>> one to support it but in this case we will be using a different code path.
>
> You can't remove those checks. If _M_map can ever be null now or in
> the future, then we need the checks. Otherwise code compiled today
> would break if passed a deque compiled with a future GCC that allows
> the map to be null.
>
> I'm curious how you plan to support it though, I don't think it's
> possible without an ABI break.

No miracle, I plan to propose it only in versioned namespace mode, it 
does break ABI.

But in this implementation those current checks are useless, I'll double 
check.

>
>>       (_Deque_base::_Deque_impl::_M_move_impl()): Remove _M_impl._M_map
>> check.
> _M_move_impl and the constructor that calls it can be removed
> completely, because https://cplusplus.github.io/LWG/issue2593 means
> that the same allocator can still be used after moving from it. That
> function only exists to handle the case where an allocator changes
> value after being moved from.
>
Good, I'll cleanup that and propose a new patch.

François



More information about the Libstdc++ mailing list