summaryrefslogtreecommitdiff
path: root/compiler/optimizing
diff options
context:
space:
mode:
author Mingyao Yang <mingyao@google.com> 2017-02-27 16:23:51 -0800
committer Mingyao Yang <mingyao@google.com> 2017-03-07 16:47:13 -0800
commit8f301e26943c53485abc2da5ff1907f7c2e0ff0c (patch)
treee255d1ce3041dff95d2cd2b6bf1b1474962d811e /compiler/optimizing
parentdcab11d06860ae1e23d03926adb6c31f75404032 (diff)
Revert "Revert "CHA for interface method.""
This reverts commit 85a1ec1347c8117365632dcaaa648ebb0a8691f5. It also fixed the issue that's caused by changing an invokeinterface to an invokevirtual, when the method is the original default interface method. Since the default interface method is not in any vtable, unless it's copied and becomes a virtual method. Test: ART_TEST_JIT=true m -j20 test-art-host-run-test Change-Id: I627616978690485c66cfca47c234f1504066ea1d
Diffstat (limited to 'compiler/optimizing')
-rw-r--r--compiler/optimizing/inliner.cc11
1 files changed, 11 insertions, 0 deletions
diff --git a/compiler/optimizing/inliner.cc b/compiler/optimizing/inliner.cc
index 3e340908bf..419dfa7a6e 100644
--- a/compiler/optimizing/inliner.cc
+++ b/compiler/optimizing/inliner.cc
@@ -878,6 +878,17 @@ bool HInliner::TryInlineAndReplace(HInvoke* invoke_instruction,
// 1) In the best case, the interface call has one more indirection (to fetch the IMT).
// 2) We will not go to the conflict trampoline with an invoke-virtual.
// TODO: Consider sharpening once it is not dependent on the compiler driver.
+
+ if (method->IsDefault() && !method->IsCopied()) {
+ // Changing to invoke-virtual cannot be done on an original default method
+ // since it's not in any vtable. Devirtualization by exact type/inline-cache
+ // always uses a method in the iftable which is never an original default
+ // method.
+ // On the other hand, inlining an original default method by CHA is fine.
+ DCHECK(cha_devirtualize);
+ return false;
+ }
+
const DexFile& caller_dex_file = *caller_compilation_unit_.GetDexFile();
uint32_t dex_method_index = FindMethodIndexIn(
method, caller_dex_file, invoke_instruction->GetDexMethodIndex());