summaryrefslogtreecommitdiff
path: root/compiler/optimizing
diff options
context:
space:
mode:
author Nicolas Geoffray <ngeoffray@google.com> 2015-06-04 18:02:34 +0100
committer Nicolas Geoffray <ngeoffray@google.com> 2015-06-04 18:04:18 +0100
commit7ce4b3d4c1c562959a8a3640df764ab50f1cbdf1 (patch)
tree5b68c75de9ae09d9573735a7c3f58751100fc759 /compiler/optimizing
parentc47908e8c32fd58bc4dc75998a80f706954db1dc (diff)
Do a type check for knowing if we can inline.
Otherwise, we might successfully inline: ((String)nonStringObject).charAt() Because the lookup of the method is based on the index of charAt, and not its name. Change-Id: I72ce802fd50cfb71343197f0a32bb1ef56549097
Diffstat (limited to 'compiler/optimizing')
-rw-r--r--compiler/optimizing/inliner.cc3
1 files changed, 3 insertions, 0 deletions
diff --git a/compiler/optimizing/inliner.cc b/compiler/optimizing/inliner.cc
index ea613b2b01..07d0dd6b49 100644
--- a/compiler/optimizing/inliner.cc
+++ b/compiler/optimizing/inliner.cc
@@ -120,6 +120,9 @@ static ArtMethod* FindVirtualOrInterfaceTarget(HInvoke* invoke, ArtMethod* resol
// Statically knowing that the receiver has an interface type cannot
// help us find what is the target method.
return nullptr;
+ } else if (!resolved_method->GetDeclaringClass()->IsAssignableFrom(info.GetTypeHandle().Get())) {
+ // The method that we're trying to call is not in the receiver's class or super classes.
+ return nullptr;
}
ClassLinker* cl = Runtime::Current()->GetClassLinker();