From f66bc749282dd7cffc68b641f527740e95e90cfa Mon Sep 17 00:00:00 2001 From: Abseil Team Date: Wed, 5 Aug 2020 08:56:25 -0700 Subject: Export of internal Abseil changes -- c12db0cff0f0cb0c10731cdf4bf1663e99ecb82e by Samuel Benzaquen : Fix incompatibility of retired flags and AddressSanitizer. PiperOrigin-RevId: 325028944 -- 20119dce82503c6ac22f3ec479d0eaea6acc7ba0 by Abseil Team : Internal change PiperOrigin-RevId: 324939694 -- bb1ab1a4e1a551469ad110bdfce3210aeb9bf4b8 by Abseil Team : Teach Abseil stack consumption utilities about AArch64. PiperOrigin-RevId: 324935395 -- 987043ffc960f38457478b01c04b47dfaf7ae006 by Evan Brown : Cleanup: simplify the slot transfer methods a bit. PiperOrigin-RevId: 324834817 -- ed7081130d3ab93a2c3c916e30fe4367d8e96954 by Abseil Team : Pass __FILE__ as const char* instead of as array of chars to internal_log_function to allow deterministic symbols for AtomicHook wrapper of the InternalLogFunction PiperOrigin-RevId: 324800499 GitOrigin-RevId: c12db0cff0f0cb0c10731cdf4bf1663e99ecb82e Change-Id: Ibb92b1cab465e45abc86281f0fba894c82a662df --- absl/container/internal/btree.h | 30 +++++++++--------------------- 1 file changed, 9 insertions(+), 21 deletions(-) (limited to 'absl/container/internal') diff --git a/absl/container/internal/btree.h b/absl/container/internal/btree.h index ab85f7da..293e5771 100644 --- a/absl/container/internal/btree.h +++ b/absl/container/internal/btree.h @@ -817,12 +817,16 @@ class btree_node { } } + static void transfer(slot_type *dest, slot_type *src, allocator_type *alloc) { + absl::container_internal::SanitizerUnpoisonObject(dest); + params_type::transfer(alloc, dest, src); + absl::container_internal::SanitizerPoisonObject(src); + } + // Transfers value from slot `src_i` in `src_node` to slot `dest_i` in `this`. void transfer(const size_type dest_i, const size_type src_i, btree_node *src_node, allocator_type *alloc) { - absl::container_internal::SanitizerUnpoisonObject(slot(dest_i)); - params_type::transfer(alloc, slot(dest_i), src_node->slot(src_i)); - absl::container_internal::SanitizerPoisonObject(src_node->slot(src_i)); + transfer(slot(dest_i), src_node->slot(src_i), alloc); } // Transfers `n` values starting at value `src_i` in `src_node` into the @@ -830,19 +834,11 @@ class btree_node { void transfer_n(const size_type n, const size_type dest_i, const size_type src_i, btree_node *src_node, allocator_type *alloc) { - absl::container_internal::SanitizerUnpoisonMemoryRegion( - slot(dest_i), n * sizeof(slot_type)); for (slot_type *src = src_node->slot(src_i), *end = src + n, *dest = slot(dest_i); src != end; ++src, ++dest) { - params_type::transfer(alloc, dest, src); + transfer(dest, src, alloc); } - // We take care to avoid poisoning transferred-to nodes in case of overlap. - const size_type overlap = - this == src_node ? (std::max)(src_i, dest_i + n) - src_i : 0; - assert(n >= overlap); - absl::container_internal::SanitizerPoisonMemoryRegion( - src_node->slot(src_i + overlap), (n - overlap) * sizeof(slot_type)); } // Same as above, except that we start at the end and work our way to the @@ -850,19 +846,11 @@ class btree_node { void transfer_n_backward(const size_type n, const size_type dest_i, const size_type src_i, btree_node *src_node, allocator_type *alloc) { - absl::container_internal::SanitizerUnpoisonMemoryRegion( - slot(dest_i), n * sizeof(slot_type)); for (slot_type *src = src_node->slot(src_i + n - 1), *end = src - n, *dest = slot(dest_i + n - 1); src != end; --src, --dest) { - params_type::transfer(alloc, dest, src); + transfer(dest, src, alloc); } - // We take care to avoid poisoning transferred-to nodes in case of overlap. - assert(this != src_node || dest_i >= src_i); - const size_type num_to_poison = - this == src_node ? (std::min)(n, dest_i - src_i) : n; - absl::container_internal::SanitizerPoisonMemoryRegion( - src_node->slot(src_i), num_to_poison * sizeof(slot_type)); } template -- cgit v1.2.3