summaryrefslogtreecommitdiff
path: root/runtime/class_linker.cc
diff options
context:
space:
mode:
author Vladimir Marko <vmarko@google.com> 2018-05-31 15:15:31 +0100
committer Vladimir Marko <vmarko@google.com> 2018-06-01 11:16:58 +0100
commit09c5ca40635faee00f40f6ca0581dd475efd545e (patch)
tree5fb13e8eebec283d8c41ce874fbd471f93915fd1 /runtime/class_linker.cc
parent317892b756cd2a87c01928b09e99e020c86dea10 (diff)
Clean up class resolution and lookup.
Simplify the code and avoid read barriers when appropriate. Relax class status check in ArtField::GetDeclaringClass() because we can see ClassStatus::kIdx from the from-space class object for kReadBarrierOption=kWithoutReadBarrier. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Change-Id: I83886a64fe5a99a1c3c30eab3b35dae449e6b4bc
Diffstat (limited to 'runtime/class_linker.cc')
-rw-r--r--runtime/class_linker.cc13
1 files changed, 13 insertions, 0 deletions
diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc
index e46b980682..dccdff0a5d 100644
--- a/runtime/class_linker.cc
+++ b/runtime/class_linker.cc
@@ -7701,6 +7701,11 @@ ObjPtr<mirror::String> ClassLinker::LookupString(dex::StringIndex string_idx,
}
ObjPtr<mirror::Class> ClassLinker::DoLookupResolvedType(dex::TypeIndex type_idx,
+ ObjPtr<mirror::Class> referrer) {
+ return DoLookupResolvedType(type_idx, referrer->GetDexCache(), referrer->GetClassLoader());
+}
+
+ObjPtr<mirror::Class> ClassLinker::DoLookupResolvedType(dex::TypeIndex type_idx,
ObjPtr<mirror::DexCache> dex_cache,
ObjPtr<mirror::ClassLoader> class_loader) {
const DexFile& dex_file = *dex_cache->GetDexFile();
@@ -7729,6 +7734,14 @@ ObjPtr<mirror::Class> ClassLinker::DoLookupResolvedType(dex::TypeIndex type_idx,
}
ObjPtr<mirror::Class> ClassLinker::DoResolveType(dex::TypeIndex type_idx,
+ ObjPtr<mirror::Class> referrer) {
+ StackHandleScope<2> hs(Thread::Current());
+ Handle<mirror::DexCache> dex_cache(hs.NewHandle(referrer->GetDexCache()));
+ Handle<mirror::ClassLoader> class_loader(hs.NewHandle(referrer->GetClassLoader()));
+ return DoResolveType(type_idx, dex_cache, class_loader);
+}
+
+ObjPtr<mirror::Class> ClassLinker::DoResolveType(dex::TypeIndex type_idx,
Handle<mirror::DexCache> dex_cache,
Handle<mirror::ClassLoader> class_loader) {
Thread* self = Thread::Current();