summaryrefslogtreecommitdiffstats
path: root/runtime/gc
diff options
context:
space:
mode:
authorMathieu Chartier <mathieuc@google.com>2015-02-04 17:46:29 -0800
committerMathieu Chartier <mathieuc@google.com>2015-02-04 18:18:53 -0800
commitc38c5ea76dd3cfd44eec21df640161046ffc3e4c (patch)
tree7af0e58932480a4d7b66eab06f29ba9f920e3382 /runtime/gc
parenta8fb460f0a5c96881c433f9586bdf1f705c97d35 (diff)
downloadandroid_art-c38c5ea76dd3cfd44eec21df640161046ffc3e4c.tar.gz
android_art-c38c5ea76dd3cfd44eec21df640161046ffc3e4c.tar.bz2
android_art-c38c5ea76dd3cfd44eec21df640161046ffc3e4c.zip
Clear thread local freed bits in RosAlloc::Run::InspectAllSlots
Previously we didn't take these bits into consideration. This could cause RosAlloc::Run::InspectAllSlots to inspect recently freed allocations as allocated. Bug: 19193521 Change-Id: I56b3c089e2a36098423261cda623fc834069f832
Diffstat (limited to 'runtime/gc')
-rw-r--r--runtime/gc/allocator/rosalloc.cc9
1 files changed, 8 insertions, 1 deletions
diff --git a/runtime/gc/allocator/rosalloc.cc b/runtime/gc/allocator/rosalloc.cc
index 7c2474f3f9..799624105c 100644
--- a/runtime/gc/allocator/rosalloc.cc
+++ b/runtime/gc/allocator/rosalloc.cc
@@ -1119,12 +1119,19 @@ void RosAlloc::Run::InspectAllSlots(void (*handler)(void* start, void* end, size
uint8_t* slot_base = reinterpret_cast<uint8_t*>(this) + headerSizes[idx];
size_t num_slots = numOfSlots[idx];
size_t bracket_size = IndexToBracketSize(idx);
- DCHECK_EQ(slot_base + num_slots * bracket_size, reinterpret_cast<uint8_t*>(this) + numOfPages[idx] * kPageSize);
+ DCHECK_EQ(slot_base + num_slots * bracket_size,
+ reinterpret_cast<uint8_t*>(this) + numOfPages[idx] * kPageSize);
size_t num_vec = RoundUp(num_slots, 32) / 32;
size_t slots = 0;
+ const uint32_t* const tl_free_vecp = IsThreadLocal() ? ThreadLocalFreeBitMap() : nullptr;
for (size_t v = 0; v < num_vec; v++, slots += 32) {
DCHECK_GE(num_slots, slots);
uint32_t vec = alloc_bit_map_[v];
+ if (tl_free_vecp != nullptr) {
+ // Clear out the set bits in the thread local free bitmap since these aren't actually
+ // allocated.
+ vec &= ~tl_free_vecp[v];
+ }
size_t end = std::min(num_slots - slots, static_cast<size_t>(32));
for (size_t i = 0; i < end; ++i) {
bool is_allocated = ((vec >> i) & 0x1) != 0;