From bcf175247272d0e321c8d988c3c01c123b56e36e Mon Sep 17 00:00:00 2001 From: Vladimir Marko Date: Fri, 1 Jun 2018 13:14:32 +0100 Subject: 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 --- runtime/mirror/array-inl.h | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'runtime/mirror/array-inl.h') diff --git a/runtime/mirror/array-inl.h b/runtime/mirror/array-inl.h index d2adcb4766..2e395302af 100644 --- a/runtime/mirror/array-inl.h +++ b/runtime/mirror/array-inl.h @@ -151,11 +151,11 @@ class SetLengthToUsableSizeVisitor { }; template -inline Array* Array::Alloc(Thread* self, - ObjPtr array_class, - int32_t component_count, - size_t component_size_shift, - gc::AllocatorType allocator_type) { +inline ObjPtr Array::Alloc(Thread* self, + ObjPtr 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 @@ inline Array* Array::Alloc(Thread* self, } #endif gc::Heap* heap = Runtime::Current()->GetHeap(); - Array* result; + ObjPtr result; if (!kFillUsable) { SetLengthVisitor visitor(component_count); - result = down_cast( + result = ObjPtr::DownCast(MakeObjPtr( heap->AllocObjectWithAllocator(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( + result = ObjPtr::DownCast(MakeObjPtr( heap->AllocObjectWithAllocator(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 @@ inline Array* Array::Alloc(Thread* self, } template -inline PrimitiveArray* PrimitiveArray::AllocateAndFill(Thread* self, - const T* data, - size_t length) { +inline ObjPtr> PrimitiveArray::AllocateAndFill(Thread* self, + const T* data, + size_t length) { StackHandleScope<1> hs(self); Handle> arr(hs.NewHandle(PrimitiveArray::Alloc(self, length))); if (!arr.IsNull()) { -- cgit v1.2.3-59-g8ed1b