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/class_linker-inl.h | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'runtime/class_linker-inl.h') diff --git a/runtime/class_linker-inl.h b/runtime/class_linker-inl.h index 888f713d8f..664b917543 100644 --- a/runtime/class_linker-inl.h +++ b/runtime/class_linker-inl.h @@ -35,20 +35,19 @@ namespace art { inline ObjPtr ClassLinker::FindArrayClass(Thread* self, - ObjPtr* element_class) { + ObjPtr element_class) { for (size_t i = 0; i < kFindArrayCacheSize; ++i) { // Read the cached array class once to avoid races with other threads setting it. ObjPtr array_class = find_array_class_cache_[i].Read(); - if (array_class != nullptr && array_class->GetComponentType() == *element_class) { - return array_class.Ptr(); + if (array_class != nullptr && array_class->GetComponentType() == element_class) { + return array_class; } } std::string descriptor = "["; std::string temp; - descriptor += (*element_class)->GetDescriptor(&temp); - StackHandleScope<2> hs(Thread::Current()); - Handle class_loader(hs.NewHandle((*element_class)->GetClassLoader())); - HandleWrapperObjPtr h_element_class(hs.NewHandleWrapper(element_class)); + descriptor += element_class->GetDescriptor(&temp); + StackHandleScope<1> hs(Thread::Current()); + Handle class_loader(hs.NewHandle(element_class->GetClassLoader())); ObjPtr array_class = FindClass(self, descriptor.c_str(), class_loader); if (array_class != nullptr) { // Benign races in storing array class and incrementing index. @@ -59,7 +58,7 @@ inline ObjPtr ClassLinker::FindArrayClass(Thread* self, // We should have a NoClassDefFoundError. self->AssertPendingException(); } - return array_class.Ptr(); + return array_class; } inline ObjPtr ClassLinker::ResolveType(dex::TypeIndex type_idx, -- cgit v1.2.3-59-g8ed1b