summaryrefslogtreecommitdiffstats
path: root/runtime/mirror/array.cc
diff options
context:
space:
mode:
authorIan Rogers <irogers@google.com>2014-02-25 17:01:10 -0800
committerIan Rogers <irogers@google.com>2014-02-26 16:38:22 -0800
commit6fac447555dc94a935b78198479cce645c837b89 (patch)
treebcf1449999084b1e1dec3dac287f6f3670d7eda0 /runtime/mirror/array.cc
parent7f0ff7e7fff82566bca5f9353eaa2c4f81f0671a (diff)
downloadart-6fac447555dc94a935b78198479cce645c837b89.tar.gz
art-6fac447555dc94a935b78198479cce645c837b89.tar.bz2
art-6fac447555dc94a935b78198479cce645c837b89.zip
Make allocations report usable size.
Work-in-progress to allow arrays to fill usable size. Bug: 13028925. Use C++11's override keyword on GCC >= 2.7 to ensure that we override GC and allocator methods. Move initial mirror::Class set up into a Functor so that all allocated objects have non-zero sizes. Use this property to assert that all objects are never larger than their usable size. Other bits of GC related clean-up, missing initialization, missing use of const, hot methods in .cc files, "unimplemented" functions that fail at runtime in header files, reducing header file includes, move valgrind's space into its own files, reduce number of array allocation routines. Change-Id: Id5760041a2d7f94dcaf17ec760f6095ec75dadaa
Diffstat (limited to 'runtime/mirror/array.cc')
-rw-r--r--runtime/mirror/array.cc11
1 files changed, 3 insertions, 8 deletions
diff --git a/runtime/mirror/array.cc b/runtime/mirror/array.cc
index 715f072c4a..139e2d030a 100644
--- a/runtime/mirror/array.cc
+++ b/runtime/mirror/array.cc
@@ -46,7 +46,9 @@ static Array* RecursiveCreateMultiArray(Thread* self,
const SirtRef<mirror::IntArray>& dimensions)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
int32_t array_length = dimensions->Get(current_dimension);
- SirtRef<Array> new_array(self, Array::Alloc<true>(self, array_class.get(), array_length));
+ SirtRef<Array> new_array(self, Array::Alloc<true>(self, array_class.get(), array_length,
+ array_class->GetComponentSize(),
+ Runtime::Current()->GetHeap()->GetCurrentAllocator()));
if (UNLIKELY(new_array.get() == nullptr)) {
CHECK(self->IsExceptionPending());
return nullptr;
@@ -117,13 +119,6 @@ void Array::ThrowArrayStoreException(Object* object) {
art::ThrowArrayStoreException(object->GetClass(), this->GetClass());
}
-template<typename T>
-PrimitiveArray<T>* PrimitiveArray<T>::Alloc(Thread* self, size_t length) {
- DCHECK(array_class_ != NULL);
- Array* raw_array = Array::Alloc<true>(self, array_class_, length, sizeof(T));
- return down_cast<PrimitiveArray<T>*>(raw_array);
-}
-
template <typename T> Class* PrimitiveArray<T>::array_class_ = NULL;
// Explicitly instantiate all the primitive array types.