[PATCH] Fix gnu-versioned-namespace build

2019-12-10 Thread François Dumont
I plan to commit this tomorrow. Note that rather than just adding the missing _GLIBCXX_[BEGIN,END]_VERSION_NAMESPACE I also move anonymous namespace usage outside std namespace. Let me know if it was intentional.     * src/c++11/random.cc: Add _GLIBCXX_BEGIN_NAMESPACE_VERSION and    

Re: [PATCH][Hashtable 0/6] Code review

2019-12-09 Thread François Dumont
This patch also require an update of the printers.py file. Here is an updated version. François On 11/17/19 9:42 PM, François Dumont wrote: This is the begining of a patch series for _Hashtable Initial patch to clarify code. I was tired to see true/false or true_type/false_type without

[PATCH] Extend std::copy_n optimization

2019-12-09 Thread François Dumont
Last patch of my series following this one: https://gcc.gnu.org/ml/libstdc++/2019-12/msg00028.html This time I work on std::copy_n/std::copy overloads for istreambuf_iterator so that it works also for deque iterators and transparently in _GLIBCXX_DEBUG mode.     * include/bits/stl_algo.h

[PATCH] Extend std::lexicographical_compare optimizations

2019-12-09 Thread François Dumont
Following: https://gcc.gnu.org/ml/libstdc++/2019-12/msg00028.html I've done the same kind of work on std::lexicographical_compare algo. I had to make the internal lexicographical_compare functions return int rather than bool cause with bool you can't use a chunck based approach unless you

Re: copy/copy_backward/fill/fill_n/equal rework

2019-12-09 Thread François Dumont
to submit afterward. Note that this patch is based after this one: https://gcc.gnu.org/ml/libstdc++/2019-10/msg00072.html François On 9/25/19 6:44 AM, François Dumont wrote: Ping ? On 9/9/19 8:34 PM, François Dumont wrote: Hi     This patch improves stl_algobase.h copy/copy_backward/fill/fill_n

Re: [PATCH] Enhance _GLIBCXX_DEBUG constexpr support

2019-12-09 Thread François Dumont
After completing execution of all tests I had to fix implementation of __check_singular to get only 1 return statement. On 12/2/19 8:31 PM, François Dumont wrote: Hi     Here is a patch to enhance constexpr support in _GLIBCXX_DEBUG. I work on std::lower_bound/upper_bound to find out

[PATCH] Fix _GLIBCXX_DEBUG tests static_assert lines

2019-12-09 Thread François Dumont
When applying: 2019-11-26  François Dumont      * include/debug/array (array<>::fill): Add C++20 constexpr.     (array<>::swap): Likewise. I forgot to adapt some line numbers. Committed as trivial. François diff --git a/libstdc++-v3/testsuite/23_containers/array/tup

[PATCH] Enhance _GLIBCXX_DEBUG constexpr support

2019-12-02 Thread François Dumont
Hi     Here is a patch to enhance constexpr support in _GLIBCXX_DEBUG. I work on std::lower_bound/upper_bound to find out if Debug mode is well prepared. I'll continue on other algos later.     I initially hope that I could count on the compiler for the valid_range check. But for

Re: [PATCH][_GLIBCXX_DEBUG] Improve valid_range check

2019-11-26 Thread François Dumont
On 11/26/19 10:52 PM, Jonathan Wakely wrote: On 26/11/19 20:07 +0100, François Dumont wrote: Sure, I am about to do so. However I wasn't sure about this syntax before the commit so I had run the new 2_neg.cc with: make CXXFLAGS=-std=c++98 check-debug and it worked fine and still

Re: [PATCH][_GLIBCXX_DEBUG] Improve valid_range check

2019-11-26 Thread François Dumont
On 11/26/19 9:49 PM, Stephan Bergmann wrote: On 26/11/2019 20:07, François Dumont wrote: However I wasn't sure about this syntax before the commit so I had run the new 2_neg.cc with: make CXXFLAGS=-std=c++98 check-debug and it worked fine and still is ! I also try -std=gnu++98 and made sure

Re: [PATCH][_GLIBCXX_DEBUG] Improve valid_range check

2019-11-26 Thread François Dumont
On 11/26/19 1:21 PM, Jonathan Wakely wrote: On 26/11/19 12:33 +0100, Stephan Bergmann wrote: On 22/11/2019 18:59, Jonathan Wakely wrote: On 22/11/19 18:38 +0100, François Dumont wrote:     I noticed that we are not checking that iterators are not singular in valid_range. Moreover

Re: [PATCH, libstdc++] More

2019-11-25 Thread François Dumont
I have a patch for the same location so here is my remark that might make my patch useless. Maybe you can even merge it with yours Ed, here it is: https://gcc.gnu.org/ml/libstdc++/2019-10/msg00072.html On 11/25/19 10:15 PM, Jonathan Wakely wrote: On 15/11/19 22:17 -0500, Ed Smith-Rowland via

