summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Mathieu Chartier <mathieuc@google.com> 2017-02-01 15:50:54 -0800
committer Mathieu Chartier <mathieuc@google.com> 2017-02-01 17:09:59 -0800
commit20eb58ef94db18de9aa3b0404aa65d958025f80b (patch)
tree96394afcc45cbd72ccdcf5a1b7c02c164a24f5a9
parent3cb871ab1af47576959fd24a99d370381b8f193e (diff)
Use dex cache for GetResolvedMethod
Using the dex cache is faster than going through the class linker. This reverts to behavior from before aog/321573. Speeds up pmd benchmark by ~50%. Test: test-art-host Change-Id: I58403aec03e2b7e7a3d3e108319cfb4c75a680cb
-rw-r--r--runtime/entrypoints/entrypoint_utils-inl.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/runtime/entrypoints/entrypoint_utils-inl.h b/runtime/entrypoints/entrypoint_utils-inl.h
index ac0ce36016..28aca6c905 100644
--- a/runtime/entrypoints/entrypoint_utils-inl.h
+++ b/runtime/entrypoints/entrypoint_utils-inl.h
@@ -76,6 +76,10 @@ inline ArtMethod* GetResolvedMethod(ArtMethod* outer_method,
// Lookup the declaring class of the inlined method.
const DexFile* dex_file = caller->GetDexFile();
const DexFile::MethodId& method_id = dex_file->GetMethodId(method_index);
+ ArtMethod* inlined_method = caller->GetDexCacheResolvedMethod(method_index, kRuntimePointerSize);
+ if (inlined_method != nullptr && !inlined_method->IsRuntimeMethod()) {
+ return inlined_method;
+ }
const char* descriptor = dex_file->StringByTypeIdx(method_id.class_idx_);
ClassLinker* class_linker = Runtime::Current()->GetClassLinker();
Thread* self = Thread::Current();
@@ -92,8 +96,7 @@ inline ArtMethod* GetResolvedMethod(ArtMethod* outer_method,
const char* method_name = dex_file->GetMethodName(method_id);
const Signature signature = dex_file->GetMethodSignature(method_id);
- ArtMethod* inlined_method =
- klass->FindDeclaredDirectMethod(method_name, signature, kRuntimePointerSize);
+ inlined_method = klass->FindDeclaredDirectMethod(method_name, signature, kRuntimePointerSize);
if (inlined_method == nullptr) {
inlined_method = klass->FindDeclaredVirtualMethod(method_name, signature, kRuntimePointerSize);
if (inlined_method == nullptr) {
@@ -103,6 +106,7 @@ inline ArtMethod* GetResolvedMethod(ArtMethod* outer_method,
<< "This must be due to duplicate classes or playing wrongly with class loaders";
}
}
+ caller->SetDexCacheResolvedMethod(method_index, inlined_method, kRuntimePointerSize);
return inlined_method;
}