summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Geoffray <ngeoffray@google.com>2021-08-26 18:49:04 +0100
committerNicolas Geoffray <ngeoffray@google.com>2021-12-21 13:20:58 +0000
commit167ffa1515d1050841bfe98891f9657052acac17 (patch)
tree7bac82614cc0bd1f1ae81ee0a063e29366ea2ba9
parent7eeb412f40135cbd20d7ebc1d5e499f5ee2c9c1d (diff)
downloadart-167ffa1515d1050841bfe98891f9657052acac17.tar.gz
Inline caches: be more robust in the presence of framework change.
What used to be a class could be changed into an interface. Test for that case as well. Test: test.py Bug: 194817322 (cherry picked from commit 4fba66c84245be79b1b32cbfa1584cfc5a87f053) Merged-In: I4c225640b45c529d440faa701ed29f978b7cbd28 Change-Id: I7b133aa60bfe0c35cb3704a62b88de53d3109d93
-rw-r--r--compiler/optimizing/inliner.cc7
1 files changed, 7 insertions, 0 deletions
diff --git a/compiler/optimizing/inliner.cc b/compiler/optimizing/inliner.cc
index 1d9520d8e3..f432c8f4e2 100644
--- a/compiler/optimizing/inliner.cc
+++ b/compiler/optimizing/inliner.cc
@@ -722,6 +722,13 @@ static ArtMethod* ResolveMethodFromInlineCache(Handle<mirror::Class> klass,
if (!resolved_method->GetDeclaringClass()->IsAssignableFrom(klass.Get())) {
return nullptr;
}
+
+ // Also check whether the type in the inline cache is an interface or an
+ // abstract class. We only expect concrete classes in inline caches, so this
+ // means the class was changed.
+ if (klass->IsAbstract() || klass->IsInterface()) {
+ return nullptr;
+ }
}
if (invoke_instruction->IsInvokeInterface()) {