aboutsummaryrefslogtreecommitdiff
path: root/libjava/testsuite/libjava.compile/Case.java
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2021-10-07 14:40:26 +0100
committerJonathan Wakely <jwakely@redhat.com>2021-10-07 17:52:04 +0100
commit561078480ffb5adb68577276c6b23e4ee7b39272 (patch)
tree0b8d2e4bfc2da06b79c03be3e05a28e01dac546e /libjava/testsuite/libjava.compile/Case.java
parent5c1838c01652a403498e27024cb0e5ea66376353 (diff)
downloadgcc-561078480ffb5adb68577276c6b23e4ee7b39272.zip
gcc-561078480ffb5adb68577276c6b23e4ee7b39272.tar.gz
gcc-561078480ffb5adb68577276c6b23e4ee7b39272.tar.bz2
libstdc++: Avoid debug checks in uniform container erasure functions
In commit r12-4083 I tried to make the std::erase and std::erase_if function avoid the unnecessary overhead of safe iterators. It didn't work, for two reasons. Firstly, for the RB tree containers the __niter_base function is a no-op (because the iterators aren't random access) so the safe iterators were still used. Secondly, for the cases where __niter_base did remove the safe iterator layer, there was still unnecessary overhead to create a new safe iterator and link it to the container. This solves the problem by simply binding a reference to the non-debug version of the conainer. For normal mode this is a no-op, and for debug mode it binds a reference to the debug container's base class. That means the rest of the function operates directly on the non-debug container, and avoids all checking. For std::basic_string there's no need to unwrap anything, because we use std::basic_string directly in debug mode anyway. libstdc++-v3/ChangeLog: * include/bits/erase_if.h (__erase_nodes_if): Remove redundant __niter_base calls. * include/std/string (erase, erase_if): Likewise. * include/std/deque (erase, erase_if): Access non-debug container directly. * include/std/map (erase, erase_if): Likewise. * include/std/set (erase, erase_if): Likewise. * include/std/unordered_map (erase, erase_if): Likewise. * include/std/unordered_set (erase, erase_if): Likewise. * include/std/vector (erase, erase_if): Likewise. * include/experimental/deque (erase, erase_if): Likewise. * include/experimental/map (erase, erase_if): Likewise. * include/experimental/set (erase, erase_if): Likewise. * include/experimental/unordered_map (erase, erase_if): Likewise. * include/experimental/unordered_set (erase, erase_if): Likewise. * include/experimental/vector (erase, erase_if): Likewise.
Diffstat (limited to 'libjava/testsuite/libjava.compile/Case.java')
0 files changed, 0 insertions, 0 deletions