[PATCH] C++20 P1032 for __debug::array

2019-11-25 Thread François Dumont
I plan to commit this tomorrow. But I really wonder if we couldn't just add some __glibcxx_checks_xxx in std/array ?     * include/debug/array (array<>::fill): Add C++20 constexpr.     (array<>::swap): Likewise. François diff --git a/libstdc++-v3/include/debug/array

[PATCH] Add safe iterator iterator_concept

2019-11-25 Thread François Dumont
I plan to commit this patch tomorrow.     * include/debug/safe_iterator.h [__cpp_lib_concepts](_Safe_iterator<>::iterator_concept): Define for     C++20. François diff --git a/libstdc++-v3/include/debug/safe_iterator.h b/libstdc++-v3/include/debug/safe_iterator.h index 685256551d9..abf575186c7

[PATCH][_GLIBCXX_DEBUG] Improve valid_range check

2019-11-22 Thread François Dumont
Hi     I noticed that we are not checking that iterators are not singular in valid_range. Moreover __check_singular signature for pointers is not intercepting all kind of pointers in terms of qualification.     I'd like to commit it next week but considering we are in stage 3 I need proper

Re: [PATCH][Hashtable 5/6] Remove H1/H2 template parameters

2019-11-18 Thread François Dumont
On 11/17/19 11:21 PM, Ville Voutilainen wrote: On Sun, 17 Nov 2019 at 23:15, François Dumont wrote: H1 used to be a reference to the user Hash, now _Hashtable and unordered types agree on the same Hash type which is more intuitive. I also chose to not support anymore a stateful ranged hash

[PATCH][Hashtable 6/6] PR 68303 small size optimization

2019-11-17 Thread François Dumont
This is an implementation of PR 68303. I try to use this idea as much as possible to avoid computation of hash codes. Note that tests are not showing any gain. I guess hash computation must be quite bad to get a benefit from it. So I am only activating it when hash code is not cached and/or

[PATCH][Hashtable 5/6] Remove H1/H2 template parameters

2019-11-17 Thread François Dumont
H1 used to be a reference to the user Hash, now _Hashtable and unordered types agree on the same Hash type which is more intuitive. I also chose to not support anymore a stateful ranged hash functor. We only use _Mod_range_hashing and _Mask_range_hashing. Thanks to this simplification

[PATCH][Hashtable 4/6] Clean local_iterator implementation

2019-11-17 Thread François Dumont
Simplify local_iterator implementation. It makes local_iterator and iterator comparable which is used in debug containers.     * include/bits/hashtable_policy.h (_Node_iterator_base()): New.     (operator==(const _Node_iterator_base&, const _Node_iterator_base&)):     Make hidden friend.    

[PATCH][Hashtable 3/6] Fix noexcept qualifications

2019-11-17 Thread François Dumont
This patch adds noexcept qualification on allocator aware constructors and fix the one on the default constructor.     * include/bits/hashtable.h     (_Hashtable(_Hashtable&& __ht, __node_alloc_type&& __a, true_type)):     Add noexcept qualification.     (_Hashtable(_Hashtable&&)): Fix noexcept

[PATCH][Hashtable 2/6] Avoid over-sizing container

