ObjPtr<>-ify array allocations.
And remove some unnecessary calls to ObjPtr<>::Ptr().
Test: m test-art-host-gtest
Test: testrunner.py --host --optimizing
Bug: 31113334
Change-Id: Ie313980f7f23b33b0ccea4fa8d5131d643c59080
diff --git a/runtime/mirror/array-inl.h b/runtime/mirror/array-inl.h
index d2adcb4..2e39530 100644
--- a/runtime/mirror/array-inl.h
+++ b/runtime/mirror/array-inl.h
@@ -151,11 +151,11 @@
};
template <bool kIsInstrumented, bool kFillUsable>
-inline Array* Array::Alloc(Thread* self,
- ObjPtr<Class> array_class,
- int32_t component_count,
- size_t component_size_shift,
- gc::AllocatorType allocator_type) {
+inline ObjPtr<Array> Array::Alloc(Thread* self,
+ ObjPtr<Class> array_class,
+ int32_t component_count,
+ size_t component_size_shift,
+ gc::AllocatorType allocator_type) {
DCHECK(allocator_type != gc::kAllocatorTypeLOS);
DCHECK(array_class != nullptr);
DCHECK(array_class->IsArrayClass());
@@ -175,19 +175,19 @@
}
#endif
gc::Heap* heap = Runtime::Current()->GetHeap();
- Array* result;
+ ObjPtr<Array> result;
if (!kFillUsable) {
SetLengthVisitor visitor(component_count);
- result = down_cast<Array*>(
+ result = ObjPtr<Array>::DownCast(MakeObjPtr(
heap->AllocObjectWithAllocator<kIsInstrumented, true>(self, array_class, size,
- allocator_type, visitor));
+ allocator_type, visitor)));
} else {
SetLengthToUsableSizeVisitor visitor(component_count,
DataOffset(1U << component_size_shift).SizeValue(),
component_size_shift);
- result = down_cast<Array*>(
+ result = ObjPtr<Array>::DownCast(MakeObjPtr(
heap->AllocObjectWithAllocator<kIsInstrumented, true>(self, array_class, size,
- allocator_type, visitor));
+ allocator_type, visitor)));
}
if (kIsDebugBuild && result != nullptr && Runtime::Current()->IsStarted()) {
array_class = result->GetClass(); // In case the array class moved.
@@ -202,9 +202,9 @@
}
template<typename T>
-inline PrimitiveArray<T>* PrimitiveArray<T>::AllocateAndFill(Thread* self,
- const T* data,
- size_t length) {
+inline ObjPtr<PrimitiveArray<T>> PrimitiveArray<T>::AllocateAndFill(Thread* self,
+ const T* data,
+ size_t length) {
StackHandleScope<1> hs(self);
Handle<PrimitiveArray<T>> arr(hs.NewHandle(PrimitiveArray<T>::Alloc(self, length)));
if (!arr.IsNull()) {
diff --git a/runtime/mirror/array.cc b/runtime/mirror/array.cc
index 06ce0bb..66ec368 100644
--- a/runtime/mirror/array.cc
+++ b/runtime/mirror/array.cc
@@ -42,17 +42,18 @@
// piece and work our way in.
// Recursively create an array with multiple dimensions. Elements may be
// Objects or primitive types.
-static Array* RecursiveCreateMultiArray(Thread* self,
- Handle<Class> array_class, int current_dimension,
- Handle<mirror::IntArray> dimensions)
+static ObjPtr<Array> RecursiveCreateMultiArray(Thread* self,
+ Handle<Class> array_class,
+ int current_dimension,
+ Handle<mirror::IntArray> dimensions)
REQUIRES_SHARED(Locks::mutator_lock_) {
int32_t array_length = dimensions->Get(current_dimension);
- StackHandleScope<1> hs(self);
- Handle<Array> new_array(
- hs.NewHandle(
- Array::Alloc<true>(self, array_class.Get(), array_length,
- array_class->GetComponentSizeShift(),
- Runtime::Current()->GetHeap()->GetCurrentAllocator())));
+ StackHandleScope<2> hs(self);
+ Handle<mirror::Class> h_component_type(hs.NewHandle(array_class->GetComponentType()));
+ size_t component_size_shift = h_component_type->GetPrimitiveTypeSizeShift();
+ gc::AllocatorType allocator_type = Runtime::Current()->GetHeap()->GetCurrentAllocator();
+ Handle<Array> new_array(hs.NewHandle(Array::Alloc<true>(
+ self, array_class.Get(), array_length, component_size_shift, allocator_type)));
if (UNLIKELY(new_array == nullptr)) {
CHECK(self->IsExceptionPending());
return nullptr;
@@ -60,10 +61,8 @@
if (current_dimension + 1 < dimensions->GetLength()) {
// Create a new sub-array in every element of the array.
for (int32_t i = 0; i < array_length; i++) {
- StackHandleScope<1> hs2(self);
- Handle<mirror::Class> h_component_type(hs2.NewHandle(array_class->GetComponentType()));
- ObjPtr<Array> sub_array = RecursiveCreateMultiArray(self, h_component_type,
- current_dimension + 1, dimensions);
+ ObjPtr<Array> sub_array =
+ RecursiveCreateMultiArray(self, h_component_type, current_dimension + 1, dimensions);
if (UNLIKELY(sub_array == nullptr)) {
CHECK(self->IsExceptionPending());
return nullptr;
@@ -75,8 +74,9 @@
return new_array.Get();
}
-Array* Array::CreateMultiArray(Thread* self, Handle<Class> element_class,
- Handle<IntArray> dimensions) {
+ObjPtr<Array> Array::CreateMultiArray(Thread* self,
+ Handle<Class> element_class,
+ Handle<IntArray> dimensions) {
// Verify dimensions.
//
// The caller is responsible for verifying that "dimArray" is non-null
@@ -95,17 +95,15 @@
// Find/generate the array class.
ClassLinker* class_linker = Runtime::Current()->GetClassLinker();
- 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)));
+ hs.NewHandle(class_linker->FindArrayClass(self, element_class.Get())));
if (UNLIKELY(array_class == nullptr)) {
CHECK(self->IsExceptionPending());
return nullptr;
}
for (int32_t i = 1; i < dimensions->GetLength(); ++i) {
- ObjPtr<mirror::Class> array_class_ptr = array_class.Get();
- array_class.Assign(class_linker->FindArrayClass(self, &array_class_ptr));
+ array_class.Assign(class_linker->FindArrayClass(self, array_class.Get()));
if (UNLIKELY(array_class == nullptr)) {
CHECK(self->IsExceptionPending());
return nullptr;
@@ -120,13 +118,14 @@
}
template<typename T>
-PrimitiveArray<T>* PrimitiveArray<T>::Alloc(Thread* self, size_t length) {
- Array* raw_array = Array::Alloc<true>(self,
- GetClassRoot<PrimitiveArray<T>>(),
- length,
- ComponentSizeShiftWidth(sizeof(T)),
- Runtime::Current()->GetHeap()->GetCurrentAllocator());
- return down_cast<PrimitiveArray<T>*>(raw_array);
+ObjPtr<PrimitiveArray<T>> PrimitiveArray<T>::Alloc(Thread* self, size_t length) {
+ gc::AllocatorType allocator_type = Runtime::Current()->GetHeap()->GetCurrentAllocator();
+ ObjPtr<Array> raw_array = Array::Alloc<true>(self,
+ GetClassRoot<PrimitiveArray<T>>(),
+ length,
+ ComponentSizeShiftWidth(sizeof(T)),
+ allocator_type);
+ return ObjPtr<PrimitiveArray<T>>::DownCast(raw_array);
}
void Array::ThrowArrayIndexOutOfBoundsException(int32_t index) {
@@ -137,7 +136,7 @@
art::ThrowArrayStoreException(object->GetClass(), this->GetClass());
}
-Array* Array::CopyOf(Thread* self, int32_t new_length) {
+ObjPtr<Array> Array::CopyOf(Thread* self, int32_t new_length) {
CHECK(GetClass()->GetComponentType()->IsPrimitive()) << "Will miss write barriers";
DCHECK_GE(new_length, 0);
// We may get copied by a compacting GC.
@@ -148,7 +147,8 @@
heap->GetCurrentNonMovingAllocator();
const auto component_size = GetClass()->GetComponentSize();
const auto component_shift = GetClass()->GetComponentSizeShift();
- ObjPtr<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),
diff --git a/runtime/mirror/array.h b/runtime/mirror/array.h
index aeaaf673..8bdd561 100644
--- a/runtime/mirror/array.h
+++ b/runtime/mirror/array.h
@@ -37,17 +37,17 @@
// least component_count size, however, if there's usable space at the end of the allocation the
// array will fill it.
template <bool kIsInstrumented, bool kFillUsable = false>
- ALWAYS_INLINE static Array* Alloc(Thread* self,
- ObjPtr<Class> array_class,
- int32_t component_count,
- size_t component_size_shift,
- gc::AllocatorType allocator_type)
+ ALWAYS_INLINE static ObjPtr<Array> Alloc(Thread* self,
+ ObjPtr<Class> array_class,
+ int32_t component_count,
+ size_t component_size_shift,
+ gc::AllocatorType allocator_type)
REQUIRES_SHARED(Locks::mutator_lock_)
REQUIRES(!Roles::uninterruptible_);
- static Array* CreateMultiArray(Thread* self,
- Handle<Class> element_class,
- Handle<IntArray> dimensions)
+ static ObjPtr<Array> CreateMultiArray(Thread* self,
+ Handle<Class> element_class,
+ Handle<IntArray> dimensions)
REQUIRES_SHARED(Locks::mutator_lock_)
REQUIRES(!Roles::uninterruptible_);
@@ -90,7 +90,7 @@
template<VerifyObjectFlags kVerifyFlags = kDefaultVerifyFlags>
ALWAYS_INLINE bool CheckIsValidIndex(int32_t index) REQUIRES_SHARED(Locks::mutator_lock_);
- Array* CopyOf(Thread* self, int32_t new_length) REQUIRES_SHARED(Locks::mutator_lock_)
+ ObjPtr<Array> CopyOf(Thread* self, int32_t new_length) REQUIRES_SHARED(Locks::mutator_lock_)
REQUIRES(!Roles::uninterruptible_);
protected:
@@ -114,10 +114,10 @@
public:
typedef T ElementType;
- static PrimitiveArray<T>* Alloc(Thread* self, size_t length)
+ static ObjPtr<PrimitiveArray<T>> Alloc(Thread* self, size_t length)
REQUIRES_SHARED(Locks::mutator_lock_) REQUIRES(!Roles::uninterruptible_);
- static PrimitiveArray<T>* AllocateAndFill(Thread* self, const T* data, size_t length)
+ static ObjPtr<PrimitiveArray<T>> AllocateAndFill(Thread* self, const T* data, size_t length)
REQUIRES_SHARED(Locks::mutator_lock_) REQUIRES(!Roles::uninterruptible_);
diff --git a/runtime/mirror/class-inl.h b/runtime/mirror/class-inl.h
index ab50973..8bc7a81 100644
--- a/runtime/mirror/class-inl.h
+++ b/runtime/mirror/class-inl.h
@@ -294,7 +294,7 @@
return GetFieldObject<PointerArray>(OFFSET_OF_OBJECT_MEMBER(Class, vtable_));
}
-inline void Class::SetVTable(PointerArray* new_vtable) {
+inline void Class::SetVTable(ObjPtr<PointerArray> new_vtable) {
SetFieldObject<false>(OFFSET_OF_OBJECT_MEMBER(Class, vtable_), new_vtable);
}
@@ -487,7 +487,7 @@
if (UNLIKELY(!this->CanAccess(dex_access_to))) {
if (throw_on_failure) {
ThrowIllegalAccessErrorClassForMethodDispatch(this,
- dex_access_to.Ptr(),
+ dex_access_to,
method,
throw_invoke_type);
}
@@ -800,7 +800,7 @@
obj = nullptr;
}
}
- return obj.Ptr();
+ return obj;
}
inline ObjPtr<Object> Class::AllocObject(Thread* self) {
diff --git a/runtime/mirror/class.h b/runtime/mirror/class.h
index a637c86..7adb0d0 100644
--- a/runtime/mirror/class.h
+++ b/runtime/mirror/class.h
@@ -781,7 +781,7 @@
ALWAYS_INLINE PointerArray* GetVTableDuringLinking() REQUIRES_SHARED(Locks::mutator_lock_);
- void SetVTable(PointerArray* new_vtable) REQUIRES_SHARED(Locks::mutator_lock_);
+ void SetVTable(ObjPtr<PointerArray> new_vtable) REQUIRES_SHARED(Locks::mutator_lock_);
static MemberOffset VTableOffset() {
return OFFSET_OF_OBJECT_MEMBER(Class, vtable_);
diff --git a/runtime/mirror/class_ext.cc b/runtime/mirror/class_ext.cc
index 7214620..44bf989 100644
--- a/runtime/mirror/class_ext.cc
+++ b/runtime/mirror/class_ext.cc
@@ -43,8 +43,8 @@
auto obsolete_dex_cache_off = OFFSET_OF_OBJECT_MEMBER(ClassExt, obsolete_dex_caches_);
auto obsolete_methods_off = OFFSET_OF_OBJECT_MEMBER(ClassExt, obsolete_methods_);
DCHECK(!Runtime::Current()->IsActiveTransaction());
- SetFieldObject<false>(obsolete_dex_cache_off, dex_caches.Ptr());
- SetFieldObject<false>(obsolete_methods_off, methods.Ptr());
+ SetFieldObject<false>(obsolete_dex_cache_off, dex_caches);
+ SetFieldObject<false>(obsolete_methods_off, methods);
}
// We really need to be careful how we update this. If we ever in the future make it so that
diff --git a/runtime/mirror/object-inl.h b/runtime/mirror/object-inl.h
index bfebd5d..2d10b97 100644
--- a/runtime/mirror/object-inl.h
+++ b/runtime/mirror/object-inl.h
@@ -747,7 +747,7 @@
} else {
obj = GetFieldObject<Object>(field_offset);
}
- Runtime::Current()->RecordWriteFieldReference(this, field_offset, obj.Ptr(), true);
+ Runtime::Current()->RecordWriteFieldReference(this, field_offset, obj, true);
}
if (kVerifyFlags & kVerifyThis) {
VerifyObject(this);
diff --git a/runtime/mirror/object_array-inl.h b/runtime/mirror/object_array-inl.h
index 086d2f4..ed3c567 100644
--- a/runtime/mirror/object_array-inl.h
+++ b/runtime/mirror/object_array-inl.h
@@ -37,14 +37,15 @@
namespace mirror {
template<class T>
-inline ObjectArray<T>* ObjectArray<T>::Alloc(Thread* self,
- ObjPtr<Class> object_array_class,
- int32_t length, gc::AllocatorType allocator_type) {
- Array* array = Array::Alloc<true>(self,
- object_array_class.Ptr(),
- length,
- ComponentSizeShiftWidth(kHeapReferenceSize),
- allocator_type);
+inline ObjPtr<ObjectArray<T>> ObjectArray<T>::Alloc(Thread* self,
+ ObjPtr<Class> object_array_class,
+ int32_t length,
+ gc::AllocatorType allocator_type) {
+ ObjPtr<Array> array = Array::Alloc<true>(self,
+ object_array_class,
+ length,
+ ComponentSizeShiftWidth(kHeapReferenceSize),
+ allocator_type);
if (UNLIKELY(array == nullptr)) {
return nullptr;
}
@@ -54,9 +55,9 @@
}
template<class T>
-inline ObjectArray<T>* ObjectArray<T>::Alloc(Thread* self,
- ObjPtr<Class> object_array_class,
- int32_t length) {
+inline ObjPtr<ObjectArray<T>> ObjectArray<T>::Alloc(Thread* self,
+ ObjPtr<Class> object_array_class,
+ int32_t length) {
return Alloc(self,
object_array_class,
length,
@@ -346,7 +347,7 @@
}
template<class T>
-inline ObjectArray<T>* ObjectArray<T>::CopyOf(Thread* self, int32_t new_length) {
+inline ObjPtr<ObjectArray<T>> ObjectArray<T>::CopyOf(Thread* self, int32_t new_length) {
DCHECK_GE(new_length, 0);
// We may get copied by a compacting GC.
StackHandleScope<1> hs(self);
@@ -354,7 +355,7 @@
gc::Heap* heap = Runtime::Current()->GetHeap();
gc::AllocatorType allocator_type = heap->IsMovableObject(this) ? heap->GetCurrentAllocator() :
heap->GetCurrentNonMovingAllocator();
- ObjectArray<T>* new_array = Alloc(self, GetClass(), new_length, allocator_type);
+ ObjPtr<ObjectArray<T>> new_array = Alloc(self, GetClass(), new_length, allocator_type);
if (LIKELY(new_array != nullptr)) {
new_array->AssignableMemcpy(0, h_this.Get(), 0, std::min(h_this->GetLength(), new_length));
}
diff --git a/runtime/mirror/object_array.h b/runtime/mirror/object_array.h
index b7a9561..6506f6e 100644
--- a/runtime/mirror/object_array.h
+++ b/runtime/mirror/object_array.h
@@ -31,15 +31,15 @@
return Array::ClassSize(pointer_size);
}
- static ObjectArray<T>* Alloc(Thread* self,
- ObjPtr<Class> object_array_class,
- int32_t length,
- gc::AllocatorType allocator_type)
+ static ObjPtr<ObjectArray<T>> Alloc(Thread* self,
+ ObjPtr<Class> object_array_class,
+ int32_t length,
+ gc::AllocatorType allocator_type)
REQUIRES_SHARED(Locks::mutator_lock_) REQUIRES(!Roles::uninterruptible_);
- static ObjectArray<T>* Alloc(Thread* self,
- ObjPtr<Class> object_array_class,
- int32_t length)
+ static ObjPtr<ObjectArray<T>> Alloc(Thread* self,
+ ObjPtr<Class> object_array_class,
+ int32_t length)
REQUIRES_SHARED(Locks::mutator_lock_) REQUIRES(!Roles::uninterruptible_);
template<VerifyObjectFlags kVerifyFlags = kDefaultVerifyFlags,
@@ -99,7 +99,7 @@
bool throw_exception)
REQUIRES_SHARED(Locks::mutator_lock_);
- ObjectArray<T>* CopyOf(Thread* self, int32_t new_length)
+ ObjPtr<ObjectArray<T>> CopyOf(Thread* self, int32_t new_length)
REQUIRES_SHARED(Locks::mutator_lock_)
REQUIRES(!Roles::uninterruptible_);
diff --git a/runtime/mirror/object_test.cc b/runtime/mirror/object_test.cc
index 8b7a1b6..0b615a6 100644
--- a/runtime/mirror/object_test.cc
+++ b/runtime/mirror/object_test.cc
@@ -76,7 +76,7 @@
}
template <class T>
- mirror::ObjectArray<T>* AllocObjectArray(Thread* self, size_t length)
+ ObjPtr<mirror::ObjectArray<T>> AllocObjectArray(Thread* self, size_t length)
REQUIRES_SHARED(Locks::mutator_lock_) {
return mirror::ObjectArray<T>::Alloc(
self, GetClassRoot(ClassRoot::kObjectArrayClass, class_linker_), length);
@@ -206,7 +206,8 @@
ScopedObjectAccess soa(Thread::Current());
typedef typename ArrayT::ElementType T;
- ArrayT* a = ArrayT::Alloc(soa.Self(), 2);
+ StackHandleScope<2> hs(soa.Self());
+ Handle<ArrayT> a = hs.NewHandle(ArrayT::Alloc(soa.Self(), 2));
EXPECT_EQ(2, a->GetLength());
EXPECT_EQ(0, a->Get(0));
EXPECT_EQ(0, a->Get(1));
@@ -217,7 +218,6 @@
EXPECT_EQ(T(123), a->Get(0));
EXPECT_EQ(T(321), a->Get(1));
- StackHandleScope<1> hs(soa.Self());
Handle<Class> aioobe = hs.NewHandle(
cl->FindSystemClass(soa.Self(), "Ljava/lang/ArrayIndexOutOfBoundsException;"));
@@ -256,7 +256,8 @@
ScopedObjectAccess soa(Thread::Current());
typedef typename ArrayT::ElementType T;
- ArrayT* a = ArrayT::Alloc(soa.Self(), 2);
+ StackHandleScope<2> hs(soa.Self());
+ Handle<ArrayT> a = hs.NewHandle(ArrayT::Alloc(soa.Self(), 2));
EXPECT_EQ(2, a->GetLength());
EXPECT_DOUBLE_EQ(0, a->Get(0));
EXPECT_DOUBLE_EQ(0, a->Get(1));
@@ -267,7 +268,6 @@
EXPECT_DOUBLE_EQ(T(123), a->Get(0));
EXPECT_DOUBLE_EQ(T(321), a->Get(1));
- StackHandleScope<1> hs(soa.Self());
Handle<Class> aioobe = hs.NewHandle(
class_linker_->FindSystemClass(soa.Self(), "Ljava/lang/ArrayIndexOutOfBoundsException;"));
@@ -287,7 +287,8 @@
ScopedObjectAccess soa(Thread::Current());
typedef typename ArrayT::ElementType T;
- ArrayT* a = ArrayT::Alloc(soa.Self(), 2);
+ StackHandleScope<2> hs(soa.Self());
+ Handle<ArrayT> a = hs.NewHandle(ArrayT::Alloc(soa.Self(), 2));
EXPECT_FLOAT_EQ(2, a->GetLength());
EXPECT_FLOAT_EQ(0, a->Get(0));
EXPECT_FLOAT_EQ(0, a->Get(1));
@@ -298,7 +299,6 @@
EXPECT_FLOAT_EQ(T(123), a->Get(0));
EXPECT_FLOAT_EQ(T(321), a->Get(1));
- StackHandleScope<1> hs(soa.Self());
Handle<Class> aioobe = hs.NewHandle(
class_linker_->FindSystemClass(soa.Self(), "Ljava/lang/ArrayIndexOutOfBoundsException;"));
@@ -317,16 +317,17 @@
TEST_F(ObjectTest, CreateMultiArray) {
ScopedObjectAccess soa(Thread::Current());
- StackHandleScope<2> hs(soa.Self());
- Handle<Class> c(hs.NewHandle(class_linker_->FindSystemClass(soa.Self(), "I")));
+ StackHandleScope<4> hs(soa.Self());
+ Handle<Class> int_class(hs.NewHandle(class_linker_->FindSystemClass(soa.Self(), "I")));
+ Handle<Class> int_array_class = hs.NewHandle(class_linker_->FindSystemClass(soa.Self(), "[I"));
MutableHandle<IntArray> dims(hs.NewHandle(IntArray::Alloc(soa.Self(), 1)));
dims->Set<false>(0, 1);
- Array* multi = Array::CreateMultiArray(soa.Self(), c, dims);
- EXPECT_TRUE(multi->GetClass() == class_linker_->FindSystemClass(soa.Self(), "[I"));
+ MutableHandle<Array> multi = hs.NewHandle(Array::CreateMultiArray(soa.Self(), int_class, dims));
+ EXPECT_OBJ_PTR_EQ(int_array_class.Get(), multi->GetClass());
EXPECT_EQ(1, multi->GetLength());
dims->Set<false>(0, -1);
- multi = Array::CreateMultiArray(soa.Self(), c, dims);
+ multi.Assign(Array::CreateMultiArray(soa.Self(), int_class, dims));
EXPECT_TRUE(soa.Self()->IsExceptionPending());
EXPECT_EQ(mirror::Class::PrettyDescriptor(soa.Self()->GetException()->GetClass()),
"java.lang.NegativeArraySizeException");
@@ -337,12 +338,12 @@
for (int j = 0; j < 20; ++j) {
dims->Set<false>(0, i);
dims->Set<false>(1, j);
- multi = Array::CreateMultiArray(soa.Self(), c, dims);
+ multi.Assign(Array::CreateMultiArray(soa.Self(), int_class, dims));
EXPECT_TRUE(multi->GetClass() == class_linker_->FindSystemClass(soa.Self(), "[[I"));
EXPECT_EQ(i, multi->GetLength());
for (int k = 0; k < i; ++k) {
- Array* outer = multi->AsObjectArray<Array>()->Get(k);
- EXPECT_TRUE(outer->GetClass() == class_linker_->FindSystemClass(soa.Self(), "[I"));
+ ObjPtr<Array> outer = multi->AsObjectArray<Array>()->Get(k);
+ EXPECT_OBJ_PTR_EQ(int_array_class.Get(), outer->GetClass());
EXPECT_EQ(j, outer->GetLength());
}
}
@@ -817,7 +818,7 @@
ObjPtr<mirror::Class> c = class_linker_->FindSystemClass(soa.Self(), "[Ljava/lang/String;");
ASSERT_TRUE(c != nullptr);
- mirror::Object* o = mirror::ObjectArray<mirror::String>::Alloc(soa.Self(), c, 0);
+ ObjPtr<mirror::Object> o = mirror::ObjectArray<mirror::String>::Alloc(soa.Self(), c, 0);
EXPECT_EQ("java.lang.String[]", mirror::Object::PrettyTypeOf(o));
EXPECT_EQ("java.lang.Class<java.lang.String[]>", mirror::Object::PrettyTypeOf(o->GetClass()));
}