summaryrefslogtreecommitdiff
path: root/runtime/class_linker-inl.h
diff options
context:
space:
mode:
author Vladimir Marko <vmarko@google.com> 2018-06-01 13:14:32 +0100
committer Vladimir Marko <vmarko@google.com> 2018-06-01 16:31:30 +0100
commitbcf175247272d0e321c8d988c3c01c123b56e36e (patch)
tree9f65ece5ce9474aa4fcf16fbfca6278109dc9a67 /runtime/class_linker-inl.h
parent09c5ca40635faee00f40f6ca0581dd475efd545e (diff)
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
Diffstat (limited to 'runtime/class_linker-inl.h')
-rw-r--r--runtime/class_linker-inl.h15
1 files changed, 7 insertions, 8 deletions
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<mirror::Class> ClassLinker::FindArrayClass(Thread* self,
- ObjPtr<mirror::Class>* element_class) {
+ ObjPtr<mirror::Class> 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<mirror::Class> 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<mirror::ClassLoader> class_loader(hs.NewHandle((*element_class)->GetClassLoader()));
- HandleWrapperObjPtr<mirror::Class> h_element_class(hs.NewHandleWrapper(element_class));
+ descriptor += element_class->GetDescriptor(&temp);
+ StackHandleScope<1> hs(Thread::Current());
+ Handle<mirror::ClassLoader> class_loader(hs.NewHandle(element_class->GetClassLoader()));
ObjPtr<mirror::Class> 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<mirror::Class> ClassLinker::FindArrayClass(Thread* self,
// We should have a NoClassDefFoundError.
self->AssertPendingException();
}
- return array_class.Ptr();
+ return array_class;
}
inline ObjPtr<mirror::Class> ClassLinker::ResolveType(dex::TypeIndex type_idx,