Fix ART debug build boot.
Some of the checks were no longer valid after the zygote bin packing.
Bug: 12480317
Change-Id: Iaa169b0aafe9fec06e75e9b58a3de28aa70a9421
diff --git a/runtime/gc/collector/semi_space.cc b/runtime/gc/collector/semi_space.cc
index ffa9154..1ea2002 100644
--- a/runtime/gc/collector/semi_space.cc
+++ b/runtime/gc/collector/semi_space.cc
@@ -308,7 +308,7 @@
mirror::Object* SemiSpace::MarkNonForwardedObject(mirror::Object* obj) {
size_t object_size = obj->SizeOf();
- size_t bytes_allocated = 0;
+ size_t bytes_allocated;
mirror::Object* forward_address = nullptr;
if (kEnableSimplePromo && reinterpret_cast<byte*>(obj) < last_gc_to_space_end_) {
// If it's allocated before the last GC (older), move (pseudo-promote) it to
@@ -344,6 +344,8 @@
if (to_space_live_bitmap_ != nullptr) {
to_space_live_bitmap_->Set(forward_address);
}
+ DCHECK(to_space_->HasAddress(forward_address) ||
+ (kEnableSimplePromo && GetHeap()->GetNonMovingSpace()->HasAddress(forward_address)));
return forward_address;
}
@@ -365,9 +367,6 @@
reinterpret_cast<size_t>(forward_address)));
// Push the object onto the mark stack for later processing.
MarkStackPush(forward_address);
- } else {
- DCHECK(to_space_->HasAddress(forward_address) ||
- (kEnableSimplePromo && GetHeap()->GetNonMovingSpace()->HasAddress(forward_address)));
}
// TODO: Do we need this if in the else statement?
} else {
@@ -420,14 +419,6 @@
GetHeap()->GetMarkBitmap()->ReplaceBitmap(mark_bitmap, live_bitmap);
}
-mirror::Object* SemiSpace::GetForwardingAddress(mirror::Object* obj) {
- if (from_space_->HasAddress(obj)) {
- LOG(FATAL) << "Shouldn't happen!";
- return GetForwardingAddressInFromSpace(obj);
- }
- return obj;
-}
-
mirror::Object* SemiSpace::MarkedForwardingAddressCallback(Object* object, void* arg) {
return reinterpret_cast<SemiSpace*>(arg)->GetMarkedForwardAddress(object);
}
@@ -532,9 +523,6 @@
}
if (from_space_->HasAddress(obj)) {
mirror::Object* forwarding_address = GetForwardingAddressInFromSpace(const_cast<Object*>(obj));
- // If the object is forwarded then it MUST be marked.
- DCHECK(forwarding_address == nullptr || to_space_->HasAddress(forwarding_address) ||
- (kEnableSimplePromo && GetHeap()->GetNonMovingSpace()->HasAddress(forwarding_address)));
return forwarding_address; // Returns either the forwarding address or nullptr.
} else if (to_space_->HasAddress(obj)) {
// Should be unlikely.
diff --git a/runtime/gc/collector/semi_space.h b/runtime/gc/collector/semi_space.h
index 7bb7b19..16c1329 100644
--- a/runtime/gc/collector/semi_space.h
+++ b/runtime/gc/collector/semi_space.h
@@ -255,8 +255,6 @@
inline mirror::Object* GetForwardingAddressInFromSpace(mirror::Object* obj) const;
- mirror::Object* GetForwardingAddress(mirror::Object* obj);
-
// Current space, we check this space first to avoid searching for the appropriate space for an
// object.
accounting::ObjectStack* mark_stack_;
diff --git a/runtime/gc/heap.cc b/runtime/gc/heap.cc
index 47c13c7..0f98116 100644
--- a/runtime/gc/heap.cc
+++ b/runtime/gc/heap.cc
@@ -1330,13 +1330,13 @@
virtual mirror::Object* MarkNonForwardedObject(mirror::Object* obj)
EXCLUSIVE_LOCKS_REQUIRED(Locks::heap_bitmap_lock_, Locks::mutator_lock_) {
size_t object_size = RoundUp(obj->SizeOf(), kObjectAlignment);
- mirror::Object* forward_address = nullptr;
+ mirror::Object* forward_address;
// Find the smallest bin which we can move obj in.
auto it = bins_.lower_bound(object_size);
if (it == bins_.end()) {
// No available space in the bins, place it in the target space instead (grows the zygote
// space).
- size_t bytes_allocated = 0;
+ size_t bytes_allocated;
forward_address = to_space_->Alloc(self_, object_size, &bytes_allocated);
if (to_space_live_bitmap_ != nullptr) {
to_space_live_bitmap_->Set(forward_address);