diff options
| -rw-r--r-- | runtime/gc/accounting/space_bitmap.cc | 80 | ||||
| -rw-r--r-- | runtime/gc/accounting/space_bitmap.h | 14 |
2 files changed, 0 insertions, 94 deletions
diff --git a/runtime/gc/accounting/space_bitmap.cc b/runtime/gc/accounting/space_bitmap.cc index 364911102c..a968343318 100644 --- a/runtime/gc/accounting/space_bitmap.cc +++ b/runtime/gc/accounting/space_bitmap.cc @@ -191,86 +191,6 @@ void SpaceBitmap<kAlignment>::SweepWalk(const SpaceBitmap<kAlignment>& live_bitm } } -template<size_t kAlignment> -void SpaceBitmap<kAlignment>::WalkInstanceFields(SpaceBitmap<kAlignment>* visited, - ObjectCallback* callback, mirror::Object* obj, - mirror::Class* klass, void* arg) - REQUIRES_SHARED(Locks::mutator_lock_) { - // Visit fields of parent classes first. - mirror::Class* super = klass->GetSuperClass(); - if (super != nullptr) { - WalkInstanceFields(visited, callback, obj, super, arg); - } - // Walk instance fields - for (ArtField& field : klass->GetIFields()) { - if (!field.IsPrimitiveType()) { - mirror::Object* value = field.GetObj(obj); - if (value != nullptr) { - WalkFieldsInOrder(visited, callback, value, arg); - } - } - } -} - -template<size_t kAlignment> -void SpaceBitmap<kAlignment>::WalkFieldsInOrder(SpaceBitmap<kAlignment>* visited, - ObjectCallback* callback, mirror::Object* obj, - void* arg) { - if (visited->Test(obj)) { - return; - } - // visit the object itself - (*callback)(obj, arg); - visited->Set(obj); - // Walk instance fields of all objects - mirror::Class* klass = obj->GetClass(); - WalkInstanceFields(visited, callback, obj, klass, arg); - // Walk static fields of a Class - if (obj->IsClass()) { - for (ArtField& field : klass->GetSFields()) { - if (!field.IsPrimitiveType()) { - mirror::Object* value = field.GetObj(nullptr); - if (value != nullptr) { - WalkFieldsInOrder(visited, callback, value, arg); - } - } - } - } else if (obj->IsObjectArray()) { - // Walk elements of an object array - mirror::ObjectArray<mirror::Object>* obj_array = obj->AsObjectArray<mirror::Object>(); - int32_t length = obj_array->GetLength(); - for (int32_t i = 0; i < length; i++) { - mirror::Object* value = obj_array->Get(i); - if (value != nullptr) { - WalkFieldsInOrder(visited, callback, value, arg); - } - } - } -} - -template<size_t kAlignment> -void SpaceBitmap<kAlignment>::InOrderWalk(ObjectCallback* callback, void* arg) { - std::unique_ptr<SpaceBitmap<kAlignment>> visited( - Create("bitmap for in-order walk", reinterpret_cast<uint8_t*>(heap_begin_), - IndexToOffset(bitmap_size_ / sizeof(intptr_t)))); - CHECK(bitmap_begin_ != nullptr); - CHECK(callback != nullptr); - uintptr_t end = Size() / sizeof(intptr_t); - for (uintptr_t i = 0; i < end; ++i) { - // Need uint for unsigned shift. - uintptr_t w = bitmap_begin_[i].LoadRelaxed(); - if (UNLIKELY(w != 0)) { - uintptr_t ptr_base = IndexToOffset(i) + heap_begin_; - while (w != 0) { - const size_t shift = CTZ(w); - mirror::Object* obj = reinterpret_cast<mirror::Object*>(ptr_base + shift * kAlignment); - WalkFieldsInOrder(visited.get(), callback, obj, arg); - w ^= (static_cast<uintptr_t>(1)) << shift; - } - } - } -} - template class SpaceBitmap<kObjectAlignment>; template class SpaceBitmap<kPageSize>; diff --git a/runtime/gc/accounting/space_bitmap.h b/runtime/gc/accounting/space_bitmap.h index 576f9c73b6..296663a8be 100644 --- a/runtime/gc/accounting/space_bitmap.h +++ b/runtime/gc/accounting/space_bitmap.h @@ -133,11 +133,6 @@ class SpaceBitmap { void Walk(ObjectCallback* callback, void* arg) REQUIRES_SHARED(Locks::heap_bitmap_lock_); - // Visits set bits with an in order traversal. The callback is not permitted to change the bitmap - // bits or max during the traversal. - void InOrderWalk(ObjectCallback* callback, void* arg) - REQUIRES_SHARED(Locks::heap_bitmap_lock_, Locks::mutator_lock_); - // Walk through the bitmaps in increasing address order, and find the object pointers that // correspond to garbage objects. Call <callback> zero or more times with lists of these object // pointers. The callback is not permitted to increase the max of either bitmap. @@ -202,15 +197,6 @@ class SpaceBitmap { template<bool kSetBit> bool Modify(const mirror::Object* obj); - // For an unvisited object, visit it then all its children found via fields. - static void WalkFieldsInOrder(SpaceBitmap* visited, ObjectCallback* callback, mirror::Object* obj, - void* arg) REQUIRES_SHARED(Locks::mutator_lock_); - // Walk instance fields of the given Class. Separate function to allow recursion on the super - // class. - static void WalkInstanceFields(SpaceBitmap<kAlignment>* visited, ObjectCallback* callback, - mirror::Object* obj, mirror::Class* klass, void* arg) - REQUIRES_SHARED(Locks::mutator_lock_); - // Backing storage for bitmap. std::unique_ptr<MemMap> mem_map_; |