Disable devirtualization detection in DEX-to-DEX compiler.
This CL allows the DEX-to-DEX compiler to disable devirtualization detection.
This allows to quicken invoke-virtual/range instructions that used to be
eligible for devirtualization.
Bug: 10632943
Change-Id: I6c9f4d3249cf42b47f004be5825b3186fa83501e
diff --git a/compiler/dex/dex_to_dex_compiler.cc b/compiler/dex/dex_to_dex_compiler.cc
index a0e2c1e..2a4d3d5 100644
--- a/compiler/dex/dex_to_dex_compiler.cc
+++ b/compiler/dex/dex_to_dex_compiler.cc
@@ -298,11 +298,12 @@
int vtable_idx;
uintptr_t direct_code;
uintptr_t direct_method;
+ // TODO: support devirtualization.
+ const bool kEnableDevirtualization = false;
bool fast_path = driver_.ComputeInvokeInfo(&unit_, dex_pc, invoke_type,
target_method, vtable_idx,
direct_code, direct_method,
- false);
- // TODO: support devirtualization.
+ false, kEnableDevirtualization);
if (fast_path && original_invoke_type == invoke_type) {
if (vtable_idx >= 0 && IsUint(16, vtable_idx)) {
VLOG(compiler) << "Quickening " << Instruction::Name(inst->Opcode())
diff --git a/compiler/dex/mir_dataflow.cc b/compiler/dex/mir_dataflow.cc
index 3a73717..42ca5dc 100644
--- a/compiler/dex/mir_dataflow.cc
+++ b/compiler/dex/mir_dataflow.cc
@@ -1224,7 +1224,7 @@
type, target_method,
vtable_idx,
direct_code, direct_method,
- false) &&
+ false, true) &&
!(cu_->enable_debug & (1 << kDebugSlowInvokePath));
return (((type == kDirect) || (type == kStatic)) &&
fast_path && ((direct_code == 0) || (direct_method == 0)));
diff --git a/compiler/dex/quick/gen_invoke.cc b/compiler/dex/quick/gen_invoke.cc
index 073b550..a4ab15d 100644
--- a/compiler/dex/quick/gen_invoke.cc
+++ b/compiler/dex/quick/gen_invoke.cc
@@ -1359,7 +1359,7 @@
info->type, target_method,
vtable_idx,
direct_code, direct_method,
- true) && !SLOW_INVOKE_PATH;
+ true, true) && !SLOW_INVOKE_PATH;
if (info->type == kInterface) {
if (fast_path) {
p_null_ck = &null_ck;