Move art/native to ObjPtr
Bug: 31113334
Test: test-art-host
Change-Id: I67eb89cf042c762c6dcd5eb8b008b9a28e9b3319
diff --git a/runtime/mirror/array.cc b/runtime/mirror/array.cc
index 1aa38dd..8afa4aa 100644
--- a/runtime/mirror/array.cc
+++ b/runtime/mirror/array.cc
@@ -60,7 +60,7 @@
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 @@
// 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 @@
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 @@
}
}
// 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 @@
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();
}