aboutsummaryrefslogtreecommitdiff
path: root/gcc/expr.c
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2018-07-23 20:40:28 +0100
committerJonathan Wakely <redi@gcc.gnu.org>2018-07-23 20:40:28 +0100
commit2d6c8eea1d7ae5b3b2b3c2508f78de918c73f4c4 (patch)
tree2db36a97ddc96b86ee3c32f89c5cfb365cbe2c5a /gcc/expr.c
parent651a79532c8e87ac096419d9852a295f9e284fe4 (diff)
downloadgcc-2d6c8eea1d7ae5b3b2b3c2508f78de918c73f4c4.zip
gcc-2d6c8eea1d7ae5b3b2b3c2508f78de918c73f4c4.tar.gz
gcc-2d6c8eea1d7ae5b3b2b3c2508f78de918c73f4c4.tar.bz2
PR libstdc++/70940 optimize pmr::resource_adaptor for allocators using malloc
pmr::resource_adaptor can avoid allocating an oversized buffer and doing manual alignment within that buffer when the wrapped allocator is known to always meet the requested alignment. Specifically, if the allocator is known to use malloc or new directly, then we can call the allocator directly for any fundamental alignment. PR libstdc++/70940 * include/experimental/memory_resource (__resource_adaptor_common::_AlignMgr::_M_unadjust): Add assertion. (__resource_adaptor_common::__guaranteed_alignment): New helper to give maximum alignment an allocator guarantees. Specialize for known allocators using new and malloc. (__resource_adaptor_imp::do_allocate): Use __guaranteed_alignment. (__resource_adaptor_imp::do_deallocate): Likewise. * testsuite/experimental/memory_resource/new_delete_resource.cc: Check that new and delete are called with expected sizes. From-SVN: r262935
Diffstat (limited to 'gcc/expr.c')
0 files changed, 0 insertions, 0 deletions