summaryrefslogtreecommitdiff
path: root/runtime/class_linker-inl.h
diff options
context:
space:
mode:
author Mathieu Chartier <mathieuc@google.com> 2014-05-29 14:31:33 -0700
committer Mathieu Chartier <mathieuc@google.com> 2014-05-30 13:58:22 -0700
commitb74cd29802f364b4cec88f4913fa38ade26b8fab (patch)
tree73ccdce1c5a6e57d5763cae1f889e53dca2b5e24 /runtime/class_linker-inl.h
parent11138c73e0c5f8a90d1eeed3c48a2b63b310671c (diff)
Compaction cleanup for FindArrayClass.
We now pass double pointer in to signify that it can cause thread suspension, this double pointer gets wrapped by a handle if don't find the array class in the cache. Change-Id: I43436b6c35597c7252b65d1180baddb5ac4caabb
Diffstat (limited to 'runtime/class_linker-inl.h')
-rw-r--r--runtime/class_linker-inl.h14
1 files changed, 7 insertions, 7 deletions
diff --git a/runtime/class_linker-inl.h b/runtime/class_linker-inl.h
index 84afb2d3f6..9d8888c167 100644
--- a/runtime/class_linker-inl.h
+++ b/runtime/class_linker-inl.h
@@ -37,19 +37,19 @@ inline mirror::Class* ClassLinker::FindSystemClass(Thread* self, const char* des
return FindClass(self, descriptor, NullHandle<mirror::ClassLoader>());
}
-inline mirror::Class* ClassLinker::FindArrayClass(Thread* self, mirror::Class* element_class) {
+inline mirror::Class* ClassLinker::FindArrayClass(Thread* self, 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.
mirror::Class* array_class = find_array_class_cache_[i];
- if (array_class != nullptr && array_class->GetComponentType() == element_class) {
+ if (array_class != nullptr && array_class->GetComponentType() == *element_class) {
return array_class;
}
}
- DCHECK(!element_class->IsPrimitiveVoid());
- std::string descriptor("[");
- descriptor += element_class->GetDescriptor();
- StackHandleScope<1> hs(Thread::Current());
- Handle<mirror::ClassLoader> class_loader(hs.NewHandle(element_class->GetClassLoader()));
+ DCHECK(!(*element_class)->IsPrimitiveVoid());
+ std::string descriptor = "[" + (*element_class)->GetDescriptor();
+ StackHandleScope<2> hs(Thread::Current());
+ Handle<mirror::ClassLoader> class_loader(hs.NewHandle((*element_class)->GetClassLoader()));
+ HandleWrapper<mirror::Class> h_element_class(hs.NewHandleWrapper(element_class));
mirror::Class* array_class = FindClass(self, descriptor.c_str(), class_loader);
// Benign races in storing array class and incrementing index.
size_t victim_index = find_array_class_cache_next_victim_;