summaryrefslogtreecommitdiffstats
path: root/runtime/entrypoints
diff options
context:
space:
mode:
authorMathieu Chartier <mathieuc@google.com>2015-01-28 13:11:44 -0800
committerMathieu Chartier <mathieuc@google.com>2015-01-28 14:26:47 -0800
commite4a91bbeaa118bc01a5c338c6a6d9ee094a6a2c6 (patch)
tree8ee63aced115823626d614e70716d745f72bb3a6 /runtime/entrypoints
parentab7f56d9b9838811cb01773e45999e2cda4aa03a (diff)
downloadart-e4a91bbeaa118bc01a5c338c6a6d9ee094a6a2c6.zip
art-e4a91bbeaa118bc01a5c338c6a6d9ee094a6a2c6.tar.gz
art-e4a91bbeaa118bc01a5c338c6a6d9ee094a6a2c6.tar.bz2
Force set resolved method for static invokes
For static invokes, we may dispatch to the static method in the superclass but resolve using the subclass. To prevent getting slow paths on each invoke, we force set the resolved method for the super class dex method index if we are in the same dex file. Added test. Bug: 19175856 Change-Id: I26f8644a7f725f5c2dc2a94a8e9578f573792507
Diffstat (limited to 'runtime/entrypoints')
-rw-r--r--runtime/entrypoints/quick/quick_trampoline_entrypoints.cc10
1 files changed, 10 insertions, 0 deletions
diff --git a/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc b/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc
index 8ab90eb..a67ebca 100644
--- a/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc
+++ b/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc
@@ -930,6 +930,16 @@ extern "C" const void* artQuickResolutionTrampoline(mirror::ArtMethod* called,
(caller->GetDexCacheResolvedMethod(update_dex_cache_method_index) != called)) {
caller->SetDexCacheResolvedMethod(update_dex_cache_method_index, called);
}
+ } else if (invoke_type == kStatic) {
+ const auto called_dex_method_idx = called->GetDexMethodIndex();
+ // For static invokes, we may dispatch to the static method in the superclass but resolve
+ // using the subclass. To prevent getting slow paths on each invoke, we force set the
+ // resolved method for the super class dex method index if we are in the same dex file.
+ // b/19175856
+ if (called->GetDexFile() == called_method.dex_file &&
+ called_method.dex_method_index != called_dex_method_idx) {
+ called->GetDexCache()->SetResolvedMethod(called_dex_method_idx, called);
+ }
}
// Ensure that the called method's class is initialized.
StackHandleScope<1> hs(soa.Self());