summaryrefslogtreecommitdiff
path: root/runtime/mirror/array.cc
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/mirror/array.cc')
-rw-r--r--runtime/mirror/array.cc17
1 files changed, 9 insertions, 8 deletions
diff --git a/runtime/mirror/array.cc b/runtime/mirror/array.cc
index 1aa38dd6b4..8afa4aa744 100644
--- a/runtime/mirror/array.cc
+++ b/runtime/mirror/array.cc
@@ -60,7 +60,7 @@ static Array* RecursiveCreateMultiArray(Thread* self,
for (int32_t i = 0; i < array_length; i++) {
StackHandleScope<1> hs2(self);
Handle<mirror::Class> h_component_type(hs2.NewHandle(array_class->GetComponentType()));
- Array* sub_array = RecursiveCreateMultiArray(self, h_component_type,
+ ObjPtr<Array> sub_array = RecursiveCreateMultiArray(self, h_component_type,
current_dimension + 1, dimensions);
if (UNLIKELY(sub_array == nullptr)) {
CHECK(self->IsExceptionPending());
@@ -93,7 +93,7 @@ Array* Array::CreateMultiArray(Thread* self, Handle<Class> element_class,
// Find/generate the array class.
ClassLinker* class_linker = Runtime::Current()->GetClassLinker();
- mirror::Class* element_class_ptr = element_class.Get();
+ ObjPtr<mirror::Class> element_class_ptr = element_class.Get();
StackHandleScope<1> hs(self);
MutableHandle<mirror::Class> array_class(
hs.NewHandle(class_linker->FindArrayClass(self, &element_class_ptr)));
@@ -102,7 +102,7 @@ Array* Array::CreateMultiArray(Thread* self, Handle<Class> element_class,
return nullptr;
}
for (int32_t i = 1; i < dimensions->GetLength(); ++i) {
- mirror::Class* array_class_ptr = array_class.Get();
+ ObjPtr<mirror::Class> array_class_ptr = array_class.Get();
array_class.Assign(class_linker->FindArrayClass(self, &array_class_ptr));
if (UNLIKELY(array_class.Get() == nullptr)) {
CHECK(self->IsExceptionPending());
@@ -110,11 +110,11 @@ Array* Array::CreateMultiArray(Thread* self, Handle<Class> element_class,
}
}
// Create the array.
- Array* new_array = RecursiveCreateMultiArray(self, array_class, 0, dimensions);
+ ObjPtr<Array> new_array = RecursiveCreateMultiArray(self, array_class, 0, dimensions);
if (UNLIKELY(new_array == nullptr)) {
CHECK(self->IsExceptionPending());
}
- return new_array;
+ return new_array.Ptr();
}
void Array::ThrowArrayIndexOutOfBoundsException(int32_t index) {
@@ -136,12 +136,13 @@ Array* Array::CopyOf(Thread* self, int32_t new_length) {
heap->GetCurrentNonMovingAllocator();
const auto component_size = GetClass()->GetComponentSize();
const auto component_shift = GetClass()->GetComponentSizeShift();
- Array* new_array = Alloc<true>(self, GetClass(), new_length, component_shift, allocator_type);
+ ObjPtr<Array> new_array = Alloc<true>(self, GetClass(), new_length, component_shift, allocator_type);
if (LIKELY(new_array != nullptr)) {
- memcpy(new_array->GetRawData(component_size, 0), h_this->GetRawData(component_size, 0),
+ memcpy(new_array->GetRawData(component_size, 0),
+ h_this->GetRawData(component_size, 0),
std::min(h_this->GetLength(), new_length) << component_shift);
}
- return new_array;
+ return new_array.Ptr();
}