summaryrefslogtreecommitdiff
path: root/runtime/mirror/array-inl.h
diff options
context:
space:
mode:
author Vladimir Marko <vmarko@google.com> 2018-06-04 09:14:42 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2018-06-04 09:14:42 +0000
commit9ddef18ae95859a985e7a0de7e22999fcbc28e07 (patch)
treeff38945fc61f1e32717a18b0a6901c5d11c33ccb /runtime/mirror/array-inl.h
parent0366f3251c3078a0161d178e3b0afd5efc4c84c0 (diff)
parentbcf175247272d0e321c8d988c3c01c123b56e36e (diff)
Merge "ObjPtr<>-ify array allocations."
Diffstat (limited to 'runtime/mirror/array-inl.h')
-rw-r--r--runtime/mirror/array-inl.h26
1 files changed, 13 insertions, 13 deletions
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 <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 @@ inline Array* Array::Alloc(Thread* self,
}
#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 @@ inline Array* Array::Alloc(Thread* self,
}
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()) {