Fix incorrect initial dex cache size.
We were previously setting it to be sizeof(DexCacheClass) instead
of sizeof(DexCache). This was causing some problems with
compaction when I relied on the object sizes being accurate to
visit objects in the bump pointer space.
Bug: 8981901
Change-Id: Iede04763aced041986b1b239368fc867143ad70d
diff --git a/runtime/mirror/class-inl.h b/runtime/mirror/class-inl.h
index 88cffb7..cd5e865 100644
--- a/runtime/mirror/class-inl.h
+++ b/runtime/mirror/class-inl.h
@@ -35,9 +35,7 @@
inline size_t Class::GetObjectSize() const {
DCHECK(!IsVariableSize()) << " class=" << PrettyTypeOf(this);
DCHECK_EQ(sizeof(size_t), sizeof(int32_t));
- size_t result = GetField32(OFFSET_OF_OBJECT_MEMBER(Class, object_size_), false);
- DCHECK_GE(result, sizeof(Object)) << " class=" << PrettyTypeOf(this);
- return result;
+ return GetField32(OFFSET_OF_OBJECT_MEMBER(Class, object_size_), false);
}
inline Class* Class::GetSuperClass() const {
diff --git a/runtime/mirror/object-inl.h b/runtime/mirror/object-inl.h
index e659108..e460a8d 100644
--- a/runtime/mirror/object-inl.h
+++ b/runtime/mirror/object-inl.h
@@ -247,6 +247,7 @@
} else {
result = GetClass()->GetObjectSize();
}
+ DCHECK_GE(result, sizeof(Object)) << " class=" << PrettyTypeOf(GetClass());
DCHECK(!IsArtField() || result == sizeof(ArtField));
DCHECK(!IsArtMethod() || result == sizeof(ArtMethod));
return result;