diff options
Diffstat (limited to 'compiler/optimizing')
-rw-r--r-- | compiler/optimizing/builder.cc | 2 | ||||
-rw-r--r-- | compiler/optimizing/inliner.cc | 4 | ||||
-rw-r--r-- | compiler/optimizing/nodes.h | 4 |
3 files changed, 8 insertions, 2 deletions
diff --git a/compiler/optimizing/builder.cc b/compiler/optimizing/builder.cc index 8786ed419..f81935a7c 100644 --- a/compiler/optimizing/builder.cc +++ b/compiler/optimizing/builder.cc @@ -620,7 +620,7 @@ bool HGraphBuilder::BuildInvoke(const Instruction& instruction, DCHECK(!is_recursive || (target_method.dex_file == dex_compilation_unit_->GetDexFile())); invoke = new (arena_) HInvokeStaticOrDirect( arena_, number_of_arguments, return_type, dex_pc, target_method.dex_method_index, - is_recursive, optimized_invoke_type); + is_recursive, invoke_type, optimized_invoke_type); } size_t start_index = 0; diff --git a/compiler/optimizing/inliner.cc b/compiler/optimizing/inliner.cc index 256e85b6c..4b990f1dd 100644 --- a/compiler/optimizing/inliner.cc +++ b/compiler/optimizing/inliner.cc @@ -50,7 +50,9 @@ void HInliner::Run() { HInstruction* next = instruction->GetNext(); HInvokeStaticOrDirect* call = instruction->AsInvokeStaticOrDirect(); if (call != nullptr) { - if (!TryInline(call, call->GetDexMethodIndex(), call->GetInvokeType())) { + // We use the original invoke type to ensure the resolution of the called method + // works properly. + if (!TryInline(call, call->GetDexMethodIndex(), call->GetOriginalInvokeType())) { if (kIsDebugBuild) { std::string callee_name = PrettyMethod(call->GetDexMethodIndex(), *outer_compilation_unit_.GetDexFile()); diff --git a/compiler/optimizing/nodes.h b/compiler/optimizing/nodes.h index 08b16d99b..9c751fb9c 100644 --- a/compiler/optimizing/nodes.h +++ b/compiler/optimizing/nodes.h @@ -2131,8 +2131,10 @@ class HInvokeStaticOrDirect : public HInvoke { uint32_t dex_pc, uint32_t dex_method_index, bool is_recursive, + InvokeType original_invoke_type, InvokeType invoke_type) : HInvoke(arena, number_of_arguments, return_type, dex_pc, dex_method_index), + original_invoke_type_(original_invoke_type), invoke_type_(invoke_type), is_recursive_(is_recursive) {} @@ -2142,6 +2144,7 @@ class HInvokeStaticOrDirect : public HInvoke { return false; } + InvokeType GetOriginalInvokeType() const { return original_invoke_type_; } InvokeType GetInvokeType() const { return invoke_type_; } bool IsRecursive() const { return is_recursive_; } bool NeedsDexCache() const OVERRIDE { return !IsRecursive(); } @@ -2149,6 +2152,7 @@ class HInvokeStaticOrDirect : public HInvoke { DECLARE_INSTRUCTION(InvokeStaticOrDirect); private: + const InvokeType original_invoke_type_; const InvokeType invoke_type_; const bool is_recursive_; |