Refinements to array and class object size computation.
* Rename dvmArrayObjectLength to dvmArrayObjectSize. In the context
of arrays length may refer to the length of the array data and not
the size of the array object instance.
* Add a new method dvmClassObjectSize which computes the total size of
a class object including its static fields.
Change-Id: I693ec8e66dfa5df35c9f35474c80411ea917c899
diff --git a/vm/oo/Array.c b/vm/oo/Array.c
index c76ea53..c1f5c3a 100644
--- a/vm/oo/Array.c
+++ b/vm/oo/Array.c
@@ -786,13 +786,14 @@
return 0; /* Quiet the compiler. */
}
-size_t dvmArrayObjectLength(const ArrayObject *array)
+size_t dvmArrayObjectSize(const ArrayObject *array)
{
- size_t length;
+ size_t size;
- length = offsetof(ArrayObject, contents);
- length += array->length * arrayElementWidth(array);
- return length;
+ assert(array != NULL);
+ size = offsetof(ArrayObject, contents);
+ size += array->length * arrayElementWidth(array);
+ return size;
}
/*