Revert "Revert^4 "CHA for interface method.""
Still failing on the bots.
This reverts commit fb185130f35bbfe2ba1875974ed39ef0b3c7a77f.
Change-Id: I1629e237dd41ce4784ccadbfc346352dfcbdb137
diff --git a/compiler/optimizing/inliner.cc b/compiler/optimizing/inliner.cc
index 9550a53..62f5114 100644
--- a/compiler/optimizing/inliner.cc
+++ b/compiler/optimizing/inliner.cc
@@ -292,18 +292,7 @@
return nullptr;
}
PointerSize pointer_size = caller_compilation_unit_.GetClassLinker()->GetImagePointerSize();
- ArtMethod* single_impl = resolved_method->GetSingleImplementation(pointer_size);
- if (single_impl == nullptr) {
- return nullptr;
- }
- if (single_impl->IsProxyMethod()) {
- // Proxy method is a generic invoker that's not worth
- // devirtualizing/inlining. It also causes issues when the proxy
- // method is in another dex file if we try to rewrite invoke-interface to
- // invoke-virtual because a proxy method doesn't have a real dex file.
- return nullptr;
- }
- return single_impl;
+ return resolved_method->GetSingleImplementation(pointer_size);
}
bool HInliner::TryInline(HInvoke* invoke_instruction) {
@@ -1032,23 +1021,11 @@
HBasicBlock* bb_cursor = invoke_instruction->GetBlock();
if (!TryBuildAndInline(invoke_instruction, method, receiver_type, &return_replacement)) {
if (invoke_instruction->IsInvokeInterface()) {
- DCHECK(!method->IsProxyMethod());
// Turn an invoke-interface into an invoke-virtual. An invoke-virtual is always
// better than an invoke-interface because:
// 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());