diff options
author | 2024-03-22 14:03:46 +0000 | |
---|---|---|
committer | 2024-03-25 15:16:22 +0000 | |
commit | 5f80711ebc1510811b4f3aa6c748106a26b78d29 (patch) | |
tree | b0b811c0231653c4b6fd4c49220e5fb9ba74dca3 /libartbase/base/bit_vector.cc | |
parent | b71150621fd1357e4be1bf2644a3fd99e69bc933 (diff) |
Move responsibility of clearing BitVectors to the allocators/callers
Both CallocAllocator and ArenaAllocator already zero the bit vector
so we don't have to do it again. ScopedArenaAllocator was the only
one which needed the ClearAllBits call so move the call to that
constructor.
Bug: 329037671
Test: art/test/testrunner/testrunner.py --host --64 --optimizing -b
Change-Id: Iff1c1386f573bfd51a7e906696a173f6d4b30fc7
Diffstat (limited to 'libartbase/base/bit_vector.cc')
-rw-r--r-- | libartbase/base/bit_vector.cc | 20 |
1 files changed, 5 insertions, 15 deletions
diff --git a/libartbase/base/bit_vector.cc b/libartbase/base/bit_vector.cc index 5b022b11c2..68d6c10222 100644 --- a/libartbase/base/bit_vector.cc +++ b/libartbase/base/bit_vector.cc @@ -38,21 +38,11 @@ BitVector::BitVector(bool expandable, static_assert(sizeof(*storage_) * 8u == kWordBits, "word bits"); } -BitVector::BitVector(uint32_t start_bits, - bool expandable, - Allocator* allocator) - : BitVector(expandable, - allocator, - BitsToWords(start_bits), - static_cast<uint32_t*>(allocator->Alloc(BitsToWords(start_bits) * kWordBytes))) { - // We don't know if the allocator cleared things. - // TODO(solanes): We should be able to remove this call to `ClearAllBits`. Currently we have: - // * `MallocAllocator` and `ArenaAllocator` which sets it to zero, and - // * `ScopedArenaAllocator` which does not. - // We also have `NoopAllocator` but that allocator should never call this method (as the Alloc - // call will turn into a LOG(FATAL)). - ClearAllBits(); -} +BitVector::BitVector(uint32_t start_bits, bool expandable, Allocator* allocator) + : BitVector(expandable, + allocator, + BitsToWords(start_bits), + static_cast<uint32_t*>(allocator->Alloc(BitsToWords(start_bits) * kWordBytes))) {} BitVector::BitVector(const BitVector& src, bool expandable, |