diff options
author | 2018-06-04 09:14:42 +0000 | |
---|---|---|
committer | 2018-06-04 09:14:42 +0000 | |
commit | 9ddef18ae95859a985e7a0de7e22999fcbc28e07 (patch) | |
tree | ff38945fc61f1e32717a18b0a6901c5d11c33ccb /runtime/class_linker-inl.h | |
parent | 0366f3251c3078a0161d178e3b0afd5efc4c84c0 (diff) | |
parent | bcf175247272d0e321c8d988c3c01c123b56e36e (diff) |
Merge "ObjPtr<>-ify array allocations."
Diffstat (limited to 'runtime/class_linker-inl.h')
-rw-r--r-- | runtime/class_linker-inl.h | 15 |
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, |