summaryrefslogtreecommitdiff
path: root/runtime/class_linker-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/class_linker-inl.h
parent0366f3251c3078a0161d178e3b0afd5efc4c84c0 (diff)
parentbcf175247272d0e321c8d988c3c01c123b56e36e (diff)
Merge "ObjPtr<>-ify array allocations."
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,