2019-11-17 Thread François Dumont
This patch avoids over-sizing of the container by rather considering the bucket count hint or potential reservation. It concerns only the non-multi containers.     * include/bits/hashtable.h     (_Hashtable<>(_InputIterator, _InputIterator, size_t, const _H1&,     const _H2&, const _Hash&,

[PATCH][Hashtable 1/6] Code simplification/optimization

2019-11-17 Thread François Dumont
This patch simplifies a number of implementations. It tries as much as possible to avoid computing hash code. This is especially true for the erase implementation in case of multi keys.     * include/bits/hashtable_policy.h (_Map_base<>::at): Use     _Hashtable<>::find.

[PATCH][Hashtable 0/6] Code review

2019-11-17 Thread François Dumont
This is the begining of a patch series for _Hashtable Initial patch to clarify code. I was tired to see true/false or true_type/false_type without knowing what was true/false. I also made code more consistent by chosing to specialize methods through usage of __unique_keys_t/__multi_keys_t

[PATCH] PR libstdc++/92124 on hashtable

2019-11-07 Thread François Dumont
From what I understood from recent fix the unordered containers need to be updated the same way. I hope you'll appreciate the usage of rvalue forwarding. Containers node values are moved as soon as _M_assign is called with a rvalue reference to the source container. Additionnaly this patch

Re: [PATCH] Help compiler detect invalid code

2019-10-16 Thread François Dumont
_neg.cc: New.     * testsuite/25_algorithms/move/constexpr.cc: New.     * testsuite/25_algorithms/move/constexpr_neg.cc: New. François On 10/10/19 10:03 PM, Jonathan Wakely wrote: On 01/10/19 22:05 +0200, François Dumont wrote: On 9/27/19 1:24 PM, Jonathan Wakely wrote: On 20/09/19 07:08 +0200, François Dum

[PATCH] Clarify constness and state

2019-10-15 Thread François Dumont
    * src/c++11/debug.cc (print_field): Replace constness_names     entry with . Replace state_names entry with     . Committed as trivial. François Index: src/c++11/debug.cc === --- src/c++11/debug.cc (révision 277048) +++

[PATCH] ostreambuf_iterator std::advance overload

2019-10-15 Thread François Dumont
Hi     I completed this overload before noticing that the Standard do not expect anything when 'advancing' an output iterator.     But as I've done it consistenly with the istreambuf_iterator here it is with samples about how to use it.     Let me know if acceptable. François diff --git

Re: [PATCH] Implement std::advance for istreambuf_iterator using pubseekoff

2019-10-15 Thread François Dumont
to std::advance algo. François On 10/14/19 10:12 PM, François Dumont wrote: The same way I proposed to review std::copy overload for istreambuf_iterator we can implement std::advance using pubseekoff. It is both a cleaner implementation and avoids yet another friend declaration.     * include

[PATCH] Implement std::advance for istreambuf_iterator using pubseekoff

2019-10-14 Thread François Dumont
The same way I proposed to review std::copy overload for istreambuf_iterator we can implement std::advance using pubseekoff. It is both a cleaner implementation and avoids yet another friend declaration.     * include/std/streambuf     (advance(istreambuf_iterator<>&, _Distance)): Remove

Re: Add std::copy_n overload for istreambuf_iterator

2019-10-10 Thread François Dumont
te: On Fri, 4 Oct 2019 at 07:01, François Dumont <mailto:frs.dum...@gmail.com>> wrote: On 9/27/19 1:00 PM, Jonathan Wakely wrote: > On 19/07/19 23:37 +0200, François Dumont wrote: >> It sounds reasonable to overload std::copy_n for istreambuf_iterator.

Re: Add std::copy_n overload for istreambuf_iterator

2019-10-09 Thread François Dumont
On 10/9/19 10:18 PM, Christophe Lyon wrote: On Fri, 4 Oct 2019 at 07:01, François Dumont <mailto:frs.dum...@gmail.com>> wrote: On 9/27/19 1:00 PM, Jonathan Wakely wrote: > On 19/07/19 23:37 +0200, François Dumont wrote: >> It sounds reasonable to ov

Re: copy/copy_backward/fill/fill_n/equal rework

2019-10-08 Thread François Dumont
can find a way to confirm that a given overload is indeed being called. So here is this patch again. François On 9/27/19 11:14 PM, François Dumont wrote: On 9/27/19 2:28 PM, Jonathan Wakely wrote: On 09/09/19 20:34 +0200, François Dumont wrote: Hi     This patch improves stl_algobase.h copy

[PATCH] Review std::copy istreambuf_iterator specialization

2019-10-08 Thread François Dumont
Hi     Following what has been done for std::copy_n I think we could simplify the __copy_move_a2 overload to also use sgetn. Code is simpler and we avoid a friend declaration.     Tested under Linux x86_64.     * include/std/streambuf (__copy_move_a2): Remove friend declaration.     *

Re: [PATCH] Improve _Safe_iterator _M_distance_to

2019-10-04 Thread François Dumont
I eventually committed the attach patch. The usage of __dp_sign_max_size will come later. François On 9/27/19 1:45 PM, Jonathan Wakely wrote: On 16/09/19 22:31 +0200, François Dumont wrote:     Here is the patch to improve _Safe_iterator<>::_M_get_distance_to implementation. I intr

Re: Add std::copy_n overload for istreambuf_iterator

2019-10-03 Thread François Dumont
On 9/27/19 1:00 PM, Jonathan Wakely wrote: On 19/07/19 23:37 +0200, François Dumont wrote: It sounds reasonable to overload std::copy_n for istreambuf_iterator. I wonder whether it's worth doing: #if __cplusplus >= 201703L    if constexpr (is_same_v<_OutputIterator, _CharT*>)   

[PATCH] Add std::__iterator_category_t

2019-10-03 Thread François Dumont
Hi     May I add this convenient function ? I'll also use it in coming patches.     Note that I removed a template parameter in __is_random_access_iter in C++11.     * include/bits/stl_iterator_base_types.h (__iterator_category_t): Define     for C++11.     (__is_random_access_iter):

[PATCH] Add std::copy_n debug checks

2019-10-03 Thread François Dumont
Hi     We are missing obvious debug checks in std::copy_n. Moreover I'll need them when I'll remove the Debug layer in a coming patch.     Tested under Linux x86_64.     * include/bits/stl_algo.h (copy_n): Add __glibcxx_requires_can_increment     debug checks.     *

Re: [PATCH] Help compiler detect invalid code

2019-10-01 Thread François Dumont
On 9/27/19 1:24 PM, Jonathan Wakely wrote: On 20/09/19 07:08 +0200, François Dumont wrote: I already realized that previous patch will be too controversial to be accepted. In this new version I just implement a real memmove in __memmove so A real memmove doesn't just work backwards

[PATCH] Implement C++20 P1023 for __debug::array

2019-09-30 Thread François Dumont
This is a missing part of C++20 P1023 for __debug::array.     Implement C++20 p1023 - constexpr comparison operators for __debug::array.     * include/debug/array: Add C++20 constexpr to comparison operators.     * testsuite/23_containers/array/tuple_interface/get_debug_neg.cc: Adapt    

Re: [PATCH] Fix algo constexpr tests in Debug mode

2019-09-30 Thread François Dumont
On 9/30/19 11:03 AM, Jonathan Wakely wrote: On 28/09/19 23:12 +0200, François Dumont wrote: Here is what I just commited. Thanks. In my branch I had a lot more _GLIBCXX20_CONSTEXPR additions in the debug mode headers. Is it not needed on __check_singular, __foreign_iterator etc. ? Yes, I

[PATCH] Fix algo constexpr tests in Debug mode

2019-09-28 Thread François Dumont
iterator<>&)): Likewise.     (__equal_aux(const _Safe_iterator<>&,     const _Safe_iterator<>&, const _Safe_iterator<>&)): Likewise. François On 9/27/19 6:45 PM, Jonathan Wakely wrote: On 27/09/19 18:24 +0200, François Dumont wrote: On 9/27/19 2:11 PM,

Re: copy/copy_backward/fill/fill_n/equal rework

2019-09-27 Thread François Dumont
On 9/27/19 2:28 PM, Jonathan Wakely wrote: On 09/09/19 20:34 +0200, François Dumont wrote: Hi     This patch improves stl_algobase.h copy/copy_backward/fill/fill_n/equal implementations. The improvements are: - activation of algo specialization for __gnu_debug::_Safe_iterator (w/o

Re: [PATCH] Help compiler detect invalid code

2019-09-27 Thread François Dumont
On 9/27/19 2:11 PM, Jonathan Wakely wrote: On 19/09/19 22:27 +0200, François Dumont wrote: Hi     I start working on making recently added constexpr tests to work in Debug mode. The attached patch seems to be necessary for that, right? On my side I had done this, almost the same

Re: [PATCH] PR libstdc++/91910 fix data race in Debug Mode destructors

2019-09-27 Thread François Dumont
On 9/26/19 3:20 PM, Jonathan Wakely wrote: Fix data race when _Safe_iterator_base::_M_detach() runs concurrently with the _Safe_container_base destructor. PR libstdc++/91910 * src/c++11/debug.cc (_Safe_iterator_base::_M_detach()): Load pointer atomically and lock the mutex before

Re: [PATCH] Help compiler detect invalid code

2019-09-25 Thread François Dumont
mode. OK to commit ? François On 9/20/19 7:08 AM, François Dumont wrote: I already realized that previous patch will be too controversial to be accepted. In this new version I just implement a real memmove in __memmove so that in copy_backward there is no need for a shortcut to a more

Re: copy/copy_backward/fill/fill_n/equal rework

2019-09-24 Thread François Dumont
Ping ? On 9/9/19 8:34 PM, François Dumont wrote: Hi     This patch improves stl_algobase.h copy/copy_backward/fill/fill_n/equal implementations. The improvements are: - activation of algo specialization for __gnu_debug::_Safe_iterator (w/o _GLIBCXX_DEBUG mode) - activation of algo

Re: [PATCH] Help compiler detect invalid code

2019-09-19 Thread François Dumont
/19/19 10:27 PM, François Dumont wrote: Hi     I start working on making recently added constexpr tests to work in Debug mode.     It appears that the compiler is able to detect code mistakes pretty well as long we don't try to hide the code intention with a defensive approach. This is why I'd

[PATCH] Help compiler detect invalid code

2019-09-19 Thread François Dumont
Hi     I start working on making recently added constexpr tests to work in Debug mode.     It appears that the compiler is able to detect code mistakes pretty well as long we don't try to hide the code intention with a defensive approach. This is why I'd like to propose to replace '__n > 0'

[PATCH] Improve _Safe_iterator _M_distance_to

2019-09-16 Thread François Dumont
    Here is the patch to improve _Safe_iterator<>::_M_get_distance_to implementation. I introduced a new _Distance_precision  __sp_sign_max_size for occasions where we can't find out the exact size of a range but still get the max size of it. Thanks to this the performance tests are much

[PATCH] lexicographical_comparison enhancements

2019-09-16 Thread François Dumont
Hi This is the next part of: https://gcc.gnu.org/ml/libstdc++/2019-09/msg00048.html This time it is to improve behavior of std::lexicographical_compare for deque or safe iterators. To do so I had to make lc internal implementation return int rather than bool otherwise it is impossible to

copy/copy_backward/fill/fill_n/equal rework

2019-09-09 Thread François Dumont
Hi     This patch improves stl_algobase.h copy/copy_backward/fill/fill_n/equal implementations. The improvements are: - activation of algo specialization for __gnu_debug::_Safe_iterator (w/o _GLIBCXX_DEBUG mode) - activation of algo specialization for _Deque_iterator even if mixed with

[PATCH] Fix unused malloc return value warning

2019-08-29 Thread François Dumont
Hi     I am having this warning: /home/fdt/dev/gcc/git/libstdc++-v3/testsuite/util/testsuite_performance.h:170: attention: ignoring return value of « void* malloc(size_t) » declared with attribute « warn_unused_result » [-Wunused-result]   170 |   malloc(0); // Needed for some

Re: PR 90409 Deque fiil/copy/move/copy_backward/move_backward/equal overloads

2019-08-26 Thread François Dumont
Hi     I am eventually working on another implementation to acheive the same result with less changes and codes. I think you'll prefer this one.     So don't spend any time on this patch proposal, a new one will come in a couple of days. François

Deque iterators lexicographical_compare overloads

2019-07-25 Thread François Dumont
And here are the lexicographical_compare overloads. I am submitting this seperately from the others cause some might argue that it is a lot of code for a scope limited to the moment to unsigned byte types. I had to overload __lexicographical_compare_aux here cause the

[PATCH] Fix bad comment copy/paste

2019-07-25 Thread François Dumont
Committed as trivial.     * testsuite/util/testsuite_iterators.h     (bidirectional_iterator_wrapper): Fix type comment.     (random_access_iterator_wrapper): Likewise. François diff --git a/libstdc++-v3/testsuite/util/testsuite_iterators.h b/libstdc++-v3/testsuite/util/testsuite_iterators.h

Add std::copy_n overload for istreambuf_iterator

2019-07-19 Thread François Dumont
It sounds reasonable to overload std::copy_n for istreambuf_iterator.     * include/bits/stl_algo.h (copy_n(istreambuf_iterator<>, _Size, _OIte)):     New declaration.     * include/bits/streambuf_iterator.h (istreambuf_iterator<>): Declare     std::copy_n for istreambuf_iterator of char types

Re: sized delete in _Temporary_buffer<>

2019-07-19 Thread François Dumont
(2nd sent attempt as text this time.) Good spot, fixed with attached patch, committed as trivial. 2019-07-19  François Dumont     * include/bits/stl_tempbuf.h (__detail::__return_temporary_buffer): Fix     sized deallocation size computation. On 7/19/19 9:46 PM, Morwenn Ed wrote: If I'm

Re: Fix failing tests after PR libstdc++/85965

2019-07-18 Thread François Dumont
Got it, it is my PR 68303 patch which was introducing this regression. I fix it to restore those assertions. You'll see once the awaiting hashtable patches are in... On 7/18/19 12:18 PM, Jonathan Wakely wrote: On 18/07/19 07:41 +0200, François Dumont wrote: Since commit

Fix failing tests after PR libstdc++/85965

2019-07-17 Thread François Dumont
Since commit 5d3695d03b7bdade9f4d05d2b those tests are failing.     * testsuite/23_containers/unordered_map/48101_neg.cc: Adapt dg-error     after PR libstdc++/85965 fix.     * testsuite/23_containers/unordered_multimap/48101_neg.cc: Likewise.     *

sized delete in _Temporary_buffer<>

2019-07-17 Thread François Dumont
As we adopted the sized deallocation in the new_allocator why not doing the same in _Temporary_buffer<>.     * include/bits/stl_tempbuf.h (__detail::__return_temporary_buffer): New.     (~_Temporary_buffer()): Use latter.     (_Temporary_buffer(_FIterator, size_type)): Likewise. Tested w/o

Re: Deque fiil/copy/move/copy_backward/move_backward/equal overloads

2019-07-16 Thread François Dumont
Ping ? On 6/19/19 7:32 PM, François Dumont wrote: I wanted to implement Debug overloads for those already existing overloads but then realized that those algos could be generalized. This way we will benefit from the memmove replacement when operating with C array or std::array or std::vector

Re: [C++ PATCH] Speed up inplace_merge algorithm & fix inefficient logic(PR libstdc++/83938)

2019-07-16 Thread François Dumont
New.     * testsuite/performance/25_algorithms/stable_sort.cc: Rework to allow     execution with different memory constraints. Ok to commit ? François On 6/9/19 4:27 PM, François Dumont wrote: On 12/21/18 9:57 PM, Jonathan Wakely wrote: On 29/10/18 07:06 +0100, François Dumont wrote: Hi     S

Re: std::vector code cleanup fixes optimizations

2019-06-24 Thread François Dumont
Hi     Any feedback regarding this patch ? Thanks On 5/14/19 7:46 AM, François Dumont wrote: Hi     This is the patch on vector to: - Optimize sizeof in Versioned namespace mode. We could go one step further by removing _M_p from _M_finish and just transform it into an offset

Re: Deque fiil/copy/move/copy_backward/move_backward/equal overloads

2019-06-20 Thread François Dumont
*De :* libstdc++-ow...@gcc.gnu.org de la part de François Dumont *Envoyé :* mercredi 19 juin 2019 19:32 *À :* libstd...@gcc.gnu.org; gcc-patches *Objet :* Deque fiil/copy/move/copy_backward/move_backward/equal overloads I wanted

Re: Review Hashtable extract node API

2019-06-20 Thread François Dumont
On 6/19/19 12:47 AM, Jonathan Wakely wrote: On 18/06/19 22:42 +0200, François Dumont wrote: On 6/18/19 12:54 PM, Jonathan Wakely wrote: On 18/06/19 07:52 +0200, François Dumont wrote: A small regression noticed while merging. We shouldn't keep on using a moved-from key_type instance. Ok

unordered_multimap/unordered_multiset optimizations

2019-06-19 Thread François Dumont
Hi     Still influenced by PR 68303 this patch: - Extend usage of find within other methods. It simplify code and will allow to implement the PR in less places if we decide to do so. - Get rid of several bucket index comparison for non-unique key containers this way we have less hash code

Re: Review Hashtable extract node API

2019-06-18 Thread François Dumont
On 6/18/19 12:54 PM, Jonathan Wakely wrote: On 18/06/19 07:52 +0200, François Dumont wrote: A small regression noticed while merging. We shouldn't keep on using a moved-from key_type instance. Ok to commit ? Feel free to do it if you prefer, I'll do so at end of Europe day otherwise. diff

Re: Review Hashtable extract node API

2019-06-17 Thread François Dumont
A small regression noticed while merging. We shouldn't keep on using a moved-from key_type instance. Ok to commit ? Feel free to do it if you prefer, I'll do so at end of Europe day otherwise. François On 6/17/19 12:28 PM, Jonathan Wakely wrote: On 07/06/19 18:39 +0200, François Dumont

Re: libbacktrace integration for _GLIBCXX_DEBUG mode

2019-06-13 Thread François Dumont
Here is a new proposal which I think take into account all your remarks. I discovered the great "%.*s" printf format so I was able to do some cleanup on the function name without any allocation. I also agree that counting the '>' or '<' is not reliable so I remove this and limit the cleanup

Re: [C++ PATCH] Speed up inplace_merge algorithm & fix inefficient logic(PR libstdc++/83938)

2019-06-09 Thread François Dumont
On 12/21/18 9:57 PM, Jonathan Wakely wrote: On 29/10/18 07:06 +0100, François Dumont wrote: Hi     Some feedback regarding this patch ? Sorry this got missed, please resubmit during stage 1. You haven't CC'd the original patch author (chang jc) to give them a chance to comment on your

Re: Review Hashtable extract node API

2019-06-07 Thread François Dumont
On 6/5/19 6:22 PM, Jonathan Wakely wrote: On 04/06/19 19:19 +0200, François Dumont wrote: Hi     Here is a patch to enhance the _Hashtable extract node API and fix a FIXME request.     The enhancement to the extract node Api is that extract(const key_type&) do not call ext

Re: libbacktrace integration for _GLIBCXX_DEBUG mode

2019-06-07 Thread François Dumont
dbf5edf0     }     iterator "__last" @ 0x0x7fffdbf5ea10 {   type = std::move_iterator<__gnu_cxx::__normal_iteratorstd::default_delete >*, std::vectorstd::default_delete >> > > (mutable iterator);   state = past-the-end;   references sequence with type 'std::

Re: libbacktrace integration for _GLIBCXX_DEBUG mode

2019-06-06 Thread François Dumont
Here is what I come up with. Regarding allocation in print_function I would also prefer to avoid it. But this patch also aim at creating a backtrace_state object in case of UB so the alloc is perhaps not so important. I can't use string_view as I need to modify it to display only a part of

Review Hashtable extract node API

2019-06-04 Thread François Dumont
Hi     Here is a patch to enhance the _Hashtable extract node API and fix a FIXME request.     The enhancement to the extract node Api is that extract(const key_type&) do not call extract(const_iterator) anymore. Doing so we had to loop again through bucket nodes to find the previous node

Re: Hashtable Small size optimization

2019-06-03 Thread François Dumont
the performance test didn't make it, I'll re-submit it in another patch more dedicated to small size optimization. François On 5/31/19 1:44 PM, Jonathan Wakely wrote: Re https://gcc.gnu.org/ml/gcc-patches/2018-10/msg00903.html On 15/10/18 22:46 +0200, François Dumont wrote: I started

Re: libbacktrace integration for _GLIBCXX_DEBUG mode

2019-05-29 Thread François Dumont
On 5/29/19 12:06 AM, Jonathan Wakely wrote: On 23/05/19 07:39 +0200, François Dumont wrote: Hi     So here what I come up with.     _GLIBCXX_DEBUG_BACKTRACE controls the feature. If the user define Thanks for making this opt-in. it and there is a detectable issue with libbacktrace then I

Re: Hashtable comment cleanups & renamings

2019-05-27 Thread François Dumont
I had miss some occurences of __bucket_hint to replace with __bucket_count_hint so here is a new version. Ok to commit with the simple ChangeLog entry below ? On 5/21/19 7:42 AM, François Dumont wrote: Here is a simplified form.     Rename variables and cleanup comments.     * include/bits

Re: libbacktrace integration for _GLIBCXX_DEBUG mode

2019-05-22 Thread François Dumont
Hi     So here what I come up with.     _GLIBCXX_DEBUG_BACKTRACE controls the feature. If the user define it and there is a detectable issue with libbacktrace then I generate a compilation error. I want to avoid users defining it but having no backtrace in the end in the debug assertion.   

Re: [PATCH] tbb-backend effective target should check ability to link TBB

2019-05-21 Thread François Dumont
On 5/21/19 10:51 PM, Jonathan Wakely wrote: On 21/05/19 22:47 +0200, François Dumont wrote: On 5/21/19 3:50 PM, Jonathan Wakely wrote: On 20/05/19 21:41 -0700, Thomas Rodgers wrote: With the addition of "-ltbb" to the v3_target_compile flags (so as to, you know, actually try t

Re: [PATCH] tbb-backend effective target should check ability to link TBB

2019-05-21 Thread François Dumont
On 5/21/19 3:50 PM, Jonathan Wakely wrote: On 20/05/19 21:41 -0700, Thomas Rodgers wrote: With the addition of "-ltbb" to the v3_target_compile flags (so as to, you know, actually try to link tbb). Tested x86_64-linux, committed to trunk. This didn't work, I still get a FAIL for every pstl

Re: Hashtable comment cleanups & renamings

2019-05-20 Thread François Dumont
Here is a simplified form.     Rename variables and cleanup comments.     * include/bits/hashtable_policy.h     * include/bits/hashtable.h Ok to commit ? François On 5/17/19 10:24 PM, Jonathan Wakely wrote: On 17/05/19 18:19 +0200, François Dumont wrote: Hi     I got tired of '__n' being

Re: [PATCH] improve performance of std::allocator::deallocate

2019-05-20 Thread François Dumont
On 5/20/19 1:14 PM, Jonathan Wakely wrote: - r1->deallocate(p, 2); + r1->deallocate(p, 2, alignof(char)); + __builtin_printf("%d\n", (int)bytes_allocated); Was this last line really intended to be added ?

Re: Hashtable comment cleanups & renamings

2019-05-19 Thread François Dumont
On 5/17/19 10:24 PM, Jonathan Wakely wrote: On 17/05/19 18:19 +0200, François Dumont wrote: Hi     I got tired of '__n' being used in _Hashtable for many different purposes: node, bucket, bucket count, bucket hint. It makes the code difficult to read. This code makes sure that __n is a node

Deque rotate on current node

2019-05-19 Thread François Dumont
Hi   std::deque is supposed to be like a double-queue that you can attack from front and back. But currrently its implementation makes it behave differently when starting from a fresh deque. If push_back then all goes well, it is copy/move to the current internal 'node'. If push_front then a

Hashtable comment cleanups & renamings

2019-05-17 Thread François Dumont
Hi     I got tired of '__n' being used in _Hashtable for many different purposes: node, bucket, bucket count, bucket hint. It makes the code difficult to read. This code makes sure that __n is a node except is some very limited use cases where the method name is clear enough to tell what __n

Re: Deque code cleanup and optimizations

2019-05-16 Thread François Dumont
: Remove.     [__cplusplus >= 201103L](_M_assign_dispatch): Remove.     [__cplusplus >= 201103L](_M_insert_dispatch): Remove.     * testsuite/23_containers/deque/allocator/default_init.cc: New. Tested under Linux x86_64. Ok to commit ? François On 5/10/19 3:38 PM, Jonathan Wakely wrote

Re: LWG2593 Move from allocator state is preserved

2019-05-16 Thread François Dumont
2 other tests needed to be adapted in 21_strings. Attached patch applied. 2019-05-17  François Dumont     Move from state of allocators (LWG2593)     * include/bits/stl_deque.h     (_Deque_base(_Deque_base&&, false_type)): Remove.     (_Deque_base(_Deque_base&&, tru

LWG2593 Move from allocator state is preserved

2019-05-15 Thread François Dumont
Hi     Let's apply this resolution first before moving forward with the std::deque implementation.     Move from state of allocators (LWG2593)     * include/bits/stl_deque.h     (_Deque_base(_Deque_base&&, false_type)): Remove.     (_Deque_base(_Deque_base&&, true_type)): Remove.    

Re: [PATCH] Remove redundant accessors in hash tables

2019-05-15 Thread François Dumont
On 5/15/19 5:37 PM, Jonathan Wakely wrote: François, I noticed that _Hash_code_base and _Hashtable_base have a number of member functions which are overloaded for const and non-const:    const _Equal&    _M_eq() const { return _EqualEBO::_S_cget(*this); }    _Equal&    _M_eq() { return

Re: Deque code cleanup and optimizations

2019-05-13 Thread François Dumont
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

std::vector code cleanup fixes optimizations

2019-05-13 Thread François Dumont
Hi     This is the patch on vector to: - Optimize sizeof in Versioned namespace mode. We could go one step further by removing _M_p from _M_finish and just transform it into an offset but it is a little bit more impacting for the code. - Implement the swap optimization already done on main

Re: Make vector iterator operators hidden friends

2019-05-11 Thread François Dumont
On 5/10/19 3:59 PM, Jonathan Wakely wrote: On 10/05/19 14:40 +0100, Jonathan Wakely wrote: On Thu, 9 May 2019 at 06:49, François Dumont wrote: Hi Patch similar to the one I just apply for deque iterator including NRVO copy ellision fix. * include/bits/stl_bvector.h (operator

Deque code cleanup and optimizations

2019-05-09 Thread François Dumont
Hi     This patch implements a number of simplifications and optimizations already done to other containers like std::vector - Default default and move constructors - The std::swap optimization - The construction always equal allocator optimization - Shortcuts on method calls.     I

Make vector iterator operators hidden friends

2019-05-08 Thread François Dumont
Hi     Patch similar to the one I just apply for deque iterator including NRVO copy ellision fix.     * include/bits/stl_bvector.h     (operator==(const _Bit_iterator_base&, const _Bit_iterator_base&)):     Make hidden friend.     (operator<(const _Bit_iterator_base&, const

Re: Make deque iterator operators hidden friends

2019-05-08 Thread François Dumont
Thanks for the tip, nice to know. Attached patch applied. François On 5/8/19 8:28 PM, Jonathan Wakely wrote: On 08/05/19 18:50 +0200, François Dumont wrote: Here is a patch to reduce number of operators exposed at std namespace scope.     * include/bits/stl_deque.h     (_Deque_iterator

Make deque iterator operators hidden friends

2019-05-08 Thread François Dumont
Here is a patch to reduce number of operators exposed at std namespace scope.     * include/bits/stl_deque.h     (_Deque_iterator<>::operator+(difference_type)): Make hidden friend.     (_Deque_iterator<>::operator-(difference_type)): Likewise.     (operator==(const _Deque_iterator<>&, const

Re: [Bug libstdc++/90277] Debug Mode test failures

2019-05-06 Thread François Dumont
.     (test02): Likewise.     (test03): Likewise.     I plan to commit it this evening if not told otherwise. François On 5/6/19 3:04 PM, redi at gcc dot gnu.org wrote: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90277 --- Comment #4 from Jonathan Wakely --- (In reply to François Dumont from comment

Hide move_iterator ill-form operators

2019-05-06 Thread François Dumont
Hi     This is another attempt to make adapter iterator types operators undefined when underlying iterator type doesn't support it. For the move_iterator it is rather easy and even already done for the operator- so I just generalize it to comparison operators. It doesn't cover all operators

Fix make check-debug RUNTESFLAGS=prettyprinters.exp

2019-05-04 Thread François Dumont
Hi     This patch allows to run pretty printer tests in _GLIBCXX_DEBUG mode. If accepted we could even integrate the pretty printers tests within the check-debug target like it is done for the check target.     * python/libstdcxx/v6/printers.py (add_one_template_type_printer):     Add type

libstdc++/90277 Review rehash policy

2019-05-02 Thread François Dumont
Hi     This is a patch I already proposed in another thread but I review it and moreover there is now a PR associated so I am submitting it as a brand new one.     So working on PR 68303 I noticed that one of the performance issue of current implementation is that initial sizing of buckets

<    1   2   3   4   5   6   7   8   9   10   >